Loom_Sleep_Manager class
Submanager to manage sleep functionality.
Contents
Base classes
- class LoomModule
- Abstract root of Loom component modules inheritance hierarchy.
Public types
- enum Mode { IDLE, STANDBY, OPENS_LOWPOWER }
- Different options available to sleep in.
Protected variables
-
Loom_
Interrupt_ Manager* interrupt_manager - Pointer to interrupt_manager instance.
- bool use_LED
- Whether or not to use LED to indicate wake status.
- bool delay_on_wake
- Whether to provide delay on wake.
- Mode sleep_mode
- Which sleep mode to use.
- byte power_off_pin
- Which pin to use to power board off (requires power board)
CONSTRUCTORS / DESTRUCTOR
-
Loom_Sleep_Manager(LoomManager* manager,
const bool use_LED = true,
const bool delay_on_wake = false,
const Mode sleep_mode = Mode::
STANDBY, const byte power_off_pin = A5) - Sleep Manager module constructor.
- Loom_Sleep_Manager(LoomManager* manager, JsonArrayConst p)
- Constructor that takes Json Array, extracts args and delegates to regular constructor.
- ~Loom_Sleep_Manager() defaulted
- Destructor.
OPERATION
PRINT INFORMATION
- void print_config() const override
- Display the configuration settings of the module.
GETTERS
- auto get_sleep_mode() const -> Mode
- Get the current sleep mode.
SETTERS
-
void link_interrupt_manager(Loom_
Interrupt_ Manager* IM) - Set pointer to interrupt manager.
- void set_sleep_mode(const Mode mode)
- Set the sleep mode to use.
MISCELLANEOUS
- void link_device_manager(LoomManager* LM) override
- Add pointer back to device manager.
- static auto enum_sleep_mode_string(const Mode m) -> const char*
- Convert enum of sleep mode to a c-string.
Enum documentation
enum Loom_ Sleep_ Manager:: Mode
Different options available to sleep in.
Enumerators | |
---|---|
IDLE |
Idle. |
STANDBY |
Standby. |
OPENS_LOWPOWER |
OPEnS board to shut board off completely. |
Function documentation
Loom_ Sleep_ Manager:: Loom_Sleep_Manager(LoomManager* manager,
const bool use_LED = true,
const bool delay_on_wake = false,
const Mode sleep_mode = Mode:: STANDBY,
const byte power_off_pin = A5)
Sleep Manager module constructor.
Parameters | |
---|---|
manager | |
use_LED in | Bool | <true> | {true, false} | Whether or not to use LED to indicate wake state |
delay_on_wake in | Bool | <false> | {true, false} | Whether or not to delay upon waking to allow time to open Serial Monitor |
sleep_mode in | Set(Mode) | <1> | { 0("Idle"), 1("Standby"), 2("Opens Low Power")} | Which Mode to use |
power_off_pin in | Set(Int) | <10> | {5, 6, 9, 10, 11, 12, 13, 14("A0"), 15("A1"), 16("A2"), 17("A3"), 18("A4"), 19("A5")} | Which pin should be used to power off board |
Loom_ Sleep_ Manager:: Loom_Sleep_Manager(LoomManager* manager,
JsonArrayConst p)
Constructor that takes Json Array, extracts args and delegates to regular constructor.
Parameters | |
---|---|
manager | |
p in | The array of constuctor args to expand |
void Loom_ Sleep_ Manager:: package(JsonObject json) override
No package necessary.
Implement with empty body.
bool Loom_ Sleep_ Manager:: sleep()
Put into low power state.
Returns | Whether or not sleep was successful |
---|
On wake, program will continue from where it went to sleep
Mode Loom_ Sleep_ Manager:: get_sleep_mode() const
Get the current sleep mode.
Returns | The current sleep mode |
---|
void Loom_ Sleep_ Manager:: link_interrupt_manager(Loom_ Interrupt_ Manager* IM)
Set pointer to interrupt manager.
Parameters | |
---|---|
IM in | Pointer to an interrupt manager |
void Loom_ Sleep_ Manager:: set_sleep_mode(const Mode mode)
Set the sleep mode to use.
Parameters | |
---|---|
mode in | The Mode to set to |
void Loom_ Sleep_ Manager:: link_device_manager(LoomManager* LM) override
Add pointer back to device manager.
Parameters | |
---|---|
LM in | LoomManager to point to |
Generally only called when device manager links module to provide pointer both directions. Derived modules may override this for increased function, such as linking a submanager or RTC module.
static const char* Loom_ Sleep_ Manager:: enum_sleep_mode_string(const Mode m)
Convert enum of sleep mode to a c-string.
Parameters | |
---|---|
m in | Sleep to get string of |
Returns | C-string of sleep mode |
Variable documentation
bool Loom_ Sleep_ Manager:: delay_on_wake protected
Whether to provide delay on wake.
Used to allow user to restart Serial Monitor