Hi all -
The app I'm porting to the ESP32 needs relatively short (<1ms) delays. Clearly the vTaskDelay() function won't work for this. I was looking at the docs regarding General Purpose Timers.
1. is this the right component to use?
2. from the docs (and the example), it's not clear to me how I specify the time duration; the example uses an even increment of seconds.
Thanks for any help.
(solved) how to program sub-tick delays?
(solved) how to program sub-tick delays?
Last edited by mzimmers on Sat Oct 09, 2021 7:31 pm, edited 1 time in total.
Re: how to program sub-tick delays?
Oh, that's perfect:
Thanks, chegewara.
Code: Select all
#include "rom/ets_sys.h"
void delay_milliseconds(uint64_t ms) {
uint64_t us = ms * 1000;
if (ms < 1000) {
ets_delay_us(us);
} else {
vTaskDelay((ms) / portTICK_PERIOD_MS);
}
}
Who is online
Users browsing this forum: Bytespider, PetalBot and 4 guests