33 #define ADXL345_DATA_FORMAT ((adxl->config.int_invert<<5)|(adxl->config.full_res<<3)|(adxl->config.justify_msb<<2)|(adxl->config.range))
112 #define Int16FromBuf(_buf,_idx) ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx]))
bool drdy_int_enable
Enable Data Ready Interrupt.
enum Adxl345Rates rate
Data Output Rate.
static void adxl345_set_default_config(struct Adxl345Config *c)
void adxl345_i2c_start_configure(struct Adxl345_I2c *adxl)
Start configuration if not already done.
void adxl345_i2c_read(struct Adxl345_I2c *adxl)
static void adxl345_i2c_tx_reg(struct Adxl345_I2c *adxl, uint8_t reg, uint8_t val)
#define ADXL345_DATA_FORMAT
static void adxl345_i2c_send_config(struct Adxl345_I2c *adxl)
void adxl345_i2c_init(struct Adxl345_I2c *adxl, struct i2c_periph *i2c_p, uint8_t addr)
void adxl345_i2c_event(struct Adxl345_I2c *adxl)
#define Int16FromBuf(_buf, _idx)
Driver for the accelerometer ADXL345 from Analog Devices using I2C.
struct Adxl345Config config
volatile bool data_available
data ready flag
bool initialized
config done flag
struct i2c_periph * i2c_p
enum Adxl345ConfStatus init_status
init status
union Adxl345_I2c::@308 data
struct i2c_transaction i2c_trans
#define ADXL345_REG_DATA_X0
#define ADXL345_REG_BW_RATE
#define ADXL345_REG_DATA_FORMAT
#define ADXL345_REG_POWER_CTL
#define ADXL345_REG_INT_ENABLE
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
uint16_t len_r
Number of bytes to read/receive.
enum I2CTransactionType type
Transaction type.
enum I2CTransactionStatus status
Transaction status.
uint8_t slave_addr
Slave address.
uint8_t len_w
Number of bytes to write/transmit.
static bool i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
Submit a I2C transaction.
@ I2CTransSuccess
transaction successfully finished by I2C driver
@ I2CTransFailed
transaction failed
@ I2CTransDone
transaction set to done by user level
@ I2CTransTx
transmit only transaction
@ I2CTransTxRx
transmit and receive transaction
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.