From 94aa6d9cc00f48581e82a7356d42f45b666af6d1 Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Wed, 28 Feb 2018 18:04:33 +0100 Subject: [PATCH] tests/driver_isl2920: update with new API --- tests/driver_isl29020/Makefile | 8 -------- tests/driver_isl29020/main.c | 18 ++++-------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/tests/driver_isl29020/Makefile b/tests/driver_isl29020/Makefile index f04f57aae5..707ceec228 100644 --- a/tests/driver_isl29020/Makefile +++ b/tests/driver_isl29020/Makefile @@ -5,12 +5,4 @@ FEATURES_REQUIRED = periph_i2c USEMODULE += isl29020 USEMODULE += xtimer -# set default device parameters in case they are undefined -TEST_ISL29020_I2C ?= I2C_DEV\(0\) -TEST_ISL29020_ADDR ?= 68 - -# export parameters -CFLAGS += -DTEST_ISL29020_I2C=$(TEST_ISL29020_I2C) -CFLAGS += -DTEST_ISL29020_ADDR=$(TEST_ISL29020_ADDR) - include $(RIOTBASE)/Makefile.include diff --git a/tests/driver_isl29020/main.c b/tests/driver_isl29020/main.c index 1484078e5c..724f0d159b 100644 --- a/tests/driver_isl29020/main.c +++ b/tests/driver_isl29020/main.c @@ -18,30 +18,21 @@ * @} */ -#ifndef TEST_ISL29020_I2C -#error "TEST_ISL29020_I2C not defined" -#endif -#ifndef TEST_ISL29020_ADDR -#error "TEST_ISL29020_ADDR not defined" -#endif - #include #include "xtimer.h" #include "isl29020.h" +#include "isl29020_params.h" -#define MODE ISL29020_MODE_AMBIENT -#define RANGE ISL29020_RANGE_16K #define SLEEP (250 * 1000U) int main(void) { isl29020_t dev; - int value; puts("ISL29020 light sensor test application\n"); - printf("Initializing ISL29020 sensor at I2C_%i... ", TEST_ISL29020_I2C); - if (isl29020_init(&dev, TEST_ISL29020_I2C, TEST_ISL29020_ADDR, RANGE, MODE) == 0) { + puts("Initializing ISL29020 sensor"); + if (isl29020_init(&dev, &isl29020_params[0]) == 0) { puts("[OK]\n"); } else { @@ -50,8 +41,7 @@ int main(void) } while (1) { - value = isl29020_read(&dev); - printf("Light value: %5i LUX\n", value); + printf("Light value: %5i LUX\n", isl29020_read(&dev)); xtimer_usleep(SLEEP); }