1
0
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:
Francisco 2021-12-07 11:29:33 +01:00 committed by GitHub
commit b8dab00303
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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;