Merge pull request #8671 from aabadie/pr/drivers/params/adxl345

drivers/adxl345: apply unified params definition scheme
This commit is contained in:
Martine Lenders 2018-03-07 13:48:14 +01:00 committed by GitHub
commit ade38468a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 6 deletions

View File

@ -62,6 +62,9 @@ extern "C" {
.rate = ADXL345_PARAM_RATE, \
.full_res = ADXL345_PARAM_FULL_RES }
#endif
#ifndef ADXL345_SAUL_INFO
#define ADXL345_SAUL_INFO { .name = "adxl345" }
#endif
/**@}*/
/**
@ -77,9 +80,7 @@ static const adxl345_params_t adxl345_params[] =
*/
static const saul_reg_info_t adxl345_saul_info[] =
{
{
.name = "adxl345"
}
ADXL345_SAUL_INFO
};
#ifdef __cplusplus

View File

@ -29,7 +29,7 @@
/**
* @brief Define the number of configured sensors
*/
#define ADXL345_NUM (sizeof(adxl345_params)/sizeof(adxl345_params[0]))
#define ADXL345_NUM (sizeof(adxl345_params) / sizeof(adxl345_params[0]))
/**
* @brief Allocate memory for the device descriptors
@ -41,15 +41,20 @@ static adxl345_t adxl345_devs[ADXL345_NUM];
*/
static saul_reg_t saul_entries[ADXL345_NUM];
/**
* @brief Define the number of saul info
*/
#define ADXL345_INFO_NUM (sizeof(adxl345_saul_info) / sizeof(adxl345_saul_info[0]))
/**
* @brief Reference the driver structs
* @{
*/
extern saul_driver_t adxl345_saul_driver;
/** @} */
void auto_init_adxl345(void)
{
assert(ADXL345_INFO_NUM == ADXL345_NUM);
for (unsigned i = 0; i < ADXL345_NUM; i++) {
LOG_DEBUG("[auto_init_saul] initializing adxl345 #%u\n", i);