Merge pull request #8684 from aabadie/pr/drivers/params/mma8x5x

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

View File

@ -51,13 +51,16 @@ extern "C" {
#endif
#ifndef MMA8X5X_PARAMS
#define MMA8X5X_PARAMS { .i2c = MMA8X5X_PARAM_I2C, \
.addr = MMA8X5X_PARAM_ADDR, \
.type = MMA8X5X_PARAM_TYPE, \
.rate = MMA8X5X_PARAM_RATE, \
#define MMA8X5X_PARAMS { .i2c = MMA8X5X_PARAM_I2C, \
.addr = MMA8X5X_PARAM_ADDR, \
.type = MMA8X5X_PARAM_TYPE, \
.rate = MMA8X5X_PARAM_RATE, \
.range = MMA8X5X_PARAM_RANGE, \
.offset = MMA8X5X_PARAM_OFFSET }
#endif
#ifndef MMA8X5X_SAUL_INFO
#define MMA8X5X_SAUL_INFO { .name = "mma8652" }
#endif
/**@}*/
/**
@ -73,9 +76,7 @@ static const mma8x5x_params_t mma8x5x_params[] =
*/
static const saul_reg_info_t mma8x5x_saul_info[] =
{
{
.name = "mma8652"
}
MMA8X5X_SAUL_INFO
};
#ifdef __cplusplus

View File

@ -42,15 +42,20 @@ static mma8x5x_t mma8x5x_devs[MMA8X5X_NUM];
*/
static saul_reg_t saul_entries[MMA8X5X_NUM];
/**
* @brief Define the number of saul info
*/
#define MMA8X5X_INFO_NUM (sizeof(mma8x5x_saul_info) / sizeof(mma8x5x_saul_info[0]))
/**
* @brief Reference the driver struct
* @{
*/
extern saul_driver_t mma8x5x_saul_driver;
/** @} */
void auto_init_mma8x5x(void)
{
assert(MMA8X5X_NUM == MMA8X5X_INFO_NUM);
for (unsigned i = 0; i < MMA8X5X_NUM; i++) {
LOG_DEBUG("[auto_init_saul] initializing mma8x5x #%u\n", i);