please recommend me a proper way for creation of small delays in a range from 60ns up to 1.6ms inside of the driver function.
I need to make delays , but do not want to use a "busy-waiting" style.
Use of chThdSleepMicroseconds(1) gives 1ms delay at least instead of 1us, so this is not an option for me. This way just makes my driver too slow.
Example code:
Code: Select all
...
palSetPad(GPIOB, GPIOB_LED3);
// here is 10 ns - 1.6 ms delay required
palClearPad(GPIOB, GPIOB_LED3);
...
If there is no way to eliminate "busy-waiting" style, then please recommend me proper macros or function to calculate delay from MCU main clock frequency.
P.S.: This is not a periodical delays, so it seems callback from virtual timer are not appropriate here.
Best wishes.
--
Igor