Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add note in documentation about behaviour of one-shot Hardware timer with Esp8266 #2713

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ void IRAM_ATTR hw_timer1_attach_interrupt(hw_timer_source_type_t source_type, hw
* @brief Enable the timer
* @param div
* @param intr_type
* @param auto_load
* @param auto_load true for repeating timer, false for one-shot
*
* Note: With one-shot timer application callback must stop the timer when it is no longer required.
* This is to reduce callback latency.
* If this is not done, timer will trigger again when timer counter wraps around to 0.
* For /16 divisor this is only 1.7s.
*/
inline void IRAM_ATTR hw_timer1_enable(hw_timer_clkdiv_t div, hw_timer_intr_type_t intr_type, bool auto_load)
{
Expand Down
14 changes: 14 additions & 0 deletions docs/source/framework/timers/hardware-timer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,19 @@ The API for hardware (and :doc:`timer-queue` timers) is identical, implemented u
:cpp:class:`CallbackTimer` class template for best performance.


.. note::

**Applies to Esp8266 architecture only.**

As with all Callback timers, the :cpp:type:`HardwareTimer` can be one-shot or repeating.

With the Esp8266 a one-shot timer will repeat after it has been triggered, but only after the timer
counter wraps around. The Esp8266 only has 23 bits of resolution so with a clock divider of 16
this will happen after about 1.7s.

Because the Esp8266 lacks any proper PWM hardware the timer latency is critical.
Adding any additional code to the callback is therefore left to the programmer.


.. doxygengroup:: hardware_timer
:members:
Loading