Skip to content
Snippets Groups Projects
Commit b2f7f066 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Add arch.idle() command

parent 7f6b7ecf
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ class Arch {
Arch () {}
void setup();
void idle_loop();
void idle();
void delay_us(unsigned char const us);
};
......
......@@ -55,6 +55,14 @@ void Arch::idle_loop(void)
}
}
void Arch::idle(void)
{
SMCR = _BV(SE);
asm("sleep");
SMCR = 0;
asm("wdr");
}
void Arch::delay_us(unsigned char const us)
{
__builtin_avr_delay_cycles(1600);
......
......@@ -57,6 +57,10 @@ void Arch::idle_loop(void)
{
}
void ArcH::idle(void)
{
}
extern "C" void user_init(void)
{
system_init_done_cb(jump_to_main);
......
......@@ -91,6 +91,17 @@ void Arch::idle_loop(void)
}
}
void Arch::idle(void)
{
__eint();
asm volatile("nop");
__bis_SR_register(LPM2_bits);
asm volatile("nop");
#ifdef WITH_WAKEUP
wakeup();
#endif
}
Arch arch;
#if defined(WITH_LOOP) || defined(TIMER_S)
......
......@@ -10,4 +10,8 @@ void Arch::idle_loop(void)
}
}
void Arch::idle(void)
{
}
Arch arch;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment