Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
itg3200.h File Reference

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"
+ Include dependency graph for itg3200.h:
+ This graph shows which files directly or indirectly include this file:

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...
 

Detailed Description

Driver for the gyro ITG3200 from InvenSense.

Definition in file itg3200.h.


Data Structure Documentation

◆ Itg3200Config

struct Itg3200Config

Definition at line 52 of file itg3200.h.

Data Fields
uint8_t clk_sel Clock select.
enum Itg3200DLPF dlpf_cfg Digital Low Pass Filter.
uint8_t fs_sel Full scale range.
uint8_t int_cfg Interrupt config.
uint8_t smplrt_div Sample rate divider.

◆ Itg3200

struct Itg3200

Definition at line 70 of file itg3200.h.

+ Collaboration diagram for 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

◆ Itg3200.data

union Itg3200.data

Definition at line 76 of file itg3200.h.

Data Fields
struct Int32Rates rates data as angular rates in gyro coordinate system
int32_t value[3] data values accessible by channel index

Macro Definition Documentation

◆ ITG3200_DEFAULT_CLK_SEL

#define ITG3200_DEFAULT_CLK_SEL   1

Default clock: PLL with X gyro reference.

Definition at line 49 of file itg3200.h.

◆ ITG3200_DEFAULT_DLPF_CFG

#define ITG3200_DEFAULT_DLPF_CFG   ITG3200_DLPF_42HZ

Default internal sampling (1kHz, 42Hz LP Bandwidth)

Definition at line 45 of file itg3200.h.

◆ ITG3200_DEFAULT_FS_SEL

#define ITG3200_DEFAULT_FS_SEL   3

Default full scale range +- 2000°/s.

Definition at line 43 of file itg3200.h.

◆ ITG3200_DEFAULT_INT_CFG

#define ITG3200_DEFAULT_INT_CFG   1

Default interrupt config: RAW_RDY_EN.

Definition at line 47 of file itg3200.h.

◆ ITG3200_DEFAULT_SMPLRT_DIV

#define ITG3200_DEFAULT_SMPLRT_DIV   0

Default sample rate divider.

Definition at line 41 of file itg3200.h.

Enumeration Type Documentation

◆ Itg3200ConfStatus

config status states

Enumerator
ITG_CONF_UNINIT 
ITG_CONF_SD 
ITG_CONF_DF 
ITG_CONF_INT 
ITG_CONF_PWR 
ITG_CONF_DONE 

Definition at line 61 of file itg3200.h.

Function Documentation

◆ itg3200_event()

void itg3200_event ( struct Itg3200 itg)

◆ itg3200_init()

void itg3200_init ( struct Itg3200 itg,
struct i2c_periph i2c_p,
uint8_t  addr 
)

Initialize Itg3200 struct and set default config options.

Parameters
itgItg3200 struct
i2c_pI2C periperal to use
addrI2C 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ itg3200_periodic()

static void itg3200_periodic ( struct Itg3200 itg)
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ itg3200_read()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ itg3200_set_default_config()

◆ itg3200_start_configure()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: