mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
tests/periph_adc: migrate to ztimer
This commit is contained in:
parent
6749b71066
commit
1e5f84ef71
@ -2,6 +2,7 @@ BOARD ?= pba-d-01-kw2x
|
|||||||
include ../Makefile.tests_common
|
include ../Makefile.tests_common
|
||||||
|
|
||||||
FEATURES_REQUIRED = periph_adc
|
FEATURES_REQUIRED = periph_adc
|
||||||
USEMODULE += xtimer
|
USEMODULE += ztimer
|
||||||
|
USEMODULE += ztimer_msec
|
||||||
|
|
||||||
include $(RIOTBASE)/Makefile.include
|
include $(RIOTBASE)/Makefile.include
|
||||||
|
@ -4,4 +4,5 @@
|
|||||||
CONFIG_MODULE_PERIPH_ADC=y
|
CONFIG_MODULE_PERIPH_ADC=y
|
||||||
|
|
||||||
# enable xtimer to wake up periodically
|
# 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 <stdio.h>
|
||||||
|
|
||||||
#include "xtimer.h"
|
#include "ztimer.h"
|
||||||
#include "timex.h"
|
|
||||||
#include "periph/adc.h"
|
#include "periph/adc.h"
|
||||||
|
|
||||||
#define RES ADC_RES_10BIT
|
#define RES ADC_RES_10BIT
|
||||||
#define DELAY (100LU * US_PER_MS) /* 100 ms */
|
#define DELAY_MS 100U
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
xtimer_ticks32_t last = xtimer_now();
|
|
||||||
int sample = 0;
|
int sample = 0;
|
||||||
|
|
||||||
puts("\nRIOT ADC peripheral driver test\n");
|
puts("\nRIOT ADC peripheral driver test\n");
|
||||||
@ -55,7 +53,7 @@ int main(void)
|
|||||||
printf("ADC_LINE(%u): %i\n", i, sample);
|
printf("ADC_LINE(%u): %i\n", i, sample);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xtimer_periodic_wakeup(&last, DELAY);
|
ztimer_sleep(ZTIMER_MSEC, DELAY_MS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user