EV Logger
A MSP430 based datalogger for an electric vehicle
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Enumerations | Functions | Variables
accel.h File Reference

Accelerometer header. More...

#include <stdint.h>
#include "logger.h"

Go to the source code of this file.

Macros

#define DOUTX   0x06
 
#define DOUTY   0x07
 
#define DOUTZ   0x08
 
#define TICKSPERUS   (F_CPU/ 1000000)
 
#define ACCEL_INT_IN   P2IN
 
#define ACCEL_INT_OUT   P2OUT
 
#define ACCEL_INT_DIR   P2DIR
 
#define ACCEL_SCK_SEL   P2SEL
 
#define ACCEL_INT_IE   P2IE
 
#define ACCEL_INT_IES   P2IES
 
#define ACCEL_INT_IFG   P2IFG
 
#define ACCEL_INT_VECTOR   PORT2_VECTOR
 
#define ACCEL_OUT   P3OUT
 
#define ACCEL_DIR   P3DIR
 
#define ACCEL_SEL   P3SEL
 
#define ACCEL_INT   BIT5
 
#define ACCEL_CS   BIT5
 
#define ACCEL_SIMO   BIT3
 
#define ACCEL_SOMI   BIT4
 
#define ACCEL_SCK   BIT7
 
#define ACCEL_PWR   BIT6
 
#define REVID   0x01
 
#define CTRL   0x02
 
#define MODE_400   0x04
 
#define DOUTX   0x06
 
#define DOUTY   0x07
 
#define DOUTZ   0x08
 
#define G_RANGE_2   0x80
 
#define I2C_DIS   0x10
 

Typedefs

typedef enum accel_state_t accel_state_t
 Enumerate possible states for the accelerometer finite state machine (FSM)
 

Enumerations

enum  accel_state_t {
  STATE_ACCEL_NONE, STATE_ACCEL_XREQ, STATE_ACCEL_XRDY, STATE_ACCEL_YREQ,
  STATE_ACCEL_YRDY, STATE_ACCEL_ZREQ, STATE_ACCEL_ZRDY, STATE_ACCEL_DONE
}
 Enumerate possible states for the accelerometer finite state machine (FSM) More...
 

Functions

void Cma3000_init (volatile SampleBuffer *samplebuffer)
 Configures the CMA3000-D01 3-Axis Ultra Low Power Accelerometer. More...
 
void Cma3000_disable (void)
 Disables the CMA3000-D01 3-Axis Ultra Low Power Accelerometer.
 
void Cma3000_readAccel (void)
 Reads data from the accelerometer.
 
int8_t Cma3000_readRegister (uint8_t Address)
 Reads data from the accelerometer. More...
 
void Cma3000_readAccelFSM (void)
 Commence reading of data into the SampleBuffer.
 
accel_state_t Cma3000_getState (void)
 Get the current state of the accelerometer. More...
 
int8_t Cma3000_writeRegister (uint8_t Address, int8_t accelData)
 Writes data to the accelerometer. More...
 

Variables

int8_t Cma3000_xAccel
 Data value x from the accelerometer.
 
int8_t Cma3000_yAccel
 Data value y from the accelerometer.
 
int8_t Cma3000_zAccel
 Data value z from the accelerometer.
 

Detailed Description

Accelerometer header.

HAL_Cma3000.h

Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

Neither the name of Texas Instruments Incorporated nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Author
TI, Modified by Jon Sowman