l3g4200d.h
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  */
8 
27 #ifndef L3G4200D_H
28 #define L3G4200D_H
29 
30 #include <stdint.h>
31 
32 #include "periph/i2c.h"
33 #include "periph/gpio.h"
34 
35 #ifdef __cplusplus
36  extern "C" {
37 #endif
38 
52 #ifndef CONFIG_L3G4200D_DEFAULT_ADDRESS
53 #define CONFIG_L3G4200D_DEFAULT_ADDRESS 0x68
54 #endif
60 typedef struct {
61  int16_t acc_x;
62  int16_t acc_y;
63  int16_t acc_z;
65 
69 typedef enum {
74 
78 typedef enum {
94 
98 typedef struct {
100  uint8_t addr;
101  gpio_t int1;
102  gpio_t int2;
106 
110 typedef struct {
112  int32_t scale;
113 } l3g4200d_t;
114 
124 int l3g4200d_init(l3g4200d_t *dev, const l3g4200d_params_t *params);
125 
135 int l3g4200d_read(const l3g4200d_t *dev, l3g4200d_data_t *acc_data);
136 
145 int l3g4200d_enable(const l3g4200d_t *dev);
146 
155 int l3g4200d_disable(const l3g4200d_t *dev);
156 
157 #ifdef __cplusplus
158 }
159 #endif
160 
161 #endif /* L3G4200D_H */
Low-level GPIO peripheral driver interface definitions.
int l3g4200d_init(l3g4200d_t *dev, const l3g4200d_params_t *params)
Initialize a gyro.
int l3g4200d_disable(const l3g4200d_t *dev)
Power-down the given device.
l3g4200d_scale_t
Measurement scale for the gyro.
Definition: l3g4200d.h:69
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.
l3g4200d_mode_t
Sampling frequency and bandwidth settings for the gyro.
Definition: l3g4200d.h:78
@ L3G4200D_SCALE_250DPS
scale: 250 degree per second
Definition: l3g4200d.h:70
@ L3G4200D_SCALE_500DPS
scale: 500 degree per second
Definition: l3g4200d.h:71
@ L3G4200D_SCALE_2000DPS
scale: 2000 degree per second
Definition: l3g4200d.h:72
@ L3G4200D_MODE_400_110
data rate: 400Hz, cut-off: 110Hz
Definition: l3g4200d.h:88
@ L3G4200D_MODE_200_12
data rate: 200Hz, cut-off: 12.5Hz
Definition: l3g4200d.h:81
@ L3G4200D_MODE_800_110
data rate: 800Hz, cut-off: 110Hz
Definition: l3g4200d.h:92
@ L3G4200D_MODE_400_20
data rate: 400Hz, cut-off: 20Hz
Definition: l3g4200d.h:85
@ L3G4200D_MODE_800_50
data rate: 800Hz, cut-off: 50Hz
Definition: l3g4200d.h:91
@ L3G4200D_MODE_800_35
data rate: 800Hz, cut-off: 35Hz
Definition: l3g4200d.h:90
@ L3G4200D_MODE_800_30
data rate: 800Hz, cut-off: 30Hz
Definition: l3g4200d.h:89
@ L3G4200D_MODE_400_25
data rate: 400Hz, cut-off: 25Hz
Definition: l3g4200d.h:86
@ L3G4200D_MODE_100_12
data rate: 100Hz, cut-off: 12.5Hz
Definition: l3g4200d.h:79
@ L3G4200D_MODE_400_50
data rate: 400Hz, cut-off: 50Hz
Definition: l3g4200d.h:87
@ L3G4200D_MODE_200_25
data rate: 200Hz, cut-off: 25Hz
Definition: l3g4200d.h:82
@ L3G4200D_MODE_200_50
data rate: 200Hz, cut-off: 50Hz
Definition: l3g4200d.h:83
@ L3G4200D_MODE_200_70
data rate: 200Hz, cut-off: 70Hz
Definition: l3g4200d.h:84
@ L3G4200D_MODE_100_25
data rate: 100Hz, cut-off: 25Hz
Definition: l3g4200d.h:80
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition: i2c.h:145
Low-level I2C peripheral driver interface definition.
Result vector for gyro measurement.
Definition: l3g4200d.h:60
int16_t acc_x
roll rate in dgs (degree per second)
Definition: l3g4200d.h:61
int16_t acc_y
pitch rate in dgs
Definition: l3g4200d.h:62
int16_t acc_z
yaw rate in dgs
Definition: l3g4200d.h:63
Device initialization parameters.
Definition: l3g4200d.h:98
gpio_t int2
INT2 (DRDY) pin.
Definition: l3g4200d.h:102
uint8_t addr
the sensors slave address on the I2C bus
Definition: l3g4200d.h:100
l3g4200d_scale_t scale
scaling factor to normalize results
Definition: l3g4200d.h:104
gpio_t int1
INT1 pin.
Definition: l3g4200d.h:101
l3g4200d_mode_t mode
sampling frequency and bandwidth mode
Definition: l3g4200d.h:103
i2c_t i2c
I2C device the sensor is connected to.
Definition: l3g4200d.h:99
Device descriptor for L3G4200D sensors.
Definition: l3g4200d.h:110
l3g4200d_params_t params
device initialization parameters
Definition: l3g4200d.h:111
int32_t scale
internal scaling factor to normalize results
Definition: l3g4200d.h:112