diff options
-rw-r--r-- | include/arch.h | 1 | ||||
-rw-r--r-- | src/arch/arduino-nano/arch.cc | 8 | ||||
-rw-r--r-- | src/arch/esp8266/arch.cc | 4 | ||||
-rw-r--r-- | src/arch/msp430fr5969lp/arch.cc | 11 | ||||
-rw-r--r-- | src/arch/posix/arch.cc | 4 |
5 files changed, 28 insertions, 0 deletions
diff --git a/include/arch.h b/include/arch.h index 70bc41c..a053b58 100644 --- a/include/arch.h +++ b/include/arch.h @@ -9,6 +9,7 @@ class Arch { Arch () {} void setup(); void idle_loop(); + void idle(); void delay_us(unsigned char const us); }; 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; |