Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
l3g4200.h File Reference

Driver for the gyro L3G4200 From ST. More...

#include "std.h"
#include "math/pprz_algebra_int.h"
#include "mcu_periph/i2c.h"
#include "peripherals/l3g4200_regs.h"
+ Include dependency graph for l3g4200.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  L3g4200Config
 
struct  L3g4200
 
union  L3g4200.data
 

Macros

#define L3G4200_DEFAULT_DR   L3G4200_DR_100Hz
 
#define L3G4200_DEFAULT_DLPF   L3G4200_DLPF_1
 
#define L3G4200_DEFAULT_SCALE   L3G4200_SCALE_2000
 
#define L3G4200_DEFAULT_CTRL_REG1   ((L3G4200_DEFAULT_DR<<6) | (L3G4200_DEFAULT_DLPF<<4) | 0xf);
 
#define L3G4200_DEFAULT_CTRL_REG4   (L3G4200_DEFAULT_SCALE<<4) | 0x00;
 
#define L3G4200_DEFAULT_CTRL_REG5   0x00
 

Enumerations

enum  L3g4200ConfStatus {
  L3G_CONF_UNINIT, L3G_CONF_REG1, L3G_CONF_REG4, L3G_CONF_REG5,
  L3G_CONF_DONE
}
 config status states More...
 

Functions

void l3g4200_init (struct L3g4200 *l3g, struct i2c_periph *i2c_p, uint8_t i2c_address)
 Initialize L3g4200 struct and set default config options. More...
 
void l3g4200_set_default_config (struct L3g4200Config *conf)
 
void l3g4200_start_configure (struct L3g4200 *l3g)
 
void l3g4200_read (struct L3g4200 *l3g)
 
void l3g4200_event (struct L3g4200 *l3g)
 
static void l3g4200_periodic (struct L3g4200 *l3g)
 convenience function: read or start configuration if not already initialized More...
 

Detailed Description

Driver for the gyro L3G4200 From ST.

Definition in file l3g4200.h.


Data Structure Documentation

struct L3g4200Config

Definition at line 52 of file l3g4200.h.

Data Fields
uint8_t ctrl_reg1
uint8_t ctrl_reg4
uint8_t ctrl_reg5
struct L3g4200

Definition at line 67 of file l3g4200.h.

+ Collaboration diagram for L3g4200:
Data Fields
struct L3g4200Config config
union L3g4200 data
volatile bool data_available data ready flag
struct i2c_periph * i2c_p
struct i2c_transaction i2c_trans
enum L3g4200ConfStatus init_status init status
bool initialized config done flag
union L3g4200.data

Definition at line 73 of file l3g4200.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

#define L3G4200_DEFAULT_CTRL_REG1   ((L3G4200_DEFAULT_DR<<6) | (L3G4200_DEFAULT_DLPF<<4) | 0xf);

Definition at line 48 of file l3g4200.h.

Referenced by l3g4200_set_default_config().

#define L3G4200_DEFAULT_CTRL_REG4   (L3G4200_DEFAULT_SCALE<<4) | 0x00;

Definition at line 49 of file l3g4200.h.

Referenced by l3g4200_set_default_config().

#define L3G4200_DEFAULT_CTRL_REG5   0x00

Definition at line 50 of file l3g4200.h.

Referenced by l3g4200_set_default_config().

#define L3G4200_DEFAULT_DLPF   L3G4200_DLPF_1

Definition at line 43 of file l3g4200.h.

#define L3G4200_DEFAULT_DR   L3G4200_DR_100Hz

Definition at line 41 of file l3g4200.h.

#define L3G4200_DEFAULT_SCALE   L3G4200_SCALE_2000

Definition at line 45 of file l3g4200.h.

Enumeration Type Documentation

config status states

Enumerator
L3G_CONF_UNINIT 
L3G_CONF_REG1 
L3G_CONF_REG4 
L3G_CONF_REG5 
L3G_CONF_DONE 

Definition at line 59 of file l3g4200.h.

Function Documentation

void l3g4200_event ( struct L3g4200 l3g)

Definition at line 114 of file l3g4200.c.

References i2c_transaction::buf, L3g4200::data, L3g4200::data_available, L3g4200::i2c_trans, I2CTransDone, I2CTransFailed, I2CTransSuccess, L3g4200::init_status, L3g4200::initialized, Int16FromBuf, l3g4200_send_config(), L3G_CONF_UNINIT, and i2c_transaction::status.

Referenced by imu_gl1_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void l3g4200_init ( struct L3g4200 l3g,
struct i2c_periph i2c_p,
uint8_t  addr 
)

Initialize L3g4200 struct and set default config options.

Parameters
l3gL3g4200 struct
i2c_pI2C periperal to use
addrI2C address of L3G4200

Definition at line 47 of file l3g4200.c.

References L3g4200::config, L3g4200::i2c_p, L3g4200::i2c_trans, I2CTransDone, L3g4200::init_status, L3g4200::initialized, l3g4200_set_default_config(), L3G_CONF_UNINIT, i2c_transaction::slave_addr, and i2c_transaction::status.

Referenced by imu_gl1_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void l3g4200_periodic ( struct L3g4200 l3g)
inlinestatic

convenience function: read or start configuration if not already initialized

Definition at line 88 of file l3g4200.h.

References L3g4200::initialized, l3g4200_read(), and l3g4200_start_configure().

Referenced by imu_gl1_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void l3g4200_read ( struct L3g4200 l3g)

Definition at line 104 of file l3g4200.c.

References i2c_transaction::buf, L3g4200::i2c_p, L3g4200::i2c_trans, i2c_transceive(), I2CTransDone, L3g4200::initialized, L3G4200_REG_STATUS_REG, i2c_transaction::slave_addr, and i2c_transaction::status.

Referenced by l3g4200_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void l3g4200_set_default_config ( struct L3g4200Config conf)

Definition at line 33 of file l3g4200.c.

References L3g4200Config::ctrl_reg1, L3g4200Config::ctrl_reg4, L3g4200Config::ctrl_reg5, L3G4200_DEFAULT_CTRL_REG1, L3G4200_DEFAULT_CTRL_REG4, and L3G4200_DEFAULT_CTRL_REG5.

Referenced by l3g4200_init().

+ Here is the caller graph for this function:

void l3g4200_start_configure ( struct L3g4200 l3g)

Definition at line 93 of file l3g4200.c.

References L3g4200::i2c_trans, I2CTransDone, I2CTransSuccess, L3g4200::init_status, l3g4200_send_config(), L3G_CONF_UNINIT, and i2c_transaction::status.

Referenced by l3g4200_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: