34 #define LIS3MDL_ADDR1 (0b0011110 << 1)
35 #define LIS3MDL_ADDR2 (0b0011100 << 1)
37 #define LIS3MDL_PERFORMANCE_LOW_POWER 0b00
38 #define LIS3MDL_PERFORMANCE_MEDIUM 0b01
39 #define LIS3MDL_PERFORMANCE_HIGH 0b10
40 #define LIS3MDL_PERFORMANCE_ULTRA_HIGH 0b11
42 #define LIS3MDL_DATA_RATE_0_625_HZ 0b000
43 #define LIS3MDL_DATA_RATE_1_25_HZ 0b001
44 #define LIS3MDL_DATA_RATE_2_5_HZ 0b010
45 #define LIS3MDL_DATA_RATE_5_HZ 0b011
46 #define LIS3MDL_DATA_RATE_10_HZ 0b100
47 #define LIS3MDL_DATA_RATE_20_HZ 0b101
48 #define LIS3MDL_DATA_RATE_40_HZ 0b110
49 #define LIS3MDL_DATA_RATE_80_HZ 0b111
51 #define LIS3MDL_MODE_CONTINUOUS 0b00
52 #define LIS3MDL_MODE_SINGLE 0b01
53 #define LIS3MDL_MODE_POWER_DOWN 0b11
55 #define LIS3MDL_SCALE_4_GAUSS 0b00
56 #define LIS3MDL_SCALE_8_GAUSS 0b01
57 #define LIS3MDL_SCALE_12_GAUSS 0b10
58 #define LIS3MDL_SCALE_16_GAUSS 0b11
static const float scale[]
I2C transaction structure.
Architecture independent I2C (Inter-Integrated Circuit Bus) API.
struct i2c_transaction i2c_trans
i2c transaction
enum Lis3mdlStatus status
init status
void lis3mdl_init(struct Lis3mdl *mag, struct i2c_periph *i2c_p, uint8_t addr, uint8_t data_rate, uint8_t scale, uint8_t mode, uint8_t perf)
void lis3mdl_read(struct Lis3mdl *mag)
bool initialized
config done flag
volatile bool data_available
data ready flag
struct i2c_periph * i2c_p
peripheral used for communcation
Lis3mdlStatus
config status states
static void lis3mdl_periodic(struct Lis3mdl *mag)
convenience function: read or start configuration if not already initialized
void lis3mdl_event(struct Lis3mdl *mag)
void lis3mdl_configure(struct Lis3mdl *mag)
Paparazzi fixed point algebra.
static uint8_t mode
mode holds the current sonar mode mode = 0 used at high altitude, uses 16 wave patterns mode = 1 used...
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.