From 1d5a67dcce3781472697d3a34a67b46320a40127 Mon Sep 17 00:00:00 2001 From: Kees Bakker Date: Thu, 3 Jan 2019 23:12:21 +0100 Subject: [PATCH] drivers/bh1750fvi: change prototype of bh1750fvi_init The params argument is now a const pointer. This eliminates the need for a type cast that converts a const to a non-const. --- drivers/bh1750fvi/bh1750fvi.c | 2 +- drivers/include/bh1750fvi.h | 2 +- tests/driver_bh1750/main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/bh1750fvi/bh1750fvi.c b/drivers/bh1750fvi/bh1750fvi.c index 9b1608e9c4..cbabaea01e 100644 --- a/drivers/bh1750fvi/bh1750fvi.c +++ b/drivers/bh1750fvi/bh1750fvi.c @@ -28,7 +28,7 @@ #define ENABLE_DEBUG (0) #include "debug.h" -int bh1750fvi_init(bh1750fvi_t *dev, bh1750fvi_params_t *params) +int bh1750fvi_init(bh1750fvi_t *dev, const bh1750fvi_params_t *params) { int res; diff --git a/drivers/include/bh1750fvi.h b/drivers/include/bh1750fvi.h index 8d0da67ffd..7c0ecdd9e3 100644 --- a/drivers/include/bh1750fvi.h +++ b/drivers/include/bh1750fvi.h @@ -80,7 +80,7 @@ typedef struct { * @return 0 on success * @return -1 if unable to speak to the device */ -int bh1750fvi_init(bh1750fvi_t *dev, bh1750fvi_params_t *params); +int bh1750fvi_init(bh1750fvi_t *dev, const bh1750fvi_params_t *params); /** * @brief Read a ambient light value from the given device [in LUX] diff --git a/tests/driver_bh1750/main.c b/tests/driver_bh1750/main.c index 471a885920..198ac1a8c5 100644 --- a/tests/driver_bh1750/main.c +++ b/tests/driver_bh1750/main.c @@ -35,7 +35,7 @@ int main(void) puts("BH1750FVI ambient light sensor test\n"); /* initialize the device */ - res = bh1750fvi_init(&dev, (bh1750fvi_params_t *)(&bh1750fvi_params)); + res = bh1750fvi_init(&dev, &bh1750fvi_params[0]); if (res != BH1750FVI_OK) { puts("error: unable to initialize sensor [I2C initialization error]"); return 1;