Skip to content

Commit

Permalink
Describe forced light sleep initiation in more detail.
Browse files Browse the repository at this point in the history
  • Loading branch information
dok-net committed Apr 28, 2021
1 parent ddae0b6 commit e8cab42
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doc/libraries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ Some ESP-specific APIs related to the deep, modem, and light sleep modes, RTC an

``ESP.forcedModemSleepOff()`` immediately returns the chip to the automatic sleep mode in effect before the preceeding call to ``ESP.forcedModemSleep``.

``ESP.forcedLightSleepBegin(microseconds, callback)`` works in tandem with ``ESP.forcedLightSleepEnd(cancel)`` to put the chip into forced ``LIGHT_SLEEP``. A microseconds duration after which the sleep mode returns to the automatic sleep mode that was effective before this call can be given, a value of 0 or 0xFFFFFFF turns off that timeout. The optional callback function will be invoked when the forced light sleep ends. Forced light sleep halts the CPU, in addition to the timeout, it can be awakened via GPIO input. Between the calls to ``ESP.forcedLightSleepBegin`` and ``ESP.forcedLightSleepEnd`` any GPIOs except GPIO16 to use for wakeup can be set up. Care must be taken not to allow the chip to enter the idle task before the call to ``ESP.forcedLightSleepEnd(cancel)``, so for instance no direct or indirect calls to ``delay()`` are possible. Otherwise the forced light sleep may engange too early, breaking the required logic of the tandem calls.
``ESP.forcedLightSleepBegin(microseconds, callback)`` works in tandem with ``ESP.forcedLightSleepEnd(cancel)`` to put the chip into forced ``LIGHT_SLEEP``. A microseconds duration after which the sleep mode returns can be given, a value of 0 or 0xFFFFFFF turns off that timeout. The optional callback function will be invoked when the forced light sleep ends. Forced light sleep halts the CPU, in addition to the timeout, it can be awakened via GPIO input. Between the calls to ``ESP.forcedLightSleepBegin`` and ``ESP.forcedLightSleepEnd`` any GPIOs except GPIO16 to use for wakeup can be set up. Care must be taken not to allow the chip to enter the idle task before the call to ``ESP.forcedLightSleepEnd(cancel)``, so for instance no direct or indirect calls to ``delay()`` are possible. Otherwise the forced light sleep may engange too early, breaking the required logic of the tandem calls.

``ESP.forcedLightSleepEnd(cancel)`` causes the chip to enter the forced light sleep mode that was set up as described for ``ESP.forcedLightSleepBegin``. The optional cancel argument, if true, prevents the sleep mode transition from occuring and returns to the automatic sleep mode that was effective before ``ESP.forcedLightSleepBegin``. This can be used, for instance, if setting up the level-triggered GPIO interrupts for wakeup fails. It returns after waking up, unless is it cancelled, in which case it returns immediately.
``ESP.forcedLightSleepEnd(cancel)`` causes the chip to enter the forced light sleep mode that was prepared by the preceeding ``ESP.forcedLightSleepBegin``. The optional cancel argument, if true, prevents the sleep mode transition from occuring. This can be used, for instance, to return immediately if setting up the level-triggered GPIO interrupts for wakeup fails. Otherwise, it returns after waking up from forced light sleep. On return, the automatic sleep mode that was effective before the call to ``ESP.forcedLightSleepBegin`` is activated.

``ESP.autoModemSleep()`` immediately puts the chip into automatic ``MODEM_SLEEP``.

Expand Down

0 comments on commit e8cab42

Please sign in to comment.