From 232b8eb2a5a7a697fa543287ea9c9311fc8e0215 Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 17 Jan 2017 11:34:16 +0100 Subject: [PATCH 1/3] drivers/bmp180: move SAUL config to params.h --- drivers/bmp180/include/bmp180_params.h | 18 +++++++++++++++--- sys/auto_init/saul/auto_init_bmp180.c | 17 ----------------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/drivers/bmp180/include/bmp180_params.h b/drivers/bmp180/include/bmp180_params.h index b69011830d..db9449207a 100644 --- a/drivers/bmp180/include/bmp180_params.h +++ b/drivers/bmp180/include/bmp180_params.h @@ -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 diff --git a/sys/auto_init/saul/auto_init_bmp180.c b/sys/auto_init/saul/auto_init_bmp180.c index d921c65cec..1a593657ac 100644 --- a/sys/auto_init/saul/auto_init_bmp180.c +++ b/sys/auto_init/saul/auto_init_bmp180.c @@ -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++) { From 13942225eb14ce714d67f07263452989a5239e4e Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 17 Jan 2017 11:34:55 +0100 Subject: [PATCH 2/3] drivers/jc42: move SAUL config to params.h --- drivers/jc42/include/jc42_params.h | 18 ++++++++++++++---- sys/auto_init/saul/auto_init_jc42.c | 11 ----------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/jc42/include/jc42_params.h b/drivers/jc42/include/jc42_params.h index 687ea72b2b..ffdbb155ba 100644 --- a/drivers/jc42/include/jc42_params.h +++ b/drivers/jc42/include/jc42_params.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 Koen Zandberg + * 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 + * @author Hauke Petersen */ #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 diff --git a/sys/auto_init/saul/auto_init_jc42.c b/sys/auto_init/saul/auto_init_jc42.c index d2cab3f4cc..cdcbbd9c43 100644 --- a/sys/auto_init/saul/auto_init_jc42.c +++ b/sys/auto_init/saul/auto_init_jc42.c @@ -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++) { From 9ad5d48065282bf85e9b5053c4d7daab7669dfeb Mon Sep 17 00:00:00 2001 From: Hauke Petersen Date: Tue, 17 Jan 2017 11:35:24 +0100 Subject: [PATCH 3/3] drivers/si70xx: move SAUL config to params.h --- drivers/si70xx/include/si70xx_params.h | 21 ++++++++++++++++++--- sys/auto_init/saul/auto_init_si70xx.c | 19 +------------------ 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/drivers/si70xx/include/si70xx_params.h b/drivers/si70xx/include/si70xx_params.h index 1aa03df3ca..2d5f55940b 100644 --- a/drivers/si70xx/include/si70xx_params.h +++ b/drivers/si70xx/include/si70xx_params.h @@ -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 + * @author Hauke Petersen */ #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 diff --git a/sys/auto_init/saul/auto_init_si70xx.c b/sys/auto_init/saul/auto_init_si70xx.c index c48f6f44a0..4fd7effda3 100644 --- a/sys/auto_init/saul/auto_init_si70xx.c +++ b/sys/auto_init/saul/auto_init_si70xx.c @@ -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; }