Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures 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
 

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.

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)
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 46 of file l3g4200.c.

References L3g4200::config, FALSE, 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_impl_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_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 103 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 92 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: