COSA
An Object-Oriented Platform for Arduino Programming
Power.cpp
Go to the documentation of this file.
1 
21 #include "Cosa/Power.hh"
22 
23 uint8_t Power::s_mode = SLEEP_MODE_IDLE;
24 
25 #if defined(COSA_BROWN_OUT_DETECT) || !defined(sleep_bod_disable)
26 #define sleep_bod_disable()
27 #endif
28 
29 void
30 Power::sleep(uint8_t mode)
31 {
32  uint8_t saved = ADCSRA;
33  ADCSRA = 0;
34  if (mode == POWER_SLEEP_MODE) mode = s_mode;
35  set_sleep_mode(mode);
36  synchronized {
37  sleep_enable();
39  }
40  sleep_cpu();
41  sleep_disable();
42  ADCSRA = saved;
43 }
44 
#define sleep_bod_disable()
Definition: Power.cpp:26
static void sleep(uint8_t mode=POWER_SLEEP_MODE)
Definition: Power.cpp:30