8.7.5 sleep_enable Macro
Put the device into sleep mode.
Include
<avr/sleep.h>
Prototype
void sleep_enable(void);
Remarks
This macro sets the sleep enable bits, putting the device into sleep mode so
it may be placed into sleep when required using sleep_cpu()
.
How the device is brought out of sleep mode depends on the specific mode
selected with the set_sleep_mode()
function.
Example
#include <xc.h>
#include <avr/sleep.h>
int main(void)
{
cli();
if (some_condition)
{
sleep_enable();
sei();
sleep_cpu();
sleep_disable();
}
sei();
}