aboutsummaryrefslogtreecommitdiff
path: root/arch/attiny85.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-11-19 01:47:40 -0700
committerSelene ToyKeeper2023-11-19 01:47:40 -0700
commite6909adcb1d44797e097dcf93ee7459276a4516a (patch)
treef9cf19bfe6d0d670750fa64a0b9a2e2d166392d9 /arch/attiny85.c
parenttemporary fix for aux LEDs on avrdd; needs proper refactoring (diff)
downloadanduril-e6909adcb1d44797e097dcf93ee7459276a4516a.tar.gz
anduril-e6909adcb1d44797e097dcf93ee7459276a4516a.tar.bz2
anduril-e6909adcb1d44797e097dcf93ee7459276a4516a.zip
moved prevent_reboot_loop() and some other junk out of fsm/main.c
Diffstat (limited to '')
-rw-r--r--arch/attiny85.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/attiny85.c b/arch/attiny85.c
index 40cbcfe..0d2d7fe 100644
--- a/arch/attiny85.c
+++ b/arch/attiny85.c
@@ -165,3 +165,24 @@ void reboot() {
while (1) {}
}
+inline void prevent_reboot_loop() {
+ // prevent WDT from rebooting MCU again
+ MCUSR &= ~(1<<WDRF); // reset status flag
+ wdt_disable();
+}
+
+
+#if 0 // example for one way of creating a 4th PWM channel
+// 4th PWM channel requires manually turning the pin on/off via interrupt :(
+ISR(TIMER1_OVF_vect) {
+ //bitClear(PORTB, 3);
+ PORTB &= 0b11110111;
+ //PORTB |= 0b00001000;
+}
+ISR(TIMER1_COMPA_vect) {
+ //if (!bitRead(TIFR,TOV1)) bitSet(PORTB, 3);
+ if (! (TIFR & (1<<TOV1))) PORTB |= 0b00001000;
+ //if (! (TIFR & (1<<TOV1))) PORTB &= 0b11110111;
+}
+#endif
+