L3G4200D gyroscope¶
Device driver for the L3G4200D gyroscope.
This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.
Note
The current state of the driver only implements a very basic polling mode.
-
enum
l3g4200d_scale_t
¶ - L3G4200D_SCALE_250DPS
= 0x0
- scale: 250 degree per second
- L3G4200D_SCALE_500DPS
= 0x1
- scale: 500 degree per second
- L3G4200D_SCALE_2000DPS
= 0x2
- scale: 2000 degree per second
- L3G4200D_SCALE_250DPS
-
enum
l3g4200d_mode_t
¶ - L3G4200D_MODE_100_12
= 0x0
- data rate: 100Hz, cut-off: 12.5Hz
- L3G4200D_MODE_100_25
= 0x1
- data rate: 100Hz, cut-off: 25Hz
- L3G4200D_MODE_200_12
= 0x4
- data rate: 200Hz, cut-off: 12.5Hz
- L3G4200D_MODE_200_25
= 0x5
- data rate: 200Hz, cut-off: 25Hz
- L3G4200D_MODE_200_50
= 0x6
- data rate: 200Hz, cut-off: 50Hz
- L3G4200D_MODE_200_70
= 0x7
- data rate: 200Hz, cut-off: 70Hz
- L3G4200D_MODE_400_20
= 0x8
- data rate: 400Hz, cut-off: 20Hz
- L3G4200D_MODE_400_25
= 0x9
- data rate: 400Hz, cut-off: 25Hz
- L3G4200D_MODE_400_50
= 0xa
- data rate: 400Hz, cut-off: 50Hz
- L3G4200D_MODE_400_110
= 0xb
- data rate: 400Hz, cut-off: 110Hz
- L3G4200D_MODE_800_30
= 0xc
- data rate: 800Hz, cut-off: 30Hz
- L3G4200D_MODE_800_35
= 0xd
- data rate: 800Hz, cut-off: 35Hz
- L3G4200D_MODE_800_50
= 0xe
- data rate: 800Hz, cut-off: 50Hz
- L3G4200D_MODE_800_110
= 0xf
- data rate: 800Hz, cut-off: 110Hz
- L3G4200D_MODE_100_12
-
int
l3g4200d_init
(l3g4200d_t * dev, const l3g4200d_params_t * params)¶ Initialize a gyro.
Parameters
dev: device descriptor of sensor to initialize params: initialization parameters Return values
- 0 on success
- -1 on error
-
int
l3g4200d_read
(const l3g4200d_t * dev, l3g4200d_data_t * acc_data)¶ Read angular speed value in degree per second from gyro.
Parameters
dev: device descriptor of gyro acc_data: result vector in dps per axis Return values
- 0 on success
- -1 on error
-
int
l3g4200d_enable
(const l3g4200d_t * dev)¶ Power-up the given device.
Parameters
dev: device to enable Return values
- 0 on success
- -1 on error
-
int
l3g4200d_disable
(const l3g4200d_t * dev)¶ Power-down the given device.
Parameters
dev: device to power-down Return values
- 0 on success
- -1 on error
-
L3G4200D_DEFAULT_ADDRESS
¶ The sensors default I2C address.
1
0x68
-
struct
l3g4200d_data_t
¶ Result vector for gyro measurement.
-
int16_t
acc_x
¶ roll rate in dgs (degree per second)
-
int16_t
acc_y
¶ pitch rate in dgs
-
int16_t
acc_z
¶ yaw rate in dgs
-
int16_t
-
struct
l3g4200d_params_t
¶ Device initialization parameters.
-
i2c.h::i2c_t
i2c
¶ I2C device the sensor is connected to.
-
uint8_t
addr
¶ the sensors slave address on the I2C bus
-
gpio.h::gpio_t
int1
¶ INT1 pin.
-
gpio.h::gpio_t
int2
¶ INT2 (DRDY) pin.
-
l3g4200d.h::l3g4200d_mode_t
mode
¶ sampling frequency and bandwidth mode
-
l3g4200d.h::l3g4200d_scale_t
scale
¶ scaling factor to normalize results
-
-
struct
l3g4200d_t
¶ Device descriptor for L3G4200D sensors.
-
l3g4200d_params_t
params
¶ device initialization parameters
-
int
scale
¶ internal scaling factor to normalize results
-
l3g4200d_params_t