I came across this code:
https://github.com/mattcallow/esp8266-s ... iver/pwm.c
and this actually works quite nicely. Only problem is if I arm the timer from user_init(), the ESP no longer attempts to connect to my access point. If I arm the timer after connection has been established, it works nicely for a few minutes but it eventually loses connection and wifi_station_get_connect_status() keeps returning 4.
This might mean I'm out of luck because the timer1 is actually used in the ESP's wifi code.
The OS timer functions (os_timer_arm / ets_timer_arm) don't work well, timer callbacks are often suspended for fractions of a second. It seems to be implemented through an event queue from the main thread, not directly from a timer interrupt. I'm really looking for a low latency/jitter PWM source to drive an RGB led at a couple of 100 Hz.