124 #define Int16FromBuf(_buf,_idx) ((int16_t)((_buf[_idx]<<8) | _buf[_idx+1]))
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
void itg3200_init(struct Itg3200 *itg, struct i2c_periph *i2c_p, uint8_t addr)
Initialize Itg3200 struct and set default config options.
void itg3200_start_configure(struct Itg3200 *itg)
static void itg3200_i2c_tx_reg(struct Itg3200 *itg, uint8_t reg, uint8_t val)
void itg3200_event(struct Itg3200 *itg)
#define Int16FromBuf(_buf, _idx)
void itg3200_set_default_config(struct Itg3200Config *c)
void itg3200_read(struct Itg3200 *itg)
static void itg3200_send_config(struct Itg3200 *itg)
Driver for the gyro ITG3200 from InvenSense.
enum Itg3200ConfStatus init_status
init status
enum Itg3200DLPF dlpf_cfg
Digital Low Pass Filter.
struct i2c_transaction i2c_trans
#define ITG3200_DEFAULT_INT_CFG
Default interrupt config: RAW_RDY_EN.
#define ITG3200_DEFAULT_FS_SEL
Default full scale range +- 2000°/s.
uint8_t smplrt_div
Sample rate divider.
#define ITG3200_DEFAULT_SMPLRT_DIV
Default sample rate divider.
#define ITG3200_DEFAULT_CLK_SEL
Default clock: PLL with X gyro reference.
uint8_t int_cfg
Interrupt config.
#define ITG3200_DEFAULT_DLPF_CFG
Default internal sampling (1kHz, 42Hz LP Bandwidth)
bool initialized
config done flag
uint8_t fs_sel
Full scale range.
uint8_t clk_sel
Clock select.
struct i2c_periph * i2c_p
struct Itg3200Config config
volatile bool data_available
data ready flag
#define ITG3200_REG_INT_CFG
#define ITG3200_REG_DLPF_FS
#define ITG3200_REG_PWR_MGM
#define ITG3200_REG_SMPLRT_DIV
#define ITG3200_REG_INT_STATUS
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.