mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 01:53:51 +01:00
cpu/esp32/periph_timer: allow changing callback or freq
Allow multiple calls to timer_init(), as this is the only way to change the timer frequency or the callback function.
This commit is contained in:
parent
26d5b7ca0b
commit
e8fd65566a
@ -230,11 +230,6 @@ int timer_init(tim_t dev, uint32_t freq, timer_cb_t cb, void *arg)
|
|||||||
assert(clk_div >= 2 && clk_div <= 65536);
|
assert(clk_div >= 2 && clk_div <= 65536);
|
||||||
assert(cb != NULL);
|
assert(cb != NULL);
|
||||||
|
|
||||||
if (_timers[dev].initialized) {
|
|
||||||
DEBUG("%s timer dev=%u is already initialized (used)\n", __func__, dev);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize timer data structure */
|
/* initialize timer data structure */
|
||||||
_timers[dev].initialized = true;
|
_timers[dev].initialized = true;
|
||||||
_timers[dev].started = false;
|
_timers[dev].started = false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user