I have been looking as much as I can in the documentation and tried to find anything in the source but could not figured out if Micropython offers the equivalent of the SDK negative delay in repeating timer using a Raspberry Pico (RP2)
Here in the SDK Documentation we can read:
Code: Select all
// Negative delay so means we will call repeating_timer_callback, and call it again
// 500ms later regardless of how long the callback took to execute
add_repeating_timer_ms(-500, repeating_timer_callback, NULL, &timer);
The RP2 Documentation does not say anything about that.
In the Micropython source code, I found that (line 85) negative delay are changed to a delay of 1:
Code: Select all
} else {
// Period specified
self->delta_us = (uint64_t)args[ARG_period].u_int * 1000000 / args[ARG_tick_hz].u_int;
}
if (self->delta_us < 1) {
self->delta_us = 1;
}
What I am not sure to understand is why this difference between alarm_pool_add_repeating_timer_us() that takes negative delays and alarm_pool_add_alarm_in_us which doesn't apart that one is an alarm and the other a repeating timer?
So my question is, how to create a hardware timer that ticks independently of the delay the callback method might add?
Thank you so much,
Torpi