ESP32: add support to light sleep
Allow putting ESP32 to light sleep, and wake it up using a GPIO or a timer.
These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
There is something that I'd like to here the opinion about:
Should we use the avm_pubsub for pushing power manager events when returning from sleep?
Such as different 3rd party drivers might need to check if any IRQ pin has been raised during sleep, or any other process might need to know that everything was suspend for a certain amount of time.
So we have either 2 options: leave the caller handle this when returning from sleep, or standardizing some kind of mechanism for informing drivers and anything else that there was a power management related event.
There is something that I'd like to here the opinion about:
Should we use the
avm_pubsubfor pushing power manager events when returning from sleep? Such as different 3rd party drivers might need to check if any IRQ pin has been raised during sleep, or any other process might need to know that everything was suspend for a certain amount of time. So we have either 2 options: leave the caller handle this when returning from sleep, or standardizing some kind of mechanism for informing drivers and anything else that there was a power management related event.
We could use monitor/2 to get the event.
BEAM documentation reads:
The monitor functionality is expected to be extended. That is, other
Types andItems are expected to be supported in a future release.
We could use
monitor/2to get the event.
This is an interesting suggestion, and might be useful to expose an API for pushing other “monitored” events, like acquiring or loosing a network connection.
I think some standardized notification system would be good, but it should be opt in, so extra resources are not consumed if they are not used.