1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #6385 from haukepetersen/opt_drivers_saulconfigmove

drivers: move SAUL config to _params.h + minor fixes
This commit is contained in:
Peter Kietzmann 2017-01-18 09:01:52 +01:00 committed by GitHub
commit 6ac2ec1b83
6 changed files with 48 additions and 56 deletions

View File

@ -1,5 +1,6 @@
/*
* Copyright (C) 2016 Inria
* 2017 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -33,14 +34,14 @@ extern "C" {
* @{
*/
#ifndef BMP180_PARAM_I2C_DEV
#define BMP180_PARAM_I2C_DEV (0)
#define BMP180_PARAM_I2C_DEV I2C_DEV(0)
#endif
#ifndef BMP180_PARAM_MODE
#define BMP180_PARAM_MODE BMP180_ULTRALOWPOWER
#endif
#define BMP180_PARAMS_DEFAULT {.i2c_dev = BMP180_PARAM_I2C_DEV, \
.mode = BMP180_PARAM_MODE }
#define BMP180_PARAMS_DEFAULT { .i2c_dev = BMP180_PARAM_I2C_DEV, \
.mode = BMP180_PARAM_MODE }
/**@}*/
/**
@ -55,6 +56,17 @@ static const bmp180_params_t bmp180_params[] =
#endif
};
/**
* @brief Configure SAUL registry entries
*/
static const saul_reg_info_t bmp180_saul_reg_info[][2] =
{
{
{ .name = "bmp180-temp" },
{ .name = "bmp180-press" }
}
};
#ifdef __cplusplus
}
#endif

View File

@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 Koen Zandberg <koen@bergzand.net>
* 2017 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -14,6 +15,7 @@
* @brief Default configuration for jc42
*
* @author Koen Zandberg <koen@bergzand.net>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef JC42_PARAMS_H
@ -31,7 +33,7 @@ extern "C" {
* @{
*/
#ifndef JC42_PARAM_I2C_DEV
#define JC42_PARAM_I2C_DEV (0)
#define JC42_PARAM_I2C_DEV I2C_DEV(0)
#endif
#ifndef JC42_PARAM_ADDR
#define JC42_PARAM_ADDR (0x18)
@ -40,9 +42,9 @@ extern "C" {
#define JC42_PARAM_SPEED I2C_SPEED_FAST
#endif
#define JC42_PARAMS_DEFAULT {.i2c = JC42_PARAM_I2C_DEV, \
.speed = JC42_PARAM_SPEED, \
.addr = JC42_PARAM_ADDR }
#define JC42_PARAMS_DEFAULT { .i2c = JC42_PARAM_I2C_DEV, \
.speed = JC42_PARAM_SPEED, \
.addr = JC42_PARAM_ADDR }
/**@}*/
/**
@ -57,6 +59,14 @@ static const jc42_params_t jc42_params[] =
#endif
};
/**
* @brief Configure SAUL registry entries
*/
static const saul_reg_info_t jc42_saul_reg_info[] =
{
{ .name= "jc42" }
};
#ifdef __cplusplus
}
#endif

View File

@ -1,5 +1,6 @@
/*
* Copyright (C) 2017 Inria
* 2017 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
@ -14,12 +15,15 @@
* @brief Default configuration for Si7006/13/20/21
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
*/
#ifndef SI70XX_PARAMS_H
#define SI70XX_PARAMS_H
#include "board.h"
#include "si70xx.h"
#include "saul_reg.h"
#ifdef __cplusplus
extern "C" {
@ -30,14 +34,14 @@ extern "C" {
* @{
*/
#ifndef SI70XX_PARAM_I2C_DEV
#define SI70XX_PARAM_I2C_DEV (0)
#define SI70XX_PARAM_I2C_DEV I2C_DEV(0)
#endif
#ifndef SI70XX_PARAM_ADDR
#define SI70XX_PARAM_ADDR (0x80)
#endif
#define SI70XX_PARAMS_DEFAULT {.i2c_dev = SI70XX_PARAM_I2C_DEV, \
.address = SI70XX_PARAM_ADDR }
#define SI70XX_PARAMS_DEFAULT { .i2c_dev = SI70XX_PARAM_I2C_DEV, \
.address = SI70XX_PARAM_ADDR }
/**@}*/
/**
@ -52,6 +56,17 @@ static const si70xx_params_t si70xx_params[] =
#endif
};
/**
* @brief Configure SAUL registry entries
*/
static const saul_reg_info_t si70xx_saul_reg_info[][2] =
{
{
{ .name = "si70xx-temp" },
{ .name = "si70xx-hum" }
}
};
#ifdef __cplusplus
}
#endif

View File

@ -48,23 +48,6 @@ extern const saul_driver_t bmp180_temperature_saul_driver;
extern const saul_driver_t bmp180_pressure_saul_driver;
/** @} */
/**
* @brief Allocate and configure entries to the SAUL registry
*/
saul_reg_t bmp180_saul_reg_info[][2] =
{
{
{
.name= "bmp180-temp",
.driver = &bmp180_temperature_saul_driver
},
{
.name = "bmp180-press",
.driver = &bmp180_pressure_saul_driver
}
}
};
void auto_init_bmp180(void)
{
for (unsigned i = 0; i < BMP180_NUMOF; i++) {

View File

@ -48,17 +48,6 @@ static saul_reg_t saul_entries[JC42_NUMOF];
extern const saul_driver_t jc42_temperature_saul_driver;
/** @} */
/**
* @brief Allocate and configure entries to the SAUL registry
*/
saul_reg_t jc42_saul_reg_info[]=
{
{
.name= "jc42",
.driver = &jc42_temperature_saul_driver
}
};
void auto_init_jc42(void)
{
for (unsigned i = 0; i < JC42_NUMOF; i++) {

View File

@ -49,23 +49,6 @@ extern const saul_driver_t si70xx_temperature_saul_driver;
extern const saul_driver_t si70xx_relative_humidity_saul_driver;
/** @} */
/**
* @brief Allocate and configure entries to the SAUL registry
*/
saul_reg_t si70xx_saul_reg_info[][2] =
{
{
{
.name = "si70xx-temp",
.driver = &si70xx_temperature_saul_driver
},
{
.name = "si70xx-hum",
.driver = &si70xx_relative_humidity_saul_driver
}
}
};
void auto_init_si70xx(void)
{
for (unsigned i = 0; i < SI70XX_NUMOF; i++) {
@ -73,7 +56,7 @@ void auto_init_si70xx(void)
si70xx_params[i].i2c_dev,
si70xx_params[i].address);
if (res < 0) {
LOG_ERROR("Unable to initialize BMP180 sensor #%i\n", i);
LOG_ERROR("Unable to initialize SI70xx sensor #%i\n", i);
return;
}