7,166
edits
Line 428: | Line 428: | ||
sleep_mode(); | sleep_mode(); | ||
ADCSRA = old_ADCSRA; | ADCSRA = old_ADCSRA; | ||
</syntaxhighlight> | |||
avr/sleep.h のコメント読む... | |||
<syntaxhighlight lang="c" enclose="div"> | |||
#include <avr/sleep.h> | |||
... | |||
set_sleep_mode(<mode>); | |||
sleep_mode(); | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="c" enclose="div"> | |||
#include <avr/interrupt.h> | |||
#include <avr/sleep.h> | |||
... | |||
set_sleep_mode(<mode>); | |||
cli(); | |||
if (some_condition) | |||
{ | |||
sleep_enable(); | |||
sei(); | |||
sleep_cpu(); | |||
sleep_disable(); | |||
} | |||
sei(); | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="c" enclose="div"> | |||
#include <avr/interrupt.h> | |||
#include <avr/sleep.h> | |||
... | |||
set_sleep_mode(<mode>); | |||
cli(); | |||
if (some_condition) | |||
{ | |||
sleep_enable(); | |||
sleep_bod_disable(); | |||
sei(); | |||
sleep_cpu(); | |||
sleep_disable(); | |||
} | |||
sei(); | |||
</syntaxhighlight> | </syntaxhighlight> | ||