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
27 extern "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 
71 #ifndef LIS2DH12_PARAMS
72 #ifdef MODULE_LIS2DH12_INT
73 #define LIS2DH12_PARAMS { \
74  LIS2DH12_PARAMS_BUSCFG, \
75  .int1_pin = LIS2DH12_PARAM_INT_PIN1, \
76  .int2_pin = LIS2DH12_PARAM_INT_PIN2, \
77  .scale = LIS2DH12_PARAM_SCALE, \
78  .rate = LIS2DH12_PARAM_RATE, \
79  }
80 #else /* MODULE_LIS2DH12_INT */
81 #define LIS2DH12_PARAMS { \
82  LIS2DH12_PARAMS_BUSCFG, \
83  .scale = LIS2DH12_PARAM_SCALE, \
84  .rate = LIS2DH12_PARAM_RATE, \
85  }
86 #endif /* MODULE_LIS2DH12_INT */
87 #endif /* LIS2DH12_PARAMS */
88 
89 #ifndef LIS2DH12_SAULINFO
90 #define LIS2DH12_SAULINFO { .name = "lis2dh12" }
91 #endif
92 
98 {
99  LIS2DH12_PARAMS
100 };
101 
106 {
107  LIS2DH12_SAULINFO
108 };
109 
110 #ifdef __cplusplus
111 }
112 #endif
113 
114 #endif /* LIS2DH12_PARAMS_H */
115 
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.
Additional data to collect for each entry.
Definition: saul_reg.h:49
SAUL registry interface definition.
Interface definition for the STM LIS2DH12 accelerometer.
LIS2DH12 configuration parameters.
Definition: lis2dh12.h:90