Get rid of USB_LED_CAPS_LOCK
(#21436)
This commit is contained in:
parent
928e03e8d6
commit
87b11345a5
70 changed files with 214 additions and 226 deletions
|
@ -109,9 +109,9 @@ void update_led(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void led_set_user(uint8_t usb_led) {
|
||||
bool led_update_user(led_t led_state) {
|
||||
// Caps Lock Indicator
|
||||
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
|
||||
if (led_state.caps_lock) {
|
||||
writePinLow(B2);
|
||||
rgblight_setrgb(255, 110, 0);
|
||||
}
|
||||
|
@ -133,6 +133,7 @@ void led_set_user(uint8_t usb_led) {
|
|||
}
|
||||
update_led();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
layer_state_t layer_state_set_user(layer_state_t state) {
|
||||
|
|
|
@ -310,9 +310,6 @@ void matrix_init_user(void) {
|
|||
void matrix_scan_user(void) {
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
//led 1, RED, Caps-Lock ON
|
||||
//if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ergodox_right_led_1_on();
|
||||
|
||||
//led 2, GREEN
|
||||
if (layer == LAYER_NUM)
|
||||
ergodox_right_led_2_on();
|
||||
|
@ -327,9 +324,10 @@ void matrix_scan_user(void) {
|
|||
};
|
||||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void led_set_user(uint8_t usb_led) {
|
||||
if (usb_led & (1<<USB_LED_CAPS_LOCK))
|
||||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.caps_lock)
|
||||
ergodox_right_led_1_on();
|
||||
else
|
||||
ergodox_right_led_1_off();
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -212,9 +212,9 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
void housekeeping_task_keymap(void) { // runs frequently to update info
|
||||
#ifdef KEYBOARD_ergodox_ez
|
||||
uint8_t modifiers = get_mods();
|
||||
uint8_t led_usb_state = host_keyboard_leds();
|
||||
uint8_t one_shot = get_oneshot_mods();
|
||||
uint8_t modifiers = get_mods();
|
||||
led_t led_state = host_keyboard_led_state();
|
||||
uint8_t one_shot = get_oneshot_mods();
|
||||
|
||||
if (!skip_leds) {
|
||||
ergodox_board_led_off();
|
||||
|
@ -225,7 +225,7 @@ void housekeeping_task_keymap(void) { // runs frequently to update info
|
|||
// Since we're not using the LEDs here for layer indication anymore,
|
||||
// then lets use them for modifier indicators. Shame we don't have 4...
|
||||
// Also, no "else", since we want to know each, independently.
|
||||
if ((modifiers | one_shot) & MOD_MASK_SHIFT || led_usb_state & (1 << USB_LED_CAPS_LOCK)) {
|
||||
if ((modifiers | one_shot) & MOD_MASK_SHIFT || led_state.caps_lock) {
|
||||
ergodox_right_led_2_on();
|
||||
ergodox_right_led_2_set(50);
|
||||
}
|
||||
|
|
|
@ -94,12 +94,12 @@ layer_state_t layer_state_set_keymap(layer_state_t state) {
|
|||
|
||||
void matrix_scan_keymap(void) {
|
||||
uint8_t modifiers = get_mods();
|
||||
uint8_t led_usb_state = host_keyboard_leds();
|
||||
led_t led_state = host_keyboard_led_state();
|
||||
uint8_t one_shot = get_oneshot_mods();
|
||||
uint8_t layer_is_workman = layer_state_is(_WORKMAN);
|
||||
|
||||
if ((modifiers) && (layer_is_workman)) {
|
||||
if (modifiers & MOD_MASK_SHIFT || led_usb_state & (1<<USB_LED_CAPS_LOCK) || one_shot & MOD_MASK_SHIFT) {
|
||||
if (modifiers & MOD_MASK_SHIFT || led_state.caps_lock || one_shot & MOD_MASK_SHIFT) {
|
||||
ergodox_right_led_1_on();
|
||||
ergodox_right_led_1_set( 25 );
|
||||
} else {
|
||||
|
|
|
@ -238,7 +238,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
// shift or caps lock turns on red light
|
||||
if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) {
|
||||
if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || host_keyboard_led_state().caps_lock) {
|
||||
ergodox_right_led_1_on();
|
||||
} else {
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -238,7 +238,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
// shift or caps lock turns on red light
|
||||
if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK))) {
|
||||
if ((keyboard_report->mods & MOD_BIT(KC_LSFT)) || (keyboard_report->mods & MOD_BIT(KC_RSFT)) || host_keyboard_led_state().caps_lock) {
|
||||
ergodox_right_led_1_on();
|
||||
} else {
|
||||
ergodox_right_led_1_off();
|
||||
|
|
|
@ -686,7 +686,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
|
||||
if ((capslock_state & MOD_MASK_SHIFT) == MOD_MASK_SHIFT) {
|
||||
// CAPSLOCK is currently active, disable it
|
||||
if (host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK)) {
|
||||
if (host_keyboard_led_state().caps_lock) {
|
||||
unregister_code(KC_LOCKING_CAPS_LOCK);
|
||||
} else {
|
||||
register_code(KC_LOCKING_CAPS_LOCK);
|
||||
|
@ -697,11 +697,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|||
return process_record_user_shifted(keycode, record);
|
||||
};
|
||||
|
||||
// Runs just one time when the keyboard initializes.
|
||||
void matrix_init_user(void){
|
||||
|
||||
};
|
||||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
|
|
@ -106,7 +106,7 @@ void matrix_scan_user(void) {
|
|||
ergodox_right_led_3_off();
|
||||
ergodox_board_led_off();
|
||||
|
||||
if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) {
|
||||
if (host_keyboard_led_state().caps_lock) {
|
||||
ergodox_right_led_3_on();
|
||||
}
|
||||
|
||||
|
|
|
@ -154,11 +154,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
),
|
||||
};
|
||||
|
||||
// Runs just one time when the keyboard initializes.
|
||||
void matrix_init_user(void) {
|
||||
|
||||
};
|
||||
|
||||
// Runs constantly in the background, in a loop.
|
||||
void matrix_scan_user(void) {
|
||||
|
||||
|
@ -185,7 +180,7 @@ void matrix_scan_user(void) {
|
|||
break;
|
||||
}
|
||||
|
||||
if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) {
|
||||
if (host_keyboard_led_state().caps_lock) {
|
||||
// if capslk is on, set led 1 on
|
||||
ergodox_right_led_1_on();
|
||||
} else {
|
||||
|
|
|
@ -100,12 +100,13 @@ void keyboard_post_init_keymap(void) {
|
|||
}
|
||||
|
||||
// Use Green LED for Caps Lock
|
||||
void led_set_user(uint8_t usb_led) {
|
||||
if (IS_LED_OFF(usb_led, USB_LED_CAPS_LOCK)) {
|
||||
bool led_update_user(led_t led_state) {
|
||||
if (led_state.caps_lock) {
|
||||
writePinLow(LED_GREEN);
|
||||
} else {
|
||||
writePinHigh(LED_GREEN);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ led_config_t g_led_config = {
|
|||
|
||||
bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
|
||||
uint8_t this_mod = get_mods();
|
||||
uint8_t this_led = host_keyboard_leds();
|
||||
led_t this_led = host_keyboard_led_state();
|
||||
uint8_t this_osm = get_oneshot_mods();
|
||||
# ifdef KEYBOARD_planck_ez
|
||||
# define THUMB_LED 41
|
||||
|
@ -208,7 +208,7 @@ bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) {
|
|||
break;
|
||||
}
|
||||
|
||||
if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led & (1 << USB_LED_CAPS_LOCK)) {
|
||||
if ((this_mod | this_osm) & MOD_MASK_SHIFT || this_led.caps_lock) {
|
||||
if (!layer_state_cmp(layer_state, _ADJUST)) {
|
||||
RGB_MATRIX_INDICATOR_SET_COLOR(24, 0x00, 0xFF, 0x00);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue