Browse Source

add patch for keyboard

cuu 1 year ago
parent
commit
442ee46621
2 changed files with 40 additions and 0 deletions
  1. 24 0
      Code/patch/keyboard/arduino.patch
  2. 16 0
      Code/patch/keyboard/bootloader.patch

+ 24 - 0
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 <libmaple/usb.h>
+ #include <string.h>
+ #include <libmaple/iwdg.h>
+-
++#include <libmaple/bkp.h>
+ #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();
+ }

+ 16 - 0
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
+