Implement QMK's IAP default keybind (#29)

* Add keymap for going into IAP

* switch to default QMK keybind for IAP mode

* implement bluetooth IAP mode
This commit is contained in:
jmarmstrong1207
2021-09-12 09:26:27 +02:00
committed by bwisn
parent 853388d9dd
commit 54de886aab
5 changed files with 33 additions and 1 deletions
+21
View File
@@ -29,6 +29,26 @@ uint16_t annepro2LedMatrix[MATRIX_ROWS * MATRIX_COLS] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
void OVERRIDE bootloader_jump(void) {
// Send msg to shine to boot into IAP
sdPut(&SD0, CMD_LED_IAP);
// wait for shine to boot into IAP
wait_ms(15);
// Load ble into IAP
annepro2_ble_bootload();
wait_ms(15);
// Magic key to set keyboard to IAP
*((uint32_t*)0x20001ffc) = 0x0000fab2;
// Load the main MCU into IAP
__disable_irq();
NVIC_SystemReset();
}
void OVERRIDE keyboard_pre_init_kb(void) {
#if HAL_USE_SPI == TRUE
spi_init();
@@ -146,6 +166,7 @@ bool OVERRIDE process_record_kb(uint16_t keycode, keyrecord_t *record) {
case KC_AP_LED_SPEED:
annepro2LedNextAnimationSpeed();
return false;
default:
break;
}
+8
View File
@@ -54,6 +54,10 @@ static uint8_t bleMcuUnpair[10] = {
0x7b, 0x10, 0x53, 0x10, 0x02, 0x00, 0x00, 0x7d, 0x40, 0x05,
};
static uint8_t bleMcuBootload[11] = {
0x7b, 0x10, 0x51, 0x10, 0x03, 0x00, 0x00, 0x7d, 0x02, 0x01, 0x01
};
static host_driver_t *lastHostDriver = NULL;
#ifdef NKRO_ENABLE
static bool lastNkroStatus = false;
@@ -61,6 +65,10 @@ static bool lastNkroStatus = false;
/* -------------------- Public Function Implementation ---------------------- */
void annepro2_ble_bootload(void) {
sdWrite(&SD1, bleMcuBootload, 11);
}
void annepro2_ble_startup(void) {
sdWrite(&SD1, bleMcuWakeup, 11);
}
+1
View File
@@ -19,6 +19,7 @@
#include "annepro2.h"
#include "quantum.h"
void annepro2_ble_bootload(void);
void annepro2_ble_startup(void);
void annepro2_ble_broadcast(uint8_t port);
void annepro2_ble_connect(uint8_t port);
+1 -1
View File
@@ -36,7 +36,7 @@ EXTRAKEY_ENABLE = yes
KEY_LOCK_ENABLE = no
# Other featues
BOOTMAGIC_ENABLE = no
BOOTMAGIC_ENABLE = yes
CONSOLE_ENABLE = no
COMMAND_ENABLE = yes
RAW_ENABLE = yes
+2
View File
@@ -15,7 +15,9 @@
#define CMD_LED_NEXT_ANIMATION_SPEED 0xD
#define CMD_LED_SET_FOREGROUND_COLOR 0xE
#define CMD_LED_KEYPRESS 0xF
#define CMD_LED_IAP 0x10
void annepro2SetIAP(void);
void annepro2LedDisable(void);
void annepro2LedEnable(void);
void annepro2LedUpdate(uint8_t row, uint8_t col);