From 77ada6d94b1d55a84529c6af6a9ca8a9934b95d9 Mon Sep 17 00:00:00 2001 From: bwisn <56162793+bwisn@users.noreply.github.com> Date: Mon, 18 Oct 2021 22:49:54 +0200 Subject: [PATCH] annepro2: apply suggestions from tzarc's code review Co-authored-by: Nick Brassel --- keyboards/annepro2/annepro2.c | 10 +-- keyboards/annepro2/annepro2.h | 2 - keyboards/annepro2/c15/config.h | 70 +------------------ keyboards/annepro2/c15/rules.mk | 4 +- keyboards/annepro2/c18/rules.mk | 2 +- .../keymaps/default-full-caps/keymap.c | 12 ---- .../keymaps/default-layer-indicators/keymap.c | 12 ---- keyboards/annepro2/keymaps/default/keymap.c | 12 ---- 8 files changed, 7 insertions(+), 117 deletions(-) diff --git a/keyboards/annepro2/annepro2.c b/keyboards/annepro2/annepro2.c index 95dc8e90f43..4d479aa241f 100644 --- a/keyboards/annepro2/annepro2.c +++ b/keyboards/annepro2/annepro2.c @@ -61,7 +61,7 @@ void OVERRIDE bootloader_jump(void) { NVIC_SystemReset(); } -void OVERRIDE keyboard_pre_init_kb(void) { +void keyboard_pre_init_kb(void) { #if HAL_USE_SPI == TRUE spi_init(); #endif @@ -83,7 +83,7 @@ void OVERRIDE keyboard_pre_init_kb(void) { sdStart(&SD0, &ledUartRuntimeConfig); } -void OVERRIDE keyboard_post_init_kb(void) { +void keyboard_post_init_kb(void) { // Start BLE UART sdStart(&SD1, &bleUartConfig); annepro2_ble_startup(); @@ -100,7 +100,6 @@ void OVERRIDE keyboard_post_init_kb(void) { keyboard_post_init_user(); } -void OVERRIDE matrix_init_kb(void) { matrix_init_user(); } void matrix_scan_kb() { // if there's stuff on the ble serial buffer @@ -125,10 +124,7 @@ void matrix_scan_kb() { matrix_scan_user(); } -/*! - * @returns false processing for this keycode has been completed. - */ -bool OVERRIDE process_record_kb(uint16_t keycode, keyrecord_t *record) { +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { if (annepro2LedStatus.matrixEnabled && annepro2LedStatus.isReactive) { annepro2LedForwardKeypress(record->event.key.row, record->event.key.col); diff --git a/keyboards/annepro2/annepro2.h b/keyboards/annepro2/annepro2.h index d5d88d7498a..25e0cf4932f 100644 --- a/keyboards/annepro2/annepro2.h +++ b/keyboards/annepro2/annepro2.h @@ -20,8 +20,6 @@ #include #include "qmk_ap2_led.h" -#define OVERRIDE __attribute__((noinline)) - typedef struct __attribute__((__packed__)) { uint8_t _dummy[10]; bool caps_lock; diff --git a/keyboards/annepro2/c15/config.h b/keyboards/annepro2/c15/config.h index 9c6516fbe65..2a74608adf2 100644 --- a/keyboards/annepro2/c15/config.h +++ b/keyboards/annepro2/c15/config.h @@ -21,7 +21,7 @@ #define VENDOR_ID 0x04d9 #define PRODUCT_ID 0xa290 #define DEVICE_VER 0x1337 -#define MANUFACTURER Holtek +#define MANUFACTURER Obins #define PRODUCT Anne Pro 2 QMK #define ANNEPRO2_C15 @@ -31,77 +31,9 @@ #define MATRIX_COLS 14 // 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 #define NUM_LAYOUTS 4 /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #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 diff --git a/keyboards/annepro2/c15/rules.mk b/keyboards/annepro2/c15/rules.mk index da0de1e56ab..243fd7bfb04 100644 --- a/keyboards/annepro2/c15/rules.mk +++ b/keyboards/annepro2/c15/rules.mk @@ -15,9 +15,9 @@ MCU_SERIES = HT32F523xx MCU_LDSCRIPT = HT32F52342_ANNEPRO2 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 # Options diff --git a/keyboards/annepro2/c18/rules.mk b/keyboards/annepro2/c18/rules.mk index 532d6be8b80..67334011a6b 100644 --- a/keyboards/annepro2/c18/rules.mk +++ b/keyboards/annepro2/c18/rules.mk @@ -17,7 +17,7 @@ MCU_STARTUP = ht32f523xx 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 # Options diff --git a/keyboards/annepro2/keymaps/default-full-caps/keymap.c b/keyboards/annepro2/keymaps/default-full-caps/keymap.c index 40fb87359a9..8ac9211ac43 100644 --- a/keyboards/annepro2/keymaps/default-full-caps/keymap.c +++ b/keyboards/annepro2/keymaps/default-full-caps/keymap.c @@ -107,18 +107,6 @@ enum anne_pro_layers { // 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 bool led_update_user(led_t leds) { if (leds.caps_lock) { diff --git a/keyboards/annepro2/keymaps/default-layer-indicators/keymap.c b/keyboards/annepro2/keymaps/default-layer-indicators/keymap.c index ab23c29bffe..ac2b421d06f 100644 --- a/keyboards/annepro2/keymaps/default-layer-indicators/keymap.c +++ b/keyboards/annepro2/keymaps/default-layer-indicators/keymap.c @@ -107,18 +107,6 @@ enum anne_pro_layers { // 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) { switch (get_highest_layer(state)) { case _FN1_LAYER: diff --git a/keyboards/annepro2/keymaps/default/keymap.c b/keyboards/annepro2/keymaps/default/keymap.c index 0c52220b8d0..a984b05830b 100644 --- a/keyboards/annepro2/keymaps/default/keymap.c +++ b/keyboards/annepro2/keymaps/default/keymap.c @@ -104,15 +104,3 @@ enum anne_pro_layers { ), }; // 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); -}