From 442ee4662182ca66fd17fe7e530da0c93f80f422 Mon Sep 17 00:00:00 2001 From: cuu Date: Fri, 11 Nov 2022 13:39:37 +0800 Subject: [PATCH] add patch for keyboard --- Code/patch/keyboard/arduino.patch | 24 ++++++++++++++++++++++++ Code/patch/keyboard/bootloader.patch | 16 ++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Code/patch/keyboard/arduino.patch create mode 100644 Code/patch/keyboard/bootloader.patch diff --git a/Code/patch/keyboard/arduino.patch b/Code/patch/keyboard/arduino.patch new file mode 100644 index 0000000..812b8e1 --- /dev/null +++ b/Code/patch/keyboard/arduino.patch @@ -0,0 +1,24 @@ +diff --git a/packages/stm32duino/hardware/STM32F1/2022.9.26/libraries/USBComposite/USBCompositeSerial.cpp b/packages/stm32duino/hardware/STM32F1/2022.9.26/libraries/USBComposite/USBCompositeSerial.cpp +index 08349a7..c3ab02f 100644 +--- a/packages/stm32duino/hardware/STM32F1/2022.9.26/libraries/USBComposite/USBCompositeSerial.cpp ++++ b/packages/stm32duino/hardware/STM32F1/2022.9.26/libraries/USBComposite/USBCompositeSerial.cpp +@@ -22,7 +22,7 @@ + #include + #include + #include +- ++#include + #include "usb_composite_serial.h" + + #define USB_TIMEOUT 50 +@@ -208,6 +208,10 @@ static void ifaceSetupHook(unsigned hook, void *requestvp) { + + #define RESET_DELAY 100000 + static void wait_reset(void) { ++ bkp_init(); ++ bkp_enable_writes(); ++ bkp_write(10, 0x424C); ++ bkp_disable_writes(); + delay_us(RESET_DELAY); + nvic_sys_reset(); + } diff --git a/Code/patch/keyboard/bootloader.patch b/Code/patch/keyboard/bootloader.patch new file mode 100644 index 0000000..b4a8429 --- /dev/null +++ b/Code/patch/keyboard/bootloader.patch @@ -0,0 +1,16 @@ +diff --git a/bootloader_only_binaries/generic_boot20_pc13.bin b/bootloader_only_binaries/generic_boot20_pc13.bin +index 33218e9..bae6437 100644 +Binary files a/bootloader_only_binaries/generic_boot20_pc13.bin and b/bootloader_only_binaries/generic_boot20_pc13.bin differ +diff --git a/config.h b/config.h +index b377f98..f8ce81a 100644 +--- a/config.h ++++ b/config.h +@@ -156,7 +156,7 @@ + // Use Boot1 PB2 as the button, as hardly anyone uses this pin as GPIO + // Need to set the button input mode to just CR_INPUT and not CR_INPUT_PU_PD because the external pullup on the jumplink is very weak + #define BUTTON_INPUT_MODE CR_INPUT +- #define BUTTON_BANK GPIOB ++ #define BUTTON_BANK GPIOD + #define BUTTON_PIN 2 + #define BUTTON_PRESSED_STATE 1 +