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

@ -58,6 +58,9 @@ extern "C" {
.range = MMA8X5X_PARAM_RANGE, \ .range = MMA8X5X_PARAM_RANGE, \
.offset = MMA8X5X_PARAM_OFFSET } .offset = MMA8X5X_PARAM_OFFSET }
#endif #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[] = static const saul_reg_info_t mma8x5x_saul_info[] =
{ {
{ MMA8X5X_SAUL_INFO
.name = "mma8652"
}
}; };
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -42,15 +42,20 @@ static mma8x5x_t mma8x5x_devs[MMA8X5X_NUM];
*/ */
static saul_reg_t saul_entries[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 * @brief Reference the driver struct
* @{
*/ */
extern saul_driver_t mma8x5x_saul_driver; extern saul_driver_t mma8x5x_saul_driver;
/** @} */
void auto_init_mma8x5x(void) void auto_init_mma8x5x(void)
{ {
assert(MMA8X5X_NUM == MMA8X5X_INFO_NUM);
for (unsigned i = 0; i < MMA8X5X_NUM; i++) { for (unsigned i = 0; i < MMA8X5X_NUM; i++) {
LOG_DEBUG("[auto_init_saul] initializing mma8x5x #%u\n", i); LOG_DEBUG("[auto_init_saul] initializing mma8x5x #%u\n", i);