summary refs log tree commit diff
path: root/lib/lufa
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2017-11-14 16:11:29 -0500
committerGitHub <noreply@github.com>2017-11-14 16:11:29 -0500
commitec3e065f0d2c65175384699cb11fa388250fa914 (patch)
treee66837d6af1a30b739303bfa06043edf12f9fcc1 /lib/lufa
parent3c15c48e6a5c584d225d369ea458f9a3f9cd3d57 (diff)
QMK DFU bootloader generation (#2009)
* adds :bootloader target

* update planck and preonic revisions

* remove references to .h files for planck

* update preonic keymap

* only add keyboard.h files that exist

* add production target

* hook things up with the new lufa variables

* update rules for planck/preonic

* back backlight key turn of status led when pressed

* add manufacturer/product strings to bootloader
Diffstat (limited to 'lib/lufa')
-rw-r--r--lib/lufa/.gitignore1
-rw-r--r--lib/lufa/Bootloaders/DFU/BootloaderDFU.c14
-rw-r--r--lib/lufa/Bootloaders/DFU/Descriptors.c12
-rw-r--r--lib/lufa/Bootloaders/DFU/Descriptors.h8
-rw-r--r--lib/lufa/LUFA/Drivers/Board/AVR8/QMK/LEDs.h18
5 files changed, 39 insertions, 14 deletions
diff --git a/lib/lufa/.gitignore b/lib/lufa/.gitignore
index 9f9d39491d..1cd1dccf80 100644
--- a/lib/lufa/.gitignore
+++ b/lib/lufa/.gitignore
@@ -13,3 +13,4 @@ Documentation/
 LUFA/StudioIntegration/ProjectGenerator/*
 LUFA/StudioIntegration/DocBook/*
 !LUFA/StudioIntegration/Docbook/mshelp/*
+Keyboard.h
\ No newline at end of file
diff --git a/lib/lufa/Bootloaders/DFU/BootloaderDFU.c b/lib/lufa/Bootloaders/DFU/BootloaderDFU.c
index 928cf6fe3b..a2307219ec 100644
--- a/lib/lufa/Bootloaders/DFU/BootloaderDFU.c
+++ b/lib/lufa/Bootloaders/DFU/BootloaderDFU.c
@@ -196,7 +196,7 @@ int main(void)
 	while (RunBootloader || WaitForExit) {
 	  USB_USBTask();
 	  #if (BOARD == BOARD_QMK)
-	  	bool pressed = (PIN(QMK_ESC_ROW) & NUM(QMK_ESC_ROW));
+	  	bool pressed = (PIN(QMK_ESC_INPUT) & NUM(QMK_ESC_INPUT));
 		if ((DFU_State == dfuIDLE) && (keypress > 5000) && pressed) {
 			break;
 		}
@@ -231,12 +231,12 @@ static void SetupHardware(void)
 	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);
+		// output setup
+		DDR(QMK_ESC_OUTPUT) |= NUM(QMK_ESC_OUTPUT);
+		PORT(QMK_ESC_OUTPUT) |= NUM(QMK_ESC_OUTPUT);
 
-		// row setup
-		DDR(QMK_ESC_ROW) |= NUM(QMK_ESC_ROW);
+		// input setup
+		DDR(QMK_ESC_INPUT) |= NUM(QMK_ESC_INPUT);
 	#endif
 
 	/* Initialize the USB and other board hardware drivers */
@@ -265,7 +265,7 @@ static void ResetHardware(void)
 	MCUCR = 0;
 
 	#if (BOARD == BOARD_QMK)
-		DDR(QMK_ESC_COL) = PORT(QMK_ESC_COL) = DDR(QMK_ESC_ROW) = PORT(QMK_ESC_ROW) = 0;
+		DDR(QMK_ESC_OUTPUT) = PORT(QMK_ESC_OUTPUT) = DDR(QMK_ESC_INPUT) = PORT(QMK_ESC_INPUT) = 0;
 	#endif
 }
 
diff --git a/lib/lufa/Bootloaders/DFU/Descriptors.c b/lib/lufa/Bootloaders/DFU/Descriptors.c
index 6b7b6d4900..46120781b1 100644
--- a/lib/lufa/Bootloaders/DFU/Descriptors.c
+++ b/lib/lufa/Bootloaders/DFU/Descriptors.c
@@ -36,6 +36,14 @@
  */
 
 #include "Descriptors.h"
+#include "Keyboard.h"
+
+#ifndef MANUFACTURER
+    #define MANUFACTURER QMK
+#endif
+#ifndef PRODUCT
+    #define PRODUCT Keyboard
+#endif
 
 /** Device descriptor structure. This descriptor, located in SRAM memory, describes the overall
  *  device characteristics, including the supported USB version, control endpoint size and the
@@ -125,13 +133,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"QMK");
+const USB_Descriptor_String_t ManufacturerString = USB_STRING_DESCRIPTOR(LSTR(MANUFACTURER));
 
 /** 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"KB");
+const USB_Descriptor_String_t ProductString = USB_STRING_DESCRIPTOR(LSTR(PRODUCT));
 
 /** 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/lib/lufa/Bootloaders/DFU/Descriptors.h b/lib/lufa/Bootloaders/DFU/Descriptors.h
index 5487f88f35..7137d0f118 100644
--- a/lib/lufa/Bootloaders/DFU/Descriptors.h
+++ b/lib/lufa/Bootloaders/DFU/Descriptors.h
@@ -189,6 +189,12 @@
 		                                    const uint16_t wIndex,
 		                                    const void** const DescriptorAddress)
 		                                    ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
-
+		// convert to L string
+		#define LSTR(s) XLSTR(s)
+		#define XLSTR(s) L ## #s
+		// convert to string
+		#define STR(s) XSTR(s)
+		#define XSTR(s) #s
+		                                    
 #endif
 
diff --git a/lib/lufa/LUFA/Drivers/Board/AVR8/QMK/LEDs.h b/lib/lufa/LUFA/Drivers/Board/AVR8/QMK/LEDs.h
index 9fc696be97..be66b9ed20 100644
--- a/lib/lufa/LUFA/Drivers/Board/AVR8/QMK/LEDs.h
+++ b/lib/lufa/LUFA/Drivers/Board/AVR8/QMK/LEDs.h
@@ -103,10 +103,20 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
         #define A6 0x06
         #define A7 0x07
 
-        #define QMK_ESC_COL F1
-        #define QMK_ESC_ROW D5
-        #define QMK_LED     E6
-        #define QMK_SPEAKER C6
+        #include "Keyboard.h"
+
+        #ifndef QMK_ESC_INPUT
+            #define QMK_ESC_INPUT F1
+        #endif
+        #ifndef QMK_ESC_OUTPUT
+            #define QMK_ESC_OUTPUT D5
+        #endif
+        #ifndef QMK_LED
+            #define QMK_LED     E6
+        #endif
+        #ifndef QMK_SPEAKER
+            #define QMK_SPEAKER C6
+        #endif
 
         #define DDR(pin) _SFR_IO8(((pin) >> 4) + 1)
         #define PORT(pin) _SFR_IO8(((pin) >> 4) + 2)