Microchip® Advanced Software Framework

lis3l06al.c File Reference
#include "board.h"
#include "gpio.h"
#include "adc.h"
#include "lis3l06al.h"
#include "math.h"

Macros

#define DEG_2_RAD(deg)   ((double)(deg)*3.14/180)
 

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...
 
static void acc_get_value (volatile avr32_adc_t *adc, xyz_t *val)
 
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 ()
 Test if sensor have detected 'down' orientation. More...
 
bool is_acc_left ()
 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 ()
 Test if sensor have detected 'right' orientation. More...
 
bool is_acc_slow ()
 Test acceleration about 1g +-10%. More...
 
bool is_acc_topdown ()
 Test if sensor have detected 'topdown' orientation. More...
 
bool is_acc_up ()
 Test if sensor have detected 'up' orientation. More...
 
static int round0 (int i, int ceil)
 
static void xyz_add (xyz_t p, xyz_t q, xyz_t *r)
 
static void xyz_diff (xyz_t p, xyz_t q, xyz_t *r)
 
static void xyz_round0 (xyz_t p, int ceil, xyz_t *r)
 
static int xyz_sumsq (xyz_t p)
 

Variables

avr32_acc_t acc
 

#define DEG_2_RAD (   deg)    ((double)(deg)*3.14/180)

static void acc_get_value ( volatile avr32_adc_t *  adc,
xyz_t val 
)
static
static int round0 ( int  i,
int  ceil 
)
static

References abs.

Referenced by xyz_round0().

static void xyz_add ( xyz_t  p,
xyz_t  q,
xyz_t r 
)
static

References xyz_t::x, xyz_t::y, and xyz_t::z.

Referenced by acc_update().

static void xyz_diff ( xyz_t  p,
xyz_t  q,
xyz_t r 
)
static

References xyz_t::x, xyz_t::y, and xyz_t::z.

Referenced by acc_update().

static void xyz_round0 ( xyz_t  p,
int  ceil,
xyz_t r 
)
static

References round0(), xyz_t::x, xyz_t::y, and xyz_t::z.

Referenced by acc_update().

static int xyz_sumsq ( xyz_t  p)
static

References xyz_t::x, xyz_t::y, and xyz_t::z.

Referenced by acc_update().

Initial value:
= {
.m = { .x=0 , .y=0 , .z=0 } ,
.pos.left = 0,
.pos.right = 0,
.pos.up = 0,
.pos.down = 0,
.pos.topdown = 0,
.k = { .x=ACC_ZERO_X , .y=ACC_ZERO_Y , .z=ACC_ZERO_Z } ,
.ak = { .x=0 , .y=0 , .z=0 } ,
.ak2 = 0 ,
.g = { .x=ACC_ZERO_X , .y=ACC_ZERO_Y , .z=ACC_MIN } ,
.ag = { .x=0 , .y=0 , .z=0 } ,
.ag2 = 0 ,
.s = { .x=0 , .y=0 , .z=0 } ,
.s2 = 0
}
#define ACC_ZERO_Z
Definition: lis3l06al.h:92
#define ACC_MIN
Definition: lis3l06al.h:63
#define ACC_ZERO_Y
Definition: lis3l06al.h:91
#define ACC_ZERO_X
Definition: lis3l06al.h:90