diff options
Diffstat (limited to 'bootloaders/caterina_LUFA/Caterina.c')
-rwxr-xr-x | bootloaders/caterina_LUFA/Caterina.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/bootloaders/caterina_LUFA/Caterina.c b/bootloaders/caterina_LUFA/Caterina.c index b6fbd9b..d4dbb7b 100755 --- a/bootloaders/caterina_LUFA/Caterina.c +++ b/bootloaders/caterina_LUFA/Caterina.c @@ -64,6 +64,9 @@ uint16_t RxLEDPulse = 0; // time remaining for Rx LED pulse /* Bootloader timeout timer */
uint16_t Timeout = 0;
+uint16_t bootKey = 0x7777;
+volatile uint16_t *const bootKeyPtr = (volatile uint16_t *)0x0A00;
+
void StartSketch(void)
{
cli();
@@ -118,6 +121,11 @@ int main(void) if (mcusr_state & (1<<PORF) && pgm_read_word(0) != 0xFFFF) {
StartSketch();
}
+ uint16_t bootKeyPtrVal = *bootKeyPtr;
+ *bootKeyPtr = 0;
+ if ((mcusr_state & (1<<WDRF)) && (bootKeyPtrVal != bootKey) && (pgm_read_word(0) != 0xFFFF)) {
+ StartSketch();
+ }
/* Setup hardware required for the bootloader */
SetupHardware();
|