ChibiOS/EX 1.3.0

Detailed Description

Collaboration diagram for LSM303AGR:

LSM303AGR accelerometer subsystem data structures and types.

enum  lsm303agr_acc_fs_t { LSM303AGR_ACC_FS_2G = 0x00 , LSM303AGR_ACC_FS_4G = 0x10 , LSM303AGR_ACC_FS_8G = 0x20 , LSM303AGR_ACC_FS_16G = 0x30 }
 LSM303AGR accelerometer subsystem full scale. More...
enum  lsm303agr_acc_odr_t {
  LSM303AGR_ACC_ODR_PD = 0x00 , LSM303AGR_ACC_ODR_1Hz = 0x10 , LSM303AGR_ACC_ODR_10Hz = 0x20 , LSM303AGR_ACC_ODR_25Hz = 0x30 ,
  LSM303AGR_ACC_ODR_50Hz = 0x40 , LSM303AGR_ACC_ODR_100Hz = 0x50 , LSM303AGR_ACC_ODR_200Hz = 0x60 , LSM303AGR_ACC_ODR_400Hz = 0x70 ,
  LSM303AGR_ACC_ODR_1620Hz = 0x80 , LSM303AGR_ACC_ODR_1344Hz = 0x90
}
 LSM303AGR accelerometer subsystem output data rate. More...
enum  lsm303agr_acc_ae_t {
  LSM303AGR_ACC_AE_DISABLED = 0x00 , LSM303AGR_ACC_AE_X = 0x01 , LSM303AGR_ACC_AE_Y = 0x02 , LSM303AGR_ACC_AE_XY = 0x03 ,
  LSM303AGR_ACC_AE_Z = 0x04 , LSM303AGR_ACC_AE_XZ = 0x05 , LSM303AGR_ACC_AE_YZ = 0x06 , LSM303AGR_ACC_AE_XYZ = 0x07
}
 LSM303AGR accelerometer subsystem axes enabling. More...
enum  lsm303agr_acc_mode_t { LSM303AGR_ACC_MODE_NORM = 0 , LSM303AGR_ACC_MODE_LPOW = 1 , LSM303AGR_ACC_MODE_HRES = 2 }
 LSM303AGR accelerometer subsystem operation mode. More...
enum  lsm303agr_acc_bdu_t { LSM303AGR_ACC_BDU_CONT = 0x00 , LSM303AGR_ACC_BDU_BLOCK = 0x80 }
 LSM303AGR accelerometer subsystem block data update. More...
enum  lsm303agr_acc_end_t { LSM303AGR_ACC_END_LITTLE = 0x00 , LSM303AGR_ACC_END_BIG = 0x40 }
 LSM303AGR accelerometer endianness. More...
typedef struct LSM303AGRDriver LSM303AGRDriver
 Structure representing a LSM303AGR driver.

LSM303AGR compass subsystem data structures and types.

enum  lsm303agr_comp_odr_t { LSM303AGR_COMP_ODR_10HZ = 0x00 , LSM303AGR_COMP_ODR_20HZ = 0x04 , LSM303AGR_COMP_ODR_50HZ = 0x08 , LSM303AGR_COMP_ODR_100HZ = 0x0C }
 LSM303AGR compass subsystem output data rate. More...
enum  lsm303agr_comp_mode_t { LSM303AGR_COMP_MODE_NORM = 0x00 , LSM303AGR_COMP_MODE_SINGLE = 0x01 , LSM303AGR_COMP_MODE_IDLE = 0x02 }
 LSM303AGR compass subsystem working mode. More...
enum  lsm303agr_comp_lpow_t { LSM303AGR_COMP_LPOW_DIS = 0x00 , LSM303AGR_COMP_LPOW_EN = 0x10 }
 LSM303AGR compass subsystem working mode. More...

LSM303AGR main system data structures and types.

enum  lsm303agr_state_t { LSM303AGR_UNINIT = 0 , LSM303AGR_STOP = 1 , LSM303AGR_READY = 2 }
 Driver state machine possible states. More...
#define _lsm303agr_methods_alone
 LSM303AGR specific methods.
#define _lsm303agr_methods
 LSM303AGR specific methods with inherited ones.
#define _lsm303agr_data
 LSM303AGRDriver specific data.

Version identification

#define EX_LSM303AGR_VERSION   "1.0.2"
 LSM303AGR driver version string.
#define EX_LSM303AGR_MAJOR   1
 LSM303AGR driver version major number.
#define EX_LSM303AGR_MINOR   0
 LSM303AGR driver version minor number.
#define EX_LSM303AGR_PATCH   2
 LSM303AGR driver version patch number.
#define LSM303AGR_ACC_NUMBER_OF_AXES   3U
 LSM303AGR accelerometer subsystem characteristics.
#define LSM303AGR_ACC_2G   2.0f
#define LSM303AGR_ACC_4G   4.0f
#define LSM303AGR_ACC_8G   8.0f
#define LSM303AGR_ACC_16G   16.0f
#define LSM303AGR_ACC_SENS_2G   0.060f
#define LSM303AGR_ACC_SENS_4G   0.120f
#define LSM303AGR_ACC_SENS_8G   0.240f
#define LSM303AGR_ACC_SENS_16G   0.750f
#define LSM303AGR_ACC_BIAS   0.0f
#define LSM303AGR_COMP_NUMBER_OF_AXES   3U
 LSM303AGR compass subsystem characteristics.
#define LSM303AGR_COMP_50GA   50.0f
#define LSM303AGR_COMP_SENS_50GA   0.00015f
#define LSM303AGR_COMP_BIAS   0.0f

LSM303AGR communication interfaces related bit masks

#define LSM303AGR_DI_MASK   0xFF
#define LSM303AGR_DI(n)
#define LSM303AGR_AD_MASK   0x7F
#define LSM303AGR_AD(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.
#define LSM303AGR_SHARED_SPI   FALSE
 LSM303AGR shared SPI switch.
#define LSM303AGR_USE_I2C   TRUE
 LSM303AGR I2C interface switch.
#define LSM303AGR_SHARED_I2C   FALSE
 LSM303AGR shared I2C switch.
#define LSM303AGR_USE_ADVANCED   FALSE
 LSM303AGR advanced configurations switch.

Data Structures

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

Macros

#define lsm303agrAccelerometerGetAxesNumber(devp)
 Return the number of axes of the BaseAccelerometer.
#define lsm303agrAccelerometerReadRaw(devp, axes)
 Retrieves raw data from the BaseAccelerometer.
#define lsm303agrAccelerometerReadCooked(devp, axes)
 Retrieves cooked data from the BaseAccelerometer.
#define lsm303agrAccelerometerSetBias(devp, bp)
 Set bias values for the BaseAccelerometer.
#define lsm303agrAccelerometerResetBias(devp)
 Reset bias values for the BaseAccelerometer.
#define lsm303agrAccelerometerSetSensitivity(devp, sp)
 Set sensitivity values for the BaseAccelerometer.
#define lsm303agrAccelerometerResetSensitivity(devp)
 Reset sensitivity values for the BaseAccelerometer.
#define lsm303agrAccelerometerSetFullScale(devp, fs)
 Changes the LSM303AGRDriver accelerometer fullscale value.
#define lsm303agrCompassGetAxesNumber(devp)
 Return the number of axes of the BaseCompass.
#define lsm303agrCompassReadRaw(devp, axes)
 Retrieves raw data from the BaseCompass.
#define lsm303agrCompassReadCooked(devp, axes)
 Retrieves cooked data from the BaseCompass.
#define lsm303agrCompassSetBias(devp, bp)
 Set bias values for the BaseCompass.
#define lsm303agrCompassResetBias(devp)
 Reset bias values for the BaseCompass.
#define lsm303agrCompassSetSensitivity(devp, sp)
 Set sensitivity values for the BaseCompass.
#define lsm303agrCompassResetSensitivity(devp)
 Reset sensitivity values for the BaseCompass.

Enumerations

enum  lsm303agr_sad_t { LSM303AGR_SAD_ACC = 0x19 , LSM303AGR_SAD_COMP = 0x1E }
 Accelerometer and Compass Slave Address. 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.
static msg_t lsm303agrI2CWriteRegister (I2CDriver *i2cp, lsm303agr_sad_t sad, uint8_t *txbuf, size_t n)
 Writes a value into a register using I2C.
static size_t acc_get_axes_number (void *ip)
 Return the number of axes of the BaseAccelerometer.
static msg_t acc_read_raw (void *ip, int32_t axes[])
 Retrieves raw data from the BaseAccelerometer.
static msg_t acc_read_cooked (void *ip, float axes[])
 Retrieves cooked data from the BaseAccelerometer.
static msg_t acc_set_bias (void *ip, float *bp)
 Set bias values for the BaseAccelerometer.
static msg_t acc_reset_bias (void *ip)
 Reset bias values for the BaseAccelerometer.
static msg_t acc_set_sensivity (void *ip, float *sp)
 Set sensitivity values for the BaseAccelerometer.
static msg_t acc_reset_sensivity (void *ip)
 Reset sensitivity values for the BaseAccelerometer.
static msg_t acc_set_full_scale (LSM303AGRDriver *devp, lsm303agr_acc_fs_t fs)
 Changes the LSM303AGRDriver accelerometer fullscale value.
static size_t comp_get_axes_number (void *ip)
 Return the number of axes of the BaseCompass.
static msg_t comp_read_raw (void *ip, int32_t axes[])
 Retrieves raw data from the BaseCompass.
static msg_t comp_read_cooked (void *ip, float axes[])
 Retrieves cooked data from the BaseCompass.
static msg_t comp_set_bias (void *ip, float *bp)
 Set bias values for the BaseCompass.
static msg_t comp_reset_bias (void *ip)
 Reset bias values for the BaseCompass.
static msg_t comp_set_sensivity (void *ip, float *sp)
 Set sensitivity values for the BaseCompass.
static msg_t comp_reset_sensivity (void *ip)
 Reset sensitivity values for the BaseCompass.
void lsm303agrObjectInit (LSM303AGRDriver *devp)
 Initializes an instance.
void lsm303agrStart (LSM303AGRDriver *devp, const LSM303AGRConfig *config)
 Configures and activates LSM303AGR Complex Driver peripheral.
void lsm303agrStop (LSM303AGRDriver *devp)
 Deactivates the LSM303AGR Complex Driver peripheral.

Variables

static const struct LSM303AGRVMT vmt_device
static const struct BaseAccelerometerVMT vmt_accelerometer
static const struct BaseCompassVMT vmt_compass

Macro Definition Documentation

◆ EX_LSM303AGR_VERSION

#define EX_LSM303AGR_VERSION   "1.0.2"

LSM303AGR driver version string.

Definition at line 46 of file lsm303agr.h.

◆ EX_LSM303AGR_MAJOR

#define EX_LSM303AGR_MAJOR   1

LSM303AGR driver version major number.

Definition at line 51 of file lsm303agr.h.

◆ EX_LSM303AGR_MINOR

#define EX_LSM303AGR_MINOR   0

LSM303AGR driver version minor number.

Definition at line 56 of file lsm303agr.h.

◆ EX_LSM303AGR_PATCH

#define EX_LSM303AGR_PATCH   2

LSM303AGR driver version patch number.

Definition at line 61 of file lsm303agr.h.

◆ LSM303AGR_ACC_NUMBER_OF_AXES

#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().

◆ LSM303AGR_ACC_2G

#define LSM303AGR_ACC_2G   2.0f

Definition at line 74 of file lsm303agr.h.

Referenced by acc_set_full_scale(), and lsm303agrStart().

◆ LSM303AGR_ACC_4G

#define LSM303AGR_ACC_4G   4.0f

Definition at line 75 of file lsm303agr.h.

Referenced by acc_set_full_scale(), and lsm303agrStart().

◆ LSM303AGR_ACC_8G

#define LSM303AGR_ACC_8G   8.0f

Definition at line 76 of file lsm303agr.h.

Referenced by acc_set_full_scale(), and lsm303agrStart().

◆ LSM303AGR_ACC_16G

#define LSM303AGR_ACC_16G   16.0f

Definition at line 77 of file lsm303agr.h.

Referenced by acc_set_full_scale(), and lsm303agrStart().

◆ LSM303AGR_ACC_SENS_2G

#define LSM303AGR_ACC_SENS_2G   0.060f

Definition at line 79 of file lsm303agr.h.

Referenced by acc_reset_sensivity(), and lsm303agrStart().

◆ LSM303AGR_ACC_SENS_4G

#define LSM303AGR_ACC_SENS_4G   0.120f

Definition at line 80 of file lsm303agr.h.

Referenced by acc_reset_sensivity(), and lsm303agrStart().

◆ LSM303AGR_ACC_SENS_8G

#define LSM303AGR_ACC_SENS_8G   0.240f

Definition at line 81 of file lsm303agr.h.

Referenced by acc_reset_sensivity(), and lsm303agrStart().

◆ LSM303AGR_ACC_SENS_16G

#define LSM303AGR_ACC_SENS_16G   0.750f

Definition at line 82 of file lsm303agr.h.

Referenced by acc_reset_sensivity(), and lsm303agrStart().

◆ LSM303AGR_ACC_BIAS

#define LSM303AGR_ACC_BIAS   0.0f

Definition at line 84 of file lsm303agr.h.

Referenced by acc_reset_bias(), and lsm303agrStart().

◆ LSM303AGR_COMP_NUMBER_OF_AXES

#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().

◆ LSM303AGR_COMP_50GA

#define LSM303AGR_COMP_50GA   50.0f

Definition at line 96 of file lsm303agr.h.

Referenced by lsm303agrStart().

◆ LSM303AGR_COMP_SENS_50GA

#define LSM303AGR_COMP_SENS_50GA   0.00015f

Definition at line 98 of file lsm303agr.h.

Referenced by comp_reset_sensivity(), and lsm303agrStart().

◆ LSM303AGR_COMP_BIAS

#define LSM303AGR_COMP_BIAS   0.0f

Definition at line 100 of file lsm303agr.h.

Referenced by comp_reset_bias().

◆ LSM303AGR_DI_MASK

#define LSM303AGR_DI_MASK   0xFF

Definition at line 107 of file lsm303agr.h.

◆ LSM303AGR_DI

#define LSM303AGR_DI ( n)
Value:
(1 << n)

Definition at line 108 of file lsm303agr.h.

◆ LSM303AGR_AD_MASK

#define LSM303AGR_AD_MASK   0x7F

Definition at line 109 of file lsm303agr.h.

◆ LSM303AGR_AD

#define LSM303AGR_AD ( n)
Value:
(1 << n)

Definition at line 110 of file lsm303agr.h.

◆ LSM303AGR_MS

#define LSM303AGR_MS   (1 << 7)

Definition at line 111 of file lsm303agr.h.

Referenced by lsm303agrI2CReadRegister(), and lsm303agrI2CWriteRegister().

◆ LSM303AGR_AD_STATUS_REG_AUX_A

#define LSM303AGR_AD_STATUS_REG_AUX_A   0x07

Definition at line 118 of file lsm303agr.h.

◆ LSM303AGR_AD_OUT_TEMP_L_A

#define LSM303AGR_AD_OUT_TEMP_L_A   0x0C

Definition at line 119 of file lsm303agr.h.

◆ LSM303AGR_AD_OUT_TEMP_H_A

#define LSM303AGR_AD_OUT_TEMP_H_A   0x0D

Definition at line 120 of file lsm303agr.h.

◆ LSM303AGR_AD_INT_COUNTER_REG_A

#define LSM303AGR_AD_INT_COUNTER_REG_A   0x0E

Definition at line 121 of file lsm303agr.h.

◆ LSM303AGR_AD_WHO_AM_I_A

#define LSM303AGR_AD_WHO_AM_I_A   0x0F

Definition at line 122 of file lsm303agr.h.

◆ LSM303AGR_AD_TEMP_CFG_REG_A

#define LSM303AGR_AD_TEMP_CFG_REG_A   0x1F

Definition at line 123 of file lsm303agr.h.

◆ LSM303AGR_AD_CTRL_REG1_A

#define LSM303AGR_AD_CTRL_REG1_A   0x20

Definition at line 124 of file lsm303agr.h.

Referenced by lsm303agrStart(), and lsm303agrStop().

◆ LSM303AGR_AD_CTRL_REG2_A

#define LSM303AGR_AD_CTRL_REG2_A   0x21

Definition at line 125 of file lsm303agr.h.

◆ LSM303AGR_AD_CTRL_REG3_A

#define LSM303AGR_AD_CTRL_REG3_A   0x22

Definition at line 126 of file lsm303agr.h.

◆ LSM303AGR_AD_CTRL_REG4_A

#define LSM303AGR_AD_CTRL_REG4_A   0x23

Definition at line 127 of file lsm303agr.h.

Referenced by acc_set_full_scale().

◆ LSM303AGR_AD_CTRL_REG5_A

#define LSM303AGR_AD_CTRL_REG5_A   0x24

Definition at line 128 of file lsm303agr.h.

◆ LSM303AGR_AD_CTRL_REG6_A

#define LSM303AGR_AD_CTRL_REG6_A   0x25

Definition at line 129 of file lsm303agr.h.

◆ LSM303AGR_AD_REFERENCE_A

#define LSM303AGR_AD_REFERENCE_A   0x26

Definition at line 130 of file lsm303agr.h.

◆ LSM303AGR_AD_STATUS_REG_A

#define LSM303AGR_AD_STATUS_REG_A   0x27

Definition at line 131 of file lsm303agr.h.

◆ LSM303AGR_AD_OUT_X_L_A

#define LSM303AGR_AD_OUT_X_L_A   0x28

Definition at line 132 of file lsm303agr.h.

Referenced by acc_read_raw().

◆ LSM303AGR_AD_OUT_X_H_A

#define LSM303AGR_AD_OUT_X_H_A   0x29

Definition at line 133 of file lsm303agr.h.

◆ LSM303AGR_AD_OUT_Y_L_A

#define LSM303AGR_AD_OUT_Y_L_A   0x2A

Definition at line 134 of file lsm303agr.h.

◆ LSM303AGR_AD_OUT_Y_H_A

#define LSM303AGR_AD_OUT_Y_H_A   0x2B

Definition at line 135 of file lsm303agr.h.

◆ LSM303AGR_AD_OUT_Z_L_A

#define LSM303AGR_AD_OUT_Z_L_A   0x2C

Definition at line 136 of file lsm303agr.h.

◆ LSM303AGR_AD_OUT_Z_H_A

#define LSM303AGR_AD_OUT_Z_H_A   0x2D

Definition at line 137 of file lsm303agr.h.

◆ LSM303AGR_AD_FIFO_CTRL_REG_A

#define LSM303AGR_AD_FIFO_CTRL_REG_A   0x2E

Definition at line 138 of file lsm303agr.h.

◆ LSM303AGR_AD_FIFO_SRC_REG_A

#define LSM303AGR_AD_FIFO_SRC_REG_A   0x2F

Definition at line 139 of file lsm303agr.h.

◆ LSM303AGR_AD_INT1_CFG_A

#define LSM303AGR_AD_INT1_CFG_A   0x30

Definition at line 140 of file lsm303agr.h.

◆ LSM303AGR_AD_INT1_SRC_A

#define LSM303AGR_AD_INT1_SRC_A   0x31

Definition at line 141 of file lsm303agr.h.

◆ LSM303AGR_AD_INT1_THS_A

#define LSM303AGR_AD_INT1_THS_A   0x32

Definition at line 142 of file lsm303agr.h.

◆ LSM303AGR_AD_INT1_DURATION_A

#define LSM303AGR_AD_INT1_DURATION_A   0x33

Definition at line 143 of file lsm303agr.h.

◆ LSM303AGR_AD_INT2_CFG_A

#define LSM303AGR_AD_INT2_CFG_A   0x34

Definition at line 144 of file lsm303agr.h.

◆ LSM303AGR_AD_INT2_SRC_A

#define LSM303AGR_AD_INT2_SRC_A   0x35

Definition at line 145 of file lsm303agr.h.

◆ LSM303AGR_AD_INT2_THS_A

#define LSM303AGR_AD_INT2_THS_A   0x36

Definition at line 146 of file lsm303agr.h.

◆ LSM303AGR_AD_INT2_DURATION_A

#define LSM303AGR_AD_INT2_DURATION_A   0x37

Definition at line 147 of file lsm303agr.h.

◆ LSM303AGR_AD_CLICK_CFG_A

#define LSM303AGR_AD_CLICK_CFG_A   0x38

Definition at line 148 of file lsm303agr.h.

◆ LSM303AGR_AD_CLICK_SRC_A

#define LSM303AGR_AD_CLICK_SRC_A   0x39

Definition at line 149 of file lsm303agr.h.

◆ LSM303AGR_AD_CLICK_THS_A

#define LSM303AGR_AD_CLICK_THS_A   0x3A

Definition at line 150 of file lsm303agr.h.

◆ LSM303AGR_AD_TIME_LIMIT_A

#define LSM303AGR_AD_TIME_LIMIT_A   0x3B

Definition at line 151 of file lsm303agr.h.

◆ LSM303AGR_AD_TIME_LATENCY_A

#define LSM303AGR_AD_TIME_LATENCY_A   0x3C

Definition at line 152 of file lsm303agr.h.

◆ LSM303AGR_AD_TIME_WINDOW_A

#define LSM303AGR_AD_TIME_WINDOW_A   0x3D

Definition at line 153 of file lsm303agr.h.

◆ LSM303AGR_AD_ACT_THS_A

#define LSM303AGR_AD_ACT_THS_A   0x3E

Definition at line 154 of file lsm303agr.h.

◆ LSM303AGR_AD_ACT_DUR_A

#define LSM303AGR_AD_ACT_DUR_A   0x3F

Definition at line 155 of file lsm303agr.h.

◆ LSM303AGR_AD_OFFSET_X_REG_L_M

#define LSM303AGR_AD_OFFSET_X_REG_L_M   0x45

Definition at line 156 of file lsm303agr.h.

◆ LSM303AGR_AD_OFFSET_X_REG_H_M

#define LSM303AGR_AD_OFFSET_X_REG_H_M   0x46

Definition at line 157 of file lsm303agr.h.

◆ LSM303AGR_AD_OFFSET_Y_REG_L_M

#define LSM303AGR_AD_OFFSET_Y_REG_L_M   0x47

Definition at line 158 of file lsm303agr.h.

◆ LSM303AGR_AD_OFFSET_Y_REG_H_M

#define LSM303AGR_AD_OFFSET_Y_REG_H_M   0x48

Definition at line 159 of file lsm303agr.h.

◆ LSM303AGR_AD_OFFSET_Z_REG_L_M

#define LSM303AGR_AD_OFFSET_Z_REG_L_M   0x49

Definition at line 160 of file lsm303agr.h.

◆ LSM303AGR_AD_OFFSET_Z_REG_H_M

#define LSM303AGR_AD_OFFSET_Z_REG_H_M   0x4A

Definition at line 161 of file lsm303agr.h.

◆ LSM303AGR_AD_WHO_AM_I_M

#define LSM303AGR_AD_WHO_AM_I_M   0x4F

Definition at line 162 of file lsm303agr.h.

◆ LSM303AGR_AD_CFG_REG_A_M

#define LSM303AGR_AD_CFG_REG_A_M   0x60

Definition at line 163 of file lsm303agr.h.

Referenced by lsm303agrStart(), and lsm303agrStop().

◆ LSM303AGR_AD_CFG_REG_B_M

#define LSM303AGR_AD_CFG_REG_B_M   0x61

Definition at line 164 of file lsm303agr.h.

◆ LSM303AGR_AD_CFG_REG_C_M

#define LSM303AGR_AD_CFG_REG_C_M   0x62

Definition at line 165 of file lsm303agr.h.

◆ LSM303AGR_AD_INT_CRTL_REG_M

#define LSM303AGR_AD_INT_CRTL_REG_M   0x63

Definition at line 166 of file lsm303agr.h.

◆ LSM303AGR_AD_INT_SOURCE_REG_M

#define LSM303AGR_AD_INT_SOURCE_REG_M   0x64

Definition at line 167 of file lsm303agr.h.

◆ LSM303AGR_AD_INT_THS_L_REG_M

#define LSM303AGR_AD_INT_THS_L_REG_M   0x65

Definition at line 168 of file lsm303agr.h.

◆ LSM303AGR_AD_INT_THS_H_REG_M

#define LSM303AGR_AD_INT_THS_H_REG_M   0x66

Definition at line 169 of file lsm303agr.h.

◆ LSM303AGR_AD_STATUS_REG_M

#define LSM303AGR_AD_STATUS_REG_M   0x67

Definition at line 170 of file lsm303agr.h.

◆ LSM303AGR_AD_OUTX_L_REG_M

#define LSM303AGR_AD_OUTX_L_REG_M   0x68

Definition at line 171 of file lsm303agr.h.

Referenced by comp_read_raw().

◆ LSM303AGR_AD_OUTX_H_REG_M

#define LSM303AGR_AD_OUTX_H_REG_M   0x69

Definition at line 172 of file lsm303agr.h.

◆ LSM303AGR_AD_OUTY_L_REG_M

#define LSM303AGR_AD_OUTY_L_REG_M   0x6A

Definition at line 173 of file lsm303agr.h.

◆ LSM303AGR_AD_OUTY_H_REG_M

#define LSM303AGR_AD_OUTY_H_REG_M   0x6B

Definition at line 174 of file lsm303agr.h.

◆ LSM303AGR_AD_OUTZ_L_REG_M

#define LSM303AGR_AD_OUTZ_L_REG_M   0x6C

Definition at line 175 of file lsm303agr.h.

◆ LSM303AGR_AD_OUTZ_H_REG_M

#define LSM303AGR_AD_OUTZ_H_REG_M   0x6D

Definition at line 176 of file lsm303agr.h.

◆ LSM303AGR_TEMP_CFG_REG_A_TEMP_EN0

#define LSM303AGR_TEMP_CFG_REG_A_TEMP_EN0   (1 << 0)

Definition at line 183 of file lsm303agr.h.

◆ LSM303AGR_TEMP_CFG_REG_A_TEMP_EN1

#define LSM303AGR_TEMP_CFG_REG_A_TEMP_EN1   (1 << 0)

Definition at line 184 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG1_A_XEN

#define LSM303AGR_CTRL_REG1_A_XEN   (1 << 0)

Definition at line 191 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG1_A_YEN

#define LSM303AGR_CTRL_REG1_A_YEN   (1 << 1)

Definition at line 192 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG1_A_ZEN

#define LSM303AGR_CTRL_REG1_A_ZEN   (1 << 2)

Definition at line 193 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG1_A_LPEN

#define LSM303AGR_CTRL_REG1_A_LPEN   (1 << 3)

Definition at line 194 of file lsm303agr.h.

Referenced by lsm303agrStart().

◆ LSM303AGR_CTRL_REG1_A_ODR0

#define LSM303AGR_CTRL_REG1_A_ODR0   (1 << 4)

Definition at line 195 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG1_A_ODR1

#define LSM303AGR_CTRL_REG1_A_ODR1   (1 << 5)

Definition at line 196 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG1_A_ODR2

#define LSM303AGR_CTRL_REG1_A_ODR2   (1 << 6)

Definition at line 197 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG1_A_ODR3

#define LSM303AGR_CTRL_REG1_A_ODR3   (1 << 7)

Definition at line 198 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG2_A_HPIS1

#define LSM303AGR_CTRL_REG2_A_HPIS1   (1 << 0)

Definition at line 205 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG2_A_HPIS2

#define LSM303AGR_CTRL_REG2_A_HPIS2   (1 << 1)

Definition at line 206 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG2_A_HPCLICK

#define LSM303AGR_CTRL_REG2_A_HPCLICK   (1 << 2)

Definition at line 207 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG2_A_FDS

#define LSM303AGR_CTRL_REG2_A_FDS   (1 << 3)

Definition at line 208 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG2_A_HPCF1

#define LSM303AGR_CTRL_REG2_A_HPCF1   (1 << 4)

Definition at line 209 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG2_A_HPCF2

#define LSM303AGR_CTRL_REG2_A_HPCF2   (1 << 5)

Definition at line 210 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG2_A_HPM0

#define LSM303AGR_CTRL_REG2_A_HPM0   (1 << 6)

Definition at line 211 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG2_A_HPM1

#define LSM303AGR_CTRL_REG2_A_HPM1   (1 << 7)

Definition at line 212 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG3_A_I1_OVERRUN

#define LSM303AGR_CTRL_REG3_A_I1_OVERRUN   (1 << 1)

Definition at line 219 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG3_A_I1_WTM

#define LSM303AGR_CTRL_REG3_A_I1_WTM   (1 << 2)

Definition at line 220 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG3_A_I1_DRDY2

#define LSM303AGR_CTRL_REG3_A_I1_DRDY2   (1 << 3)

Definition at line 221 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG3_A_I1_DRDY1

#define LSM303AGR_CTRL_REG3_A_I1_DRDY1   (1 << 4)

Definition at line 222 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG3_A_I1_AOI2

#define LSM303AGR_CTRL_REG3_A_I1_AOI2   (1 << 5)

Definition at line 223 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG3_A_I1_AOI1

#define LSM303AGR_CTRL_REG3_A_I1_AOI1   (1 << 6)

Definition at line 224 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG3_A_I1_CLICK

#define LSM303AGR_CTRL_REG3_A_I1_CLICK   (1 << 7)

Definition at line 225 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG4_A_SPI_ENABLE

#define LSM303AGR_CTRL_REG4_A_SPI_ENABLE   (1 << 0)

Definition at line 232 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG4_A_ST0

#define LSM303AGR_CTRL_REG4_A_ST0   (1 << 1)

Definition at line 233 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG4_A_ST1

#define LSM303AGR_CTRL_REG4_A_ST1   (1 << 2)

Definition at line 234 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG4_A_HR

#define LSM303AGR_CTRL_REG4_A_HR   (1 << 3)

Definition at line 235 of file lsm303agr.h.

Referenced by lsm303agrStart().

◆ LSM303AGR_CTRL_REG4_A_FS_MASK

#define LSM303AGR_CTRL_REG4_A_FS_MASK   0x30

Definition at line 236 of file lsm303agr.h.

Referenced by acc_set_full_scale().

◆ LSM303AGR_CTRL_REG4_A_FS0

#define LSM303AGR_CTRL_REG4_A_FS0   (1 << 4)

Definition at line 237 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG4_A_FS1

#define LSM303AGR_CTRL_REG4_A_FS1   (1 << 5)

Definition at line 238 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG4_A_BLE

#define LSM303AGR_CTRL_REG4_A_BLE   (1 << 6)

Definition at line 239 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG4_A_BDU

#define LSM303AGR_CTRL_REG4_A_BDU   (1 << 7)

Definition at line 240 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG5_A_D4D_INT2

#define LSM303AGR_CTRL_REG5_A_D4D_INT2   (1 << 0)

Definition at line 247 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG5_A_LIR_INT2

#define LSM303AGR_CTRL_REG5_A_LIR_INT2   (1 << 1)

Definition at line 248 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG5_A_D4D_INT1

#define LSM303AGR_CTRL_REG5_A_D4D_INT1   (1 << 2)

Definition at line 249 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG5_A_LIR_INT1

#define LSM303AGR_CTRL_REG5_A_LIR_INT1   (1 << 3)

Definition at line 250 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG5_A_FIFO_EN

#define LSM303AGR_CTRL_REG5_A_FIFO_EN   (1 << 6)

Definition at line 251 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG5_A_BOOT

#define LSM303AGR_CTRL_REG5_A_BOOT   (1 << 7)

Definition at line 252 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG6_A_H_LACTIVE

#define LSM303AGR_CTRL_REG6_A_H_LACTIVE   (1 << 1)

Definition at line 259 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG6_A_P2_ACT

#define LSM303AGR_CTRL_REG6_A_P2_ACT   (1 << 3)

Definition at line 260 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG6_A_BOOT_I2

#define LSM303AGR_CTRL_REG6_A_BOOT_I2   (1 << 4)

Definition at line 261 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG6_A_I2_INT2

#define LSM303AGR_CTRL_REG6_A_I2_INT2   (1 << 5)

Definition at line 262 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG6_A_I2_INT1

#define LSM303AGR_CTRL_REG6_A_I2_INT1   (1 << 6)

Definition at line 263 of file lsm303agr.h.

◆ LSM303AGR_CTRL_REG6_A_I2_CLICKEN

#define LSM303AGR_CTRL_REG6_A_I2_CLICKEN   (1 << 7)

Definition at line 264 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_A_M_MD0

#define LSM303AGR_CFG_REG_A_M_MD0   (1 << 0)

Definition at line 271 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_A_M_MD1

#define LSM303AGR_CFG_REG_A_M_MD1   (1 << 1)

Definition at line 272 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_A_M_ODR0

#define LSM303AGR_CFG_REG_A_M_ODR0   (1 << 2)

Definition at line 273 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_A_M_ODR1

#define LSM303AGR_CFG_REG_A_M_ODR1   (1 << 3)

Definition at line 274 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_A_M_LP

#define LSM303AGR_CFG_REG_A_M_LP   (1 << 4)

Definition at line 275 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_A_M_SOFT_RST

#define LSM303AGR_CFG_REG_A_M_SOFT_RST   (1 << 5)

Definition at line 276 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_A_M_REBOOT

#define LSM303AGR_CFG_REG_A_M_REBOOT   (1 << 6)

Definition at line 277 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_A_M_COMP_TEMP_EN

#define LSM303AGR_CFG_REG_A_M_COMP_TEMP_EN   (1 << 7)

Definition at line 278 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_B_M_LPF

#define LSM303AGR_CFG_REG_B_M_LPF   (1 << 0)

Definition at line 285 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_B_M_OFF_CANC

#define LSM303AGR_CFG_REG_B_M_OFF_CANC   (1 << 1)

Definition at line 286 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_B_M_SET_FREQ

#define LSM303AGR_CFG_REG_B_M_SET_FREQ   (1 << 2)

Definition at line 287 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_B_M_INT_ON

#define LSM303AGR_CFG_REG_B_M_INT_ON   (1 << 3)

Definition at line 288 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_B_M_OFF_CANC_OS

#define LSM303AGR_CFG_REG_B_M_OFF_CANC_OS   (1 << 4)

Definition at line 289 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_C_M_INT_MAG

#define LSM303AGR_CFG_REG_C_M_INT_MAG   (1 << 0)

Definition at line 296 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_C_M_SELF_TEST

#define LSM303AGR_CFG_REG_C_M_SELF_TEST   (1 << 1)

Definition at line 297 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_C_M_BLE

#define LSM303AGR_CFG_REG_C_M_BLE   (1 << 3)

Definition at line 298 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_C_M_BDU

#define LSM303AGR_CFG_REG_C_M_BDU   (1 << 4)

Definition at line 299 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_C_M_I2C_DIS

#define LSM303AGR_CFG_REG_C_M_I2C_DIS   (1 << 5)

Definition at line 300 of file lsm303agr.h.

◆ LSM303AGR_CFG_REG_C_M_INT_MAG_PIN

#define LSM303AGR_CFG_REG_C_M_INT_MAG_PIN   (1 << 6)

Definition at line 301 of file lsm303agr.h.

◆ LSM303AGR_USE_SPI

#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.

◆ LSM303AGR_SHARED_SPI

#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.

◆ LSM303AGR_USE_I2C

#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.

◆ LSM303AGR_SHARED_I2C

#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.

◆ LSM303AGR_USE_ADVANCED

#define LSM303AGR_USE_ADVANCED   FALSE

LSM303AGR advanced configurations switch.

If set to TRUE more configurations are available.

Note
The default is FALSE.

Definition at line 356 of file lsm303agr.h.

◆ _lsm303agr_methods_alone

#define _lsm303agr_methods_alone
Value:
/* Change full scale value of LSM303AGR accelerometer subsystem.*/ \
static msg_t acc_set_full_scale(ADXL355Driver *devp, adxl355_acc_fs_t fs)
Changes the ADXL355Driver accelerometer fullscale value.
Definition adxl355.c:301
lsm303agr_acc_fs_t
LSM303AGR accelerometer subsystem full scale.
Definition lsm303agr.h:407
LSM303AGR 6-axis accelerometer/compass class.
Definition lsm303agr.h:634

LSM303AGR specific methods.

Definition at line 584 of file lsm303agr.h.

◆ _lsm303agr_methods

#define _lsm303agr_methods
Value:
_base_object_methods \
_lsm303agr_methods_alone

LSM303AGR specific methods with inherited ones.

Definition at line 592 of file lsm303agr.h.

◆ _lsm303agr_data

#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 _base_sensor_data
BaseSensor specific data.
Definition ex_sensors.h:74
lsm303agr_state_t
Driver state machine possible states.
Definition lsm303agr.h:509
#define LSM303AGR_ACC_NUMBER_OF_AXES
LSM303AGR accelerometer subsystem characteristics.
Definition lsm303agr.h:72
#define LSM303AGR_COMP_NUMBER_OF_AXES
LSM303AGR compass subsystem characteristics.
Definition lsm303agr.h:94
LSM303AGR configuration structure.
Definition lsm303agr.h:518

LSM303AGRDriver specific data.

Definition at line 608 of file lsm303agr.h.

◆ lsm303agrAccelerometerGetAxesNumber

#define lsm303agrAccelerometerGetAxesNumber ( devp)
Value:
accelerometerGetAxesNumber(&((devp)->acc_if))
#define accelerometerGetAxesNumber(ip)
Accelerometer get axes number.

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 658 of file lsm303agr.h.

◆ lsm303agrAccelerometerReadRaw

#define lsm303agrAccelerometerReadRaw ( devp,
axes )
Value:
accelerometerReadRaw(&((devp)->acc_if), axes)
#define accelerometerReadRaw(ip, dp)
Accelerometer read raw data.

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 679 of file lsm303agr.h.

◆ lsm303agrAccelerometerReadCooked

#define lsm303agrAccelerometerReadCooked ( devp,
axes )
Value:
accelerometerReadCooked(&((devp)->acc_if), axes)
#define accelerometerReadCooked(ip, dp)
Accelerometer read cooked data.

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 701 of file lsm303agr.h.

◆ lsm303agrAccelerometerSetBias

#define lsm303agrAccelerometerSetBias ( devp,
bp )
Value:
accelerometerSetBias(&((devp)->acc_if), bp)
#define accelerometerSetBias(ip, bp)
Updates accelerometer bias data from received buffer.

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 718 of file lsm303agr.h.

◆ lsm303agrAccelerometerResetBias

#define lsm303agrAccelerometerResetBias ( devp)
Value:
accelerometerResetBias(&((devp)->acc_if))
#define accelerometerResetBias(ip)
Reset accelerometer bias data restoring it to zero.

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 733 of file lsm303agr.h.

◆ lsm303agrAccelerometerSetSensitivity

#define lsm303agrAccelerometerSetSensitivity ( devp,
sp )
Value:
accelerometerSetSensitivity(&((devp)->acc_if), sp)
#define accelerometerSetSensitivity(ip, sp)
Updates accelerometer sensitivity data from received buffer.

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 750 of file lsm303agr.h.

◆ lsm303agrAccelerometerResetSensitivity

#define lsm303agrAccelerometerResetSensitivity ( devp)
Value:
accelerometerResetSensitivity(&((devp)->acc_if))
#define accelerometerResetSensitivity(ip)
Reset accelerometer sensitivity data restoring it to its typical value.

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 765 of file lsm303agr.h.

◆ lsm303agrAccelerometerSetFullScale

#define lsm303agrAccelerometerSetFullScale ( devp,
fs )
Value:
(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 783 of file lsm303agr.h.

◆ lsm303agrCompassGetAxesNumber

#define lsm303agrCompassGetAxesNumber ( devp)
Value:
compassGetAxesNumber(&((devp)->comp_if))
#define compassGetAxesNumber(ip)
Compass get axes number.
Definition ex_compass.h:107

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 795 of file lsm303agr.h.

◆ lsm303agrCompassReadRaw

#define lsm303agrCompassReadRaw ( devp,
axes )
Value:
compassReadRaw(&((devp)->comp_if), axes)
#define compassReadRaw(ip, dp)
Compass read raw data.
Definition ex_compass.h:122

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 816 of file lsm303agr.h.

◆ lsm303agrCompassReadCooked

#define lsm303agrCompassReadCooked ( devp,
axes )
Value:
compassReadCooked(&((devp)->comp_if), axes)
#define compassReadCooked(ip, dp)
Compass read cooked data.
Definition ex_compass.h:137

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 838 of file lsm303agr.h.

◆ lsm303agrCompassSetBias

#define lsm303agrCompassSetBias ( devp,
bp )
Value:
compassSetBias(&((devp)->comp_if), bp)
#define compassSetBias(ip, bp)
Updates compass bias data from received buffer.
Definition ex_compass.h:154

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 855 of file lsm303agr.h.

◆ lsm303agrCompassResetBias

#define lsm303agrCompassResetBias ( devp)
Value:
compassResetBias(&((devp)->comp_if))
#define compassResetBias(ip)
Reset compass bias data restoring it to zero.
Definition ex_compass.h:168

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 870 of file lsm303agr.h.

◆ lsm303agrCompassSetSensitivity

#define lsm303agrCompassSetSensitivity ( devp,
sp )
Value:
compassSetSensitivity(&((devp)->comp_if), sp)
#define compassSetSensitivity(ip, sp)
Updates compass sensitivity data from received buffer.
Definition ex_compass.h:185

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 887 of file lsm303agr.h.

◆ lsm303agrCompassResetSensitivity

#define lsm303agrCompassResetSensitivity ( devp)
Value:
compassResetSensitivity(&((devp)->comp_if))
#define compassResetSensitivity(ip)
Reset compass sensitivity data restoring it to its typical value.
Definition ex_compass.h:200

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 902 of file lsm303agr.h.

Typedef Documentation

◆ LSM303AGRDriver

typedef struct LSM303AGRDriver LSM303AGRDriver

Structure representing a LSM303AGR driver.

Definition at line 402 of file lsm303agr.h.

Enumeration Type Documentation

◆ lsm303agr_sad_t

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_acc_fs_t

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 407 of file lsm303agr.h.

◆ lsm303agr_acc_odr_t

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 417 of file lsm303agr.h.

◆ lsm303agr_acc_ae_t

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 433 of file lsm303agr.h.

◆ lsm303agr_acc_mode_t

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 447 of file lsm303agr.h.

◆ lsm303agr_acc_bdu_t

LSM303AGR accelerometer subsystem block data update.

Enumerator
LSM303AGR_ACC_BDU_CONT 

Continuous update

LSM303AGR_ACC_BDU_BLOCK 

Update blocked

Definition at line 456 of file lsm303agr.h.

◆ lsm303agr_acc_end_t

LSM303AGR accelerometer endianness.

Enumerator
LSM303AGR_ACC_END_LITTLE 

Little Endian

LSM303AGR_ACC_END_BIG 

Big Endian

Definition at line 464 of file lsm303agr.h.

◆ lsm303agr_comp_odr_t

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 477 of file lsm303agr.h.

◆ lsm303agr_comp_mode_t

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 487 of file lsm303agr.h.

◆ lsm303agr_comp_lpow_t

LSM303AGR compass subsystem working mode.

Enumerator
LSM303AGR_COMP_LPOW_DIS 

High Resolution Mode

LSM303AGR_COMP_LPOW_EN 

Low Power Mode

Definition at line 496 of file lsm303agr.h.

◆ lsm303agr_state_t

Driver state machine possible states.

Enumerator
LSM303AGR_UNINIT 

Not initialized.

LSM303AGR_STOP 

Stopped.

LSM303AGR_READY 

Ready.

Definition at line 509 of file lsm303agr.h.

Function Documentation

◆ lsm303agrI2CReadRegister()

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 LSM303AGR_MS.

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

◆ lsm303agrI2CWriteRegister()

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 LSM303AGR_MS.

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

◆ acc_get_axes_number()

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.

◆ acc_read_raw()

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 LSM303AGR_ACC_NUMBER_OF_AXES, LSM303AGR_AD_OUT_X_L_A, LSM303AGR_READY, LSM303AGR_SAD_ACC, and lsm303agrI2CReadRegister().

Referenced by acc_read_cooked().

Here is the call graph for this function:

◆ acc_read_cooked()

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, and LSM303AGR_READY.

Here is the call graph for this function:

◆ acc_set_bias()

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, and LSM303AGR_READY.

◆ acc_reset_bias()

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_BIAS, LSM303AGR_ACC_NUMBER_OF_AXES, and LSM303AGR_READY.

◆ acc_set_sensivity()

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, and LSM303AGR_READY.

◆ acc_reset_sensivity()

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 LSM303AGR_ACC_FS_16G, LSM303AGR_ACC_FS_2G, LSM303AGR_ACC_FS_4G, LSM303AGR_ACC_FS_8G, LSM303AGR_ACC_NUMBER_OF_AXES, LSM303AGR_ACC_SENS_16G, LSM303AGR_ACC_SENS_2G, LSM303AGR_ACC_SENS_4G, LSM303AGR_ACC_SENS_8G, and LSM303AGR_READY.

◆ acc_set_full_scale()

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 LSM303AGR_ACC_16G, LSM303AGR_ACC_2G, LSM303AGR_ACC_4G, LSM303AGR_ACC_8G, LSM303AGR_ACC_FS_16G, LSM303AGR_ACC_FS_2G, LSM303AGR_ACC_FS_4G, LSM303AGR_ACC_FS_8G, LSM303AGR_ACC_NUMBER_OF_AXES, LSM303AGR_AD_CTRL_REG4_A, LSM303AGR_CTRL_REG4_A_FS_MASK, LSM303AGR_READY, LSM303AGR_SAD_ACC, lsm303agrI2CReadRegister(), and lsm303agrI2CWriteRegister().

Here is the call graph for this function:

◆ comp_get_axes_number()

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 448 of file lsm303agr.c.

References LSM303AGR_COMP_NUMBER_OF_AXES.

◆ comp_read_raw()

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 470 of file lsm303agr.c.

References LSM303AGR_AD_OUTX_L_REG_M, LSM303AGR_COMP_NUMBER_OF_AXES, LSM303AGR_READY, LSM303AGR_SAD_COMP, and lsm303agrI2CReadRegister().

Referenced by comp_read_cooked().

Here is the call graph for this function:

◆ comp_read_cooked()

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 524 of file lsm303agr.c.

References comp_read_raw(), LSM303AGR_COMP_NUMBER_OF_AXES, and LSM303AGR_READY.

Here is the call graph for this function:

◆ comp_set_bias()

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 558 of file lsm303agr.c.

References LSM303AGR_COMP_NUMBER_OF_AXES, and LSM303AGR_READY.

◆ comp_reset_bias()

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 587 of file lsm303agr.c.

References LSM303AGR_COMP_BIAS, LSM303AGR_COMP_NUMBER_OF_AXES, and LSM303AGR_READY.

◆ comp_set_sensivity()

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 617 of file lsm303agr.c.

References LSM303AGR_COMP_NUMBER_OF_AXES, and LSM303AGR_READY.

◆ comp_reset_sensivity()

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 646 of file lsm303agr.c.

References LSM303AGR_COMP_NUMBER_OF_AXES, LSM303AGR_COMP_SENS_50GA, and LSM303AGR_READY.

◆ lsm303agrObjectInit()

void lsm303agrObjectInit ( LSM303AGRDriver * devp)

Initializes an instance.

Parameters
[out]devppointer to the LSM303AGRDriver object
Function Class:
Object or module nitializer function.

Definition at line 693 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, LSM303AGRDriver::vmt, vmt_accelerometer, vmt_compass, and vmt_device.

◆ lsm303agrStart()

◆ lsm303agrStop()

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 876 of file lsm303agr.c.

References LSM303AGR_ACC_AE_DISABLED, LSM303AGR_ACC_ODR_PD, LSM303AGR_AD_CFG_REG_A_M, LSM303AGR_AD_CTRL_REG1_A, LSM303AGR_COMP_MODE_IDLE, LSM303AGR_READY, LSM303AGR_SAD_ACC, LSM303AGR_SAD_COMP, LSM303AGR_STOP, and lsm303agrI2CWriteRegister().

Here is the call graph for this function:

Variable Documentation

◆ vmt_device

const struct LSM303AGRVMT vmt_device
static
Initial value:
= {
(size_t)0,
}

Definition at line 665 of file lsm303agr.c.

◆ vmt_accelerometer

const struct BaseAccelerometerVMT vmt_accelerometer
static
Initial value:
= {
sizeof(struct LSM303AGRVMT*),
}
static size_t acc_get_axes_number(void *ip)
Return the number of axes of the BaseAccelerometer.
Definition adxl317.c:115
static msg_t acc_reset_sensivity(void *ip)
Reset sensitivity values for the BaseAccelerometer.
Definition adxl317.c:310
static msg_t acc_set_bias(void *ip, float *bp)
Set bias values for the BaseAccelerometer.
Definition adxl317.c:222
static msg_t acc_reset_bias(void *ip)
Reset bias values for the BaseAccelerometer.
Definition adxl317.c:251
static msg_t acc_set_sensivity(void *ip, float *sp)
Set sensitivity values for the BaseAccelerometer.
Definition adxl317.c:281
static msg_t acc_read_cooked(void *ip, float axes[])
Retrieves cooked data from the BaseAccelerometer.
Definition adxl317.c:185
static msg_t acc_read_raw(void *ip, int32_t axes[])
Retrieves raw data from the BaseAccelerometer.
Definition adxl317.c:137
LSM303AGR virtual methods table.
Definition lsm303agr.h:601

Definition at line 670 of file lsm303agr.c.

◆ vmt_compass

const struct BaseCompassVMT vmt_compass
static
Initial value:
= {
sizeof(struct LSM303AGRVMT*) + sizeof(BaseAccelerometer),
}
static size_t comp_get_axes_number(void *ip)
Return the number of axes of the BaseCompass.
Definition lis3mdl.c:102
static msg_t comp_set_sensivity(void *ip, float *sp)
Set sensitivity values for the BaseCompass.
Definition lis3mdl.c:271
static msg_t comp_reset_bias(void *ip)
Reset bias values for the BaseCompass.
Definition lis3mdl.c:241
static msg_t comp_set_bias(void *ip, float *bp)
Set bias values for the BaseCompass.
Definition lis3mdl.c:212
static msg_t comp_reset_sensivity(void *ip)
Reset sensitivity values for the BaseCompass.
Definition lis3mdl.c:300
static msg_t comp_read_cooked(void *ip, float axes[])
Retrieves cooked data from the BaseCompass.
Definition lis3mdl.c:178
static msg_t comp_read_raw(void *ip, int32_t axes[])
Retrieves raw data from the BaseCompass.
Definition lis3mdl.c:124
Base accelerometer class.

Definition at line 676 of file lsm303agr.c.