1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

tests/driver_tsl2561: update to new API changes

This commit is contained in:
Alexandre Abadie 2018-02-28 16:26:10 +01:00 committed by dylad
parent e78739a9a3
commit 5c6df7165f
2 changed files with 4 additions and 33 deletions

View File

@ -1,20 +1,6 @@
include ../Makefile.tests_common
FEATURES_REQUIRED = periph_i2c
USEMODULE += tsl2561
USEMODULE += xtimer
# set default device parameters in case they are undefined
TEST_I2C ?= I2C_DEV\(0\)
TEST_ADDR ?= TSL2561_ADDR_FLOAT
TEST_GAIN ?= TSL2561_GAIN_1X
TEST_INTEGRATION_TIME ?= TSL2561_INTEGRATIONTIME_402MS
# export parameters
CFLAGS += -DTEST_I2C=$(TEST_I2C)
CFLAGS += -DTEST_ADDR=$(TEST_ADDR)
CFLAGS += -DTEST_GAIN=$(TEST_GAIN)
CFLAGS += -DTEST_INTEGRATION_TIME=$(TEST_INTEGRATION_TIME)
include $(RIOTBASE)/Makefile.include

View File

@ -18,29 +18,15 @@
* @}
*/
#ifndef TEST_I2C
#error "TEST_I2C not defined"
#endif
#ifndef TEST_ADDR
#error "TEST_ADDR not defined"
#endif
#ifndef TEST_GAIN
#error "TEST_GAIN not defined"
#endif
#ifndef TEST_INTEGRATION_TIME
#error "TEST_INTEGRATION_TIME not defined"
#endif
#include <stdio.h>
#include <inttypes.h>
#include "tsl2561.h"
#include "xtimer.h"
#include "board.h"
#include "tsl2561.h"
#include "tsl2561_params.h"
#define SLEEP_1S (1 * 1000 * 1000u) /* 1 second delay between printf */
int main(void)
@ -51,8 +37,7 @@ int main(void)
printf("+------------Initializing------------+\n");
switch(tsl2561_init(&dev, TEST_I2C, TEST_ADDR,
TEST_GAIN, TEST_INTEGRATION_TIME)) {
switch(tsl2561_init(&dev, &tsl2561_params[0])) {
case TSL2561_NOI2C:
puts("[Error] I2C not working: cannot initialize the sensor.\n");
break;