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]))
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.
transaction successfully finished by I2C driver
bool drdy_int_enable
Enable Data Ready Interrupt.
enum Adxl345Rates rate
Data Output Rate.
transmit and receive transaction
void adxl345_i2c_start_configure(struct Adxl345_I2c *adxl)
Start configuration if not already done.
struct i2c_transaction i2c_trans
bool initialized
config done flag
#define ADXL345_REG_INT_ENABLE
enum Adxl345ConfStatus init_status
init status
uint8_t len_w
Number of bytes to write/transmit.
#define ADXL345_REG_BW_RATE
transaction set to done by user level
struct Adxl345Config config
void adxl345_i2c_event(struct Adxl345_I2c *adxl)
void adxl345_i2c_read(struct Adxl345_I2c *adxl)
bool i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
i2c_submit() function
static void adxl345_i2c_send_config(struct Adxl345_I2c *adxl)
#define ADXL345_REG_DATA_FORMAT
static void adxl345_i2c_tx_reg(struct Adxl345_I2c *adxl, uint8_t reg, uint8_t val)
void adxl345_i2c_init(struct Adxl345_I2c *adxl, struct i2c_periph *i2c_p, uint8_t addr)
enum I2CTransactionStatus status
Transaction status.
#define Int16FromBuf(_buf, _idx)
union Adxl345_I2c::@293 data
uint8_t slave_addr
Slave address.
struct i2c_periph * i2c_p
I2C peripheral structure.
static void adxl345_set_default_config(struct Adxl345Config *c)
transmit only transaction
#define ADXL345_REG_POWER_CTL
#define ADXL345_DATA_FORMAT
enum I2CTransactionType type
Transaction type.
Driver for the accelerometer ADXL345 from Analog Devices using I2C.
#define ADXL345_REG_DATA_X0
volatile bool data_available
data ready flag