Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for the accelerometer ADXL345 from Analog Devices using I2C. More...
#include "std.h"
#include "math/pprz_algebra_int.h"
#include "mcu_periph/i2c.h"
#include "peripherals/adxl345.h"
Go to the source code of this file.
Data Structures | |
struct | Adxl345_I2c |
union | Adxl345_I2c.data |
Functions | |
void | adxl345_i2c_init (struct Adxl345_I2c *adxl, struct i2c_periph *i2c_p, uint8_t addr) |
void | adxl345_i2c_start_configure (struct Adxl345_I2c *adxl) |
Start configuration if not already done. More... | |
void | adxl345_i2c_read (struct Adxl345_I2c *adxl) |
void | adxl345_i2c_event (struct Adxl345_I2c *adxl) |
static void | adxl345_i2c_periodic (struct Adxl345_I2c *adxl) |
convenience function: read or start configuration if not already initialized More... | |
Driver for the accelerometer ADXL345 from Analog Devices using I2C.
Definition in file adxl345_i2c.h.
struct Adxl345_I2c |
Definition at line 39 of file adxl345_i2c.h.
Data Fields | ||
---|---|---|
struct Adxl345Config | config | |
union Adxl345_I2c | data | |
volatile bool | data_available | data ready flag |
struct i2c_periph * | i2c_p | |
struct i2c_transaction | i2c_trans | |
enum Adxl345ConfStatus | init_status | init status |
bool | initialized | config done flag |
union Adxl345_I2c.data |
Definition at line 45 of file adxl345_i2c.h.
Data Fields | ||
---|---|---|
int16_t | value[3] | data values accessible by channel index |
struct Int16Vect3 | vect | data vector in accel coordinate system |
void adxl345_i2c_event | ( | struct Adxl345_I2c * | adxl | ) |
Definition at line 114 of file adxl345_i2c.c.
References adxl345_i2c_send_config(), ADXL_CONF_UNINIT, i2c_transaction::buf, Adxl345_I2c::data, Adxl345_I2c::data_available, Adxl345_I2c::i2c_trans, I2CTransDone, I2CTransFailed, I2CTransSuccess, Adxl345_I2c::init_status, Adxl345_I2c::initialized, Int16FromBuf, and i2c_transaction::status.
Referenced by imu_aspirin_i2c_event().
void adxl345_i2c_init | ( | struct Adxl345_I2c * | adxl, |
struct i2c_periph * | i2c_p, | ||
uint8_t | addr | ||
) |
Definition at line 36 of file adxl345_i2c.c.
References adxl345_set_default_config(), ADXL_CONF_UNINIT, Adxl345_I2c::config, Adxl345_I2c::i2c_p, Adxl345_I2c::i2c_trans, I2CTransDone, Adxl345_I2c::init_status, Adxl345_I2c::initialized, i2c_transaction::slave_addr, and i2c_transaction::status.
Referenced by imu_aspirin_i2c_init().
|
inlinestatic |
convenience function: read or start configuration if not already initialized
Definition at line 59 of file adxl345_i2c.h.
References adxl345_i2c_read(), adxl345_i2c_start_configure(), and Adxl345_I2c::initialized.
Referenced by imu_aspirin_i2c_periodic().
void adxl345_i2c_read | ( | struct Adxl345_I2c * | adxl | ) |
Definition at line 101 of file adxl345_i2c.c.
References ADXL345_REG_DATA_X0, i2c_transaction::buf, Adxl345_I2c::i2c_p, i2c_submit(), Adxl345_I2c::i2c_trans, I2CTransDone, I2CTransTxRx, Adxl345_I2c::initialized, i2c_transaction::len_r, i2c_transaction::len_w, i2c_transaction::status, and i2c_transaction::type.
Referenced by adxl345_i2c_periodic().
void adxl345_i2c_start_configure | ( | struct Adxl345_I2c * | adxl | ) |
Start configuration if not already done.
Definition at line 90 of file adxl345_i2c.c.
References adxl345_i2c_send_config(), ADXL_CONF_UNINIT, Adxl345_I2c::i2c_trans, I2CTransDone, I2CTransSuccess, Adxl345_I2c::init_status, and i2c_transaction::status.
Referenced by adxl345_i2c_periodic().