diff options
| author | Selene ToyKeeper | 2020-04-27 18:44:49 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2020-04-27 18:44:49 -0600 |
| commit | 1b28816bd972d3de733c581fa2243add24b73779 (patch) | |
| tree | e967c0b02760f0afdeba1f0f2e0840149f434da3 /spaghetti-monster/fsm-misc.c | |
| parent | added a noFET build for D4v2, by request (diff) | |
| parent | calibrated K1 and K1-12V thermal response (smaller, slower) and candle mode (... (diff) | |
| download | anduril-1b28816bd972d3de733c581fa2243add24b73779.tar.gz anduril-1b28816bd972d3de733c581fa2243add24b73779.tar.bz2 anduril-1b28816bd972d3de733c581fa2243add24b73779.zip | |
merged Noctigon KR4 and K1-12V (XHP35) branches
(also includes some minor thermal updates to make it faster, more stable, and easier to tweak per host)
(and some code to prevent eeprom corruption while turning power chips on/off)
(and enables reboot function on tiny1634)
(and makes rainbow aux RGB mode speed configurable per host)
(and calibrates the original K1 a bit better)
Diffstat (limited to 'spaghetti-monster/fsm-misc.c')
| -rw-r--r-- | spaghetti-monster/fsm-misc.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/spaghetti-monster/fsm-misc.c b/spaghetti-monster/fsm-misc.c index 152f047..82be745 100644 --- a/spaghetti-monster/fsm-misc.c +++ b/spaghetti-monster/fsm-misc.c @@ -231,18 +231,20 @@ uint8_t triangle_wave(uint8_t phase) { #ifdef USE_REBOOT void reboot() { - #if 1 // WDT method, safer but larger + // put the WDT in hard reset mode, then trigger it cli(); - WDTCR = 0xD8 | WDTO_15MS; + #if (ATTINY == 25) || (ATTINY == 45) || (ATTINY == 85) + WDTCR = 0xD8 | WDTO_15MS; + #elif (ATTINY == 1634) + // allow protected configuration changes for next 4 clock cycles + CCP = 0xD8; // magic number + // reset (WDIF + WDE), no WDIE, fastest (16ms) timing (0000) + // (DS section 8.5.2 and table 8-4) + WDTCSR = 0b10001000; + #endif 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 |
