diff options
| author | Selene ToyKeeper | 2019-06-27 02:40:38 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2019-06-27 02:40:38 -0600 |
| commit | 41fef25bf05bb8fa377c9bcbbc7c0b5858cd20a1 (patch) | |
| tree | 901d6eaac250e2f1bc3a1695536486e16ac83e45 /spaghetti-monster/fsm-misc.c | |
| parent | anduril manual: added info about manual memory, 2-level lockout, and aux LED ... (diff) | |
| download | anduril-41fef25bf05bb8fa377c9bcbbc7c0b5858cd20a1.tar.gz anduril-41fef25bf05bb8fa377c9bcbbc7c0b5858cd20a1.tar.bz2 anduril-41fef25bf05bb8fa377c9bcbbc7c0b5858cd20a1.zip | |
added factory reset function to Anduril, and reboot function for FSM
Diffstat (limited to 'spaghetti-monster/fsm-misc.c')
| -rw-r--r-- | spaghetti-monster/fsm-misc.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spaghetti-monster/fsm-misc.c b/spaghetti-monster/fsm-misc.c index 9f953fa..eced482 100644 --- a/spaghetti-monster/fsm-misc.c +++ b/spaghetti-monster/fsm-misc.c @@ -154,4 +154,21 @@ uint8_t triangle_wave(uint8_t phase) { } #endif +#ifdef USE_REBOOT +void reboot() { + #if 1 // WDT method, safer but larger + cli(); + WDTCR = 0xD8 | WDTO_15MS; + sei(); + wdt_reset(); + while (1) {} + #else // raw assembly method, doesn't reset registers or anything + __asm__ __volatile__ ( + "cli" "\n\t" + "rjmp 0x00" "\n\t" + ); + #endif +} +#endif + #endif |
