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_SCALE
57 #define LIS2DH12_PARAM_SCALE LIS2DH12_SCALE_2G
58 #endif
59 #ifndef LIS2DH12_PARAM_RATE
60 #define LIS2DH12_PARAM_RATE LIS2DH12_RATE_100HZ
61 #endif
62 
63 #ifndef LIS2DH12_PARAMS
64 #define LIS2DH12_PARAMS { LIS2DH12_PARAMS_BUSCFG, \
65  .scale = LIS2DH12_PARAM_SCALE, \
66  .rate = LIS2DH12_PARAM_RATE, }
67 #endif
68 
69 #ifndef LIS2DH12_SAULINFO
70 #define LIS2DH12_SAULINFO { .name = "lis2dh12" }
71 #endif
72 
78 {
79  LIS2DH12_PARAMS
80 };
81 
86 {
87  LIS2DH12_SAULINFO
88 };
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif /* LIS2DH12_PARAMS_H */
95 
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