Merge pull request #8682 from aabadie/pr/drivers/params/tmp006

drivers/tmp006: apply unified params definition scheme
This commit is contained in:
Martine Lenders 2018-03-07 14:47:06 +01:00 committed by GitHub
commit 9ee91a6dd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 9 deletions

View File

@ -41,9 +41,14 @@ extern "C" {
#define TMP006_PARAM_RATE TMP006_CONFIG_CR_DEF
#endif
#define TMP006_PARAMS_DEFAULT { .i2c = TMP006_PARAM_I2C, \
.addr = TMP006_PARAM_ADDR, \
.rate = TMP006_PARAM_RATE }
#ifndef TMP006_PARAMS
#define TMP006_PARAMS { .i2c = TMP006_PARAM_I2C, \
.addr = TMP006_PARAM_ADDR, \
.rate = TMP006_PARAM_RATE }
#endif
#ifndef TMP006_SAUL_INFO
#define TMP006_SAUL_INFO { .name = "tmp006" }
#endif
/**@}*/
/**
@ -51,11 +56,7 @@ extern "C" {
*/
static const tmp006_params_t tmp006_params[] =
{
#ifdef TMP006_PARAMS_BOARD
TMP006_PARAMS_BOARD,
#else
TMP006_PARAMS_DEFAULT,
#endif
TMP006_PARAMS
};
/**
@ -63,7 +64,7 @@ static const tmp006_params_t tmp006_params[] =
*/
static const saul_reg_info_t tmp006_saul_info[] =
{
{ .name = "tmp006" }
TMP006_SAUL_INFO
};
#ifdef __cplusplus

View File

@ -42,6 +42,11 @@ static tmp006_t tmp006_devs[TMP006_NUM];
*/
static saul_reg_t saul_entries[TMP006_NUM];
/**
* @brief Define the number of saul info
*/
#define TMP006_INFO_NUM (sizeof(tmp006_saul_info) / sizeof(tmp006_saul_info[0]))
/**
* @brief Reference the driver struct
*/
@ -49,6 +54,8 @@ extern const saul_driver_t tmp006_saul_driver;
void auto_init_tmp006(void)
{
assert(TMP006_NUM == TMP006_INFO_NUM);
for (unsigned i = 0; i < TMP006_NUM; i++) {
LOG_DEBUG("[auto_init_saul] initializing tmp006 #%u\n", i);