SimpleSleep
An Arduino library for simple means of putting your Arduino into low power sleep modes.
|
Simple Sleep class for Arduino. More...
#include <SimpleSleep.h>
Public Member Functions | |
void | forever () |
Sleep forever in a deep and dreamless slumber. More... | |
void | deeply () |
Sleep deeply, allow external interrupts where possible (LEVEL only usually), bod off, adc off, timers generally off. More... | |
void | deeplyFor (uint32_t sleepMs) |
Sleep deeply for a given time, allow external interrupts where possible (LEVEL only usually), bod off, adc off, timers generally off. More... | |
void | lightly () |
Sleep lightly, allow many interrupts, adc off, timers generally off. More... | |
void | lightlyFor (uint32_t sleepMs) |
Sleep lightly for a given time, allow many interrupts, adc off, timers generally off. More... | |
void | idle () |
Wait patiently, most anything can wake you including Serial, timers etc. More... | |
void | idleFor (uint32_t sleepMs) |
Wait patiently for a given time. More... | |
SimpleSleep_Cal | getCalibration () |
For more accurate sleep times, you can generate calibration data and pass it into the deeplyFor, lightlyFor and idleFor. More... | |
void | deeplyFor (uint32_t sleepMs, SimpleSleep_Cal calibrationData) |
Sleep deeply for a given time with a pre-determined calibration factor. More... | |
void | lightlyFor (uint32_t sleepMs, SimpleSleep_Cal calibrationData) |
Sleep lightly for a given time with a pre-determined calibration factor. More... | |
void | idleFor (uint32_t sleepMs, SimpleSleep_Cal calibrationData) |
Idle for a given time with a pre-determined calibration factor. More... | |
Simple Sleep class for Arduino.
SimpleSleep Sleep;
Sleep.forever(); // Deep dreamless slumber, bod off, adc off, interrupts off
Sleep.deeply(); // Wakes up on external interrupts, Power Save mode or Power Down mode, bod off, adc off Sleep.lightly(); // Wakes up on externl interrupts, some internal interrupts, timers generally off, adc off Sleep.idle(); // Wakes up on most anything, timers still run, adc is on
Sleep.deeplyFor(arbitraryMs); Sleep.lightlyFor(arbitraryMs); Sleep.idleFor(arbitraryMs);
|
inline |
Sleep deeply, allow external interrupts where possible (LEVEL only usually), bod off, adc off, timers generally off.
For AVR, typically implemented as Power Down
|
inline |
Sleep deeply for a given time, allow external interrupts where possible (LEVEL only usually), bod off, adc off, timers generally off.
Will not return until the time has elapsed, think of this as a low power delay()
.
For AVR, typically implemented as Power Down
void SimpleSleep::deeplyFor | ( | uint32_t | sleepMs, |
SimpleSleep_Cal | calibrationData | ||
) |
Sleep deeply for a given time with a pre-determined calibration factor.
Use getCalibration()
to obtain the calibration data.
|
inline |
Sleep forever in a deep and dreamless slumber.
Everything that can be shut down is shut down, not even interrupts will wake you.
The only way to recover from forever()
is to reset.
This is a one-way operation, minimum power consumption.
SimpleSleep_Cal SimpleSleep::getCalibration | ( | ) |
For more accurate sleep times, you can generate calibration data and pass it into the deeplyFor, lightlyFor and idleFor.
Getting the calibration will take some time, more than 355 mS, during which time the system is in idle() mode.
You probably want to get fresh calibration data somewhat regularly, especially if you experience temperature changes or voltage changes.
|
inline |
Wait patiently, most anything can wake you including Serial, timers etc.
Most importantly, millis() and Serial will continue to function.
For AVR, typically implemented as Idle
|
inline |
Wait patiently for a given time.
Most importantly, millis() and Serial will continue to function.
Will not return until the time has elapsed, think of this as a low power delay()
.
For AVR, typically implemented as Idle
void SimpleSleep::idleFor | ( | uint32_t | sleepMs, |
SimpleSleep_Cal | calibrationData | ||
) |
Idle for a given time with a pre-determined calibration factor.
Use getCalibration()
to obtain the calibration data.
|
inline |
Sleep lightly, allow many interrupts, adc off, timers generally off.
For AVR, typically either implemented as Extended Standby or ADC Noise Reduction with the ADC OFF.
|
inline |
Sleep lightly for a given time, allow many interrupts, adc off, timers generally off.
Will not return until the time has elapsed, think of this as a low power delay()
.
For AVR, typically either implemented as Extended Standby or ADC Noise Reduction with the ADC OFF.
void SimpleSleep::lightlyFor | ( | uint32_t | sleepMs, |
SimpleSleep_Cal | calibrationData | ||
) |
Sleep lightly for a given time with a pre-determined calibration factor.
Use getCalibration()
to obtain the calibration data.