drivers/tsl2561: migrate to ztimer
This commit is contained in:
parent
aa65feab25
commit
40a1dcb35b
@ -10,4 +10,5 @@ config MODULE_TSL2561
|
||||
depends on HAS_PERIPH_I2C
|
||||
depends on TEST_KCONFIG
|
||||
select MODULE_PERIPH_I2C
|
||||
select MODULE_XTIMER
|
||||
select MODULE_ZTIMER
|
||||
select MODULE_ZTIMER_MSEC
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
FEATURES_REQUIRED += periph_i2c
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_msec
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
#include "tsl2561.h"
|
||||
#include "tsl2561_internals.h"
|
||||
#include "periph/i2c.h"
|
||||
#include "xtimer.h"
|
||||
#include "ztimer.h"
|
||||
|
||||
#define ENABLE_DEBUG 0
|
||||
#include "debug.h"
|
||||
@ -220,16 +220,16 @@ static void _read_data(const tsl2561_t *dev, uint16_t *full, uint16_t *ir)
|
||||
|
||||
/* Wait integration time in ms for ADC to complete */
|
||||
switch (DEV_INTEGRATION) {
|
||||
case TSL2561_INTEGRATIONTIME_13MS:
|
||||
xtimer_usleep(13700);
|
||||
case TSL2561_INTEGRATIONTIME_13MS: /* 13700us */
|
||||
ztimer_sleep(ZTIMER_MSEC, 14);
|
||||
break;
|
||||
|
||||
case TSL2561_INTEGRATIONTIME_101MS:
|
||||
xtimer_usleep(101000);
|
||||
ztimer_sleep(ZTIMER_MSEC, 101);
|
||||
break;
|
||||
|
||||
default: /* TSL2561_INTEGRATIONTIME_402MS */
|
||||
xtimer_usleep(402000);
|
||||
ztimer_sleep(ZTIMER_MSEC, 402);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
include ../Makefile.tests_common
|
||||
|
||||
USEMODULE += tsl2561
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_msec
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
# this file enables modules defined in Kconfig. Do not use this file for
|
||||
# application configuration. This is only needed during migration.
|
||||
CONFIG_MODULE_TSL2561=y
|
||||
CONFIG_MODULE_XTIMER=y
|
||||
CONFIG_MODULE_ZTIMER=y
|
||||
CONFIG_MODULE_ZTIMER_MSEC=y
|
||||
|
||||
@ -21,14 +21,13 @@
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "timex.h"
|
||||
#include "ztimer.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)
|
||||
{
|
||||
puts("TSL2561 test application\n");
|
||||
@ -58,7 +57,7 @@ int main(void)
|
||||
"\n+-------------------------------------+\n",
|
||||
(int)tsl2561_read_illuminance(&dev));
|
||||
|
||||
xtimer_usleep(SLEEP_1S);
|
||||
ztimer_sleep(ZTIMER_MSEC, MS_PER_SEC); /* 1s delay */
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user