Loading...
Searching...
No Matches
l3g4200d.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2014 Freie Universität Berlin
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
25
26#include <stdint.h>
27
28#include "periph/i2c.h"
29#include "periph/gpio.h"
30
31#ifdef __cplusplus
32 extern "C" {
33#endif
34
48#ifndef CONFIG_L3G4200D_DEFAULT_ADDRESS
49#define CONFIG_L3G4200D_DEFAULT_ADDRESS 0x68
50#endif
52
56typedef struct {
57 int16_t acc_x;
58 int16_t acc_y;
59 int16_t acc_z;
61
70
90
102
106typedef struct {
108 int32_t scale;
109} l3g4200d_t;
110
121
131int l3g4200d_read(const l3g4200d_t *dev, l3g4200d_data_t *acc_data);
132
142
152
153#ifdef __cplusplus
154}
155#endif
156
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:65
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:74
@ L3G4200D_SCALE_250DPS
scale: 250 degree per second
Definition l3g4200d.h:66
@ L3G4200D_SCALE_500DPS
scale: 500 degree per second
Definition l3g4200d.h:67
@ L3G4200D_SCALE_2000DPS
scale: 2000 degree per second
Definition l3g4200d.h:68
@ L3G4200D_MODE_400_110
data rate: 400Hz, cut-off: 110Hz
Definition l3g4200d.h:84
@ L3G4200D_MODE_200_12
data rate: 200Hz, cut-off: 12.5Hz
Definition l3g4200d.h:77
@ L3G4200D_MODE_800_110
data rate: 800Hz, cut-off: 110Hz
Definition l3g4200d.h:88
@ L3G4200D_MODE_400_20
data rate: 400Hz, cut-off: 20Hz
Definition l3g4200d.h:81
@ L3G4200D_MODE_800_50
data rate: 800Hz, cut-off: 50Hz
Definition l3g4200d.h:87
@ L3G4200D_MODE_800_35
data rate: 800Hz, cut-off: 35Hz
Definition l3g4200d.h:86
@ L3G4200D_MODE_800_30
data rate: 800Hz, cut-off: 30Hz
Definition l3g4200d.h:85
@ L3G4200D_MODE_400_25
data rate: 400Hz, cut-off: 25Hz
Definition l3g4200d.h:82
@ L3G4200D_MODE_100_12
data rate: 100Hz, cut-off: 12.5Hz
Definition l3g4200d.h:75
@ L3G4200D_MODE_400_50
data rate: 400Hz, cut-off: 50Hz
Definition l3g4200d.h:83
@ L3G4200D_MODE_200_25
data rate: 200Hz, cut-off: 25Hz
Definition l3g4200d.h:78
@ L3G4200D_MODE_200_50
data rate: 200Hz, cut-off: 50Hz
Definition l3g4200d.h:79
@ L3G4200D_MODE_200_70
data rate: 200Hz, cut-off: 70Hz
Definition l3g4200d.h:80
@ L3G4200D_MODE_100_25
data rate: 100Hz, cut-off: 25Hz
Definition l3g4200d.h:76
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:155
Low-level I2C peripheral driver interface definition.
Result vector for gyro measurement.
Definition l3g4200d.h:56
int16_t acc_x
roll rate in dgs (degree per second)
Definition l3g4200d.h:57
int16_t acc_y
pitch rate in dgs
Definition l3g4200d.h:58
int16_t acc_z
yaw rate in dgs
Definition l3g4200d.h:59
Device initialization parameters.
Definition l3g4200d.h:94
gpio_t int2
INT2 (DRDY) pin.
Definition l3g4200d.h:98
uint8_t addr
the sensors slave address on the I2C bus
Definition l3g4200d.h:96
l3g4200d_scale_t scale
scaling factor to normalize results
Definition l3g4200d.h:100
gpio_t int1
INT1 pin.
Definition l3g4200d.h:97
l3g4200d_mode_t mode
sampling frequency and bandwidth mode
Definition l3g4200d.h:99
i2c_t i2c
I2C device the sensor is connected to.
Definition l3g4200d.h:95
Device descriptor for L3G4200D sensors.
Definition l3g4200d.h:106
l3g4200d_params_t params
device initialization parameters
Definition l3g4200d.h:107
int32_t scale
internal scaling factor to normalize results
Definition l3g4200d.h:108