From ebbc5f6663cd73397f8e1c25afbb47d2f06548db Mon Sep 17 00:00:00 2001 From: Bluebie Date: Fri, 8 Feb 2013 21:11:56 +1100 Subject: experimental build with pin0 as boot button pin --- firmware/bootloaderconfig.h | 33 +++++++++++++++++---------------- 1 file 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__ */ -- cgit v1.2.3