mirror of
https://github.com/eclipse/upm.git
synced 2025-03-15 04:57:30 +03:00
utilities/101: Add 1 tick offset to nanotimer
In certain cases with the Arduino 101/Zephyr, using the upm_delay*() functions can cause hangs and/or exceptions. Adding a single tick to the generated offset resolves these issues. The documentation warns that this is a good idea to ensure that a timer does not expire early. Adding this made the random hangs and CPU exceptions go away. Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
parent
4b149313e6
commit
f0fa6f7b68
@ -32,7 +32,7 @@ void upm_delay(int time){
|
||||
struct nano_timer timer;
|
||||
void *timer_data[1];
|
||||
nano_timer_init(&timer, timer_data);
|
||||
nano_timer_start(&timer, SECONDS(time));
|
||||
nano_timer_start(&timer, SECONDS(time) + 1);
|
||||
nano_timer_test(&timer, TICKS_UNLIMITED);
|
||||
#endif
|
||||
}
|
||||
@ -44,7 +44,7 @@ void upm_delay_ms(int time){
|
||||
struct nano_timer timer;
|
||||
void *timer_data[1];
|
||||
nano_timer_init(&timer, timer_data);
|
||||
nano_timer_start(&timer, MSEC(time));
|
||||
nano_timer_start(&timer, MSEC(time) + 1);
|
||||
nano_timer_test(&timer, TICKS_UNLIMITED);
|
||||
#endif
|
||||
}
|
||||
@ -56,7 +56,7 @@ void upm_delay_us(int time){
|
||||
struct nano_timer timer;
|
||||
void *timer_data[1];
|
||||
nano_timer_init(&timer, timer_data);
|
||||
nano_timer_start(&timer, USEC(time));
|
||||
nano_timer_start(&timer, USEC(time) + 1);
|
||||
nano_timer_test(&timer, TICKS_UNLIMITED);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user