From a5e62ff2517e4add49ec67c1844b93e38144ea31 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Wed, 3 Jul 2019 07:36:03 -0700 Subject: QMK Lufa Bootloader Generation (qmk#2009) This re-implements the code changes into QMK's LUFA repo --- Bootloaders/DFU/BootloaderDFU.c | 12 ++++++------ Bootloaders/DFU/Descriptors.c | 12 ++++++++++-- Bootloaders/DFU/Descriptors.h | 9 ++++++++- 3 files changed, 24 insertions(+), 9 deletions(-) (limited to 'Bootloaders') diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c index 10396f012..883afef03 100644 --- a/Bootloaders/DFU/BootloaderDFU.c +++ b/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; } @@ -234,12 +234,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); + DDR(QMK_ESC_INPUT) |= NUM(QMK_ESC_INPUT); #endif /* Initialize the USB and other board hardware drivers */ @@ -268,7 +268,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/Bootloaders/DFU/Descriptors.c b/Bootloaders/DFU/Descriptors.c index 37c36dcc3..dcad11d6c 100644 --- a/Bootloaders/DFU/Descriptors.c +++ b/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/Bootloaders/DFU/Descriptors.h b/Bootloaders/DFU/Descriptors.h index d70b477dc..40f604a1e 100644 --- a/Bootloaders/DFU/Descriptors.h +++ b/Bootloaders/DFU/Descriptors.h @@ -189,6 +189,13 @@ 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 +#endif -- cgit v1.2.3