diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c
index 8da725d248..928cf6fe3b 100644
--- a/Bootloaders/DFU/BootloaderDFU.c
+++ b/Bootloaders/DFU/BootloaderDFU.c
@@ -136,8 +136,8 @@ void Application_Jump_Check(void)
if (boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS) & FUSE_BOOTRST)
{
/* If the reset source was not an external reset or the key is correct, clear it and jump to the application */
- if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY))
- JumpToApplication = true;
+ //if (!(MCUSR & (1 << EXTRF)) || (MagicBootKey == MAGIC_BOOT_KEY))
+ // JumpToApplication = true;
/* Clear reset source */
MCUSR &= ~(1 << EXTRF);
@@ -146,8 +146,8 @@ void Application_Jump_Check(void)
{
/* If the reset source was the bootloader and the key is correct, clear it and jump to the application;
* this can happen in the HWBE fuse is set, and the HBE pin is low during the watchdog reset */
- if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
- JumpToApplication = true;
+ //if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
+ // JumpToApplication = true;
/* Clear reset source */
MCUSR &= ~(1 << WDRF);
@@ -182,14 +182,32 @@ int main(void)
SetupHardware();
/* Turn on first LED on the board to indicate that the bootloader has started */
- LEDs_SetAllLEDs(LEDS_LED1);
+ LEDs_SetAllLEDs(LEDS_LED1 | LEDS_LED2);
/* Enable global interrupts so that the USB stack can function */
GlobalInterruptEnable();
+
+ #if (BOARD == BOARD_QMK)
+ uint16_t keypress = 0;
+ #endif
+
/* Run the USB management task while the bootloader is supposed to be running */
- while (RunBootloader || WaitForExit)
+ while (RunBootloader || WaitForExit) {
USB_USBTask();
+ #if (BOARD == BOARD_QMK)
+ bool pressed = (PIN(QMK_ESC_ROW) & NUM(QMK_ESC_ROW));
+ if ((DFU_State == dfuIDLE) && (keypress > 5000) && pressed) {
+ break;
+ }
+ if (pressed) {
+ keypress++;
+ } else {
+ keypress = 0;
+ }
+
+ #endif
+ }
/* Reset configured hardware back to their original states for the user application */
ResetHardware();
@@ -212,6 +230,15 @@ static void SetupHardware(void)
MCUCR = (1 << IVCE);
MCUCR = (1 << IVSEL);
+ #if (BOARD == BOARD_QMK)
+ // column setup
+ DDR(QMK_ESC_COL) |= NUM(QMK_ESC_COL);
+ PORT(QMK_ESC_COL) |= NUM(QMK_ESC_COL);
+
+ // row setup
+ DDR(QMK_ESC_ROW) |= NUM(QMK_ESC_ROW);
+ #endif
+
/* Initialize the USB and other board hardware drivers */
USB_Init();
LEDs_Init();
@@ -219,7 +246,8 @@ static void SetupHardware(void)
/* Bootloader active LED toggle timer initialization */
TIMSK1 = (1 << TOIE1);
TCCR1B = ((1 << CS11) | (1 << CS10));
-}
+
+}
/** Resets all configured hardware required for the bootloader back to their original states. */
static void ResetHardware(void)
@@ -235,6 +263,10 @@ static void ResetHardware(void)
/* Relocate the interrupt vector table back to the application section */
MCUCR = (1 << IVCE);
MCUCR = 0;
+
+ #if (BOARD == BOARD_QMK)
+ DDR(QMK_ESC_COL) = PORT(QMK_ESC_COL) = DDR(QMK_ESC_ROW) = PORT(QMK_ESC_ROW) = 0;
+ #endif
}
/** ISR to periodically toggle the LEDs on the board to indicate that the bootloader is active. */
diff --git a/Bootloaders/DFU/Descriptors.c b/Bootloaders/DFU/Descriptors.c
index f7fe1cbb42..6b7b6d4900 100644
--- a/Bootloaders/DFU/Descriptors.c
+++ b/Bootloaders/DFU/Descriptors.c
@@ -125,13 +125,13 @@ const USB_Descriptor_String_t LanguageString = USB_STRING_DESCRIPTOR_ARRAY(LANGU
* form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
-const USB_Descriptor_String_t ManufacturerString = USB_STRING_DESCRIPTOR(L"Dean Camera");
+const USB_Descriptor_String_t ManufacturerString = USB_STRING_DESCRIPTOR(L"QMK");
/** Product descriptor string. This is a Unicode string containing the product's details in human readable form,
* and is read out upon request by the host when the appropriate string ID is requested, listed in the Device
* Descriptor.
*/
-const USB_Descriptor_String_t ProductString = USB_STRING_DESCRIPTOR(L"LUFA DFU");
+const USB_Descriptor_String_t ProductString = USB_STRING_DESCRIPTOR(L"KB");
/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors"
* documentation) by the application code so that the address and size of a requested descriptor can be given
diff --git a/Bootloaders/DFU/makefile b/Bootloaders/DFU/makefile
index 6e15cedfc3..0d2014015d 100644
--- a/Bootloaders/DFU/makefile
+++ b/Bootloaders/DFU/makefile
@@ -11,10 +11,10 @@
# Run "make help" for target help.
-MCU = at90usb1287
+MCU = atmega32u4
ARCH = AVR8
-BOARD = USBKEY
-F_CPU = 8000000
+BOARD = QMK
+F_CPU = 16000000
F_USB = $(F_CPU)
OPTIMIZATION = s
TARGET = BootloaderDFU
@@ -26,8 +26,8 @@ LD_FLAGS = -Wl,--section-start=.text=$(BOOT_START_OFFSET) $(BOOT_API_LD_FLAG
# Flash size and bootloader section sizes of the target, in KB. These must
# match the target's total FLASH size and the bootloader size set in the
# device's fuses.
-FLASH_SIZE_KB = 128
-BOOT_SECTION_SIZE_KB = 8
+FLASH_SIZE_KB = 32
+BOOT_SECTION_SIZE_KB = 4
# Bootloader address calculation formulas
# Do not modify these macros, but rather modify the dependent values above.
diff --git a/LUFA/Common/BoardTypes.h b/LUFA/Common/BoardTypes.h
index a8bb191db0..e945523427 100644
--- a/LUFA/Common/BoardTypes.h
+++ b/LUFA/Common/BoardTypes.h
@@ -246,6 +246,9 @@
/** Selects the Atmel Xplained-MINI specific board drivers, including the driver for the board LEDs. */
#define BOARD_XPLAINED_MINI 60
+ /** Selects the QMK specific board drivres, including the driver for the board LEDs. */
+ #define BOARD_QMK 61
+
#if !defined(__DOXYGEN__)
#define BOARD_ BOARD_NONE
diff --git a/LUFA/Drivers/Board/AVR8/QMK/Board.h b/LUFA/Drivers/Board/AVR8/QMK/Board.h
new file mode 100644
index 0000000000..19a0f2dfee
--- /dev/null
+++ b/LUFA/Drivers/Board/AVR8/QMK/Board.h
@@ -0,0 +1,65 @@
+/*
+Copyright 2017 Jack Humbert
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
Name | Color | Info | Active Level | Port Pin |
---|---|---|---|---|
LEDS_LED1 | Green | General Indicator | High | PORT(QMK_LED).6 |