Enabling micro second timer
Posted: Sat Apr 04, 2015 3:15 pm
I have a project that requires 500 us events but the Ticker library as delivered only supports millisecond intervals. There is a SDK call for switching to microseconds so I added additional interfaces to Ticker to make the correct calls. When I first tied this it didn't work and it appears that before you can use the microseconds calls, the system timer has to be reset in the right at the start of usercode. Adding a call to system_timer_reinit (); in the user_init routine in core_esp8266_main.cpp did the trick!
Steps:
1) Add #define USE_US_TIMER at the beginning of osapi.h to make the microsecond timer call visible. osapi.h is in the ...\hardware\tools\esp8266\sdk\include directory
2) Add appropriate calls to the Ticker library (attached)
3) Add a call to system_timer_reinit () right at the beginning of the user_init function in core_esp8266_main.cpp. core_esp8266_main.cpp is in ...\hardware\esp8266com\esp8266\cores\esp8266
Steps:
1) Add #define USE_US_TIMER at the beginning of osapi.h to make the microsecond timer call visible. osapi.h is in the ...\hardware\tools\esp8266\sdk\include directory
2) Add appropriate calls to the Ticker library (attached)
3) Add a call to system_timer_reinit () right at the beginning of the user_init function in core_esp8266_main.cpp. core_esp8266_main.cpp is in ...\hardware\esp8266com\esp8266\cores\esp8266