ChibiOS  0.0.0
Collaboration diagram for LSM303AGR:

Detailed Description

Macros

#define lsm303agrAccelerometerGetAxesNumber(devp)   accelerometerGetAxesNumber(&((devp)->acc_if))
 Return the number of axes of the BaseAccelerometer. More...
 
#define lsm303agrAccelerometerReadRaw(devp, axes)   accelerometerReadRaw(&((devp)->acc_if), axes)
 Retrieves raw data from the BaseAccelerometer. More...
 
#define lsm303agrAccelerometerReadCooked(devp, axes)   accelerometerReadCooked(&((devp)->acc_if), axes)
 Retrieves cooked data from the BaseAccelerometer. More...
 
#define lsm303agrAccelerometerSetBias(devp, bp)   accelerometerSetBias(&((devp)->acc_if), bp)
 Set bias values for the BaseAccelerometer. More...
 
#define lsm303agrAccelerometerResetBias(devp)   accelerometerResetBias(&((devp)->acc_if))
 Reset bias values for the BaseAccelerometer. More...
 
#define lsm303agrAccelerometerSetSensitivity(devp, sp)   accelerometerSetSensitivity(&((devp)->acc_if), sp)
 Set sensitivity values for the BaseAccelerometer. More...
 
#define lsm303agrAccelerometerResetSensitivity(devp)   accelerometerResetSensitivity(&((devp)->acc_if))
 Reset sensitivity values for the BaseAccelerometer. More...
 
#define lsm303agrAccelerometerSetFullScale(devp, fs)   (devp)->vmt->acc_set_full_scale(devp, fs)
 Changes the LSM303AGRDriver accelerometer fullscale value. More...
 
#define lsm303agrCompassGetAxesNumber(devp)   compassGetAxesNumber(&((devp)->comp_if))
 Return the number of axes of the BaseCompass. More...
 
#define lsm303agrCompassReadRaw(devp, axes)   compassReadRaw(&((devp)->comp_if), axes)
 Retrieves raw data from the BaseCompass. More...
 
#define lsm303agrCompassReadCooked(devp, axes)   compassReadCooked(&((devp)->comp_if), axes)
 Retrieves cooked data from the BaseCompass. More...
 
#define lsm303agrCompassSetBias(devp, bp)   compassSetBias(&((devp)->comp_if), bp)
 Set bias values for the BaseCompass. More...
 
#define lsm303agrCompassResetBias(devp)   compassResetBias(&((devp)->comp_if))
 Reset bias values for the BaseCompass. More...
 
#define lsm303agrCompassSetSensitivity(devp, sp)   compassSetSensitivity(&((devp)->comp_if), sp)
 Set sensitivity values for the BaseCompass. More...
 
#define lsm303agrCompassResetSensitivity(devp)   compassResetSensitivity(&((devp)->comp_if))
 Reset sensitivity values for the BaseCompass. More...
 

Version identification

#define EX_LSM303AGR_VERSION   "1.0.0"
 LSM303AGR driver version string. More...
 
#define EX_LSM303AGR_MAJOR   1
 LSM303AGR driver version major number. More...
 
#define EX_LSM303AGR_MINOR   0
 LSM303AGR driver version minor number. More...
 
#define EX_LSM303AGR_PATCH   0
 LSM303AGR driver version patch number. More...
 
#define LSM303AGR_ACC_NUMBER_OF_AXES   3U
 LSM303AGR accelerometer subsystem characteristics. More...
 
#define LSM303AGR_COMP_NUMBER_OF_AXES   3U
 LSM303AGR compass subsystem characteristics. More...
 

LSM303AGR communication interfaces related bit masks

#define LSM303AGR_DI_MASK   0xFF
 
#define LSM303AGR_DI(n)   (1 << n)
 
#define LSM303AGR_AD_MASK   0x7F
 
#define LSM303AGR_AD(n)   (1 << n)
 
#define LSM303AGR_MS   (1 << 7)
 

LSM303AGR register addresses

#define LSM303AGR_AD_STATUS_REG_AUX_A   0x07
 
#define LSM303AGR_AD_OUT_TEMP_L_A   0x0C
 
#define LSM303AGR_AD_OUT_TEMP_H_A   0x0D
 
#define LSM303AGR_AD_INT_COUNTER_REG_A   0x0E
 
#define LSM303AGR_AD_WHO_AM_I_A   0x0F
 
#define LSM303AGR_AD_TEMP_CFG_REG_A   0x1F
 
#define LSM303AGR_AD_CTRL_REG1_A   0x20
 
#define LSM303AGR_AD_CTRL_REG2_A   0x21
 
#define LSM303AGR_AD_CTRL_REG3_A   0x22
 
#define LSM303AGR_AD_CTRL_REG4_A   0x23
 
#define LSM303AGR_AD_CTRL_REG5_A   0x24
 
#define LSM303AGR_AD_CTRL_REG6_A   0x25
 
#define LSM303AGR_AD_REFERENCE_A   0x26
 
#define LSM303AGR_AD_STATUS_REG_A   0x27
 
#define LSM303AGR_AD_OUT_X_L_A   0x28
 
#define LSM303AGR_AD_OUT_X_H_A   0x29
 
#define LSM303AGR_AD_OUT_Y_L_A   0x2A
 
#define LSM303AGR_AD_OUT_Y_H_A   0x2B
 
#define LSM303AGR_AD_OUT_Z_L_A   0x2C
 
#define LSM303AGR_AD_OUT_Z_H_A   0x2D
 
#define LSM303AGR_AD_FIFO_CTRL_REG_A   0x2E
 
#define LSM303AGR_AD_FIFO_SRC_REG_A   0x2F
 
#define LSM303AGR_AD_INT1_CFG_A   0x30
 
#define LSM303AGR_AD_INT1_SRC_A   0x31
 
#define LSM303AGR_AD_INT1_THS_A   0x32
 
#define LSM303AGR_AD_INT1_DURATION_A   0x33
 
#define LSM303AGR_AD_INT2_CFG_A   0x34
 
#define LSM303AGR_AD_INT2_SRC_A   0x35
 
#define LSM303AGR_AD_INT2_THS_A   0x36
 
#define LSM303AGR_AD_INT2_DURATION_A   0x37
 
#define LSM303AGR_AD_CLICK_CFG_A   0x38
 
#define LSM303AGR_AD_CLICK_SRC_A   0x39
 
#define LSM303AGR_AD_CLICK_THS_A   0x3A
 
#define LSM303AGR_AD_TIME_LIMIT_A   0x3B
 
#define LSM303AGR_AD_TIME_LATENCY_A   0x3C
 
#define LSM303AGR_AD_TIME_WINDOW_A   0x3D
 
#define LSM303AGR_AD_ACT_THS_A   0x3E
 
#define LSM303AGR_AD_ACT_DUR_A   0x3F
 
#define LSM303AGR_AD_OFFSET_X_REG_L_M   0x45
 
#define LSM303AGR_AD_OFFSET_X_REG_H_M   0x46
 
#define LSM303AGR_AD_OFFSET_Y_REG_L_M   0x47
 
#define LSM303AGR_AD_OFFSET_Y_REG_H_M   0x48
 
#define LSM303AGR_AD_OFFSET_Z_REG_L_M   0x49
 
#define LSM303AGR_AD_OFFSET_Z_REG_H_M   0x4A
 
#define LSM303AGR_AD_WHO_AM_I_M   0x4F
 
#define LSM303AGR_AD_CFG_REG_A_M   0x60
 
#define LSM303AGR_AD_CFG_REG_B_M   0x61
 
#define LSM303AGR_AD_CFG_REG_C_M   0x62
 
#define LSM303AGR_AD_INT_CRTL_REG_M   0x63
 
#define LSM303AGR_AD_INT_SOURCE_REG_M   0x64
 
#define LSM303AGR_AD_INT_THS_L_REG_M   0x65
 
#define LSM303AGR_AD_INT_THS_H_REG_M   0x66
 
#define LSM303AGR_AD_STATUS_REG_M   0x67
 
#define LSM303AGR_AD_OUTX_L_REG_M   0x68
 
#define LSM303AGR_AD_OUTX_H_REG_M   0x69
 
#define LSM303AGR_AD_OUTY_L_REG_M   0x6A
 
#define LSM303AGR_AD_OUTY_H_REG_M   0x6B
 
#define LSM303AGR_AD_OUTZ_L_REG_M   0x6C
 
#define LSM303AGR_AD_OUTZ_H_REG_M   0x6D
 

LSM303AGR_TEMP_CFG_REG_A register bits definitions

#define LSM303AGR_TEMP_CFG_REG_A_TEMP_EN0   (1 << 0)
 
#define LSM303AGR_TEMP_CFG_REG_A_TEMP_EN1   (1 << 0)
 

LSM303AGR_CTRL_REG1_A register bits definitions

#define LSM303AGR_CTRL_REG1_A_XEN   (1 << 0)
 
#define LSM303AGR_CTRL_REG1_A_YEN   (1 << 1)
 
#define LSM303AGR_CTRL_REG1_A_ZEN   (1 << 2)
 
#define LSM303AGR_CTRL_REG1_A_LPEN   (1 << 3)
 
#define LSM303AGR_CTRL_REG1_A_ODR0   (1 << 4)
 
#define LSM303AGR_CTRL_REG1_A_ODR1   (1 << 5)
 
#define LSM303AGR_CTRL_REG1_A_ODR2   (1 << 6)
 
#define LSM303AGR_CTRL_REG1_A_ODR3   (1 << 7)
 

LSM303AGR_CTRL_REG2_A register bits definitions

#define LSM303AGR_CTRL_REG2_A_HPIS1   (1 << 0)
 
#define LSM303AGR_CTRL_REG2_A_HPIS2   (1 << 1)
 
#define LSM303AGR_CTRL_REG2_A_HPCLICK   (1 << 2)
 
#define LSM303AGR_CTRL_REG2_A_FDS   (1 << 3)
 
#define LSM303AGR_CTRL_REG2_A_HPCF1   (1 << 4)
 
#define LSM303AGR_CTRL_REG2_A_HPCF2   (1 << 5)
 
#define LSM303AGR_CTRL_REG2_A_HPM0   (1 << 6)
 
#define LSM303AGR_CTRL_REG2_A_HPM1   (1 << 7)
 

LSM303AGR_CTRL_REG3_A register bits definitions

#define LSM303AGR_CTRL_REG3_A_I1_OVERRUN   (1 << 1)
 
#define LSM303AGR_CTRL_REG3_A_I1_WTM   (1 << 2)
 
#define LSM303AGR_CTRL_REG3_A_I1_DRDY2   (1 << 3)
 
#define LSM303AGR_CTRL_REG3_A_I1_DRDY1   (1 << 4)
 
#define LSM303AGR_CTRL_REG3_A_I1_AOI2   (1 << 5)
 
#define LSM303AGR_CTRL_REG3_A_I1_AOI1   (1 << 6)
 
#define LSM303AGR_CTRL_REG3_A_I1_CLICK   (1 << 7)
 

LSM303AGR_CTRL_REG4_A register bits definitions

#define LSM303AGR_CTRL_REG4_A_SPI_ENABLE   (1 << 0)
 
#define LSM303AGR_CTRL_REG4_A_ST0   (1 << 1)
 
#define LSM303AGR_CTRL_REG4_A_ST1   (1 << 2)
 
#define LSM303AGR_CTRL_REG4_A_HR   (1 << 3)
 
#define LSM303AGR_CTRL_REG4_A_FS_MASK   0x30
 
#define LSM303AGR_CTRL_REG4_A_FS0   (1 << 4)
 
#define LSM303AGR_CTRL_REG4_A_FS1   (1 << 5)
 
#define LSM303AGR_CTRL_REG4_A_BLE   (1 << 6)
 
#define LSM303AGR_CTRL_REG4_A_BDU   (1 << 7)
 

LSM303AGR_CTRL_REG5_A register bits definitions

#define LSM303AGR_CTRL_REG5_A_D4D_INT2   (1 << 0)
 
#define LSM303AGR_CTRL_REG5_A_LIR_INT2   (1 << 1)
 
#define LSM303AGR_CTRL_REG5_A_D4D_INT1   (1 << 2)
 
#define LSM303AGR_CTRL_REG5_A_LIR_INT1   (1 << 3)
 
#define LSM303AGR_CTRL_REG5_A_FIFO_EN   (1 << 6)
 
#define LSM303AGR_CTRL_REG5_A_BOOT   (1 << 7)
 

LSM303AGR_CTRL_REG6_A register bits definitions

#define LSM303AGR_CTRL_REG6_A_H_LACTIVE   (1 << 1)
 
#define LSM303AGR_CTRL_REG6_A_P2_ACT   (1 << 3)
 
#define LSM303AGR_CTRL_REG6_A_BOOT_I2   (1 << 4)
 
#define LSM303AGR_CTRL_REG6_A_I2_INT2   (1 << 5)
 
#define LSM303AGR_CTRL_REG6_A_I2_INT1   (1 << 6)
 
#define LSM303AGR_CTRL_REG6_A_I2_CLICKEN   (1 << 7)
 

LSM303AGR_CFG_REG_A register bits definitions

#define LSM303AGR_CFG_REG_A_M_MD0   (1 << 0)
 
#define LSM303AGR_CFG_REG_A_M_MD1   (1 << 1)
 
#define LSM303AGR_CFG_REG_A_M_ODR0   (1 << 2)
 
#define LSM303AGR_CFG_REG_A_M_ODR1   (1 << 3)
 
#define LSM303AGR_CFG_REG_A_M_LP   (1 << 4)
 
#define LSM303AGR_CFG_REG_A_M_SOFT_RST   (1 << 5)
 
#define LSM303AGR_CFG_REG_A_M_REBOOT   (1 << 6)
 
#define LSM303AGR_CFG_REG_A_M_COMP_TEMP_EN   (1 << 7)
 

LSM303AGR_CFG_REG_B register bits definitions

#define LSM303AGR_CFG_REG_B_M_LPF   (1 << 0)
 
#define LSM303AGR_CFG_REG_B_M_OFF_CANC   (1 << 1)
 
#define LSM303AGR_CFG_REG_B_M_SET_FREQ   (1 << 2)
 
#define LSM303AGR_CFG_REG_B_M_INT_ON   (1 << 3)
 
#define LSM303AGR_CFG_REG_B_M_OFF_CANC_OS   (1 << 4)
 

LSM303AGR_CFG_REG_C register bits definitions

#define LSM303AGR_CFG_REG_C_M_INT_MAG   (1 << 0)
 
#define LSM303AGR_CFG_REG_C_M_SELF_TEST   (1 << 1)
 
#define LSM303AGR_CFG_REG_C_M_BLE   (1 << 3)
 
#define LSM303AGR_CFG_REG_C_M_BDU   (1 << 4)
 
#define LSM303AGR_CFG_REG_C_M_I2C_DIS   (1 << 5)
 
#define LSM303AGR_CFG_REG_C_M_INT_MAG_PIN   (1 << 6)
 

Configuration options

#define LSM303AGR_USE_SPI   FALSE
 LSM303AGR SPI interface switch. More...
 
#define LSM303AGR_SHARED_SPI   FALSE
 LSM303AGR shared SPI switch. More...
 
#define LSM303AGR_USE_I2C   TRUE
 LSM303AGR I2C interface switch. More...
 
#define LSM303AGR_SHARED_I2C   FALSE
 LSM303AGR shared I2C switch. More...
 
#define LSM303AGR_ACC_USE_ADVANCED   FALSE
 LSM303AGR accelerometer subsystem advanced configurations switch. More...
 
#define LSM303AGR_COMP_USE_ADVANCED   FALSE
 LSM303AGR compass subsystem advanced configurations switch. More...
 

LSM303AGR accelerometer subsystem data structures and types.

Todo:
Add support for LSM303AGR over SPI.
typedef struct LSM303AGRDriver LSM303AGRDriver
 Structure representing a LSM303AGR driver. More...
 

LSM303AGR compass subsystem data structures and types.

LSM303AGR main system data structures and types.

#define _lsm303agr_methods_alone
 LSM303AGR specific methods. More...
 
#define _lsm303agr_methods
 LSM303AGR specific methods with inherited ones. More...
 
#define _lsm303agr_data
 LSM303AGRDriver specific data. More...
 

Data Structures

struct  LSM303AGRConfig
 LSM303AGR configuration structure. More...
 
struct  LSM303AGRVMT
 LSM303AGR virtual methods table. More...
 
struct  LSM303AGRDriver
 LSM303AGR 6-axis accelerometer/compass class. More...
 

Functions

static msg_t lsm303agrI2CReadRegister (I2CDriver *i2cp, lsm303agr_sad_t sad, uint8_t reg, uint8_t *rxbuf, size_t n)
 Reads registers value using I2C. More...
 
static msg_t lsm303agrI2CWriteRegister (I2CDriver *i2cp, lsm303agr_sad_t sad, uint8_t *txbuf, size_t n)
 Writes a value into a register using I2C. More...
 
static size_t acc_get_axes_number (void *ip)
 Return the number of axes of the BaseAccelerometer. More...
 
static msg_t acc_read_raw (void *ip, int32_t axes[])
 Retrieves raw data from the BaseAccelerometer. More...
 
static msg_t acc_read_cooked (void *ip, float axes[])
 Retrieves cooked data from the BaseAccelerometer. More...
 
static msg_t acc_set_bias (void *ip, float *bp)
 Set bias values for the BaseAccelerometer. More...
 
static msg_t acc_reset_bias (void *ip)
 Reset bias values for the BaseAccelerometer. More...
 
static msg_t acc_set_sensivity (void *ip, float *sp)
 Set sensitivity values for the BaseAccelerometer. More...
 
static msg_t acc_reset_sensivity (void *ip)
 Reset sensitivity values for the BaseAccelerometer. More...
 
static msg_t acc_set_full_scale (LSM303AGRDriver *devp, lsm303agr_acc_fs_t fs)
 Changes the LSM303AGRDriver accelerometer fullscale value. More...
 
static size_t comp_get_axes_number (void *ip)
 Return the number of axes of the BaseCompass. More...
 
static msg_t comp_read_raw (void *ip, int32_t axes[])
 Retrieves raw data from the BaseCompass. More...
 
static msg_t comp_read_cooked (void *ip, float axes[])
 Retrieves cooked data from the BaseCompass. More...
 
static msg_t comp_set_bias (void *ip, float *bp)
 Set bias values for the BaseCompass. More...
 
static msg_t comp_reset_bias (void *ip)
 Reset bias values for the BaseCompass. More...
 
static msg_t comp_set_sensivity (void *ip, float *sp)
 Set sensitivity values for the BaseCompass. More...
 
static msg_t comp_reset_sensivity (void *ip)
 Reset sensitivity values for the BaseCompass. More...
 
void lsm303agrObjectInit (LSM303AGRDriver *devp)
 Initializes an instance. More...
 
void lsm303agrStart (LSM303AGRDriver *devp, const LSM303AGRConfig *config)
 Configures and activates LSM303AGR Complex Driver peripheral. More...
 
void lsm303agrStop (LSM303AGRDriver *devp)
 Deactivates the LSM303AGR Complex Driver peripheral. More...
 

Enumerations

Macro Definition Documentation

#define EX_LSM303AGR_VERSION   "1.0.0"

LSM303AGR driver version string.

Definition at line 46 of file lsm303agr.h.

#define EX_LSM303AGR_MAJOR   1

LSM303AGR driver version major number.

Definition at line 51 of file lsm303agr.h.

#define EX_LSM303AGR_MINOR   0

LSM303AGR driver version minor number.

Definition at line 56 of file lsm303agr.h.

#define EX_LSM303AGR_PATCH   0

LSM303AGR driver version patch number.

Definition at line 61 of file lsm303agr.h.

#define LSM303AGR_ACC_NUMBER_OF_AXES   3U

LSM303AGR accelerometer subsystem characteristics.

Note
Sensitivity is expressed as milli-G/LSB whereas 1 milli-G = 0.00980665 m/s^2.
Bias is expressed as milli-G.

Definition at line 72 of file lsm303agr.h.

Referenced by acc_get_axes_number(), acc_read_cooked(), acc_read_raw(), acc_reset_bias(), acc_reset_sensivity(), acc_set_bias(), acc_set_full_scale(), acc_set_sensivity(), lsm303agrObjectInit(), and lsm303agrStart().

#define LSM303AGR_COMP_NUMBER_OF_AXES   3U

LSM303AGR compass subsystem characteristics.

Note
Sensitivity is expressed as G/LSB whereas G stands for Gauss.
Bias is expressed as G.

Definition at line 94 of file lsm303agr.h.

Referenced by comp_get_axes_number(), comp_read_cooked(), comp_read_raw(), comp_reset_bias(), comp_reset_sensivity(), comp_set_bias(), comp_set_sensivity(), lsm303agrObjectInit(), and lsm303agrStart().

#define LSM303AGR_USE_SPI   FALSE

LSM303AGR SPI interface switch.

If set to TRUE the support for SPI is included.

Note
The default is FALSE.

Definition at line 318 of file lsm303agr.h.

#define LSM303AGR_SHARED_SPI   FALSE

LSM303AGR shared SPI switch.

If set to TRUE the device acquires SPI bus ownership on each transaction.

Note
The default is FALSE. Requires SPI_USE_MUTUAL_EXCLUSION.

Definition at line 328 of file lsm303agr.h.

#define LSM303AGR_USE_I2C   TRUE

LSM303AGR I2C interface switch.

If set to TRUE the support for I2C is included.

Note
The default is TRUE.

Definition at line 337 of file lsm303agr.h.

#define LSM303AGR_SHARED_I2C   FALSE

LSM303AGR shared I2C switch.

If set to TRUE the device acquires I2C bus ownership on each transaction.

Note
The default is FALSE. Requires I2C_USE_MUTUAL_EXCLUSION.

Definition at line 347 of file lsm303agr.h.

#define LSM303AGR_ACC_USE_ADVANCED   FALSE

LSM303AGR accelerometer subsystem advanced configurations switch.

If set to TRUE more configurations are available.

Note
The default is FALSE.

Definition at line 357 of file lsm303agr.h.

#define LSM303AGR_COMP_USE_ADVANCED   FALSE

LSM303AGR compass subsystem advanced configurations switch.

If set to TRUE more configurations are available.

Note
The default is FALSE.

Definition at line 367 of file lsm303agr.h.

#define _lsm303agr_methods_alone
Value:
/* Change full scale value of LSM303AGR accelerometer subsystem.*/ \
static msg_t acc_set_full_scale(LIS302DLDriver *devp, lis302dl_acc_fs_t fs)
Changes the LIS302DLDriver accelerometer fullscale value.
Definition: lis302dl.c:332
LSM303AGR 6-axis accelerometer/compass class.
Definition: lsm303agr.h:643
lsm303agr_acc_fs_t
LSM303AGR accelerometer subsystem full scale.
Definition: lsm303agr.h:418
int32_t msg_t
Definition: chtypes.h:51

LSM303AGR specific methods.

Definition at line 593 of file lsm303agr.h.

#define _lsm303agr_methods
Value:
#define _lsm303agr_methods_alone
LSM303AGR specific methods.
Definition: lsm303agr.h:593

LSM303AGR specific methods with inherited ones.

Definition at line 601 of file lsm303agr.h.

#define _lsm303agr_data
Value:
/* Driver state.*/ \
/* Current configuration data.*/ \
const LSM303AGRConfig *config; \
/* Accelerometer subsystem axes number.*/ \
size_t accaxes; \
/* Accelerometer subsystem current sensitivity.*/ \
float accsensitivity[LSM303AGR_ACC_NUMBER_OF_AXES]; \
/* Accelerometer subsystem current bias .*/ \
float accbias[LSM303AGR_ACC_NUMBER_OF_AXES]; \
/* Accelerometer subsystem current full scale value.*/ \
float accfullscale; \
/* Compass subsystem axes number.*/ \
size_t compaxes; \
/* Compass subsystem current sensitivity.*/ \
float compsensitivity[LSM303AGR_COMP_NUMBER_OF_AXES]; \
/* Compass subsystem current bias.*/ \
float compbias[LSM303AGR_COMP_NUMBER_OF_AXES]; \
/* Compass subsystem current full scale value.*/ \
float compfullscale;
#define LSM303AGR_COMP_NUMBER_OF_AXES
LSM303AGR compass subsystem characteristics.
Definition: lsm303agr.h:94
lsm303agr_state_t
Driver state machine possible states.
Definition: lsm303agr.h:518
LSM303AGR configuration structure.
Definition: lsm303agr.h:527
#define _base_sensor_data
BaseSensor specific data.
Definition: hal_sensors.h:74
#define LSM303AGR_ACC_NUMBER_OF_AXES
LSM303AGR accelerometer subsystem characteristics.
Definition: lsm303agr.h:72

LSM303AGRDriver specific data.

Definition at line 617 of file lsm303agr.h.

#define lsm303agrAccelerometerGetAxesNumber (   devp)    accelerometerGetAxesNumber(&((devp)->acc_if))

Return the number of axes of the BaseAccelerometer.

Parameters
[in]devppointer to LSM303AGRDriver.
Returns
the number of axes.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 667 of file lsm303agr.h.

#define lsm303agrAccelerometerReadRaw (   devp,
  axes 
)    accelerometerReadRaw(&((devp)->acc_if), axes)

Retrieves raw data from the BaseAccelerometer.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]devppointer to LSM303AGRDriver.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 688 of file lsm303agr.h.

#define lsm303agrAccelerometerReadCooked (   devp,
  axes 
)    accelerometerReadCooked(&((devp)->acc_if), axes)

Retrieves cooked data from the BaseAccelerometer.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as milli-G.
The axes array must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]devppointer to LSM303AGRDriver.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 710 of file lsm303agr.h.

#define lsm303agrAccelerometerSetBias (   devp,
  bp 
)    accelerometerSetBias(&((devp)->acc_if), bp)

Set bias values for the BaseAccelerometer.

Note
Bias must be expressed as milli-G.
The bias buffer must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]devppointer to LSM303AGRDriver.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 727 of file lsm303agr.h.

#define lsm303agrAccelerometerResetBias (   devp)    accelerometerResetBias(&((devp)->acc_if))

Reset bias values for the BaseAccelerometer.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]devppointer to LSM303AGRDriver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 742 of file lsm303agr.h.

#define lsm303agrAccelerometerSetSensitivity (   devp,
  sp 
)    accelerometerSetSensitivity(&((devp)->acc_if), sp)

Set sensitivity values for the BaseAccelerometer.

Note
Sensitivity must be expressed as milli-G/LSB.
The sensitivity buffer must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]devppointer to LSM303AGRDriver.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 759 of file lsm303agr.h.

#define lsm303agrAccelerometerResetSensitivity (   devp)    accelerometerResetSensitivity(&((devp)->acc_if))

Reset sensitivity values for the BaseAccelerometer.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]devppointer to LSM303AGRDriver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 774 of file lsm303agr.h.

#define lsm303agrAccelerometerSetFullScale (   devp,
  fs 
)    (devp)->vmt->acc_set_full_scale(devp, fs)

Changes the LSM303AGRDriver accelerometer fullscale value.

Note
This function also rescale sensitivities and biases based on previous and next fullscale value.
A recalibration is highly suggested after calling this function.
Parameters
[in]devppointer to LSM303AGRDriver.
[in]fsnew fullscale value.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 792 of file lsm303agr.h.

#define lsm303agrCompassGetAxesNumber (   devp)    compassGetAxesNumber(&((devp)->comp_if))

Return the number of axes of the BaseCompass.

Parameters
[in]devppointer to LSM303AGRDriver.
Returns
the number of axes.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 804 of file lsm303agr.h.

#define lsm303agrCompassReadRaw (   devp,
  axes 
)    compassReadRaw(&((devp)->comp_if), axes)

Retrieves raw data from the BaseCompass.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseCompass axes number.
Parameters
[in]devppointer to BaseCompass interface.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 825 of file lsm303agr.h.

#define lsm303agrCompassReadCooked (   devp,
  axes 
)    compassReadCooked(&((devp)->comp_if), axes)

Retrieves cooked data from the BaseCompass.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as G.
The axes array must be at least the same size of the BaseCompass axes number.
Parameters
[in]devppointer to BaseCompass interface.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 847 of file lsm303agr.h.

#define lsm303agrCompassSetBias (   devp,
  bp 
)    compassSetBias(&((devp)->comp_if), bp)

Set bias values for the BaseCompass.

Note
Bias must be expressed as G.
The bias buffer must be at least the same size of the BaseCompass axes number.
Parameters
[in]devppointer to BaseCompass interface.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 864 of file lsm303agr.h.

#define lsm303agrCompassResetBias (   devp)    compassResetBias(&((devp)->comp_if))

Reset bias values for the BaseCompass.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]devppointer to LSM303AGRDriver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 879 of file lsm303agr.h.

#define lsm303agrCompassSetSensitivity (   devp,
  sp 
)    compassSetSensitivity(&((devp)->comp_if), sp)

Set sensitivity values for the BaseCompass.

Note
Sensitivity must be expressed as G/LSB.
The sensitivity buffer must be at least the same size of the BaseCompass axes number.
Parameters
[in]devppointer to LSM303AGRDriver.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 896 of file lsm303agr.h.

#define lsm303agrCompassResetSensitivity (   devp)    compassResetSensitivity(&((devp)->comp_if))

Reset sensitivity values for the BaseCompass.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]devppointer to LSM303AGRDriver.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 911 of file lsm303agr.h.

Typedef Documentation

Structure representing a LSM303AGR driver.

Definition at line 413 of file lsm303agr.h.

Enumeration Type Documentation

Accelerometer and Compass Slave Address.

Enumerator
LSM303AGR_SAD_ACC 

SAD for accelerometer.

LSM303AGR_SAD_COMP 

SAD for compass.

Definition at line 48 of file lsm303agr.c.

LSM303AGR accelerometer subsystem full scale.

Enumerator
LSM303AGR_ACC_FS_2G 

Full scale ±2g.

LSM303AGR_ACC_FS_4G 

Full scale ±4g.

LSM303AGR_ACC_FS_8G 

Full scale ±8g.

LSM303AGR_ACC_FS_16G 

Full scale ±16g.

Definition at line 418 of file lsm303agr.h.

LSM303AGR accelerometer subsystem output data rate.

Enumerator
LSM303AGR_ACC_ODR_PD 

Power down

LSM303AGR_ACC_ODR_1Hz 

ODR 1 Hz

LSM303AGR_ACC_ODR_10Hz 

ODR 10 Hz

LSM303AGR_ACC_ODR_25Hz 

ODR 25 Hz

LSM303AGR_ACC_ODR_50Hz 

ODR 50 Hz

LSM303AGR_ACC_ODR_100Hz 

ODR 100 Hz

LSM303AGR_ACC_ODR_200Hz 

ODR 200 Hz

LSM303AGR_ACC_ODR_400Hz 

ODR 400 Hz

LSM303AGR_ACC_ODR_1620Hz 

ODR 1620 Hz (LP only)

LSM303AGR_ACC_ODR_1344Hz 

ODR 1344 Hz or 5376 Hz in LP

Definition at line 428 of file lsm303agr.h.

LSM303AGR accelerometer subsystem axes enabling.

Enumerator
LSM303AGR_ACC_AE_DISABLED 

All axes disabled.

LSM303AGR_ACC_AE_X 

Only X-axis enabled.

LSM303AGR_ACC_AE_Y 

Only Y-axis enabled.

LSM303AGR_ACC_AE_XY 

X and Y axes enabled.

LSM303AGR_ACC_AE_Z 

Only Z-axis enabled.

LSM303AGR_ACC_AE_XZ 

X and Z axes enabled.

LSM303AGR_ACC_AE_YZ 

Y and Z axes enabled.

LSM303AGR_ACC_AE_XYZ 

All axes enabled.

Definition at line 444 of file lsm303agr.h.

LSM303AGR accelerometer subsystem operation mode.

Enumerator
LSM303AGR_ACC_MODE_NORM 

Normal mode.

LSM303AGR_ACC_MODE_LPOW 

Low power mode.

LSM303AGR_ACC_MODE_HRES 

High resolution mode.

Definition at line 458 of file lsm303agr.h.

LSM303AGR accelerometer subsystem block data update.

Enumerator
LSM303AGR_ACC_BDU_CONT 

Continuous update

LSM303AGR_ACC_BDU_BLOCK 

Update blocked

Definition at line 467 of file lsm303agr.h.

LSM303AGR accelerometer endianness.

Enumerator
LSM303AGR_ACC_END_LITTLE 

Little Endian

LSM303AGR_ACC_END_BIG 

Big Endian

Definition at line 475 of file lsm303agr.h.

LSM303AGR compass subsystem output data rate.

Enumerator
LSM303AGR_COMP_ODR_10HZ 

ODR 10 Hz

LSM303AGR_COMP_ODR_20HZ 

ODR 20 Hz

LSM303AGR_COMP_ODR_50HZ 

ODR 50 Hz

LSM303AGR_COMP_ODR_100HZ 

ODR 100 Hz

Definition at line 487 of file lsm303agr.h.

LSM303AGR compass subsystem working mode.

Enumerator
LSM303AGR_COMP_MODE_NORM 

Continuous-Conversion Mode

LSM303AGR_COMP_MODE_SINGLE 

Single-Conversion Mode

LSM303AGR_COMP_MODE_IDLE 

Sleep Mode

Definition at line 497 of file lsm303agr.h.

LSM303AGR compass subsystem working mode.

Enumerator
LSM303AGR_COMP_LPOW_DIS 

High Resolution Mode

LSM303AGR_COMP_LPOW_EN 

Low Power Mode

Definition at line 506 of file lsm303agr.h.

Driver state machine possible states.

Enumerator
LSM303AGR_UNINIT 

Not initialized.

LSM303AGR_STOP 

Stopped.

LSM303AGR_READY 

Ready.

Definition at line 518 of file lsm303agr.h.

Function Documentation

static msg_t lsm303agrI2CReadRegister ( I2CDriver i2cp,
lsm303agr_sad_t  sad,
uint8_t  reg,
uint8_t *  rxbuf,
size_t  n 
)
static

Reads registers value using I2C.

Precondition
The I2C interface must be initialized and the driver started.
Note
IF_ADD_INC bit must be 1 in CTRL_REG8.
Parameters
[in]i2cppointer to the I2C interface.
[in]sadslave address without R bit.
[in]regfirst sub-register address.
[in]rxbufreceiving buffer.
[in]nsize of rxbuf.
Returns
the operation status.

Definition at line 69 of file lsm303agr.c.

References i2cMasterTransmitTimeout(), and TIME_INFINITE.

Referenced by acc_read_raw(), acc_set_full_scale(), and comp_read_raw().

Here is the call graph for this function:

static msg_t lsm303agrI2CWriteRegister ( I2CDriver i2cp,
lsm303agr_sad_t  sad,
uint8_t *  txbuf,
size_t  n 
)
static

Writes a value into a register using I2C.

Precondition
The I2C interface must be initialized and the driver started.
Parameters
[in]i2cppointer to the I2C interface.
[in]sadslave address without R bit.
[in]txbufbuffer containing sub-address value in first position and values to write.
[in]nsize of txbuf less one (not considering the first element).
Returns
the operation status.

Definition at line 89 of file lsm303agr.c.

References i2cMasterTransmitTimeout(), and TIME_INFINITE.

Referenced by acc_set_full_scale(), lsm303agrStart(), and lsm303agrStop().

Here is the call graph for this function:

static size_t acc_get_axes_number ( void *  ip)
static

Return the number of axes of the BaseAccelerometer.

Parameters
[in]ippointer to BaseAccelerometer interface.
Returns
the number of axes.

Definition at line 104 of file lsm303agr.c.

References LSM303AGR_ACC_NUMBER_OF_AXES.

static msg_t acc_read_raw ( void *  ip,
int32_t  axes[] 
)
static

Retrieves raw data from the BaseAccelerometer.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]ippointer to BaseAccelerometer interface.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 126 of file lsm303agr.c.

References I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LSM303AGR_ACC_NUMBER_OF_AXES, LSM303AGR_READY, LSM303AGR_SAD_ACC, lsm303agrI2CReadRegister(), MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by acc_read_cooked().

Here is the call graph for this function:

static msg_t acc_read_cooked ( void *  ip,
float  axes[] 
)
static

Retrieves cooked data from the BaseAccelerometer.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as milli-G.
The axes array must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]ippointer to BaseAccelerometer interface.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 181 of file lsm303agr.c.

References acc_read_raw(), LSM303AGR_ACC_NUMBER_OF_AXES, LSM303AGR_READY, objGetInstance, osalDbgAssert, and osalDbgCheck.

Here is the call graph for this function:

static msg_t acc_set_bias ( void *  ip,
float *  bp 
)
static

Set bias values for the BaseAccelerometer.

Note
Bias must be expressed as milli-G.
The bias buffer must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]ippointer to BaseAccelerometer interface.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 214 of file lsm303agr.c.

References LSM303AGR_ACC_NUMBER_OF_AXES, LSM303AGR_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

static msg_t acc_reset_bias ( void *  ip)
static

Reset bias values for the BaseAccelerometer.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]ippointer to BaseAccelerometer interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 243 of file lsm303agr.c.

References LSM303AGR_ACC_NUMBER_OF_AXES, LSM303AGR_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

static msg_t acc_set_sensivity ( void *  ip,
float *  sp 
)
static

Set sensitivity values for the BaseAccelerometer.

Note
Sensitivity must be expressed as milli-G/LSB.
The sensitivity buffer must be at least the same size of the BaseAccelerometer axes number.
Parameters
[in]ippointer to BaseAccelerometer interface.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 273 of file lsm303agr.c.

References LSM303AGR_ACC_NUMBER_OF_AXES, LSM303AGR_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

static msg_t acc_reset_sensivity ( void *  ip)
static

Reset sensitivity values for the BaseAccelerometer.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]ippointer to BaseAccelerometer interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.

Definition at line 302 of file lsm303agr.c.

References FALSE, LSM303AGR_ACC_FS_16G, LSM303AGR_ACC_FS_2G, LSM303AGR_ACC_FS_4G, LSM303AGR_ACC_FS_8G, LSM303AGR_ACC_NUMBER_OF_AXES, LSM303AGR_READY, MSG_OK, MSG_RESET, objGetInstance, osalDbgAssert, and osalDbgCheck.

static msg_t acc_set_full_scale ( LSM303AGRDriver devp,
lsm303agr_acc_fs_t  fs 
)
static

Changes the LSM303AGRDriver accelerometer fullscale value.

Note
This function also rescale sensitivities and biases based on previous and next fullscale value.
A recalibration is highly suggested after calling this function.
Parameters
[in]devppointer to LSM303AGRDriver interface.
[in]fsnew fullscale value.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.

Definition at line 355 of file lsm303agr.c.

References I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LSM303AGR_ACC_FS_16G, LSM303AGR_ACC_FS_2G, LSM303AGR_ACC_FS_4G, LSM303AGR_ACC_FS_8G, LSM303AGR_ACC_NUMBER_OF_AXES, LSM303AGR_READY, LSM303AGR_SAD_ACC, lsm303agrI2CReadRegister(), lsm303agrI2CWriteRegister(), MSG_OK, MSG_RESET, osalDbgAssert, and osalDbgCheck.

Here is the call graph for this function:

static size_t comp_get_axes_number ( void *  ip)
static

Return the number of axes of the BaseCompass.

Parameters
[in]ippointer to BaseCompass interface
Returns
the number of axes.

Definition at line 445 of file lsm303agr.c.

References LSM303AGR_COMP_NUMBER_OF_AXES, and osalDbgCheck.

static msg_t comp_read_raw ( void *  ip,
int32_t  axes[] 
)
static

Retrieves raw data from the BaseCompass.

Note
This data is retrieved from MEMS register without any algebraical manipulation.
The axes array must be at least the same size of the BaseCompass axes number.
Parameters
[in]ippointer to BaseCompass interface.
[out]axesa buffer which would be filled with raw data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 467 of file lsm303agr.c.

References I2C_READY, i2cAcquireBus(), i2cReleaseBus(), i2cStart(), LSM303AGR_COMP_NUMBER_OF_AXES, LSM303AGR_READY, LSM303AGR_SAD_COMP, lsm303agrI2CReadRegister(), MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

Referenced by comp_read_cooked().

Here is the call graph for this function:

static msg_t comp_read_cooked ( void *  ip,
float  axes[] 
)
static

Retrieves cooked data from the BaseCompass.

Note
This data is manipulated according to the formula cooked = (raw * sensitivity) - bias.
Final data is expressed as G.
The axes array must be at least the same size of the BaseCompass axes number.
Parameters
[in]ippointer to BaseCompass interface.
[out]axesa buffer which would be filled with cooked data.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETif one or more I2C errors occurred, the errors can be retrieved using i2cGetErrors().
MSG_TIMEOUTif a timeout occurred before operation end.

Definition at line 521 of file lsm303agr.c.

References comp_read_raw(), LSM303AGR_COMP_NUMBER_OF_AXES, LSM303AGR_READY, objGetInstance, osalDbgAssert, and osalDbgCheck.

Here is the call graph for this function:

static msg_t comp_set_bias ( void *  ip,
float *  bp 
)
static

Set bias values for the BaseCompass.

Note
Bias must be expressed as G.
The bias buffer must be at least the same size of the BaseCompass axes number.
Parameters
[in]ippointer to BaseCompass interface.
[in]bpa buffer which contains biases.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 555 of file lsm303agr.c.

References LSM303AGR_COMP_NUMBER_OF_AXES, LSM303AGR_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

static msg_t comp_reset_bias ( void *  ip)
static

Reset bias values for the BaseCompass.

Note
Default biases value are obtained from device datasheet when available otherwise they are considered zero.
Parameters
[in]ippointer to BaseCompass interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 584 of file lsm303agr.c.

References LSM303AGR_COMP_NUMBER_OF_AXES, LSM303AGR_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

static msg_t comp_set_sensivity ( void *  ip,
float *  sp 
)
static

Set sensitivity values for the BaseCompass.

Note
Sensitivity must be expressed as G/LSB.
The sensitivity buffer must be at least the same size of the BaseCompass axes number.
Parameters
[in]ippointer to BaseCompass interface.
[in]spa buffer which contains sensitivities.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.

Definition at line 614 of file lsm303agr.c.

References LSM303AGR_COMP_NUMBER_OF_AXES, LSM303AGR_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

static msg_t comp_reset_sensivity ( void *  ip)
static

Reset sensitivity values for the BaseCompass.

Note
Default sensitivities value are obtained from device datasheet.
Parameters
[in]ippointer to BaseCompass interface.
Returns
The operation status.
Return values
MSG_OKif the function succeeded.
MSG_RESETotherwise.

Definition at line 643 of file lsm303agr.c.

References LSM303AGR_COMP_NUMBER_OF_AXES, LSM303AGR_READY, MSG_OK, objGetInstance, osalDbgAssert, and osalDbgCheck.

void lsm303agrObjectInit ( LSM303AGRDriver devp)

Initializes an instance.

Parameters
[out]devppointer to the LSM303AGRDriver object
Function Class:Initializer, this function just initializes an object and can be invoked before the kernel is initialized.

Definition at line 690 of file lsm303agr.c.

References LSM303AGRDriver::acc_if, LSM303AGRDriver::comp_if, LSM303AGR_ACC_NUMBER_OF_AXES, LSM303AGR_COMP_NUMBER_OF_AXES, LSM303AGR_STOP, BaseAccelerometer::vmt, BaseCompass::vmt, and LSM303AGRDriver::vmt.

void lsm303agrStart ( LSM303AGRDriver devp,
const LSM303AGRConfig config 
)

Configures and activates LSM303AGR Complex Driver peripheral.

Parameters
[in]devppointer to the LSM303AGRDriver object
[in]configpointer to the LSM303AGRConfig object
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 711 of file lsm303agr.c.

References I2CDriver::config, FALSE, i2cAcquireBus(), LSM303AGRConfig::i2cp, i2cReleaseBus(), i2cStart(), LSM303AGR_ACC_AE_XYZ, LSM303AGR_ACC_FS_16G, LSM303AGR_ACC_FS_2G, LSM303AGR_ACC_FS_4G, LSM303AGR_ACC_FS_8G, LSM303AGR_ACC_MODE_HRES, LSM303AGR_ACC_MODE_LPOW, LSM303AGR_ACC_NUMBER_OF_AXES, LSM303AGR_COMP_NUMBER_OF_AXES, LSM303AGR_READY, LSM303AGR_SAD_ACC, LSM303AGR_SAD_COMP, LSM303AGR_STOP, lsm303agrI2CWriteRegister(), osalDbgAssert, osalDbgCheck, and osalThreadSleepMilliseconds.

Here is the call graph for this function:

void lsm303agrStop ( LSM303AGRDriver devp)

Deactivates the LSM303AGR Complex Driver peripheral.

Parameters
[in]devppointer to the LSM303AGRDriver object
Function Class:Normal API, this function can be invoked by regular system threads but not from within a lock zone.

Definition at line 873 of file lsm303agr.c.

References i2cAcquireBus(), i2cReleaseBus(), i2cStart(), i2cStop(), LSM303AGR_ACC_AE_DISABLED, LSM303AGR_ACC_ODR_PD, LSM303AGR_COMP_MODE_IDLE, LSM303AGR_READY, LSM303AGR_SAD_ACC, LSM303AGR_SAD_COMP, LSM303AGR_STOP, lsm303agrI2CWriteRegister(), osalDbgAssert, and osalDbgCheck.

Here is the call graph for this function: