mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/native: Add support for periph_timer_query_freqs
Add support for querying the frequency supported by `periph_timer`. This allows applications which require this feature to run on the `native` board. Signed-off-by: Armin Wolf <W_Armin@gmx.de>
This commit is contained in:
parent
8f111a3c29
commit
6070c57e21
@ -18,6 +18,7 @@ FEATURES_PROVIDED += periph_hwrng
|
||||
FEATURES_PROVIDED += periph_pm
|
||||
FEATURES_PROVIDED += periph_pwm
|
||||
FEATURES_PROVIDED += periph_timer_periodic
|
||||
FEATURES_PROVIDED += periph_timer_query_freqs
|
||||
ifeq ($(OS) $(OS_ARCH),Linux x86_64)
|
||||
FEATURES_PROVIDED += rust_target
|
||||
endif
|
||||
|
@ -49,7 +49,8 @@ extern "C" {
|
||||
* @name Timer peripheral configuration
|
||||
* @{
|
||||
*/
|
||||
#define TIMER_NUMOF (1U)
|
||||
#define TIMER_NUMOF (1U)
|
||||
#define TIMER_CHANNEL_NUMOF (1U) /**< Number of timer channels */
|
||||
|
||||
/**
|
||||
* @brief xtimer configuration
|
||||
|
@ -75,6 +75,28 @@ void native_isr_timer(void)
|
||||
_callback(_cb_arg, 0);
|
||||
}
|
||||
|
||||
uword_t timer_query_freqs_numof(tim_t dev)
|
||||
{
|
||||
(void)dev;
|
||||
|
||||
assert(TIMER_DEV(dev) < TIMER_NUMOF);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint32_t timer_query_freqs(tim_t dev, uword_t index)
|
||||
{
|
||||
(void)dev;
|
||||
|
||||
assert(TIMER_DEV(dev) < TIMER_NUMOF);
|
||||
|
||||
if (index > 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return NATIVE_TIMER_SPEED;
|
||||
}
|
||||
|
||||
int timer_init(tim_t dev, uint32_t freq, timer_cb_t cb, void *arg)
|
||||
{
|
||||
(void)freq;
|
||||
|
Loading…
Reference in New Issue
Block a user