From 7d60a141a25526d94bb28015eb08bbe27c0a88cd Mon Sep 17 00:00:00 2001 From: James Young <18669334+noroadsleft@users.noreply.github.com> Date: Sun, 17 Apr 2022 12:53:59 -0700 Subject: Anne Pro 2 Refactor (#16864) * 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 --- keyboards/annepro2/annepro2.c | 113 +++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 57 deletions(-) (limited to 'keyboards/annepro2/annepro2.c') diff --git a/keyboards/annepro2/annepro2.c b/keyboards/annepro2/annepro2.c index ef18f83329..d5639be3ae 100644 --- a/keyboards/annepro2/annepro2.c +++ b/keyboards/annepro2/annepro2.c @@ -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 @@ -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; -- cgit v1.2.3