diff options
author | Bluebie <a@creativepony.com> | 2013-02-08 21:11:56 +1100 |
---|---|---|
committer | Bluebie <a@creativepony.com> | 2013-02-08 21:11:56 +1100 |
commit | ebbc5f6663cd73397f8e1c25afbb47d2f06548db (patch) | |
tree | 2652514c976e1c943ee68b4301d8964a81fd044d /firmware/bootloaderconfig.h | |
parent | e5721a36a1ea9b811cd0fe4d057d1e2294c5d418 (diff) | |
download | micronucleus-ebbc5f6663cd73397f8e1c25afbb47d2f06548db.tar.gz micronucleus-ebbc5f6663cd73397f8e1c25afbb47d2f06548db.tar.bz2 micronucleus-ebbc5f6663cd73397f8e1c25afbb47d2f06548db.zip |
experimental build with pin0 as boot button pin
Diffstat (limited to 'firmware/bootloaderconfig.h')
-rw-r--r-- | firmware/bootloaderconfig.h | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index f3dc5d8..25773da 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -213,15 +213,15 @@ these macros are defined, the boot loader uses them. // set clock prescaler to a value before running user program //#define SET_CLOCK_PRESCALER _BV(CLKPS0) /* divide by 2 for 8mhz */ -#define bootLoaderCondition() (idlePolls < (AUTO_EXIT_MS * 10UL)) -#if LOW_POWER_MODE + +/*#if LOW_POWER_MODE // only starts bootloader if USB D- is pulled high on startup - by putting your pullup in to an external connector // you can avoid ever entering an out of spec clock speed or waiting on bootloader when that pullup isn't there #define bootLoaderStartCondition() \ (PINB & (_BV(USB_CFG_DMINUS_BIT) | _BV(USB_CFG_DMINUS_BIT))) == _BV(USB_CFG_DMINUS_BIT) #else #define bootLoaderStartCondition() 1 -#endif +#endif*/ /* ----------------------- Optional MCU Description ------------------------ */ @@ -240,23 +240,24 @@ these macros are defined, the boot loader uses them. /* #define USB_INTR_PENDING_BIT INTF0 */ /* #define USB_INTR_VECTOR INT0_vect */ +// todo: change to pin 5 +#define DEUXVIS_JUMPER_PIN 0 +#define digitalRead(pin) ((PINB >> pin) & 0b00000001) +#define bootLoaderStartCondition() (!digitalRead(DEUXVIS_JUMPER_PIN)) +#define bootLoaderCondition() (1) + #ifndef __ASSEMBLER__ /* assembler cannot parse function definitions */ -static inline void bootLoaderInit(void) -{ -#ifndef TINY85MODE - PORTD |= (1 << JUMPER_BIT); /* activate pull-up */ - if(!(MCUCSR & (1 << EXTRF))) /* If this was not an external reset, ignore */ - leaveBootloader(); - MCUCSR = 0; /* clear all reset flags for next time */ -#endif +static inline void bootLoaderInit(void) { + // DeuxVis pin-5 pullup + DDRB |= _BV(DEUXVIS_JUMPER_PIN); // is an input + PORTB |= _BV(DEUXVIS_JUMPER_PIN); // has pullup enabled } -static inline void bootLoaderExit(void) -{ -#ifndef TINY85MODE - PORTD = 0; /* undo bootLoaderInit() changes */ -#endif +static inline void bootLoaderExit(void) { + // DeuxVis pin-5 pullup + PORTB = 0; + DDRB = 0; } #endif /* __ASSEMBLER__ */ |