- Sat Aug 22, 2015 6:33 am
#26774
What do you need the precise timer for?
os_delay_timer is just as (in)accurate as the timer.
I think the appropriate approach is:
- find out what is the max deviation of the sdk timer against accurate "wall clock"
- double this value, to be sure, subtract this value from the time you want to wait and create a timer for this period
- when the timer fires and your callback function is called, run a busy loop that counts the cpu cycles (there is a special command for that, or you may want to use the system time api call, I guess it gives the same value, this timer IS accurate).
- the busy loop should only run for a very short timespan, I guess it will boil down to a few microseconds, maybe even nanoseconds.
With this approach you won't starve the wlan system nor the watchdog and only keep the cpu busy when necessary.