Microchip® Advanced Software Framework

lis3l06al.h File Reference

Data Structures

struct  avr32_acc_t
 Set of computed data. More...
 
struct  xyz_t
 All 3-axis values from ADC conversion. More...
 

Macros

#define ACC_SHIFT   2
 
Nominal values out of lis3l06al accelerometer spec
#define ACC_ZERO   (512 >> ACC_SHIFT)
 
#define ACC_1G   (205 >> ACC_SHIFT)
 
#define ACC_MIN   ( ACC_ZERO - ACC_1G )
 
#define ACC_MAX   ( ACC_ZERO + ACC_1G )
 
Sinus table
#define SIN0   0
 
#define SIN15   0.26
 
#define SIN30   0.5
 
#define SIN45   0.71
 
#define SIN60   0.87
 
#define SIN75   0.97
 
#define SIN90   1
 
Axis calibration correction
#define ACC_CALIB_X   0
 
#define ACC_CALIB_Y   0
 
#define ACC_CALIB_Z   0
 
Axis zero point.
#define ACC_ZERO_X   ( ACC_ZERO + ACC_CALIB_X )
 
#define ACC_ZERO_Y   ( ACC_ZERO + ACC_CALIB_Y )
 
#define ACC_ZERO_Z   ( ACC_ZERO + ACC_CALIB_Z )
 
Axis reference values for a set of predefined angles.
#define ACC_TRIG_X0   (int) ( ACC_ZERO_X - SIN15 * ACC_1G )
 
#define ACC_TRIG_X1   (int) ( ACC_ZERO_X + SIN15 * ACC_1G )
 
#define ACC_TRIG_Y0   (int) ( ACC_ZERO_Y - SIN15 * ACC_1G )
 
#define ACC_TRIG_Y1   (int) ( ACC_ZERO_Y + SIN15 * ACC_1G )
 
#define ACC_TRIG_Z_TOP   (int) ( ACC_ZERO_Z - SIN75 * ACC_1G )
 
#define ACC_TRIG_Z_BOT   (int) ( ACC_ZERO_Z + SIN60 * ACC_1G )
 
Sudden acceleration thresholds
#define ACC_QUIET_LO   (int) ( 0.6 * ACC_1G * ACC_1G )
 
#define ACC_QUIET_HI   (int) ( 1.4 * ACC_1G * ACC_1G )
 
Accelerometer ADC channel mapping
#define ADC_CHANNEL_X   ADC_ACC_X_CHANNEL
 
#define ADC_CHANNEL_Y   ADC_ACC_Y_CHANNEL
 
#define ADC_CHANNEL_Z   ADC_ACC_Z_CHANNEL
 

Functions

unsigned long acc_get_m_x (void)
 Return measured value of X sensor. More...
 
unsigned long acc_get_m_y (void)
 Return measured value of Y sensor. More...
 
unsigned long acc_get_m_z (void)
 Return measured value of Z sensor. More...
 
void acc_init (void)
 Initialize Accelerometer driver. Mandatory to call. More...
 
void acc_update (void)
 Get accelerometer measure (3x) and process results. More...
 
signed long is_acc_abs_angle_x (unsigned long abs_ang)
 Test if absolute value of X angle has reached the specified limit. More...
 
signed long is_acc_abs_angle_y (unsigned long abs_ang)
 Test if absolute value of Y angle has reached the specified limit. More...
 
bool is_acc_down (void)
 Test if sensor have detected 'down' orientation. More...
 
bool is_acc_left (void)
 Test if sensor have detected 'left' orientation. More...
 
bool is_acc_meuh (char stop)
 Detect a topdown to up transition. More...
 
bool is_acc_right (void)
 Test if sensor have detected 'right' orientation. More...
 
bool is_acc_slow (void)
 Test acceleration about 1g +-10%. More...
 
bool is_acc_topdown (void)
 Test if sensor have detected 'topdown' orientation. More...
 
bool is_acc_up (void)
 Test if sensor have detected 'up' orientation. More...