The friendly Operating System for the Internet of Things
L3G4200D gyroscope

Device driver for the L3G4200D gyroscope. More...

Detailed Description

Files

file  l3g4200d.h
 Device driver interface for the L3G4200D gyroscope.
 

Data Structures

struct  l3g4200d_data_t
 Result vector for gyro measurement. More...
 
struct  l3g4200d_t
 Device descriptor for L3G4200D sensors. More...
 
struct  l3g4200d_params_t
 Data structure holding the device parameters needed for initialization. More...
 

Macros

#define L3G4200D_DEFAULT_ADDRESS   0x68
 The sensors default I2C address.
 

Enumerations

enum  l3g4200d_scale_t { L3G4200D_SCALE_250DPS = 0x0, L3G4200D_SCALE_500DPS = 0x1, L3G4200D_SCALE_2000DPS = 0x2 }
 Measurement scale for the gyro. More...
 
enum  l3g4200d_mode_t {
  L3G4200D_MODE_100_12 = 0x0, L3G4200D_MODE_100_25 = 0x1, L3G4200D_MODE_200_12 = 0x4, L3G4200D_MODE_200_25 = 0x5,
  L3G4200D_MODE_200_50 = 0x6, L3G4200D_MODE_200_70 = 0x7, L3G4200D_MODE_400_20 = 0x8, L3G4200D_MODE_400_25 = 0x9,
  L3G4200D_MODE_400_50 = 0xa, L3G4200D_MODE_400_110 = 0xb, L3G4200D_MODE_800_30 = 0xc, L3G4200D_MODE_800_35 = 0xd,
  L3G4200D_MODE_800_50 = 0xe, L3G4200D_MODE_800_110 = 0xf
}
 Sampling frequency and bandwidth settings for the gyro. More...
 

Functions

int l3g4200d_init (l3g4200d_t *dev, i2c_t i2c, uint8_t address, gpio_t int1_pin, gpio_t int2_pin, l3g4200d_mode_t mode, l3g4200d_scale_t scale)
 Initialize a gyro. More...
 
int l3g4200d_read (l3g4200d_t *dev, l3g4200d_data_t *acc_data)
 Read angular speed value in degree per second from gyro. More...
 
int l3g4200d_enable (l3g4200d_t *dev)
 Power-up the given device. More...
 
int l3g4200d_disable (l3g4200d_t *dev)
 Power-down the given device. More...
 

Enumeration Type Documentation

Enumerator
L3G4200D_MODE_100_12 

data rate: 100Hz, cut-off: 12.5Hz

L3G4200D_MODE_100_25 

data rate: 100Hz, cut-off: 25Hz

L3G4200D_MODE_200_12 

data rate: 200Hz, cut-off: 12.5Hz

L3G4200D_MODE_200_25 

data rate: 200Hz, cut-off: 25Hz

L3G4200D_MODE_200_50 

data rate: 200Hz, cut-off: 50Hz

L3G4200D_MODE_200_70 

data rate: 200Hz, cut-off: 70Hz

L3G4200D_MODE_400_20 

data rate: 400Hz, cut-off: 20Hz

L3G4200D_MODE_400_25 

data rate: 400Hz, cut-off: 25Hz

L3G4200D_MODE_400_50 

data rate: 400Hz, cut-off: 50Hz

L3G4200D_MODE_400_110 

data rate: 400Hz, cut-off: 110Hz

L3G4200D_MODE_800_30 

data rate: 800Hz, cut-off: 30Hz

L3G4200D_MODE_800_35 

data rate: 800Hz, cut-off: 35Hz

L3G4200D_MODE_800_50 

data rate: 800Hz, cut-off: 50Hz

L3G4200D_MODE_800_110 

data rate: 800Hz, cut-off: 110Hz

Definition at line 61 of file l3g4200d.h.

Enumerator
L3G4200D_SCALE_250DPS 

scale: 250 degree per second

L3G4200D_SCALE_500DPS 

scale: 500 degree per second

L3G4200D_SCALE_2000DPS 

scale: 2000 degree per second

Definition at line 52 of file l3g4200d.h.

Function Documentation

int l3g4200d_disable ( l3g4200d_t dev)
Parameters
[in]devdevice to power-down
Returns
0 on success
-1 on error
int l3g4200d_enable ( l3g4200d_t dev)
Parameters
[in]devdevice to enable
Returns
0 on success
-1 on error
int l3g4200d_init ( l3g4200d_t dev,
i2c_t  i2c,
uint8_t  address,
gpio_t  int1_pin,
gpio_t  int2_pin,
l3g4200d_mode_t  mode,
l3g4200d_scale_t  scale 
)
Parameters
[out]devdevice descriptor of sensor to initialize
[in]i2cI2C bus the gyro is connected to
[in]addressgyro's I2C slave address
[in]int1_pinINT pin the gyro is connected to
[in]int2_pinDRDY pin the gyro is connected to
[in]modebandwidth and sampling rate settings
[in]scalescaling of results
Returns
0 on success
-1 on error
int l3g4200d_read ( l3g4200d_t dev,
l3g4200d_data_t acc_data 
)
Parameters
[in]devdevice descriptor of gyro
[out]acc_dataresult vector in dps per axis
Returns
0 on success
-1 on error