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
55 
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 */
162 
l3g4200d_params_t
Device initialization parameters.
Definition: l3g4200d.h:98
l3g4200d_disable
int l3g4200d_disable(const l3g4200d_t *dev)
Power-down the given device.
l3g4200d_params_t::i2c
i2c_t i2c
I2C device the sensor is connected to.
Definition: l3g4200d.h:99
l3g4200d_t::params
l3g4200d_params_t params
device initialization parameters
Definition: l3g4200d.h:111
L3G4200D_MODE_800_30
@ L3G4200D_MODE_800_30
data rate: 800Hz, cut-off: 30Hz
Definition: l3g4200d.h:89
l3g4200d_read
int l3g4200d_read(const l3g4200d_t *dev, l3g4200d_data_t *acc_data)
Read angular speed value in degree per second from gyro.
l3g4200d_enable
int l3g4200d_enable(const l3g4200d_t *dev)
Power-up the given device.
l3g4200d_init
int l3g4200d_init(l3g4200d_t *dev, const l3g4200d_params_t *params)
Initialize a gyro.
i2c_t
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:151
l3g4200d_data_t::acc_x
int16_t acc_x
roll rate in dgs (degree per second)
Definition: l3g4200d.h:61
L3G4200D_MODE_400_25
@ L3G4200D_MODE_400_25
data rate: 400Hz, cut-off: 25Hz
Definition: l3g4200d.h:86
l3g4200d_params_t::int1
gpio_t int1
INT1 pin.
Definition: l3g4200d.h:101
L3G4200D_MODE_200_50
@ L3G4200D_MODE_200_50
data rate: 200Hz, cut-off: 50Hz
Definition: l3g4200d.h:83
L3G4200D_MODE_400_50
@ L3G4200D_MODE_400_50
data rate: 400Hz, cut-off: 50Hz
Definition: l3g4200d.h:87
L3G4200D_MODE_200_25
@ L3G4200D_MODE_200_25
data rate: 200Hz, cut-off: 25Hz
Definition: l3g4200d.h:82
L3G4200D_MODE_200_70
@ L3G4200D_MODE_200_70
data rate: 200Hz, cut-off: 70Hz
Definition: l3g4200d.h:84
l3g4200d_t
Device descriptor for L3G4200D sensors.
Definition: l3g4200d.h:110
L3G4200D_MODE_400_20
@ L3G4200D_MODE_400_20
data rate: 400Hz, cut-off: 20Hz
Definition: l3g4200d.h:85
l3g4200d_mode_t
l3g4200d_mode_t
Sampling frequency and bandwidth settings for the gyro.
Definition: l3g4200d.h:78
l3g4200d_params_t::int2
gpio_t int2
INT2 (DRDY) pin.
Definition: l3g4200d.h:102
L3G4200D_MODE_800_50
@ L3G4200D_MODE_800_50
data rate: 800Hz, cut-off: 50Hz
Definition: l3g4200d.h:91
L3G4200D_MODE_100_25
@ L3G4200D_MODE_100_25
data rate: 100Hz, cut-off: 25Hz
Definition: l3g4200d.h:80
gpio.h
Low-level GPIO peripheral driver interface definitions.
l3g4200d_data_t::acc_y
int16_t acc_y
pitch rate in dgs
Definition: l3g4200d.h:62
l3g4200d_scale_t
l3g4200d_scale_t
Measurement scale for the gyro.
Definition: l3g4200d.h:69
L3G4200D_SCALE_2000DPS
@ L3G4200D_SCALE_2000DPS
scale: 2000 degree per second
Definition: l3g4200d.h:72
l3g4200d_data_t::acc_z
int16_t acc_z
yaw rate in dgs
Definition: l3g4200d.h:63
L3G4200D_SCALE_500DPS
@ L3G4200D_SCALE_500DPS
scale: 500 degree per second
Definition: l3g4200d.h:71
l3g4200d_params_t::addr
uint8_t addr
the sensors slave address on the I2C bus
Definition: l3g4200d.h:100
l3g4200d_params_t::mode
l3g4200d_mode_t mode
sampling frequency and bandwidth mode
Definition: l3g4200d.h:103
l3g4200d_t::scale
int32_t scale
internal scaling factor to normalize results
Definition: l3g4200d.h:112
L3G4200D_MODE_100_12
@ L3G4200D_MODE_100_12
data rate: 100Hz, cut-off: 12.5Hz
Definition: l3g4200d.h:79
L3G4200D_MODE_800_35
@ L3G4200D_MODE_800_35
data rate: 800Hz, cut-off: 35Hz
Definition: l3g4200d.h:90
L3G4200D_MODE_400_110
@ L3G4200D_MODE_400_110
data rate: 400Hz, cut-off: 110Hz
Definition: l3g4200d.h:88
l3g4200d_params_t::scale
l3g4200d_scale_t scale
scaling factor to normalize results
Definition: l3g4200d.h:104
i2c.h
Low-level I2C peripheral driver interface definition.
l3g4200d_data_t
Result vector for gyro measurement.
Definition: l3g4200d.h:60
L3G4200D_MODE_800_110
@ L3G4200D_MODE_800_110
data rate: 800Hz, cut-off: 110Hz
Definition: l3g4200d.h:92
L3G4200D_MODE_200_12
@ L3G4200D_MODE_200_12
data rate: 200Hz, cut-off: 12.5Hz
Definition: l3g4200d.h:81
L3G4200D_SCALE_250DPS
@ L3G4200D_SCALE_250DPS
scale: 250 degree per second
Definition: l3g4200d.h:70