mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-28 20:09:23 +00:00
annepro2: apply suggestions from tzarc's code review
Co-authored-by: Nick Brassel <nick@tzarc.org>
This commit is contained in:
parent
b4cac43d61
commit
77ada6d94b
@ -61,7 +61,7 @@ void OVERRIDE bootloader_jump(void) {
|
|||||||
NVIC_SystemReset();
|
NVIC_SystemReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OVERRIDE keyboard_pre_init_kb(void) {
|
void keyboard_pre_init_kb(void) {
|
||||||
#if HAL_USE_SPI == TRUE
|
#if HAL_USE_SPI == TRUE
|
||||||
spi_init();
|
spi_init();
|
||||||
#endif
|
#endif
|
||||||
@ -83,7 +83,7 @@ void OVERRIDE keyboard_pre_init_kb(void) {
|
|||||||
sdStart(&SD0, &ledUartRuntimeConfig);
|
sdStart(&SD0, &ledUartRuntimeConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OVERRIDE keyboard_post_init_kb(void) {
|
void keyboard_post_init_kb(void) {
|
||||||
// Start BLE UART
|
// Start BLE UART
|
||||||
sdStart(&SD1, &bleUartConfig);
|
sdStart(&SD1, &bleUartConfig);
|
||||||
annepro2_ble_startup();
|
annepro2_ble_startup();
|
||||||
@ -100,7 +100,6 @@ void OVERRIDE keyboard_post_init_kb(void) {
|
|||||||
keyboard_post_init_user();
|
keyboard_post_init_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OVERRIDE matrix_init_kb(void) { matrix_init_user(); }
|
|
||||||
|
|
||||||
void matrix_scan_kb() {
|
void matrix_scan_kb() {
|
||||||
// if there's stuff on the ble serial buffer
|
// if there's stuff on the ble serial buffer
|
||||||
@ -125,10 +124,7 @@ void matrix_scan_kb() {
|
|||||||
matrix_scan_user();
|
matrix_scan_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
* @returns false processing for this keycode has been completed.
|
|
||||||
*/
|
|
||||||
bool OVERRIDE process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
if (annepro2LedStatus.matrixEnabled && annepro2LedStatus.isReactive) {
|
if (annepro2LedStatus.matrixEnabled && annepro2LedStatus.isReactive) {
|
||||||
annepro2LedForwardKeypress(record->event.key.row, record->event.key.col);
|
annepro2LedForwardKeypress(record->event.key.row, record->event.key.col);
|
||||||
|
@ -20,8 +20,6 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "qmk_ap2_led.h"
|
#include "qmk_ap2_led.h"
|
||||||
|
|
||||||
#define OVERRIDE __attribute__((noinline))
|
|
||||||
|
|
||||||
typedef struct __attribute__((__packed__)) {
|
typedef struct __attribute__((__packed__)) {
|
||||||
uint8_t _dummy[10];
|
uint8_t _dummy[10];
|
||||||
bool caps_lock;
|
bool caps_lock;
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#define VENDOR_ID 0x04d9
|
#define VENDOR_ID 0x04d9
|
||||||
#define PRODUCT_ID 0xa290
|
#define PRODUCT_ID 0xa290
|
||||||
#define DEVICE_VER 0x1337
|
#define DEVICE_VER 0x1337
|
||||||
#define MANUFACTURER Holtek
|
#define MANUFACTURER Obins
|
||||||
#define PRODUCT Anne Pro 2 QMK
|
#define PRODUCT Anne Pro 2 QMK
|
||||||
|
|
||||||
#define ANNEPRO2_C15
|
#define ANNEPRO2_C15
|
||||||
@ -31,77 +31,9 @@
|
|||||||
#define MATRIX_COLS 14
|
#define MATRIX_COLS 14
|
||||||
// layer size: MATRIX_ROWS * MATRIX_COLS * sizeof(uint16_t) = 144 bytes
|
// layer size: MATRIX_ROWS * MATRIX_COLS * sizeof(uint16_t) = 144 bytes
|
||||||
|
|
||||||
// Max available layers
|
|
||||||
#define MAX_LAYERS 8
|
|
||||||
// keymaps size: layer size * MAX_LAYERS = 1152 bytes
|
|
||||||
|
|
||||||
#define KEYMAP_60_ANSI
|
|
||||||
// Number of supported layouts
|
// Number of supported layouts
|
||||||
#define NUM_LAYOUTS 4
|
#define NUM_LAYOUTS 4
|
||||||
|
|
||||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||||
#define DEBOUNCE 5
|
#define DEBOUNCE 5
|
||||||
|
|
||||||
/* number of backlight levels */
|
|
||||||
// #define BACKLIGHT_LEVELS 10
|
|
||||||
|
|
||||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
|
||||||
//#define LOCKING_SUPPORT_ENABLE
|
|
||||||
/* Locking resynchronize hack */
|
|
||||||
//#define LOCKING_RESYNC_ENABLE
|
|
||||||
|
|
||||||
/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
|
|
||||||
* This is userful for the Windows task manager shortcut (ctrl+shift+esc).
|
|
||||||
*/
|
|
||||||
// #define GRAVE_ESC_CTRL_OVERRIDE
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Force NKRO
|
|
||||||
*
|
|
||||||
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
|
|
||||||
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
|
|
||||||
* makefile for this to work.)
|
|
||||||
*
|
|
||||||
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
|
|
||||||
* until the next keyboard reset.
|
|
||||||
*
|
|
||||||
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
|
|
||||||
* fully operational during normal computer usage.
|
|
||||||
*
|
|
||||||
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
|
|
||||||
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
|
|
||||||
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
|
|
||||||
* power-up.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#define FORCE_NKRO
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Magic Key Options
|
|
||||||
*
|
|
||||||
* Magic keys are hotkey commands that allow control over firmware functions of
|
|
||||||
* the keyboard. They are best used in combination with the HID Listen program,
|
|
||||||
* found here: https://www.pjrc.com/teensy/hid_listen.html
|
|
||||||
*
|
|
||||||
* The options below allow the magic key functionality to be changed. This is
|
|
||||||
* useful if your keyboard/keypad is missing keys and you want magic key support.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Feature disable options
|
|
||||||
* These options are also useful to firmware size reduction.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* disable debug print */
|
|
||||||
// #define NO_DEBUG
|
|
||||||
|
|
||||||
/* disable print */
|
|
||||||
// #define NO_PRINTg
|
|
||||||
|
|
||||||
/* disable action features */
|
|
||||||
//#define NO_ACTION_LAYER
|
|
||||||
//#define NO_ACTION_TAPPING
|
|
||||||
//#define NO_ACTION_ONESHOT
|
|
||||||
//#define NO_ACTION_MACRO
|
|
||||||
//#define NO_ACTION_FUNCTION
|
|
||||||
|
@ -15,9 +15,9 @@ MCU_SERIES = HT32F523xx
|
|||||||
MCU_LDSCRIPT = HT32F52342_ANNEPRO2
|
MCU_LDSCRIPT = HT32F52342_ANNEPRO2
|
||||||
MCU_STARTUP = ht32f523xx
|
MCU_STARTUP = ht32f523xx
|
||||||
|
|
||||||
BOARD = ANNEPRO2
|
BOARD = ANNEPRO2_C15
|
||||||
|
|
||||||
OPT_DEFS = -Wno-unused-function -fdump-rtl-dfinish -fstack-usage
|
OPT_DEFS += -Wno-unused-function -fdump-rtl-dfinish -fstack-usage
|
||||||
#EXTRALDFLAGS = -Wl,--print-memory-usage
|
#EXTRALDFLAGS = -Wl,--print-memory-usage
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
|
@ -17,7 +17,7 @@ MCU_STARTUP = ht32f523xx
|
|||||||
|
|
||||||
BOARD = ANNEPRO2_C18
|
BOARD = ANNEPRO2_C18
|
||||||
|
|
||||||
OPT_DEFS = -Wno-unused-function -fdump-rtl-dfinish -fstack-usage
|
OPT_DEFS += -Wno-unused-function -fdump-rtl-dfinish -fstack-usage
|
||||||
#EXTRALDFLAGS = -Wl,--print-memory-usage
|
#EXTRALDFLAGS = -Wl,--print-memory-usage
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
|
@ -107,18 +107,6 @@ enum anne_pro_layers {
|
|||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
// Code to run after initializing the keyboard
|
|
||||||
void keyboard_post_init_user(void) {
|
|
||||||
// Here are two common functions that you can use. For more LED functions, refer to the file "qmk_ap2_led.h"
|
|
||||||
|
|
||||||
// annepro2-shine disables LEDs by default. Uncomment this function to enable them at startup.
|
|
||||||
// annepro2LedEnable();
|
|
||||||
|
|
||||||
// Additionally, it also chooses the first LED profile by default. Refer to the "profiles" array in main.c in
|
|
||||||
// annepro2-shine to see the order. Replace "i" with the index of your preferred profile. (i.e the RED profile is index 0)
|
|
||||||
// annepro2LedSetProfile(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The function to handle the caps lock logic
|
// The function to handle the caps lock logic
|
||||||
bool led_update_user(led_t leds) {
|
bool led_update_user(led_t leds) {
|
||||||
if (leds.caps_lock) {
|
if (leds.caps_lock) {
|
||||||
|
@ -107,18 +107,6 @@ enum anne_pro_layers {
|
|||||||
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
// Code to run after initializing the keyboard
|
|
||||||
void keyboard_post_init_user(void) {
|
|
||||||
// Here are two common functions that you can use. For more LED functions, refer to the file "qmk_ap2_led.h"
|
|
||||||
|
|
||||||
// annepro2-shine disables LEDs by default. Uncomment this function to enable them at startup.
|
|
||||||
// annepro2LedEnable();
|
|
||||||
|
|
||||||
// Additionally, it also chooses the first LED profile by default. Refer to the "profiles" array in main.c in
|
|
||||||
// annepro2-shine to see the order. Replace "i" with the index of your preferred profile. (i.e the RED profile is index 0)
|
|
||||||
// annepro2LedSetProfile(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||||
switch (get_highest_layer(state)) {
|
switch (get_highest_layer(state)) {
|
||||||
case _FN1_LAYER:
|
case _FN1_LAYER:
|
||||||
|
@ -104,15 +104,3 @@ enum anne_pro_layers {
|
|||||||
),
|
),
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
// Code to run after initializing the keyboard
|
|
||||||
void keyboard_post_init_user(void) {
|
|
||||||
// Here are two common functions that you can use. For more LED functions, refer to the file "qmk_ap2_led.h"
|
|
||||||
|
|
||||||
// annepro2-shine disables LEDs by default. Uncomment this function to enable them at startup.
|
|
||||||
// annepro2LedEnable();
|
|
||||||
|
|
||||||
// Additionally, it also chooses the first LED profile by default. Refer to the "profiles" array in main.c in
|
|
||||||
// annepro2-shine to see the order. Replace "i" with the index of your preferred profile. (i.e the RED profile is index 0)
|
|
||||||
// annepro2LedSetProfile(i);
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user