7,275
edits
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>
|