mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #17322 from aabadie/pr/tests/periph_adc_ztimer
tests/periph_adc: migrate to ztimer
This commit is contained in:
commit
b8dab00303
@ -2,6 +2,7 @@ BOARD ?= pba-d-01-kw2x
|
||||
include ../Makefile.tests_common
|
||||
|
||||
FEATURES_REQUIRED = periph_adc
|
||||
USEMODULE += xtimer
|
||||
USEMODULE += ztimer
|
||||
USEMODULE += ztimer_msec
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -4,4 +4,5 @@
|
||||
CONFIG_MODULE_PERIPH_ADC=y
|
||||
|
||||
# enable xtimer to wake up periodically
|
||||
CONFIG_MODULE_XTIMER=y
|
||||
CONFIG_MODULE_ZTIMER=y
|
||||
CONFIG_MODULE_ZTIMER_MSEC=y
|
||||
|
@ -20,16 +20,14 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "xtimer.h"
|
||||
#include "timex.h"
|
||||
#include "ztimer.h"
|
||||
#include "periph/adc.h"
|
||||
|
||||
#define RES ADC_RES_10BIT
|
||||
#define DELAY (100LU * US_PER_MS) /* 100 ms */
|
||||
#define DELAY_MS 100U
|
||||
|
||||
int main(void)
|
||||
{
|
||||
xtimer_ticks32_t last = xtimer_now();
|
||||
int sample = 0;
|
||||
|
||||
puts("\nRIOT ADC peripheral driver test\n");
|
||||
@ -55,7 +53,7 @@ int main(void)
|
||||
printf("ADC_LINE(%u): %i\n", i, sample);
|
||||
}
|
||||
}
|
||||
xtimer_periodic_wakeup(&last, DELAY);
|
||||
ztimer_sleep(ZTIMER_MSEC, DELAY_MS);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user