Added Runbootloader example
Alternative way to the USB-Serial Bridge
This commit is contained in:
parent
f6a19cff3d
commit
0e738a08d9
1 changed files with 33 additions and 0 deletions
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
Copyright (c) 2015 NicoHood
|
||||
See the readme for credit to other people.
|
||||
|
||||
HoodLoader2 Run Bootloader example
|
||||
|
||||
Starts Bootloader mode.
|
||||
This is useful if you only want to use
|
||||
the USB-Serial bridge again.
|
||||
|
||||
You could delete the program with avrdude,
|
||||
but this sketch is way simpler to upload.
|
||||
|
||||
It forces a watchdog reset,
|
||||
meaning the bootloader is started completely indipendant.
|
||||
*/
|
||||
|
||||
#include <avr/wdt.h>
|
||||
|
||||
void setup() {
|
||||
// close interrupts
|
||||
cli();
|
||||
|
||||
// write magic key to ram
|
||||
*(uint8_t *)0x0280 = 0x77;
|
||||
|
||||
// watchdog reset
|
||||
wdt_enable(WDTO_120MS);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// wait for reset
|
||||
}
|
||||
Loading…
Reference in a new issue