bmx280_params.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Kees Bakker, SODAQ
3  * 2017 Inria
4  * 2018 Freie Universität Berlin
5  *
6  * This file is subject to the terms and conditions of the GNU Lesser
7  * General Public License v2.1. See the file LICENSE in the top level
8  * directory for more details.
9  */
10 
11 #pragma once
12 
25 #include "board.h"
26 #include "bmx280.h"
27 #include "saul_reg.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
37 #ifdef BMX280_USE_SPI
38 /* SPI configuration */
39 #ifndef BMX280_PARAM_SPI
40 #define BMX280_PARAM_SPI SPI_DEV(0)
41 #endif
42 #ifndef BMX280_PARAM_CLK
43 #define BMX280_PARAM_CLK SPI_CLK_5MHZ
44 #endif
45 #ifndef BMX280_PARAM_CS
46 #define BMX280_PARAM_CS GPIO_PIN(0, 0)
47 #endif
48 #else
49 /* I2C configuration */
50 #ifndef BMX280_PARAM_I2C_DEV
51 #define BMX280_PARAM_I2C_DEV I2C_DEV(0)
52 #endif
53 #ifndef BMX280_PARAM_I2C_ADDR
54 #define BMX280_PARAM_I2C_ADDR (0x77)
55 #endif
56 #endif
57 
58 #define BMX280_PARAM_MISC \
59  .t_sb = BMX280_SB_0_5, \
60  .filter = BMX280_FILTER_OFF, \
61  .run_mode = BMX280_MODE_FORCED, \
62  .temp_oversample = BMX280_OSRS_X1, \
63  .press_oversample = BMX280_OSRS_X1, \
64  .humid_oversample = BMX280_OSRS_X1, \
65 
66 /* Defaults for Weather Monitoring */
67 #ifndef BMX280_PARAMS
68 #ifdef BMX280_USE_SPI
69 #define BMX280_PARAMS \
70  { \
71  .spi = BMX280_PARAM_SPI, \
72  .clk = BMX280_PARAM_CLK, \
73  .cs = BMX280_PARAM_CS, \
74  BMX280_PARAM_MISC \
75  }
76 #else
77 #define BMX280_PARAMS \
78  { \
79  .i2c_dev = BMX280_PARAM_I2C_DEV, \
80  .i2c_addr = BMX280_PARAM_I2C_ADDR, \
81  BMX280_PARAM_MISC \
82  }
83 #endif
84 #endif
91 {
92  BMX280_PARAMS
93 };
94 
98 #define BMX280_NUMOF ARRAY_SIZE(bmx280_params)
99 
108 {
109 #if defined(MODULE_BME280_SPI) || defined(MODULE_BME280_I2C)
110  { .name = "bme280" }
111 #else
112  { .name = "bmp280" }
113 #endif
114 };
115 
116 #ifdef __cplusplus
117 }
118 #endif
119 
Device driver interface for the BMP280 and BME280 sensors.
static const saul_reg_info_t bmx280_saul_reg_info[BMX280_NUMOF]
Configuration details of SAUL registry entries.
static const bmx280_params_t bmx280_params[]
Configure BMX280.
Definition: bmx280_params.h:90
#define BMX280_NUMOF
The number of configured sensors.
Definition: bmx280_params.h:98
SAUL registry interface definition.
Parameters for the BMX280 sensor.
Definition: bmx280.h:182
Additional data to collect for each entry.
Definition: saul_reg.h:48
const char * name
string identifier for a device
Definition: saul_reg.h:49