I also found stm32's jshDelayMicroseconds function you were talking about earlier
void jshDelayMicroseconds(int microsec) {
int iter = (int)(((long long)microsec * (long long)JSH_DELAY_MULTIPLIER) >> 10);
// iter -= JSH_DELAY_OVERHEAD;
if (iter<0) iter=0;
while (iter--) __NOP();
}
I see the logic of this function like this:
iter = microsec * (how_fast_mc_is / how_fast_it_should_be)
But i don't understand how to make this function work with nanoseconds.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Unfortunately i don't have one...
I also found stm32's
jshDelayMicroseconds
function you were talking about earlierI see the logic of this function like this:
But i don't understand how to make this function work with nanoseconds.