14 #ifndef DRV_I2C_lsm303Agr_H_
15 #define DRV_I2C_lsm303Agr_H_
35 #define LSM303AGR_ACC_PM_LOW_8BIT 0x1
36 #define LSM303AGR_ACC_PM_NORM_10BIT 0x0
37 #define LSM303AGR_ACC_PM_HIGH_12BIT 0x2
40 #define LSM303AGR_ACC_RATE_POWERDOWN 0x00
41 #define LSM303AGR_ACC_RATE_1HZ 0x01
42 #define LSM303AGR_ACC_RATE_10HZ 0x02
43 #define LSM303AGR_ACC_RATE_25HZ 0x03
44 #define LSM303AGR_ACC_RATE_50HZ 0x04
45 #define LSM303AGR_ACC_RATE_100HZ 0x05
46 #define LSM303AGR_ACC_RATE_200HZ 0x06
47 #define LSM303AGR_ACC_RATE_400HZ 0x07
48 #define LSM303AGR_ACC_RATE_LP_1620HZ 0x08
49 #define LSM303AGR_ACC_RATE_1344_LP5376HZ 0x09
51 #define LSM303AGR_ACC_FS_2G 0x00
52 #define LSM303AGR_ACC_FS_4G 0x01
53 #define LSM303AGR_ACC_FS_8G 0x02
54 #define LSM303AGR_ACC_FS_16G 0x03
57 #define LSM303AGR_MAG_RATE_10HZ 0x00
58 #define LSM303AGR_MAG_RATE_20HZ 0x01
59 #define LSM303AGR_MAG_RATE_50HZ 0x02
60 #define LSM303AGR_MAG_RATE_100HZ 0x03
62 #define LSM303AGR_MAG_MODE_CONTINUOUS 0x00
63 #define LSM303AGR_MAG_MODE_SINGLE 0x01
64 #define LSM303AGR_MAG_MODE_IDLE 0x02
79 #define LSM303AGR_ACC_HPCF_AGRESSIVE 0x0
80 #define LSM303AGR_ACC_HPCF_STRONG 0x1
81 #define LSM303AGR_ACC_HPCF_MEDIUM 0x2
82 #define LSM303AGR_ACC_HPCF_LIGHT 0x3
101 #define LSM303AGR_MAG_CFG_DEFAULT {\
102 .mode = LSM303AGR_MAG_MODE_CONTINUOUS, \
103 .rate = LSM303AGR_MAG_RATE_10HZ, \
104 .tempCompEn = false, \
127 #define LSM303AGR_ACC_CFG_DEFAULT {\
128 .rate = LSM303AGR_ACC_RATE_POWERDOWN, \
129 .hpcf = LSM303AGR_ACC_HPCF_AGRESSIVE, \
130 .fs = LSM303AGR_ACC_FS_2G, \
131 .pm = LSM303AGR_ACC_PM_NORM_10BIT, \
179 bool lsm303AgrHasTemp(
I2C_Device * dev,
bool * hasData);
Axis structure for 3D information.
bool tempCompEn
Temperature compensation enabled.
Accelerator configuration structure.
bool lsm303AgrAccCfg(I2C_Device *dev, Lsm303AgrAccCfg config)
Set the accelerometer configuration.
uint16_t hpcf
High-pass filter, one of LSM303AG_ACC_HPCF_*.
struct Lsm303AgrAccCfg_ Lsm303AgrAccCfg
Accelerator configuration structure.
bool lsm303AgrAccRead(I2C_Device *dev, Lsm303Axis *result)
Read the accelerometer information.
Structure defines OpenCores I2C Device.
uint16_t mode
one of LSM303AGR_MAG_MODE_*
bool lsm303AgrMagCfg(I2C_Device *dev, Lsm303AgrMagCfg config)
Set the Magnet configuration.
bool lsm303AgrValid(I2C_Device *dev, bool *isLSM303Agr)
Checks whether or not the lsm303Agr is valid.
struct Lsm303AgrMagCfg_ Lsm303AgrMagCfg
Magnet configuration.
bool lsm303AgrTempRead(I2C_Device *dev, int16_t *result)
Reads the temperature.
bool offCanc
Offset cancellation.
uint16_t rate
One of LSM303AGR_MAG_RATE_*.
uint16_t rate
Accelerometer rate , one of LSM303AG_ACC_RATE_*.
bool temp
Temperature sensor enable.
bool bdu
Block data update.
bool lpf
Enable low-pass filter.
uint16_t fs
Full scale of accelerometer, one of LSM303AGR_ACC_FS_*.
bool fds
Filter data selection.
bool bdu
Block date update enable.
bool lsm303AgrMagRead(I2C_Device *dev, Lsm303Axis *result)
Read the magnet information.
OpenCores I2C device driver.