The generic wait_ms, offered by the codal system timer, is not tight enough to perform small waits accurately. For instance, the sync call in the timer takes 4us alone to read the counter value and update the timestamp. This commit introduces an instruction based wait, using the clock speed of the CPU.
Another question is if we want to handle uint64_t? I imagine that has a variable decrement/increment operation depending on the size of the number, resulting in uneven cycle counts.
The generic wait_ms, offered by the codal system timer, is not tight enough to perform small waits accurately. For instance, the sync call in the timer takes 4us alone to read the counter value and update the timestamp. This commit introduces an instruction based wait, using the clock speed of the CPU.