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

drivers/pulse_counter: migrate to ztimer

This commit is contained in:
Alexandre Abadie 2021-12-10 14:10:36 +01:00
parent 38c2ea57aa
commit 097b1970d2
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
5 changed files with 9 additions and 5 deletions

View File

@ -12,4 +12,3 @@ config MODULE_PULSE_COUNTER
depends on TEST_KCONFIG
select MODULE_PERIPH_GPIO
select MODULE_PERIPH_GPIO_IRQ
select MODULE_XTIMER

View File

@ -1,2 +1 @@
USEMODULE += xtimer
FEATURES_REQUIRED += periph_gpio_irq

View File

@ -4,4 +4,7 @@ BOARD_BLACKLIST := msb-430 msb-430h telosb z1
USEMODULE += pulse_counter
USEMODULE += ztimer
USEMODULE += ztimer_msec
include $(RIOTBASE)/Makefile.include

View File

@ -1,3 +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_PULSE_COUNTER=y
CONFIG_MODULE_ZTIMER=y
CONFIG_MODULE_ZTIMER_MSEC=y

View File

@ -20,10 +20,11 @@
#include <stdio.h>
#include "xtimer.h"
#include "timex.h"
#include "ztimer.h"
#include "pulse_counter_params.h"
#define SLEEP_USEC US_PER_SEC
#define SLEEP_MS MS_PER_SEC
int main(void)
{
@ -45,7 +46,7 @@ int main(void)
int16_t count = pulse_counter_read_with_reset(&dev);
printf("pulse counter: %d\n", count);
xtimer_usleep(SLEEP_USEC);
ztimer_sleep(ZTIMER_MSEC, SLEEP_MS);
}
return 0;