Created
February 15, 2022 18:42
-
-
Save AndryG/0b993daa65279af37162bd21bd898c1f to your computer and use it in GitHub Desktop.
avr-gcc self reset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Виявляється, перезавантаження контролера має свої несподівані хитрощі. | |
void reset(){ | |
wdt_enable(WDTO_15MS); | |
while(1); | |
} | |
// Function to disable wdt after reboot (wdt remains enabled) | |
void wdt_init(void) __attribute__((naked)) __attribute__((section(".init3"))); | |
void wdt_init(void){ | |
MCUSR = 0; // The datasheet cleared the WDRF bit. Who knows why | |
wdt_disable(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment