From 946256d26f4cff5c88c625ea770fe60650506f5a Mon Sep 17 00:00:00 2001 From: smlng Date: Mon, 26 Jun 2017 16:00:34 +0200 Subject: [PATCH] saul: use const for device parameter --- drivers/adcxx1c/adcxx1c_saul.c | 4 ++-- drivers/adxl345/adxl345_saul.c | 5 ++--- drivers/bmp180/bmp180_saul.c | 12 ++++-------- drivers/bmx280/bmx280_saul.c | 18 ++++++------------ drivers/dht/dht_saul.c | 12 ++++-------- drivers/hdc1000/hdc1000_saul.c | 12 ++++-------- drivers/include/saul.h | 8 ++++---- drivers/io1_xplained/io1_xplained_saul.c | 5 ++--- drivers/isl29020/isl29020_saul.c | 5 ++--- drivers/jc42/jc42_saul.c | 5 ++--- drivers/l3g4200d/l3g4200d_saul.c | 5 ++--- drivers/lis3dh/lis3dh_saul.c | 5 ++--- drivers/lps331ap/lps331ap_saul.c | 5 ++--- drivers/lsm303dlhc/lsm303dlhc_saul.c | 9 +++++---- drivers/lsm6dsl/lsm6dsl_saul.c | 9 ++++----- drivers/mag3110/mag3110_saul.c | 4 ++-- drivers/mma8x5x/mma8x5x_saul.c | 4 ++-- drivers/saul/adc_saul.c | 2 +- drivers/saul/gpio_saul.c | 8 ++++---- drivers/saul/saul.c | 2 +- drivers/saul/saul_str.c | 2 +- drivers/si70xx/si70xx_saul.c | 12 ++++-------- drivers/tcs37727/tcs37727_saul.c | 5 ++--- drivers/tmp006/tmp006_saul.c | 5 +++-- drivers/tsl2561/tsl2561_saul.c | 6 ++---- drivers/veml6070/veml6070_saul.c | 6 ++---- 26 files changed, 71 insertions(+), 104 deletions(-) diff --git a/drivers/adcxx1c/adcxx1c_saul.c b/drivers/adcxx1c/adcxx1c_saul.c index a697de47f..775b4c7a5 100644 --- a/drivers/adcxx1c/adcxx1c_saul.c +++ b/drivers/adcxx1c/adcxx1c_saul.c @@ -24,9 +24,9 @@ #include "saul.h" #include "adcxx1c.h" -static int read_adc(void *dev, phydat_t *res) +static int read_adc(const void *dev, phydat_t *res) { - adcxx1c_read_raw((adcxx1c_t *)dev, res->val); + adcxx1c_read_raw((const adcxx1c_t *)dev, res->val); res->unit = UNIT_NONE; res->scale = 0; diff --git a/drivers/adxl345/adxl345_saul.c b/drivers/adxl345/adxl345_saul.c index 1e31f97ef..fb680a7f8 100644 --- a/drivers/adxl345/adxl345_saul.c +++ b/drivers/adxl345/adxl345_saul.c @@ -21,10 +21,9 @@ #include "saul.h" #include "adxl345.h" -static int read_acc(void *dev, phydat_t *res) +static int read_acc(const void *dev, phydat_t *res) { - adxl345_t *d = (adxl345_t *)dev; - adxl345_read(d, (adxl345_data_t *)res->val); + adxl345_read((const adxl345_t *)dev, (adxl345_data_t *)res->val); res->unit = UNIT_G; res->scale = -3; diff --git a/drivers/bmp180/bmp180_saul.c b/drivers/bmp180/bmp180_saul.c index 03158315e..7a5076d44 100644 --- a/drivers/bmp180/bmp180_saul.c +++ b/drivers/bmp180/bmp180_saul.c @@ -25,21 +25,17 @@ #include "bmp180.h" #include "xtimer.h" -static int read_temperature(void *dev, phydat_t *res) +static int read_temperature(const void *dev, phydat_t *res) { - bmp180_t *d = (bmp180_t *)dev; - - res->val[0] = bmp180_read_temperature(d); + res->val[0] = bmp180_read_temperature((const bmp180_t *)dev); res->unit = UNIT_TEMP_C; res->scale = -1; return 1; } -static int read_pressure(void *dev, phydat_t *res) +static int read_pressure(const void *dev, phydat_t *res) { - bmp180_t *d = (bmp180_t *)dev; - - res->val[0] = bmp180_read_pressure(d) / 100; + res->val[0] = bmp180_read_pressure((const bmp180_t *)dev) / 100; res->unit = UNIT_PA; res->scale = 2; return 1; diff --git a/drivers/bmx280/bmx280_saul.c b/drivers/bmx280/bmx280_saul.c index e767d8402..d0d08dd4a 100644 --- a/drivers/bmx280/bmx280_saul.c +++ b/drivers/bmx280/bmx280_saul.c @@ -24,22 +24,18 @@ #include "bmx280.h" -static int read_temperature(void *dev, phydat_t *res) +static int read_temperature(const void *dev, phydat_t *res) { - bmx280_t *d = (bmx280_t *)dev; - - res->val[0] = bmx280_read_temperature(d); + res->val[0] = bmx280_read_temperature((const bmx280_t *)dev); res->unit = UNIT_TEMP_C; res->scale = -2; return 1; } -static int read_pressure(void *dev, phydat_t *res) +static int read_pressure(const void *dev, phydat_t *res) { - bmx280_t *d = (bmx280_t *)dev; - - res->val[0] = bmx280_read_pressure(d) / 100; + res->val[0] = bmx280_read_pressure((const bmx280_t *)dev) / 100; res->unit = UNIT_PA; res->scale = 2; @@ -47,11 +43,9 @@ static int read_pressure(void *dev, phydat_t *res) } #ifdef MODULE_BME280 -static int read_relative_humidity(void *dev, phydat_t *res) +static int read_relative_humidity(const void *dev, phydat_t *res) { - bmx280_t *d = (bmx280_t *)dev; - - res->val[0] = bme280_read_humidity(d); + res->val[0] = bme280_read_humidity((const bmx280_t *)dev); res->unit = UNIT_PERCENT; res->scale = -2; diff --git a/drivers/dht/dht_saul.c b/drivers/dht/dht_saul.c index 4cbb4a20f..1b5a9644c 100644 --- a/drivers/dht/dht_saul.c +++ b/drivers/dht/dht_saul.c @@ -37,18 +37,14 @@ static int16_t temp, hum; static uint32_t last = 0; -static int check_and_read(void *dev, phydat_t *res, int16_t *val, uint8_t unit) +static int check_and_read(const void *dev, phydat_t *res, int16_t *val, uint8_t unit) { - dht_t *d = (dht_t *)dev; uint32_t now = xtimer_now_usec(); if ((now - last) > DHT_SAUL_HOLD_TIME) { - dht_read(d, &temp, &hum); + dht_read((const dht_t *)dev, &temp, &hum); last = now; } - else { - (void)d; - } res->val[0] = *val; memset(&res->val[1], 0, 2 * sizeof(int16_t)); @@ -57,12 +53,12 @@ static int check_and_read(void *dev, phydat_t *res, int16_t *val, uint8_t unit) return 1; } -static int read_temp(void *dev, phydat_t *res) +static int read_temp(const void *dev, phydat_t *res) { return check_and_read(dev, res, &temp, UNIT_TEMP_C); } -static int read_hum(void *dev, phydat_t *res) +static int read_hum(const void *dev, phydat_t *res) { return check_and_read(dev, res, &hum, UNIT_PERCENT); } diff --git a/drivers/hdc1000/hdc1000_saul.c b/drivers/hdc1000/hdc1000_saul.c index 691408fd8..4cca369f7 100644 --- a/drivers/hdc1000/hdc1000_saul.c +++ b/drivers/hdc1000/hdc1000_saul.c @@ -23,11 +23,9 @@ #include "saul.h" #include "hdc1000.h" -static int read_temp(void *dev, phydat_t *res) +static int read_temp(const void *dev, phydat_t *res) { - hdc1000_t *d = (hdc1000_t *)dev; - - if (hdc1000_read(d, &(res->val[0]), NULL) != HDC1000_OK) { + if (hdc1000_read((const hdc1000_t *)dev, &(res->val[0]), NULL) != HDC1000_OK) { return -ECANCELED; } memset(&(res->val[1]), 0, 2 * sizeof(int16_t)); @@ -37,11 +35,9 @@ static int read_temp(void *dev, phydat_t *res) return 1; } -static int read_hum(void *dev, phydat_t *res) +static int read_hum(const void *dev, phydat_t *res) { - hdc1000_t *d = (hdc1000_t *)dev; - - if (hdc1000_read(d, NULL, &(res->val[0])) != HDC1000_OK) { + if (hdc1000_read((const hdc1000_t *)dev, NULL, &(res->val[0])) != HDC1000_OK) { return -ECANCELED; } memset(&(res->val[1]), 0, 2 * sizeof(int16_t)); diff --git a/drivers/include/saul.h b/drivers/include/saul.h index bb7cffb37..588251c0d 100644 --- a/drivers/include/saul.h +++ b/drivers/include/saul.h @@ -112,7 +112,7 @@ enum { * @return -ENOTSUP if the device does not support this operation * @return -ECANCELED on other errors */ -typedef int(*saul_read_t)(void *dev, phydat_t *res); +typedef int(*saul_read_t)(const void *dev, phydat_t *res); /** * @brief Write a value (a set of values) to a device @@ -132,7 +132,7 @@ typedef int(*saul_read_t)(void *dev, phydat_t *res); * @return -ENOTSUP if the device does not support this operation * @return -ECANCELED on other errors */ -typedef int(*saul_write_t)(void *dev, phydat_t *data); +typedef int(*saul_write_t)(const void *dev, phydat_t *data); /** * @brief Definition of the RIOT actuator/sensor interface @@ -146,7 +146,7 @@ typedef struct { /** * @brief Default not supported function */ -int saul_notsup(void *dev, phydat_t *dat); +int saul_notsup(const void *dev, phydat_t *dat); /** * @brief Helper function converts a class ID to a string @@ -156,7 +156,7 @@ int saul_notsup(void *dev, phydat_t *dat); * @return string representation of the device class * @return NULL if class ID is not known */ -const char *saul_class_to_str(uint8_t class_id); +const char *saul_class_to_str(const uint8_t class_id); #ifdef __cplusplus } diff --git a/drivers/io1_xplained/io1_xplained_saul.c b/drivers/io1_xplained/io1_xplained_saul.c index 6864bb70b..ed56e621a 100644 --- a/drivers/io1_xplained/io1_xplained_saul.c +++ b/drivers/io1_xplained/io1_xplained_saul.c @@ -25,10 +25,9 @@ static float temperature; -static int read_temperature(void *dev, phydat_t *res) +static int read_temperature(const void *dev, phydat_t *res) { - io1_xplained_t *d = (io1_xplained_t *)dev; - io1_xplained_read_temperature(d, &temperature); + io1_xplained_read_temperature((const io1_xplained_t *)dev, &temperature); res->val[0] = (int)(temperature * 100.0); res->unit = UNIT_TEMP_C; res->scale = -2; diff --git a/drivers/isl29020/isl29020_saul.c b/drivers/isl29020/isl29020_saul.c index 07127ee30..0faf82ae6 100644 --- a/drivers/isl29020/isl29020_saul.c +++ b/drivers/isl29020/isl29020_saul.c @@ -23,10 +23,9 @@ #include "saul.h" #include "isl29020.h" -static int read(void *dev, phydat_t *res) +static int read(const void *dev, phydat_t *res) { - isl29020_t *d = (isl29020_t *)dev; - res->val[0] = (int16_t)isl29020_read(d); + res->val[0] = (int16_t)isl29020_read((const isl29020_t *)dev); memset(&(res->val[1]), 0, 2 * sizeof(int16_t)); res->unit = UNIT_CD; res->scale = 0; diff --git a/drivers/jc42/jc42_saul.c b/drivers/jc42/jc42_saul.c index a0cebdb7e..391cee5b3 100644 --- a/drivers/jc42/jc42_saul.c +++ b/drivers/jc42/jc42_saul.c @@ -25,12 +25,11 @@ -static int read_temperature(void *dev, phydat_t *res) +static int read_temperature(const void *dev, phydat_t *res) { int16_t temperature; - jc42_t *d = (jc42_t *)dev; - jc42_get_temperature(d, &temperature); + jc42_get_temperature((const jc42_t *)dev, &temperature); res->val[0] = temperature; res->unit = UNIT_TEMP_C; res->scale = -2; diff --git a/drivers/l3g4200d/l3g4200d_saul.c b/drivers/l3g4200d/l3g4200d_saul.c index 3e1021297..5c9379972 100644 --- a/drivers/l3g4200d/l3g4200d_saul.c +++ b/drivers/l3g4200d/l3g4200d_saul.c @@ -23,10 +23,9 @@ #include "saul.h" #include "l3g4200d.h" -static int read(void *dev, phydat_t *res) +static int read(const void *dev, phydat_t *res) { - l3g4200d_t *d = (l3g4200d_t *)dev; - l3g4200d_read(d, (l3g4200d_data_t *)res); + l3g4200d_read((const l3g4200d_t *)dev, (l3g4200d_data_t *)res); res->unit = UNIT_DPS; res->scale = 0; return 3; diff --git a/drivers/lis3dh/lis3dh_saul.c b/drivers/lis3dh/lis3dh_saul.c index 2146e7938..e1df3e190 100644 --- a/drivers/lis3dh/lis3dh_saul.c +++ b/drivers/lis3dh/lis3dh_saul.c @@ -24,12 +24,11 @@ #include "saul.h" #include "lis3dh.h" -static int read_acc(void *dev, phydat_t *res) +static int read_acc(const void *dev, phydat_t *res) { lis3dh_data_t xyz; - lis3dh_t *d = (lis3dh_t *)dev; - int err = lis3dh_read_xyz(d, &xyz); + int err = lis3dh_read_xyz((const lis3dh_t *)dev, &xyz); if (err != 0) { /* Something went wrong in the LIS3DH driver */ return -ECANCELED; diff --git a/drivers/lps331ap/lps331ap_saul.c b/drivers/lps331ap/lps331ap_saul.c index cdb161094..50d2932c3 100644 --- a/drivers/lps331ap/lps331ap_saul.c +++ b/drivers/lps331ap/lps331ap_saul.c @@ -23,10 +23,9 @@ #include "saul.h" #include "lps331ap.h" -static int read(void *dev, phydat_t *res) +static int read(const void *dev, phydat_t *res) { - lps331ap_t *d = (lps331ap_t *)dev; - res->val[0] = (int16_t)lps331ap_read_pres(d); + res->val[0] = (int16_t)lps331ap_read_pres((const lps331ap_t *)dev); memset(&(res->val[1]), 0, 2 * sizeof(int16_t)); res->unit = UNIT_BAR; res->scale = -3; diff --git a/drivers/lsm303dlhc/lsm303dlhc_saul.c b/drivers/lsm303dlhc/lsm303dlhc_saul.c index 473ddaa2e..61b981c0e 100644 --- a/drivers/lsm303dlhc/lsm303dlhc_saul.c +++ b/drivers/lsm303dlhc/lsm303dlhc_saul.c @@ -23,9 +23,9 @@ #include "saul.h" #include "lsm303dlhc.h" -static int read_acc(void *dev, phydat_t *res) +static int read_acc(const void *dev, phydat_t *res) { - lsm303dlhc_t *d = (lsm303dlhc_t *)dev; + const lsm303dlhc_t *d = (const lsm303dlhc_t *)dev; lsm303dlhc_read_acc(d, (lsm303dlhc_3d_data_t *)res); /* normalize result */ @@ -39,9 +39,10 @@ static int read_acc(void *dev, phydat_t *res) return 3; } -static int read_mag(void *dev, phydat_t *res) +static int read_mag(const void *dev, phydat_t *res) { - lsm303dlhc_t *d = (lsm303dlhc_t *)dev; + const lsm303dlhc_t *d = (const lsm303dlhc_t *)dev; + lsm303dlhc_read_mag(d, (lsm303dlhc_3d_data_t *)res); /* normalize results */ diff --git a/drivers/lsm6dsl/lsm6dsl_saul.c b/drivers/lsm6dsl/lsm6dsl_saul.c index 322e71037..4b86e6a74 100644 --- a/drivers/lsm6dsl/lsm6dsl_saul.c +++ b/drivers/lsm6dsl/lsm6dsl_saul.c @@ -17,9 +17,9 @@ #include "lsm6dsl.h" #include "saul.h" -static int read_acc(void *dev, phydat_t *res) +static int read_acc(const void *dev, phydat_t *res) { - int ret = lsm6dsl_read_acc(dev, (lsm6dsl_3d_data_t *)res); + int ret = lsm6dsl_read_acc((const lsm6dsl_t *)dev, (lsm6dsl_3d_data_t *)res); if (ret < 0) { return -ECANCELED; } @@ -30,9 +30,9 @@ static int read_acc(void *dev, phydat_t *res) return 3; } -static int read_gyro(void *dev, phydat_t *res) +static int read_gyro(const void *dev, phydat_t *res) { - int ret = lsm6dsl_read_gyro(dev, (lsm6dsl_3d_data_t *)res); + int ret = lsm6dsl_read_gyro((const lsm6dsl_t *)dev, (lsm6dsl_3d_data_t *)res); if (ret < 0) { return -ECANCELED; } @@ -49,7 +49,6 @@ const saul_driver_t lsm6dsl_saul_acc_driver = { .type = SAUL_SENSE_ACCEL, }; - const saul_driver_t lsm6dsl_saul_gyro_driver = { .read = read_gyro, .write = saul_notsup, diff --git a/drivers/mag3110/mag3110_saul.c b/drivers/mag3110/mag3110_saul.c index c890ab4f5..221fc79b2 100644 --- a/drivers/mag3110/mag3110_saul.c +++ b/drivers/mag3110/mag3110_saul.c @@ -24,9 +24,9 @@ #include "saul.h" #include "mag3110.h" -static int read_mag(void *dev, phydat_t *res) +static int read_mag(const void *dev, phydat_t *res) { - mag3110_read((mag3110_t *)dev, (mag3110_data_t *)res); + mag3110_read((const mag3110_t *)dev, (mag3110_data_t *)res); res->unit = UNIT_GS; res->scale = 2; diff --git a/drivers/mma8x5x/mma8x5x_saul.c b/drivers/mma8x5x/mma8x5x_saul.c index 5c1156daa..1998b1efb 100644 --- a/drivers/mma8x5x/mma8x5x_saul.c +++ b/drivers/mma8x5x/mma8x5x_saul.c @@ -25,9 +25,9 @@ #include "saul.h" #include "mma8x5x.h" -static int read_acc(void *dev, phydat_t *res) +static int read_acc(const void *dev, phydat_t *res) { - mma8x5x_read((mma8x5x_t *)dev, (mma8x5x_data_t *)res); + mma8x5x_read((const mma8x5x_t *)dev, (mma8x5x_data_t *)res); res->unit = UNIT_G; res->scale = -3; diff --git a/drivers/saul/adc_saul.c b/drivers/saul/adc_saul.c index a7c81f279..c732b1a85 100644 --- a/drivers/saul/adc_saul.c +++ b/drivers/saul/adc_saul.c @@ -26,7 +26,7 @@ #include "periph/adc.h" -static int read_adc(void *dev, phydat_t *res) +static int read_adc(const void *dev, phydat_t *res) { const saul_adc_params_t *params = *((const saul_adc_params_t **)dev); res->val[0] = adc_sample(params->line, params->res); diff --git a/drivers/saul/gpio_saul.c b/drivers/saul/gpio_saul.c index 8e1912d15..e32511585 100644 --- a/drivers/saul/gpio_saul.c +++ b/drivers/saul/gpio_saul.c @@ -25,9 +25,9 @@ #include "periph/gpio.h" -static int read(void *dev, phydat_t *res) +static int read(const void *dev, phydat_t *res) { - gpio_t pin = *((gpio_t *)dev); + gpio_t pin = *((const gpio_t *)dev); res->val[0] = (gpio_read(pin)) ? 1 : 0; memset(&(res->val[1]), 0, 2 * sizeof(int16_t)); res->unit = UNIT_BOOL; @@ -35,9 +35,9 @@ static int read(void *dev, phydat_t *res) return 1; } -static int write(void *dev, phydat_t *state) +static int write(const void *dev, phydat_t *state) { - gpio_t pin = *((gpio_t *)dev); + gpio_t pin = *((const gpio_t *)dev); gpio_write(pin, state->val[0]); return 1; } diff --git a/drivers/saul/saul.c b/drivers/saul/saul.c index dbcb4f1b4..5f7dd72a6 100644 --- a/drivers/saul/saul.c +++ b/drivers/saul/saul.c @@ -22,7 +22,7 @@ #include "saul.h" -int saul_notsup(void *dev, phydat_t *dat) +int saul_notsup(const void *dev, phydat_t *dat) { (void)dev; (void)dat; diff --git a/drivers/saul/saul_str.c b/drivers/saul/saul_str.c index 3e688563d..d912dec95 100644 --- a/drivers/saul/saul_str.c +++ b/drivers/saul/saul_str.c @@ -26,7 +26,7 @@ * This is surely not the most beautiful implementation of a stringification * function, but works... */ -const char *saul_class_to_str(uint8_t class_id) +const char *saul_class_to_str(const uint8_t class_id) { switch (class_id) { case SAUL_CLASS_UNDEF: return "CLASS_UNDEF"; diff --git a/drivers/si70xx/si70xx_saul.c b/drivers/si70xx/si70xx_saul.c index c56702808..09de1dca1 100644 --- a/drivers/si70xx/si70xx_saul.c +++ b/drivers/si70xx/si70xx_saul.c @@ -22,22 +22,18 @@ #include "si70xx.h" -static int read_temperature(void *dev, phydat_t *res) +static int read_temperature(const void *dev, phydat_t *res) { - si70xx_t *d = (si70xx_t *)dev; - - res->val[0] = (int32_t) si70xx_get_temperature(d); + res->val[0] = (int32_t) si70xx_get_temperature((const si70xx_t *)dev); res->unit = UNIT_TEMP_C; res->scale = -2; return 1; } -static int read_relative_humidity(void *dev, phydat_t *res) +static int read_relative_humidity(const void *dev, phydat_t *res) { - si70xx_t *d = (si70xx_t *)dev; - - res->val[0] = (int32_t) si70xx_get_relative_humidity(d); + res->val[0] = (int32_t) si70xx_get_relative_humidity((const si70xx_t *)dev); res->unit = UNIT_PERCENT; res->scale = -2; diff --git a/drivers/tcs37727/tcs37727_saul.c b/drivers/tcs37727/tcs37727_saul.c index 887198677..d8c45e7a5 100644 --- a/drivers/tcs37727/tcs37727_saul.c +++ b/drivers/tcs37727/tcs37727_saul.c @@ -23,12 +23,11 @@ #include "saul.h" #include "tcs37727.h" -static int read(void *dev, phydat_t *res) +static int read(const void *dev, phydat_t *res) { - tcs37727_t *d = (tcs37727_t *)dev; tcs37727_data_t val; - tcs37727_read(d, &val); + tcs37727_read((const tcs37727_t *)dev, &val); res->val[0] = (int16_t)val.red; res->val[1] = (int16_t)val.green; diff --git a/drivers/tmp006/tmp006_saul.c b/drivers/tmp006/tmp006_saul.c index bc817c6f6..194c46430 100644 --- a/drivers/tmp006/tmp006_saul.c +++ b/drivers/tmp006/tmp006_saul.c @@ -23,9 +23,10 @@ #include "saul.h" #include "tmp006.h" -static int read_temp(void *dev, phydat_t *res) +static int read_temp(const void *dev, phydat_t *res) { - if (tmp006_read_temperature((tmp006_t *)dev, &res->val[0], &res->val[1]) != TMP006_OK) { + if (tmp006_read_temperature((const tmp006_t *)dev, &res->val[0], + &res->val[1]) != TMP006_OK) { return -ECANCELED; } res->val[2] = 0; diff --git a/drivers/tsl2561/tsl2561_saul.c b/drivers/tsl2561/tsl2561_saul.c index 0e8aebd0d..9a2b4d5a1 100644 --- a/drivers/tsl2561/tsl2561_saul.c +++ b/drivers/tsl2561/tsl2561_saul.c @@ -23,11 +23,9 @@ #include "tsl2561.h" #include "xtimer.h" -static int read_illuminance(void *dev, phydat_t *res) +static int read_illuminance(const void *dev, phydat_t *res) { - tsl2561_t *d = (tsl2561_t *)dev; - - res->val[0] = tsl2561_read_illuminance(d); + res->val[0] = tsl2561_read_illuminance((const tsl2561_t *)dev); res->unit = UNIT_LUX; res->scale = 0; return 1; diff --git a/drivers/veml6070/veml6070_saul.c b/drivers/veml6070/veml6070_saul.c index c6f3fcf04..ce7477b83 100644 --- a/drivers/veml6070/veml6070_saul.c +++ b/drivers/veml6070/veml6070_saul.c @@ -24,11 +24,9 @@ #include "veml6070.h" #include "xtimer.h" -static int read_uv(void *dev, phydat_t *res) +static int read_uv(const void *dev, phydat_t *res) { - veml6070_t *d = (veml6070_t *)dev; - - res->val[0] = veml6070_read_uv(d); + res->val[0] = veml6070_read_uv((const veml6070_t *)dev); res->unit = UNIT_NONE; res->scale = -1; return 1;