mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-17 18:43:50 +01:00
Merge pull request #17393 from fjmolinas/pr_kinetis_fix_rtt
cpu/kinetis/include: fix xtimer backend timer selection
This commit is contained in:
commit
29ed101405
@ -500,7 +500,7 @@ enum {
|
||||
#ifndef RTT_FREQUENCY
|
||||
#define RTT_FREQUENCY RTT_MAX_FREQUENCY
|
||||
#endif
|
||||
#if IS_USED(PERIPH_RTT)
|
||||
#if IS_USED(MODULE_PERIPH_RTT)
|
||||
/* On kinetis periph_rtt is built on top on an LPTIMER so if used it
|
||||
will conflict with xtimer, if a LPTIMER backend and RTT are needed
|
||||
consider using ztimer */
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
#include "debug.h"
|
||||
|
||||
static rtt_cb_t alarm_cb = NULL; /**< callback called from RTC alarm */
|
||||
static void *alarm_arg; /**< argument passed to the callback */
|
||||
static void *alarm_arg = NULL; /**< argument passed to the callback */
|
||||
static uint32_t alarm_value = 0;
|
||||
|
||||
static void _rtt_cb(void *arg, int channel)
|
||||
@ -46,7 +46,6 @@ static void _rtt_cb(void *arg, int channel)
|
||||
void rtt_init(void)
|
||||
{
|
||||
timer_init(RTT_DEV, RTT_FREQUENCY, _rtt_cb, NULL);
|
||||
alarm_value = 0;
|
||||
}
|
||||
|
||||
uint32_t rtt_get_counter(void)
|
||||
@ -60,7 +59,7 @@ void rtt_set_alarm(uint32_t alarm, rtt_cb_t cb, void *arg)
|
||||
alarm_arg = arg;
|
||||
alarm_cb = cb;
|
||||
alarm_value = alarm;
|
||||
timer_set_absolute(RTT_DEV, 0, alarm % RTT_MAX_VALUE);
|
||||
timer_set_absolute(RTT_DEV, 0, alarm & RTT_MAX_VALUE);
|
||||
irq_restore(state);
|
||||
}
|
||||
|
||||
@ -71,7 +70,11 @@ uint32_t rtt_get_alarm(void)
|
||||
|
||||
void rtt_clear_alarm(void)
|
||||
{
|
||||
unsigned state = irq_disable();
|
||||
alarm_cb = NULL;
|
||||
alarm_arg = NULL;
|
||||
timer_clear(RTT_DEV, 0);
|
||||
irq_restore(state);
|
||||
}
|
||||
|
||||
void rtt_poweron(void)
|
||||
|
||||
@ -11,15 +11,10 @@ RIOT_TERMINAL ?= socat
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
# use highest possible RTT_FREQUENCY for boards that allow it
|
||||
ifneq (,$(filter stm32 nrf5%,$(CPU)))
|
||||
ifneq (,$(filter stm32 nrf5% sam% kinetis efm32 fe310,$(CPU)))
|
||||
RTT_FREQUENCY ?= RTT_MAX_FREQUENCY
|
||||
CFLAGS += -DRTT_FREQUENCY=$(RTT_FREQUENCY)
|
||||
endif
|
||||
|
||||
# kinetis rtt runs at 1Hz, reduce samples to speed up the test
|
||||
ifneq (,$(filter kinetis,$(CPU)))
|
||||
SAMPLES ?= 64
|
||||
else
|
||||
SAMPLES ?= 1024
|
||||
endif
|
||||
CFLAGS += -DSAMPLES=$(SAMPLES)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user