Skip to content

Commit

Permalink
Anne Pro 2 Refactor (#16864)
Browse files Browse the repository at this point in the history
* move RGB Matrix rules to keyboard level

* move PERMISSIVE_HOLD config to keyboard level

* annepro2.c: convert tabs to spaces

* refactor rules.mk files

Reformats each version's `rules.mk` file to be arranged more similarly to those of the rest of the keyboards in QMK.

No logic change.

* annepro2.c: allow compilation without RGB Matrix

Wraps the `led_enabled` definition and the `KC_AP_RGB_*` keycodes in `#ifdef RGB_MATRIX_ENABLE`, allowing successful compilation if the user sets `RGB_MATRIX_ENABLE = no`.

* rework readme files

Reworks the main `readme.md` file to be more friendly to GitHub viewing, and removes the single-line version-specific readme files (exposes the main readme to QMK Configurator users).

* info.json: update maintainer value

* info.json: apply friendly formatting
  • Loading branch information
noroadsleft authored Apr 17, 2022
1 parent a5a4597 commit 7d60a14
Show file tree
Hide file tree
Showing 13 changed files with 211 additions and 503 deletions.
113 changes: 56 additions & 57 deletions keyboards/annepro2/annepro2.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ static const SerialConfig ble_uart_config = {

static uint8_t led_mcu_wakeup[11] = {0x7b, 0x10, 0x43, 0x10, 0x03, 0x00, 0x00, 0x7d, 0x02, 0x01, 0x02};

static uint8_t led_enabled = 1;

ble_capslock_t ble_capslock = {._dummy = {0}, .caps_lock = false};

#ifdef RGB_MATRIX_ENABLE
static uint8_t led_enabled = 1;
static uint8_t current_rgb_row = 0;
#endif

Expand Down Expand Up @@ -227,69 +226,69 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if(rgb_matrix_is_enabled()) ap2_led_disable();
else ap2_led_enable();
return true;
#endif


case KC_AP_RGB_VAI:
if (record->event.pressed) {
if (get_mods() & MOD_MASK_SHIFT) {
rgb_matrix_increase_hue();
return false;
} else if (get_mods() & MOD_MASK_CTRL) {
rgb_matrix_decrease_hue();
return false;
} else {
rgb_matrix_increase_val();
}
}
if (record->event.pressed) {
if (get_mods() & MOD_MASK_SHIFT) {
rgb_matrix_increase_hue();
return false;
} else if (get_mods() & MOD_MASK_CTRL) {
rgb_matrix_decrease_hue();
return false;
} else {
rgb_matrix_increase_val();
}
}
return true;

case KC_AP_RGB_VAD:
if (record->event.pressed) {
if (get_mods() & MOD_MASK_SHIFT) {
rgb_matrix_increase_sat();
return false;
} else if (get_mods() & MOD_MASK_CTRL) {
rgb_matrix_decrease_sat();
return false;
} else {
rgb_matrix_decrease_val();
}
}
if (record->event.pressed) {
if (get_mods() & MOD_MASK_SHIFT) {
rgb_matrix_increase_sat();
return false;
} else if (get_mods() & MOD_MASK_CTRL) {
rgb_matrix_decrease_sat();
return false;
} else {
rgb_matrix_decrease_val();
}
}
return true;

case KC_AP_RGB_TOG:
if (record->event.pressed) {
if (get_mods() & MOD_MASK_SHIFT) {
rgb_matrix_increase_speed();
return false;
} else if (get_mods() & MOD_MASK_CTRL) {
rgb_matrix_decrease_speed();
return false;
} else {
if (led_enabled) {
ap2_led_disable();
rgb_matrix_disable();
led_enabled = 0;
} else {
ap2_led_enable();
rgb_matrix_enable();
led_enabled = 1;
}
return true;
}
}
if (record->event.pressed) {
if (get_mods() & MOD_MASK_SHIFT) {
rgb_matrix_increase_speed();
return false;
} else if (get_mods() & MOD_MASK_CTRL) {
rgb_matrix_decrease_speed();
return false;
} else {
if (led_enabled) {
ap2_led_disable();
rgb_matrix_disable();
led_enabled = 0;
} else {
ap2_led_enable();
rgb_matrix_enable();
led_enabled = 1;
}
return true;
}
}
return true;

case KC_AP_RGB_MOD:
if (record->event.pressed) {
if (get_mods() & MOD_MASK_CTRL) {
rgb_matrix_step_reverse();
return false;
} else {
rgb_matrix_step();
}
}
if (record->event.pressed) {
if (get_mods() & MOD_MASK_CTRL) {
rgb_matrix_step_reverse();
return false;
} else {
rgb_matrix_step();
}
}
return true;
#endif

default:
break;
Expand Down
3 changes: 3 additions & 0 deletions keyboards/annepro2/c15/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@

#define MATRIX_COL_PINS \
{ C4, C5, B10, B11, C0, A15, A8, A10, A11, A12, A13, A14, B2, B3 }

// Obins stock firmware has something similar to this already enabled, but disabled by default in QMK
#define PERMISSIVE_HOLD
1 change: 0 additions & 1 deletion keyboards/annepro2/c15/readme.md

This file was deleted.

52 changes: 32 additions & 20 deletions keyboards/annepro2/c15/rules.mk
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
# Anne Pro 2
SRC = \
matrix.c \
annepro2_ble.c \
ap2_led.c \
protocol.c \
rgb_driver.c \
config_led.c

# MCU
MCU = cortex-m0plus
ARMV = 6
Expand All @@ -18,23 +9,44 @@ MCU_STARTUP = ht32f523xx

BOARD = ANNEPRO2_C15

# Options
# Bootloader selection
BOOTLOADER = custom
PROGRAM_CMD = annepro2_tools --boot $(BUILD_DIR)/$(TARGET).bin

# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = no # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output

# Custom RGB matrix handling
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = custom

# Keys
CUSTOM_MATRIX = lite
NKRO_ENABLE = no
MOUSEKEY_ENABLE = no
EXTRAKEY_ENABLE = yes
KEY_LOCK_ENABLE = no
LAYOUTS = 60_ansi

# Other featues
BOOTMAGIC_ENABLE = no
CONSOLE_ENABLE = no
COMMAND_ENABLE = no
# Other features
RAW_ENABLE = no
MIDI_ENABLE = no
VIRTSER_ENABLE = no
COMBO_ENABLE = no
BOOTLOADER = custom
PROGRAM_CMD = annepro2_tools --boot $(BUILD_DIR)/$(TARGET).bin

LAYOUTS = 60_ansi

# Anne Pro 2
SRC = \
matrix.c \
annepro2_ble.c \
ap2_led.c \
protocol.c \
rgb_driver.c \
config_led.c
3 changes: 3 additions & 0 deletions keyboards/annepro2/c18/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@
// inputs (columns are sampled)
#define MATRIX_COL_PINS \
{ C4, C5, D0, B15, C11, A15, C12, C13, A8, A10, A11, A14, D2, D3 }

// Obins stock firmware has something similar to this already enabled, but disabled by default in QMK
#define PERMISSIVE_HOLD
1 change: 0 additions & 1 deletion keyboards/annepro2/c18/readme.md

This file was deleted.

52 changes: 32 additions & 20 deletions keyboards/annepro2/c18/rules.mk
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
# Anne Pro 2
SRC = \
matrix.c \
annepro2_ble.c \
ap2_led.c \
protocol.c \
rgb_driver.c \
config_led.c

# MCU
MCU = cortex-m0plus
ARMV = 6
Expand All @@ -18,23 +9,44 @@ MCU_STARTUP = ht32f523xx

BOARD = ANNEPRO2_C18

# Options
# Bootloader selection
BOOTLOADER = custom
PROGRAM_CMD = annepro2_tools --boot $(BUILD_DIR)/$(TARGET).bin

# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = no # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output

# Custom RGB matrix handling
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = custom

# Keys
CUSTOM_MATRIX = lite
NKRO_ENABLE = no
MOUSEKEY_ENABLE = no
EXTRAKEY_ENABLE = yes
KEY_LOCK_ENABLE = no
LAYOUTS = 60_ansi

# Other featues
BOOTMAGIC_ENABLE = yes
CONSOLE_ENABLE = no
COMMAND_ENABLE = no
# Other features
RAW_ENABLE = no
MIDI_ENABLE = no
VIRTSER_ENABLE = no
COMBO_ENABLE = no
BOOTLOADER = custom
PROGRAM_CMD = annepro2_tools --boot $(BUILD_DIR)/$(TARGET).bin

LAYOUTS = 60_ansi

# Anne Pro 2
SRC = \
matrix.c \
annepro2_ble.c \
ap2_led.c \
protocol.c \
rgb_driver.c \
config_led.c
Loading

0 comments on commit 7d60a14

Please sign in to comment.