Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for the gyro ITG3200 from InvenSense. More...
#include "std.h"
#include "math/pprz_algebra_int.h"
#include "mcu_periph/i2c.h"
#include "peripherals/itg3200_regs.h"
Go to the source code of this file.
Data Structures | |
struct | Itg3200Config |
struct | Itg3200 |
union | Itg3200.data |
Macros | |
#define | ITG3200_DEFAULT_SMPLRT_DIV 0 |
Default sample rate divider. More... | |
#define | ITG3200_DEFAULT_FS_SEL 3 |
Default full scale range +- 2000°/s. More... | |
#define | ITG3200_DEFAULT_DLPF_CFG ITG3200_DLPF_42HZ |
Default internal sampling (1kHz, 42Hz LP Bandwidth) More... | |
#define | ITG3200_DEFAULT_INT_CFG 1 |
Default interrupt config: RAW_RDY_EN. More... | |
#define | ITG3200_DEFAULT_CLK_SEL 1 |
Default clock: PLL with X gyro reference. More... | |
Enumerations | |
enum | Itg3200ConfStatus { ITG_CONF_UNINIT , ITG_CONF_SD , ITG_CONF_DF , ITG_CONF_INT , ITG_CONF_PWR , ITG_CONF_DONE } |
config status states More... | |
Functions | |
void | itg3200_init (struct Itg3200 *itg, struct i2c_periph *i2c_p, uint8_t i2c_address) |
Initialize Itg3200 struct and set default config options. More... | |
void | itg3200_set_default_config (struct Itg3200Config *conf) |
void | itg3200_start_configure (struct Itg3200 *itg) |
void | itg3200_read (struct Itg3200 *itg) |
void | itg3200_event (struct Itg3200 *itg) |
static void | itg3200_periodic (struct Itg3200 *itg) |
convenience function: read or start configuration if not already initialized More... | |
Driver for the gyro ITG3200 from InvenSense.
Definition in file itg3200.h.
struct Itg3200Config |
struct Itg3200 |
Data Fields | ||
---|---|---|
struct Itg3200Config | config | |
union Itg3200 | data | |
volatile bool | data_available | data ready flag |
struct i2c_periph * | i2c_p | |
struct i2c_transaction | i2c_trans | |
enum Itg3200ConfStatus | init_status | init status |
bool | initialized | config done flag |
union Itg3200.data |
Data Fields | ||
---|---|---|
struct Int32Rates | rates | data as angular rates in gyro coordinate system |
int32_t | value[3] | data values accessible by channel index |
#define ITG3200_DEFAULT_CLK_SEL 1 |
#define ITG3200_DEFAULT_DLPF_CFG ITG3200_DLPF_42HZ |
#define ITG3200_DEFAULT_FS_SEL 3 |
#define ITG3200_DEFAULT_INT_CFG 1 |
#define ITG3200_DEFAULT_SMPLRT_DIV 0 |
enum Itg3200ConfStatus |
void itg3200_event | ( | struct Itg3200 * | itg | ) |
Definition at line 126 of file itg3200.c.
References i2c_transaction::buf, Itg3200::data, Itg3200::data_available, Itg3200::i2c_trans, I2CTransDone, I2CTransFailed, I2CTransSuccess, Itg3200::init_status, Itg3200::initialized, Int16FromBuf, itg3200_send_config(), ITG_CONF_UNINIT, and i2c_transaction::status.
Referenced by imu_aspirin_event(), and imu_aspirin_i2c_event().
void itg3200_init | ( | struct Itg3200 * | itg, |
struct i2c_periph * | i2c_p, | ||
uint8_t | addr | ||
) |
Initialize Itg3200 struct and set default config options.
itg | Itg3200 struct |
i2c_p | I2C periperal to use |
addr | I2C address of ITG3200 |
Definition at line 49 of file itg3200.c.
References Itg3200::config, Itg3200::i2c_p, Itg3200::i2c_trans, I2CTransDone, Itg3200::init_status, Itg3200::initialized, itg3200_set_default_config(), ITG_CONF_UNINIT, i2c_transaction::slave_addr, and i2c_transaction::status.
Referenced by imu_aspirin_i2c_init(), and imu_aspirin_init().
|
inlinestatic |
convenience function: read or start configuration if not already initialized
Definition at line 93 of file itg3200.h.
References Itg3200::initialized, itg3200_read(), and itg3200_start_configure().
Referenced by imu_aspirin_i2c_periodic(), and imu_aspirin_periodic().
void itg3200_read | ( | struct Itg3200 * | itg | ) |
Definition at line 113 of file itg3200.c.
References i2c_transaction::buf, Itg3200::i2c_p, i2c_submit(), Itg3200::i2c_trans, I2CTransDone, I2CTransTxRx, Itg3200::initialized, ITG3200_REG_INT_STATUS, i2c_transaction::len_r, i2c_transaction::len_w, i2c_transaction::status, and i2c_transaction::type.
Referenced by itg3200_periodic().
void itg3200_set_default_config | ( | struct Itg3200Config * | conf | ) |
Definition at line 33 of file itg3200.c.
References Itg3200Config::clk_sel, Itg3200Config::dlpf_cfg, Itg3200Config::fs_sel, Itg3200Config::int_cfg, ITG3200_DEFAULT_CLK_SEL, ITG3200_DEFAULT_DLPF_CFG, ITG3200_DEFAULT_FS_SEL, ITG3200_DEFAULT_INT_CFG, ITG3200_DEFAULT_SMPLRT_DIV, and Itg3200Config::smplrt_div.
Referenced by itg3200_init().
void itg3200_start_configure | ( | struct Itg3200 * | itg | ) |
Definition at line 102 of file itg3200.c.
References Itg3200::i2c_trans, I2CTransDone, I2CTransSuccess, Itg3200::init_status, itg3200_send_config(), ITG_CONF_UNINIT, and i2c_transaction::status.
Referenced by itg3200_periodic().