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_t initialized
config done flag
bool_t i2c_submit(struct i2c_periph *p, struct i2c_transaction *t)
Submit a I2C transaction.
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
enum Adxl345Rates rate
Data Output Rate.
transmit and receive transaction
bool_t drdy_int_enable
Enable Data Ready Interrupt.
void adxl345_i2c_start_configure(struct Adxl345_I2c *adxl)
Start configuration if not already done.
struct i2c_transaction i2c_trans
#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)
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)
uint8_t slave_addr
Slave address.
struct i2c_periph * i2c_p
volatile bool_t data_available
data ready flag
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
union Adxl345_I2c::@24 data