summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-07-12 15:24:36 +0200
committerDaniel Friesel <derf@finalrewind.org>2018-07-12 15:24:36 +0200
commitb2f7f066dbeed346e6d70414593cad2d918c2bd4 (patch)
tree14d61f487fadc109e38485e74e65fb7741ffe5e8 /src/arch
parent7f6b7ecfb0fb60a08dcc6c174d313eee052a94dc (diff)
Add arch.idle() command
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/arduino-nano/arch.cc8
-rw-r--r--src/arch/esp8266/arch.cc4
-rw-r--r--src/arch/msp430fr5969lp/arch.cc11
-rw-r--r--src/arch/posix/arch.cc4
4 files changed, 27 insertions, 0 deletions
diff --git a/src/arch/arduino-nano/arch.cc b/src/arch/arduino-nano/arch.cc
index 16d09fb..fda518c 100644
--- a/src/arch/arduino-nano/arch.cc
+++ b/src/arch/arduino-nano/arch.cc
@@ -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);
diff --git a/src/arch/esp8266/arch.cc b/src/arch/esp8266/arch.cc
index f5d1c91..3490ffe 100644
--- a/src/arch/esp8266/arch.cc
+++ b/src/arch/esp8266/arch.cc
@@ -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);
diff --git a/src/arch/msp430fr5969lp/arch.cc b/src/arch/msp430fr5969lp/arch.cc
index aee46f3..3016842 100644
--- a/src/arch/msp430fr5969lp/arch.cc
+++ b/src/arch/msp430fr5969lp/arch.cc
@@ -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)
diff --git a/src/arch/posix/arch.cc b/src/arch/posix/arch.cc
index efcf90e..54ee8e1 100644
--- a/src/arch/posix/arch.cc
+++ b/src/arch/posix/arch.cc
@@ -10,4 +10,8 @@ void Arch::idle_loop(void)
}
}
+void Arch::idle(void)
+{
+}
+
Arch arch;