Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions optiboot/bootloaders/optiboot/optiboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,11 @@ int main(void) {
#endif
#endif

#ifdef HOLD_TO_PROG
if (HOLD_TO_PROG_ON)
watchdogConfig(WATCHDOG_OFF);
else
#endif
// Set up watchdog to trigger after desired timeout
watchdogConfig(WDTPERIOD);

Expand Down
23 changes: 23 additions & 0 deletions optiboot/bootloaders/optiboot/pin_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1628,3 +1628,26 @@
#if SOFT_UART && defined(SOFTTX) && defined(SOFTRX)
#include "pins_softuart.h"
#endif

#ifdef HOLD_TO_PROG

#if HOLD_TO_PROG == D0
#undef HOLD_TO_PROG
#define HOLD_TO_PROG_PIN PIND
#define HOLD_TO_PROG PIND0

#else
#error -------------------------------------------
#error Unrecognized LED name. Should be like "B5"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is incorrect wording probably an effect of cut&paste. Can you re-word please?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'll change it (and yeah, it's cut and paste).

#error -------------------------------------------
#endif

#endif

#ifdef BUTTON_ON_HIGH
// A pin is 1 when the button is down
#define HOLD_TO_PROG_ON ((HOLD_TO_PROG_PIN & HOLD_TO_PROG) == 1)
#else
// A pin is 0 when the button is down
#define HOLD_TO_PROG_ON ((HOLD_TO_PROG_PIN & HOLD_TO_PROG) == 0)
#endif