Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Freie Universit├Ąt Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
23 #ifndef L3G4200D_H
24 #define L3G4200D_H
26 #include <stdint.h>
28 #include "periph/i2c.h"
29 #include "periph/gpio.h"
31 #ifdef __cplusplus
32  extern "C" {
33 #endif
38 #define L3G4200D_DEFAULT_ADDRESS 0x68
43 typedef struct {
44  int16_t acc_x;
45  int16_t acc_y;
46  int16_t acc_z;
52 typedef enum {
61 typedef enum {
81 typedef struct {
83  uint8_t addr;
84  gpio_t int1;
85  gpio_t int2;
86  int32_t scale;
87 } l3g4200d_t;
92 typedef struct {
94  uint8_t addr;
95  gpio_t int1_pin;
96  gpio_t int2_pin;
115 int l3g4200d_init(l3g4200d_t *dev, i2c_t i2c, uint8_t address,
116  gpio_t int1_pin, gpio_t int2_pin,
117  l3g4200d_mode_t mode, l3g4200d_scale_t scale);
128 int l3g4200d_read(const l3g4200d_t *dev, l3g4200d_data_t *acc_data);
138 int l3g4200d_enable(const l3g4200d_t *dev);
148 int l3g4200d_disable(const l3g4200d_t *dev);
150 #ifdef __cplusplus
151 }
152 #endif
154 #endif /* L3G4200D_H */
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.
scale: 250 degree per second
Definition: l3g4200d.h:53
data rate: 400Hz, cut-off: 110Hz
Definition: l3g4200d.h:71
data rate: 400Hz, cut-off: 50Hz
Definition: l3g4200d.h:70
data rate: 100Hz, cut-off: 12.5Hz
Definition: l3g4200d.h:62
data rate: 100Hz, cut-off: 25Hz
Definition: l3g4200d.h:63
Device descriptor for L3G4200D sensors.
Definition: l3g4200d.h:81
data rate: 200Hz, cut-off: 25Hz
Definition: l3g4200d.h:65
int l3g4200d_disable(const l3g4200d_t *dev)
Power-down the given device.
Low-level GPIO peripheral driver interface definitions.
int16_t acc_z
yaw rate in dgs
Definition: l3g4200d.h:46
data rate: 800Hz, cut-off: 50Hz
Definition: l3g4200d.h:74
gpio_t int1
INT1 pin.
Definition: l3g4200d.h:84
uint8_t addr
the address on that bus
Definition: l3g4200d.h:94
int32_t scale
scaling factor to normalize results
Definition: l3g4200d.h:86
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:113
data rate: 800Hz, cut-off: 30Hz
Definition: l3g4200d.h:72
int16_t acc_x
roll rate in dgs (degree per second)
Definition: l3g4200d.h:44
gpio_t int2
INT2 (DRDY) pin.
Definition: l3g4200d.h:85
Sampling frequency and bandwidth settings for the gyro.
Definition: l3g4200d.h:61
i2c_t i2c
I2C device the sensor is connected to.
Definition: l3g4200d.h:82
data rate: 800Hz, cut-off: 35Hz
Definition: l3g4200d.h:73
Measurement scale for the gyro.
Definition: l3g4200d.h:52
i2c_t i2c
I2C bus the device is connected to.
Definition: l3g4200d.h:93
data rate: 200Hz, cut-off: 70Hz
Definition: l3g4200d.h:67
l3g4200d_mode_t mode
sampling mode to use
Definition: l3g4200d.h:97
data rate: 400Hz, cut-off: 20Hz
Definition: l3g4200d.h:68
gpio_t int2_pin
GPIO pin connected to the INT2 line.
Definition: l3g4200d.h:96
Result vector for gyro measurement.
Definition: l3g4200d.h:43
int l3g4200d_read(const l3g4200d_t *dev, l3g4200d_data_t *acc_data)
Read angular speed value in degree per second from gyro.
int l3g4200d_enable(const l3g4200d_t *dev)
Power-up the given device.
scale: 500 degree per second
Definition: l3g4200d.h:54
data rate: 400Hz, cut-off: 25Hz
Definition: l3g4200d.h:69
scale: 2000 degree per second
Definition: l3g4200d.h:55
int16_t acc_y
pitch rate in dgs
Definition: l3g4200d.h:45
uint8_t addr
the sensors slave address on the I2C bus
Definition: l3g4200d.h:83
Data structure holding the device parameters needed for initialization.
Definition: l3g4200d.h:92
l3g4200d_scale_t scale
scaling to use
Definition: l3g4200d.h:98
data rate: 200Hz, cut-off: 12.5Hz
Definition: l3g4200d.h:64
gpio_t int1_pin
GPIO pin connected to the INT1 line.
Definition: l3g4200d.h:95
data rate: 800Hz, cut-off: 110Hz
Definition: l3g4200d.h:75
data rate: 200Hz, cut-off: 50Hz
Definition: l3g4200d.h:66
Low-level I2C peripheral driver interface definition.