SimpleSleep
An Arduino library for simple means of putting your Arduino into low power sleep modes.
SimpleSleep.h
1 #ifndef SimpleSleep_h
2 #define SimpleSleep_h
3 
4 #include <Arduino.h>
5 
6 #include "avr/avr.h"
7 
25  {
26  public:
27 
38  inline void forever() { sleepForever(); }
39 
45  inline void deeply() { sleepDeeply(); }
46 
54  inline void deeplyFor(uint32_t sleepMs) { sleepDeeply(sleepMs); }
55 
56 
62  inline void lightly() { sleepLightly(); }
63 
71  inline void lightlyFor(uint32_t sleepMs) { sleepLightly(sleepMs); }
72 
80  inline void idle() { sleepIdle(); }
81 
91  inline void idleFor(uint32_t sleepMs) { sleepIdle(sleepMs); }
92 
103  SimpleSleep_Cal getCalibration();
104 
110  void deeplyFor(uint32_t sleepMs, SimpleSleep_Cal calibrationData);
111 
117  void lightlyFor(uint32_t sleepMs, SimpleSleep_Cal calibrationData);
118 
124  void idleFor(uint32_t sleepMs, SimpleSleep_Cal calibrationData);
125 
126 
127  protected:
128 
129  void sleepForever();
130 
131  void sleepDeeply();
132  void sleepLightly();
133  void sleepIdle();
134 
135  void sleepDeeply(uint32_t sleepMs);
136  void sleepLightly(uint32_t sleepMs);
137  void sleepIdle(uint32_t sleepMs);
138 
139  };
140 
141 #endif
void forever()
Sleep forever in a deep and dreamless slumber.
Definition: SimpleSleep.h:38
Support functions and macros which are common across AVR microcontrollers.
void idleFor(uint32_t sleepMs)
Wait patiently for a given time.
Definition: SimpleSleep.h:91
void deeplyFor(uint32_t sleepMs)
Sleep deeply for a given time, allow external interrupts where possible (LEVEL only usually)...
Definition: SimpleSleep.h:54
void lightly()
Sleep lightly, allow many interrupts, adc off, timers generally off.
Definition: SimpleSleep.h:62
SimpleSleep_Cal getCalibration()
For more accurate sleep times, you can generate calibration data and pass it into the deeplyFor...
void lightlyFor(uint32_t sleepMs)
Sleep lightly for a given time, allow many interrupts, adc off, timers generally off.
Definition: SimpleSleep.h:71
Simple Sleep class for Arduino.
Definition: SimpleSleep.h:24
void idle()
Wait patiently, most anything can wake you including Serial, timers etc.
Definition: SimpleSleep.h:80
void deeply()
Sleep deeply, allow external interrupts where possible (LEVEL only usually), bod off, adc off, timers generally off.
Definition: SimpleSleep.h:45