Loading...
Searching...
No Matches
lis2dh12_params.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 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
19#ifndef LIS2DH12_PARAMS_H
20#define LIS2DH12_PARAMS_H
21
22#include "board.h"
23#include "lis2dh12.h"
24#include "saul_reg.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
34#ifdef MODULE_LIS2DH12_SPI /* default configuration for SPI mode */
35#ifndef LIS2DH12_PARAM_SPI
36#define LIS2DH12_PARAM_SPI SPI_DEV(0)
37#endif
38#ifndef LIS2DH12_PARAM_CS
39#define LIS2DH12_PARAM_CS GPIO_PIN(0, 0)
40#endif
41#define LIS2DH12_PARAMS_BUSCFG .spi = LIS2DH12_PARAM_SPI, \
42 .cs = LIS2DH12_PARAM_CS
43
44#else /* default configuration for I2C mode */
45#ifndef LIS2DH12_PARAM_I2C
46#define LIS2DH12_PARAM_I2C I2C_DEV(0)
47#endif
48#ifndef LIS2DH12_PARAM_ADDR
49#define LIS2DH12_PARAM_ADDR LIS2DH12_ADDR_DEFAULT
50#endif
51#define LIS2DH12_PARAMS_BUSCFG .i2c = LIS2DH12_PARAM_I2C, \
52 .addr = LIS2DH12_PARAM_ADDR
53
54#endif
55
56#ifndef LIS2DH12_PARAM_INT_PIN1
57#define LIS2DH12_PARAM_INT_PIN1 GPIO_UNDEF
58#endif
59
60#ifndef LIS2DH12_PARAM_INT_PIN2
61#define LIS2DH12_PARAM_INT_PIN2 GPIO_UNDEF
62#endif
63
64#ifndef LIS2DH12_PARAM_SCALE
65#define LIS2DH12_PARAM_SCALE LIS2DH12_SCALE_2G
66#endif
67#ifndef LIS2DH12_PARAM_RATE
68#define LIS2DH12_PARAM_RATE LIS2DH12_RATE_100HZ
69#endif
70#ifndef LIS2DH12_PARAM_RESOLUTION
71#define LIS2DH12_PARAM_RESOLUTION LIS2DH12_POWER_NORMAL
72#endif
73
74#ifndef LIS2DH12_PARAMS
75#ifdef MODULE_LIS2DH12_INT
76#define LIS2DH12_PARAMS { \
77 LIS2DH12_PARAMS_BUSCFG, \
78 .int1_pin = LIS2DH12_PARAM_INT_PIN1, \
79 .int2_pin = LIS2DH12_PARAM_INT_PIN2, \
80 .scale = LIS2DH12_PARAM_SCALE, \
81 .rate = LIS2DH12_PARAM_RATE, \
82 .resolution = LIS2DH12_PARAM_RESOLUTION, \
83 }
84#else /* MODULE_LIS2DH12_INT */
85#define LIS2DH12_PARAMS { \
86 LIS2DH12_PARAMS_BUSCFG, \
87 .scale = LIS2DH12_PARAM_SCALE, \
88 .rate = LIS2DH12_PARAM_RATE, \
89 .resolution = LIS2DH12_PARAM_RESOLUTION, \
90 }
91#endif /* MODULE_LIS2DH12_INT */
92#endif /* LIS2DH12_PARAMS */
93
94#ifndef LIS2DH12_SAULINFO
95#define LIS2DH12_SAULINFO { .name = "lis2dh12" }
96#endif
103{
104 LIS2DH12_PARAMS
105};
106
111{
112 LIS2DH12_SAULINFO
113};
114
115#ifdef __cplusplus
116}
117#endif
118
119#endif /* LIS2DH12_PARAMS_H */
Interface definition for the STM LIS2DH12 accelerometer.
static const lis2dh12_params_t lis2dh12_params[]
LIS2DH12 configuration.
static const saul_reg_info_t lis2dh12_saul_info[]
Additional meta information to keep in the SAUL registry.
SAUL registry interface definition.
LIS2DH12 configuration parameters.
Definition lis2dh12.h:111
Additional data to collect for each entry.
Definition saul_reg.h:49