Loading...
Searching...
No Matches
l3gxxxx.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 Gunar Schorcht
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
960#ifndef L3GXXXX_H
961#define L3GXXXX_H
962
963#ifdef __cplusplus
964extern "C"
965{
966#endif
967
968#include <stdbool.h>
969#include <stdint.h>
970
971#include "mutex.h"
972#include "periph/gpio.h"
973#include "periph/i2c.h"
974#include "periph/spi.h"
975
976#include "l3gxxxx_regs.h"
977
978#if !IS_USED(MODULE_L3GD20H) && !IS_USED(MODULE_L3GD20) \
979 && !IS_USED(MODULE_L3G4200D_NG) \
980 && !IS_USED(MODULE_A3G4250D) \
981 && !IS_USED(MODULE_I3G4250D)
982#error Please select your sensor variant by using the respective pseudomodule.
983#endif
984
989#if IS_USED(MODULE_L3GD20H) || IS_USED(MODULE_L3GD20)
990#define L3GXXXX_I2C_ADDR_1 (0x6a)
991#define L3GXXXX_I2C_ADDR_2 (0x6b)
992#else
993#define L3GXXXX_I2C_ADDR_1 (0x68)
994#define L3GXXXX_I2C_ADDR_2 (0x69)
995#endif
1002#define L3GXXXX_CHIP_ID_L3GD20H (0xd7)
1003#define L3GXXXX_CHIP_ID_L3GD20 (0xd4)
1004#define L3GXXXX_CHIP_ID_X3G42XXD (0xd3)
1025
1089
1105
1112typedef enum {
1115 L3GXXXX_FIFO = 1,
1117 L3GXXXX_STREAM = 2,
1119#if IS_USED(MODULE_L3GD20H) || IS_USED(MODULE_L3GD20) || DOXYGEN
1126#endif
1127#if IS_USED(MODULE_L3GD20H) || DOXYGEN
1134#endif
1136
1195
1209
1246
1253#define L3GXXXX_INT_DATA (L3GXXXX_INT_DATA_READY | \
1254 L3GXXXX_INT_FIFO_WATERMARK | \
1255 L3GXXXX_INT_FIFO_OVERRUN | \
1256 L3GXXXX_INT_FIFO_EMPTY)
1257
1292
1296typedef union {
1297 struct {
1298 uint8_t x_low :1;
1299 uint8_t x_high:1;
1300 uint8_t y_low :1;
1301 uint8_t y_high:1;
1302 uint8_t z_low :1;
1303 uint8_t z_high:1;
1304 uint8_t active:1;
1305 uint8_t unused:1;
1306 };
1307 uint8_t val;
1310
1314typedef union {
1315 struct {
1316 uint8_t fifo_empty :1;
1317 uint8_t fifo_overrun :1;
1318 uint8_t fifo_watermark:1;
1319 uint8_t data_ready :1;
1320 uint8_t unused :4;
1321 };
1322 uint8_t val;
1325
1337
1345
1353
1357typedef struct {
1358 int16_t x;
1359 int16_t y;
1360 int16_t z;
1362
1366typedef struct {
1367 int32_t x;
1368 int32_t y;
1369 int32_t z;
1371
1376
1381
1385typedef enum {
1386#if IS_USED(MODULE_L3GXXXX_I2C) || DOXYGEN
1388#endif
1389#if IS_USED(MODULE_L3GXXXX_SPI) || DOXYGEN
1391#endif
1392} l3gxxxx_if_t;
1393
1394#if IS_USED(MODULE_L3GXXXX_I2C) || DOXYGEN
1398typedef struct {
1400 uint8_t addr;
1402#endif
1403
1404#if IS_USED(MODULE_L3GXXXX_SPI) || DOXYGEN
1408typedef struct {
1409 spi_t dev;
1411 gpio_t cs;
1413#endif
1414
1418typedef struct {
1420 union {
1421#if IS_USED(MODULE_L3GXXXX_I2C) || DOXYGEN
1423#endif
1424#if IS_USED(MODULE_L3GXXXX_SPI) || DOXYGEN
1426#endif
1427 };
1429
1433typedef struct {
1441 uint8_t hpf_cutoff;
1443#if IS_USED(MODULE_L3GXXXX_FIFO) || DOXYGEN
1446#endif
1447
1448#if IS_USED(MODULE_L3GXXXX_IRQ_DATA) || DOXYGEN
1449 gpio_t int2_pin;
1451#endif
1452
1453#if IS_USED(MODULE_L3GXXXX_IRQ_EVENT) || DOXYGEN
1455 gpio_t int1_pin;
1457#endif
1458
1460
1475
1494int l3gxxxx_init(l3gxxxx_t *dev, const l3gxxxx_params_t *params);
1495
1496#if IS_USED(MODULE_L3GXXXX_CONFIG) || DOXYGEN
1512 l3gxxxx_odr_t odr, bool x, bool y, bool z);
1513
1526
1527#endif /* IS_USED(MODULE_L3GXXXX_CONFIG) || DOXYGEN */
1547
1560
1561#if IS_USED(MODULE_L3GXXXX_SLEEP) || DOXYGEN
1577
1593
1594#endif /* IS_USED(MODULE_L3GXXXX_SLEEP) || DOXYGEN */
1619
1646
1662
1665#if IS_USED(MODULE_L3GXXXX_FIFO) || DOXYGEN
1666
1672#if IS_USED(MODULE_L3GXXXX_CONFIG) || DOXYGEN
1699 l3gxxxx_fifo_mode_t mode, uint8_t watermark);
1700
1701#endif /* IS_USED(MODULE_L3GXXXX_CONFIG) || DOXYGEN */
1702
1722 l3gxxxx_data_fifo_t data);
1723
1741
1742#endif /* IS_USED(MODULE_L3GXXXX_FIFO) || DOXYGEN */
1745#if IS_USED(MODULE_L3GXXXX_CONFIG) || DOXYGEN
1773 l3gxxxx_filter_sel_t filter);
1774
1808 l3gxxxx_hpf_mode_t mode, uint8_t cutoff);
1809
1825int l3gxxxx_set_hpf_ref(const l3gxxxx_t *dev, int8_t ref);
1826
1841int l3gxxxx_get_hpf_ref(const l3gxxxx_t *dev, int8_t *ref);
1842
1843#endif /* IS_USED(MODULE_L3GXXXX_CONFIG) || DOXYGEN */
1846#if IS_USED(MODULE_L3GXXXX_IRQ) || DOXYGEN
1874 l3gxxxx_int_types_t mask, bool enable);
1875
1899
1900#if IS_USED(MODULE_L3GXXXX_IRQ_EVENT) || DOXYGEN
1923 const l3gxxxx_int_event_cfg_t *cfg);
1924
1925#if IS_USED(MODULE_L3GXXXX_CONFIG) || DOXYGEN
1944
1945#endif /* IS_USED(MODULE_L3GXXXX_CONFIG) || DOXYGEN */
1946#endif /* IS_USED(MODULE_L3GXXXX_IRQ_EVENT) || DOXYGEN */
1947
1950#endif /* IS_USED(MODULE_L3GXXXX_IRQ) || DOXYGEN */
1951
1973 uint8_t reg, const uint8_t *data, uint8_t len);
1974
1991 uint8_t reg, uint8_t *data, uint8_t len);
1994#ifdef __cplusplus
1995}
1996#endif
1997
1998#endif /* L3GXXXX_H */
spi_clk_t
Definition periph_cpu.h:352
Low-level GPIO peripheral driver interface definitions.
int l3gxxxx_set_mode(l3gxxxx_t *dev, l3gxxxx_odr_t odr, bool x, bool y, bool z)
Set sensor mode.
int l3gxxxx_reg_write(const l3gxxxx_t *dev, uint8_t reg, const uint8_t *data, uint8_t len)
Direct write to register.
int l3gxxxx_read(const l3gxxxx_t *dev, l3gxxxx_data_t *data)
Read last sample of angular rates in millidegree per second (mpds)
l3gxxxx_int_types_t
Interrupt types.
Definition l3gxxxx.h:1222
int l3gxxxx_data_ready(const l3gxxxx_t *dev)
Data ready status function.
l3gxxxx_int_pin_level_t
INT1, INT2/DRDY sensor signal activity level
Definition l3gxxxx.h:1341
int l3gxxxx_read_raw_fifo(const l3gxxxx_t *dev, l3gxxxx_raw_data_fifo_t raw)
Get all samples of raw output data stored in the FIFO.
int l3gxxxx_power_up(l3gxxxx_t *dev)
Power up the sensor.
int l3gxxxx_select_output_filter(l3gxxxx_t *dev, l3gxxxx_filter_sel_t filter)
Filter selection for raw output data.
l3gxxxx_hpf_mode_t
HPF (high pass filter) modes.
Definition l3gxxxx.h:1201
int l3gxxxx_enable_int(const l3gxxxx_t *dev, l3gxxxx_int_types_t mask, bool enable)
Enable or disable event and/or data interrupts on signal INT1 and INT2/DRDY
l3gxxxx_filter_sel_t
High pass filter (HPF) and low pass filter 2 (LPF2) selection.
Definition l3gxxxx.h:1189
l3gxxxx_scale_t
Full scale in degrees per second (dps)
Definition l3gxxxx.h:1100
int l3gxxxx_init(l3gxxxx_t *dev, const l3gxxxx_params_t *params)
Initialize the L3Gxxxx sensor device.
int l3gxxxx_reg_read(const l3gxxxx_t *dev, uint8_t reg, uint8_t *data, uint8_t len)
Direct read from register.
l3gxxxx_data_t l3gxxxx_data_fifo_t[32]
Angular rates FIFO type.
Definition l3gxxxx.h:1380
int l3gxxxx_sleep(l3gxxxx_t *dev)
Sleep mode.
int l3gxxxx_set_int_event_cfg(const l3gxxxx_t *dev, const l3gxxxx_int_event_cfg_t *cfg)
Set new configuration for event interrupt generation.
l3gxxxx_fifo_mode_t
FIFO mode.
Definition l3gxxxx.h:1112
int l3gxxxx_set_hpf_ref(const l3gxxxx_t *dev, int8_t ref)
Set HPF (high pass filter) reference.
l3gxxxx_int_src_t l3gxxxx_wait_int(l3gxxxx_t *dev)
Wait for event and/or data interrupts on signals INT1 and INT2/DRDY
int l3gxxxx_read_fifo(const l3gxxxx_t *dev, l3gxxxx_data_fifo_t data)
Get all samples of angular rates stored in the FIFO (unit mdps)
int l3gxxxx_config_hpf(const l3gxxxx_t *dev, l3gxxxx_hpf_mode_t mode, uint8_t cutoff)
Config HPF (high pass filter) for output data.
l3gxxxx_if_t
L3Gxxxx interface types.
Definition l3gxxxx.h:1385
l3gxxxx_int_pin_type_t
INT1, INT2/DRDY sensor signal type
Definition l3gxxxx.h:1349
int l3gxxxx_power_down(l3gxxxx_t *dev)
Power down the sensor.
int l3gxxxx_read_raw(const l3gxxxx_t *dev, l3gxxxx_raw_data_t *raw)
Read last sample of raw output data as 16 bit two's complements.
int l3gxxxx_get_hpf_ref(const l3gxxxx_t *dev, int8_t *ref)
Get HPF (high pass filter) reference.
int l3gxxxx_set_fifo_mode(l3gxxxx_t *dev, l3gxxxx_fifo_mode_t mode, uint8_t watermark)
Set FIFO mode and watermark level (threshold)
l3gxxxx_raw_data_t l3gxxxx_raw_data_fifo_t[32]
Raw output data FIFO type.
Definition l3gxxxx.h:1375
l3gxxxx_error_codes_t
Definition of error codes.
Definition l3gxxxx.h:1008
int l3gxxxx_wake_up(l3gxxxx_t *dev)
Wake-up the sensor.
l3gxxxx_odr_t
Sensor output data rates (ODR) and LPF2 cutoff frequencies.
Definition l3gxxxx.h:1068
int l3gxxxx_get_int_event_cfg(const l3gxxxx_t *dev, l3gxxxx_int_event_cfg_t *cfg)
Get current configuration of event interrupt generation.
int l3gxxxx_set_scale(l3gxxxx_t *dev, l3gxxxx_scale_t scale)
Set full scale.
@ L3GXXXX_INT_FIFO_OVERRUN
Data interrupt on signal INT2/DRDY: FIFO is completely filled.
Definition l3gxxxx.h:1235
@ L3GXXXX_INT_EVENT
Event interrupt on signal INT1: Angular rate of one or more axes is lower or higher than the configur...
Definition l3gxxxx.h:1244
@ L3GXXXX_INT_FIFO_EMPTY
Data interrupt on signal INT2/DRDY: FIFO becomes empty.
Definition l3gxxxx.h:1239
@ L3GXXXX_INT_DATA_READY
Data interrupt on signal INT2/DRDY: Output data are ready to be read.
Definition l3gxxxx.h:1226
@ L3GXXXX_INT_FIFO_WATERMARK
Data interrupt on signal INT2/DRDY: FIFO filling exceeds the watermark level (threshold)
Definition l3gxxxx.h:1231
@ L3GXXXX_HIGH
INT signals are High active (default)
Definition l3gxxxx.h:1342
@ L3GXXXX_LOW
INT signals are Low active.
Definition l3gxxxx.h:1343
@ L3GXXXX_HPF_AUTORESET
Autoreset mode, HPF is automatically reset when a configured event interrupt occurs.
Definition l3gxxxx.h:1206
@ L3GXXXX_HPF_REFERENCE
Reference mode, output data are the difference to the REFERENCE register.
Definition l3gxxxx.h:1204
@ L3GXXXX_HPF_NORMAL
Normal mode, HPF is reset by reading the REFERENCE register.
Definition l3gxxxx.h:1202
@ L3GXXXX_NO_FILTER
HPF not used, LPF2 not used (default)
Definition l3gxxxx.h:1190
@ L3GXXXX_HPF_ONLY
HPF used, LPF2 not used.
Definition l3gxxxx.h:1191
@ L3GXXXX_HPF_AND_LPF2
HPF used, LPF2 used.
Definition l3gxxxx.h:1193
@ L3GXXXX_LPF2_ONLY
HPF not used, LPF2 used.
Definition l3gxxxx.h:1192
@ L3GXXXX_SCALE_2000_DPS
2000 dps
Definition l3gxxxx.h:1103
@ L3GXXXX_SCALE_245_DPS
245 dps (default)
Definition l3gxxxx.h:1101
@ L3GXXXX_SCALE_500_DPS
500 dps
Definition l3gxxxx.h:1102
@ L3GXXXX_STREAM_TO_FIFO
FIFO is used in Stream mode until an interrupt, switches then to FIFO mode (L3GD20H and L3GD20 only)
Definition l3gxxxx.h:1120
@ L3GXXXX_STREAM
FIFO is used as ring buffer and newest data samples are stored continuously.
Definition l3gxxxx.h:1117
@ L3GXXXX_DYNAMIC_STREAM
like Stream mode, but differs in reading the first data sample after emptying (L3GD20H only)
Definition l3gxxxx.h:1128
@ L3GXXXX_BYPASS_TO_FIFO
FIFO is not used until an interrupt, switches then to FIFO mode (L3GD20H only)
Definition l3gxxxx.h:1131
@ L3GXXXX_BYPASS
FIFO is not used (default)
Definition l3gxxxx.h:1113
@ L3GXXXX_BYPASS_TO_STREAM
FIFO is not used until an interrupt, switches then to Stream mode (L3GD20H and L3GD20 only)
Definition l3gxxxx.h:1123
@ L3GXXXX_FIFO
Data samples are stored in the FIFO until it is full.
Definition l3gxxxx.h:1115
@ L3GXXXX_SPI
SPI interface used.
Definition l3gxxxx.h:1390
@ L3GXXXX_I2C
I2C interface used.
Definition l3gxxxx.h:1387
@ L3GXXXX_OPEN_DRAIN
INT pins are open-drain.
Definition l3gxxxx.h:1351
@ L3GXXXX_PUSH_PULL
INT pins are push/pull outputs (default)
Definition l3gxxxx.h:1350
@ L3GXXXX_ERROR_BYPASS_MODE
sensor is in bypass mode
Definition l3gxxxx.h:1022
@ L3GXXXX_ERROR_I2C
I2C communication error.
Definition l3gxxxx.h:1010
@ L3GXXXX_ERROR_INV_INT_TYPE
invalid interrupt type used
Definition l3gxxxx.h:1016
@ L3GXXXX_ERROR_WRONG_CHIP_ID
wrong chip id read from WHO_AM_I reg
Definition l3gxxxx.h:1012
@ L3GXXXX_ERROR_RAW_DATA_FIFO
reading raw output data from FIFO failed
Definition l3gxxxx.h:1019
@ L3GXXXX_ERROR_SPI
SPI communication error.
Definition l3gxxxx.h:1011
@ L3GXXXX_ERROR_NO_INT1_PIN
INT1 signal pin not configured
Definition l3gxxxx.h:1020
@ L3GXXXX_ERROR_INV_MODE
sensor mode is invalid or not available
Definition l3gxxxx.h:1014
@ L3GXXXX_ERROR_FIFO_MODE
sensor is in FIFO mode
Definition l3gxxxx.h:1023
@ L3GXXXX_ERROR_INV_DEV
invalid device type used
Definition l3gxxxx.h:1013
@ L3GXXXX_OK
success
Definition l3gxxxx.h:1009
@ L3GXXXX_ERROR_NO_INT2_PIN
INT2/DRDY signal pin not configured
Definition l3gxxxx.h:1021
@ L3GXXXX_ERROR_RAW_DATA
reading raw output data failed
Definition l3gxxxx.h:1018
@ L3GXXXX_ERROR_INV_FIFO_MODE
FIFO mode is invalid or not available.
Definition l3gxxxx.h:1015
@ L3GXXXX_ERROR_NO_NEW_DATA
no new data are available
Definition l3gxxxx.h:1017
@ L3GXXXX_ODR_800_35
High ODR 400 Hz, LPF1 cutoff 211 Hz, LPF2 cutoff 35 Hz.
Definition l3gxxxx.h:1080
@ L3GXXXX_ODR_400_110
High ODR 400 Hz, LPF1 cutoff 128 Hz, LPF2 cutoff 110 Hz.
Definition l3gxxxx.h:1078
@ L3GXXXX_ODR_50
Low ODR 50 Hz, LPF1 cutoff 16 Hz, LPF2 cutoff 16.6 Hz.
Definition l3gxxxx.h:1086
@ L3GXXXX_ODR_800_50
High ODR 400 Hz, LPF1 cutoff 211 Hz, LPF2 cutoff 50 Hz.
Definition l3gxxxx.h:1081
@ L3GXXXX_ODR_200_12
High ODR 200 Hz, LPF1 cutoff 63.3 Hz, LPF2 cutoff 12.5 Hz.
Definition l3gxxxx.h:1071
@ L3GXXXX_ODR_800_30
High ODR 400 Hz, LPF1 cutoff 211 Hz, LPF2 cutoff 30 Hz.
Definition l3gxxxx.h:1079
@ L3GXXXX_ODR_200_70
High ODR 200 Hz, LPF1 cutoff 63.3 Hz, LPF2 cutoff 70 Hz.
Definition l3gxxxx.h:1074
@ L3GXXXX_ODR_400_25
High ODR 400 Hz, LPF1 cutoff 128 Hz, LPF2 cutoff 25 Hz.
Definition l3gxxxx.h:1076
@ L3GXXXX_ODR_400_20
High ODR 400 Hz, LPF1 cutoff 128 Hz, LPF2 cutoff 20 Hz.
Definition l3gxxxx.h:1075
@ L3GXXXX_ODR_100_12
High ODR 100 Hz, LPF1 cutoff 32 Hz, LPF2 cutoff 12.5 Hz.
Definition l3gxxxx.h:1069
@ L3GXXXX_ODR_12
Low ODR 12.5 Hz, LPF1 cutoff 3.9 Hz, LPF2 not used.
Definition l3gxxxx.h:1084
@ L3GXXXX_ODR_200_50
High ODR 200 Hz, LPF1 cutoff 63.3 Hz, LPF2 cutoff 50 Hz.
Definition l3gxxxx.h:1073
@ L3GXXXX_ODR_800_100
High ODR 400 Hz, LPF1 cutoff 211 Hz, LPF2 cutoff 100 Hz.
Definition l3gxxxx.h:1082
@ L3GXXXX_ODR_200_25
High ODR 200 Hz, LPF1 cutoff 63.3 Hz, LPF2 cutoff 25 Hz.
Definition l3gxxxx.h:1072
@ L3GXXXX_ODR_25
Low ODR 25 Hz, LPF1 cutoff 7.8 Hz, LPF2 not used.
Definition l3gxxxx.h:1085
@ L3GXXXX_ODR_400_50
High ODR 400 Hz, LPF1 cutoff 128 Hz, LPF2 cutoff 50 Hz.
Definition l3gxxxx.h:1077
@ L3GXXXX_ODR_100_25
High ODR 100 Hz, LPF1 cutoff 32 Hz, LPF2 cutoff 25 Hz.
Definition l3gxxxx.h:1070
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:151
Low-level I2C peripheral driver interface definition.
Register definitions for ST L3Gxxxx 3-axis gyroscope sensor family.
#define L3GXXXX_INT2_WTM
L3GXXXX_REG_CTRL3<2>
#define L3GXXXX_INT2_ORUN
L3GXXXX_REG_CTRL3<1>
#define L3GXXXX_INT2_EMPTY
L3GXXXX_REG_CTRL3<0>
#define L3GXXXX_INT2_DRDY
L3GXXXX_REG_CTRL3<3>
#define L3GXXXX_INT1_IG
L3GXXXX_REG_CTRL3<7>
Mutex for thread synchronization.
Low-level SPI peripheral driver interface definition.
Angular rates in millidegrees per seconds (mdps)
Definition l3gxxxx.h:1366
int32_t z
Z angular rate (yaw)
Definition l3gxxxx.h:1369
int32_t y
Y angular rate (pitch)
Definition l3gxxxx.h:1368
int32_t x
X angular rate (roll)
Definition l3gxxxx.h:1367
L3Gxxxx I2C interface parameters.
Definition l3gxxxx.h:1398
i2c_t dev
I2C device used.
Definition l3gxxxx.h:1399
uint8_t addr
I2C slave address.
Definition l3gxxxx.h:1400
L3Gxxxx Hardware interface parameters union.
Definition l3gxxxx.h:1418
l3gxxxx_spi_params_t spi
SPI interface parameters.
Definition l3gxxxx.h:1425
l3gxxxx_i2c_params_t i2c
I2C interface parameters.
Definition l3gxxxx.h:1422
l3gxxxx_if_t type
I2C/SPI interface type selector.
Definition l3gxxxx.h:1419
Event interrupt generator configuration (axis movement and wake-up)
Definition l3gxxxx.h:1263
bool y_low_enabled
Interrupt enabled for |Y| < Y threshold (Y low event)
Definition l3gxxxx.h:1271
bool counter_mode
DCRM is not documented and not used therefore.
Definition l3gxxxx.h:1290
bool z_high_enabled
Interrupt enabled for |Z| > Z threshold (Y high event)
Definition l3gxxxx.h:1275
uint16_t x_threshold
X threshold value in full scale / INT16_MAX.
Definition l3gxxxx.h:1264
bool x_high_enabled
Interrupt enabled for |X| > X threshold (X high event)
Definition l3gxxxx.h:1269
l3gxxxx_filter_sel_t filter
HPF and LPF2 filter selection used for threshold comparison.
Definition l3gxxxx.h:1277
bool y_high_enabled
Interrupt enabled for |Y| > Y threshold (Y high event)
Definition l3gxxxx.h:1272
bool latch
Latch the interrupt when true until the interrupt source has been read by function l3gxxxx_wait_int.
Definition l3gxxxx.h:1283
bool and_or
Combination of interrupt events (true=AND, false=OR): AND - all enabled axes passed their thresholds...
Definition l3gxxxx.h:1280
uint16_t z_threshold
Z threshold value in full scale / INT16_MAX.
Definition l3gxxxx.h:1266
bool wait
When true, duration is also used when interrupt condition in no longer given before interrupt signal ...
Definition l3gxxxx.h:1287
bool z_low_enabled
Interrupt enabled for |Z| < Z threshold (Z low event)
Definition l3gxxxx.h:1274
uint16_t y_threshold
Y threshold value in full scale / INT16_MAX.
Definition l3gxxxx.h:1265
uint8_t duration
Duration in 1/ODR an interrupt condition has to be given before the interrupt is generated.
Definition l3gxxxx.h:1285
bool x_low_enabled
Interrupt enabled for |X| < X threshold (X low event)
Definition l3gxxxx.h:1268
Composite type for all possible interrupt sources.
Definition l3gxxxx.h:1333
l3gxxxx_int_data_src_t data
data interrupt sources
Definition l3gxxxx.h:1335
l3gxxxx_int_event_src_t event
event interrupt sources
Definition l3gxxxx.h:1334
L3Gxxxx device initialization parameters.
Definition l3gxxxx.h:1433
gpio_t int1_pin
MCU GPIO pin for event interrupts on signal INT1
Definition l3gxxxx.h:1455
uint8_t hpf_cutoff
HPF cutoff frequency 0..9, see l3gxxxx_config_hpf for details.
Definition l3gxxxx.h:1441
gpio_t int2_pin
MCU GPIO pin for data interrupts on signal INT2/DRDY pin.
Definition l3gxxxx.h:1449
uint8_t fifo_watermark
FIFO watermark setting 0..31.
Definition l3gxxxx.h:1445
l3gxxxx_scale_t scale
Full scale.
Definition l3gxxxx.h:1437
l3gxxxx_if_params_t if_params
Interface parameters (I2C/SPI)
Definition l3gxxxx.h:1434
l3gxxxx_fifo_mode_t fifo_mode
FIFO operation mode.
Definition l3gxxxx.h:1444
l3gxxxx_filter_sel_t filter_sel
HPF/LPF2 filter selection.
Definition l3gxxxx.h:1439
l3gxxxx_int_event_cfg_t int1_cfg
event interrupt parameters
Definition l3gxxxx.h:1454
l3gxxxx_odr_t odr
ODR and LPF2 cutoff frequency.
Definition l3gxxxx.h:1436
l3gxxxx_hpf_mode_t hpf_mode
HPF mode.
Definition l3gxxxx.h:1440
Raw output data set as two's complements.
Definition l3gxxxx.h:1357
int16_t z
Z angular rate (yaw) as 16 bit two's complements.
Definition l3gxxxx.h:1360
int16_t x
X angular rate (roll) as 16 bit two's complements.
Definition l3gxxxx.h:1358
int16_t y
Y angular rate (pitch) as 16 bit two's complements.
Definition l3gxxxx.h:1359
L3Gxxxx SPI interface parameters.
Definition l3gxxxx.h:1408
spi_t dev
SPI device used.
Definition l3gxxxx.h:1409
spi_clk_t clk
SPI clock speed.
Definition l3gxxxx.h:1410
gpio_t cs
SPI chip Select pin.
Definition l3gxxxx.h:1411
L3Gxxxx sensor device data structure type.
Definition l3gxxxx.h:1464
mutex_t int_lock
Used to lock the calling thread while waiting for an interrupt.
Definition l3gxxxx.h:1467
l3gxxxx_int_types_t int_type
Type of the last interrupt triggered.
Definition l3gxxxx.h:1466
l3gxxxx_params_t params
Device initialization parameters.
Definition l3gxxxx.h:1465
@ L3GD20H
Sensor detected at runtime.
Definition l3gxxxx.h:1470
@ L3GD20
L3GD20 detected.
Definition l3gxxxx.h:1471
Mutex structure.
Definition mutex.h:146
Data interrupt sources (data ready and FIFO status)
Definition l3gxxxx.h:1314
uint8_t fifo_empty
true when FIFO is empty
Definition l3gxxxx.h:1316
uint8_t fifo_overrun
true when FIFO is completely filled
Definition l3gxxxx.h:1317
uint8_t unused
not used
Definition l3gxxxx.h:1320
uint8_t val
data interrupt sources as value that can be used for bitwise operations
Definition l3gxxxx.h:1322
uint8_t fifo_watermark
true when FIFO filling > watermark
Definition l3gxxxx.h:1318
uint8_t data_ready
true when data are ready to read
Definition l3gxxxx.h:1319
Event interrupt sources (axis movement and wake-up)
Definition l3gxxxx.h:1296
uint8_t y_low
true on |Y| < Y threshold (Y low event)
Definition l3gxxxx.h:1300
uint8_t y_high
true on |Y| > Y threshold (Y high event)
Definition l3gxxxx.h:1301
uint8_t z_low
true on |Z| < Z threshold (Z low event)
Definition l3gxxxx.h:1302
uint8_t val
event interrupt sources as value that can be used for bitwise operations
Definition l3gxxxx.h:1307
uint8_t x_low
true on |X| < X threshold (X low event)
Definition l3gxxxx.h:1298
uint8_t z_high
true on |Z| > Z threshold (Z high event)
Definition l3gxxxx.h:1303
uint8_t x_high
true on |X| > X threshold (X high event)
Definition l3gxxxx.h:1299
uint8_t active
true when one or more events have been generated
Definition l3gxxxx.h:1304
uint8_t unused
not used
Definition l3gxxxx.h:1305