Browse Source

Get rid of `USB_LED_SCROLL_LOCK` (#21405)

pull/21432/head
Ryan 10 months ago
committed by GitHub
parent
commit
7ff80a57cb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
62 changed files with 399 additions and 479 deletions
  1. +0
    -21
      keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c
  2. +4
    -4
      keyboards/cannonkeys/satisfaction75/satisfaction75.c
  3. +4
    -4
      keyboards/ckeys/washington/keymaps/default/keymap.c
  4. +5
    -4
      keyboards/converter/ibm_terminal/led.c
  5. +5
    -5
      keyboards/crkbd/keymaps/oled_sample/keymap.c
  6. +4
    -4
      keyboards/crkbd/lib/host_led_state_reader.c
  7. +2
    -2
      keyboards/duck/octagon/v1/v1.c
  8. +5
    -5
      keyboards/duck/octagon/v2/v2.c
  9. +0
    -83
      keyboards/duck/tcv3/tcv3.c
  10. +8
    -12
      keyboards/ergodox_ez/keymaps/bepo_tm_style/keymap.c
  11. +17
    -11
      keyboards/gh80_3000/keymaps/ansi_std/keymap.c
  12. +23
    -17
      keyboards/gh80_3000/keymaps/ansi_wkl/keymap.c
  13. +17
    -11
      keyboards/gh80_3000/keymaps/default/keymap.c
  14. +17
    -11
      keyboards/gh80_3000/keymaps/iso_default/keymap.c
  15. +23
    -17
      keyboards/gh80_3000/keymaps/iso_std/keymap.c
  16. +23
    -17
      keyboards/gh80_3000/keymaps/iso_wkl/keymap.c
  17. +5
    -4
      keyboards/handwired/datahand/keymaps/default/keymap.c
  18. +5
    -4
      keyboards/handwired/jopr/keymaps/default/keymap.c
  19. +5
    -4
      keyboards/handwired/jopr/keymaps/modded_white/keymap.c
  20. +5
    -5
      keyboards/handwired/myskeeb/oled.c
  21. +2
    -6
      keyboards/helix/rev2/keymaps/edvorakjp/oled.c
  22. +4
    -4
      keyboards/helix/rev2/keymaps/five_rows_jis/keymap.c
  23. +8
    -6
      keyboards/helix/rev2/keymaps/froggy/keymap.c
  24. +8
    -6
      keyboards/helix/rev2/keymaps/froggy_106/keymap.c
  25. +8
    -12
      keyboards/helix/rev2/keymaps/yshrsmz/keymap.c
  26. +4
    -3
      keyboards/hineybush/h87a/keymaps/gam3cat/keymap.c
  27. +27
    -19
      keyboards/hineybush/hbcp/hbcp.c
  28. +5
    -4
      keyboards/hineybush/hbcp/keymaps/hiney/keymap.c
  29. +4
    -4
      keyboards/kingly_keys/romac_plus/keymaps/default/keymap.c
  30. +4
    -4
      keyboards/marksard/treadstone48/common/oled_helper.c
  31. +4
    -4
      keyboards/matrix/noah/noah.c
  32. +7
    -7
      keyboards/nullbitsco/snap/keymaps/bongo_reactive/keymap.c
  33. +7
    -7
      keyboards/nullbitsco/snap/keymaps/oled/keymap.c
  34. +7
    -7
      keyboards/nullbitsco/snap/keymaps/typehud/keymap.c
  35. +4
    -4
      keyboards/nullbitsco/tidbit/keymaps/snailmap_lite/keymap.c
  36. +5
    -4
      keyboards/orange75/keymaps/default/keymap.c
  37. +10
    -9
      keyboards/planck/keymaps/vaire/keymap.c
  38. +0
    -8
      keyboards/plut0nium/0x3e/keymaps/default/keymap.c
  39. +4
    -10
      keyboards/primekb/prime_e/keymaps/default/keymap.c
  40. +4
    -10
      keyboards/primekb/prime_e/keymaps/via/keymap.c
  41. +4
    -4
      keyboards/rgbkb/sol/keymaps/brianweyer/keymap.c
  42. +4
    -4
      keyboards/rgbkb/sol/keymaps/danielhklein/keymap.c
  43. +4
    -4
      keyboards/rgbkb/sol/keymaps/default/keymap.c
  44. +4
    -4
      keyboards/rgbkb/sol/keymaps/xyverz/keymap.c
  45. +4
    -4
      keyboards/rgbkb/zen/rev2/rev2.c
  46. +4
    -3
      keyboards/rgbkb/zygomorph/keymaps/5x6pad/keymap.c
  47. +4
    -4
      keyboards/rgbkb/zygomorph/keymaps/default_oled/keymap.c
  48. +4
    -4
      keyboards/satt/comet46/lib/host_led_state_reader.c
  49. +4
    -4
      keyboards/splitkb/kyria/keymaps/cwebster2/keymap.c
  50. +4
    -4
      keyboards/splitkb/kyria/keymaps/shinze/keymap.c
  51. +4
    -4
      keyboards/splitkb/kyria/keymaps/tessachka/keymap.c
  52. +4
    -4
      keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c
  53. +5
    -4
      keyboards/viktus/at101_bh/keymaps/default/keymap.c
  54. +5
    -4
      keyboards/viktus/omnikey_bh/keymaps/default/keymap.c
  55. +4
    -4
      keyboards/yosino58/lib/host_led_state_reader.c
  56. +6
    -6
      quantum/action.c
  57. +0
    -1
      quantum/led.h
  58. +5
    -5
      users/curry/oled.c
  59. +5
    -8
      users/ericgebhart/oled/oled_stuff.c
  60. +6
    -6
      users/spidey3/layer_rgb.c
  61. +7
    -7
      users/xulkal/custom_oled.c
  62. +5
    -4
      users/zer09/zer09.c

+ 0
- 21
keyboards/bpiphany/kitten_paw/keymaps/ickerwx/keymap.c View File

@ -3,8 +3,6 @@
#define MEDAPP LT(MEDIA, KC_APP)
uint8_t current_layer_global = 255;
enum layers {
DEFAULT,
PROG1,
@ -87,25 +85,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______,_______,_______, LT(MISC, KC_SPC), _______,_______,_______,_______, _______,_______,_______, _______,_______),
};
void matrix_scan_user(void) {
uint8_t layer;
layer = get_highest_layer(layer_state);
if (current_layer_global != layer) {
current_layer_global = layer;
// unset CAPSLOCK and SCROLL LOCK LEDs
led_set(host_keyboard_leds() & ~(1<<USB_LED_CAPS_LOCK));
led_set(host_keyboard_leds() & ~(1<<USB_LED_SCROLL_LOCK));
// set SCROLL LOCK LED when the mouse layer is active, CAPS LOCK when PROG layer is active
if (layer == MOUSE1 || layer == MOUSE2) {
led_set(host_keyboard_leds() | (1<<USB_LED_SCROLL_LOCK));
} else if (layer == PROG1 || layer == PROG2) {
led_set(host_keyboard_leds() | (1<<USB_LED_CAPS_LOCK));
}
}
}
void tap_helper(keyrecord_t *record, uint16_t orig_mod, uint16_t macro_mod, uint16_t macro_kc ) {
if (record->event.pressed) {
if (record->tap.count > 0 && !record->tap.interrupted) {


+ 4
- 4
keyboards/cannonkeys/satisfaction75/satisfaction75.c View File

@ -243,22 +243,22 @@ void via_custom_value_command(uint8_t *data, uint8_t length) {
void read_host_led_state(void) {
uint8_t leds = host_keyboard_leds();
if (leds & (1 << USB_LED_NUM_LOCK)) {
led_t led_state = host_keyboard_led_state();
if (led_state.num_lock) {
if (led_numlock == false){
led_numlock = true;}
} else {
if (led_numlock == true){
led_numlock = false;}
}
if (leds & (1 << USB_LED_CAPS_LOCK)) {
if (led_state.caps_lock) {
if (led_capslock == false){
led_capslock = true;}
} else {
if (led_capslock == true){
led_capslock = false;}
}
if (leds & (1 << USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
if (led_scrolllock == false){
led_scrolllock = true;}
} else {


+ 4
- 4
keyboards/ckeys/washington/keymaps/default/keymap.c View File

@ -75,10 +75,10 @@ bool oled_task_user(void) {
}
// Host Keyboard LED Status
uint8_t usb_led = host_keyboard_leds();
oled_write_P(IS_LED_ON(usb_led, USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(usb_led, USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false);
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false);
return false;
}
#endif

+ 5
- 4
keyboards/converter/ibm_terminal/led.c View File

@ -20,14 +20,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "led.h"
void led_set(uint8_t usb_led)
bool led_update_kb(led_t led_state)
{
uint8_t ps2_led = 0;
if (usb_led & (1<<USB_LED_SCROLL_LOCK))
if (led_state.scroll_lock)
ps2_led |= (1<<PS2_LED_SCROLL_LOCK);
if (usb_led & (1<<USB_LED_NUM_LOCK))
if (led_state.num_lock)
ps2_led |= (1<<PS2_LED_NUM_LOCK);
if (usb_led & (1<<USB_LED_CAPS_LOCK))
if (led_state.caps_lock)
ps2_led |= (1<<PS2_LED_CAPS_LOCK);
ps2_host_set_led(ps2_led);
return false;
}

+ 5
- 5
keyboards/crkbd/keymaps/oled_sample/keymap.c View File

@ -147,12 +147,12 @@ void render_layer_state(void) {
oled_write_P(PSTR("Raise"), layer_state_is(_RAISE));
}
void render_keylock_status(uint8_t led_usb_state) {
void render_keylock_status(led_t led_state) {
oled_write_P(PSTR("Lock:"), false);
oled_write_P(PSTR(" "), false);
oled_write_P(PSTR("N"), led_usb_state & (1 << USB_LED_NUM_LOCK));
oled_write_P(PSTR("C"), led_usb_state & (1 << USB_LED_CAPS_LOCK));
oled_write_ln_P(PSTR("S"), led_usb_state & (1 << USB_LED_SCROLL_LOCK));
oled_write_P(PSTR("N"), led_state.num_lock);
oled_write_P(PSTR("C"), led_state.caps_lock);
oled_write_ln_P(PSTR("S"), led_state.scroll_lock);
}
void render_mod_status(uint8_t modifiers) {
@ -183,7 +183,7 @@ void render_bootmagic_status(void) {
void render_status_main(void) {
/* Show Keyboard Layout */
render_default_layer_state();
render_keylock_status(host_keyboard_leds());
render_keylock_status(host_keyboard_led_state());
render_mod_status(get_mods());
render_bootmagic_status();


+ 4
- 4
keyboards/crkbd/lib/host_led_state_reader.c View File

@ -5,11 +5,11 @@ char host_led_state_str[24];
const char *read_host_led_state(void)
{
uint8_t leds = host_keyboard_leds();
led_t led_state = host_keyboard_led_state();
snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s",
(leds & (1 << USB_LED_NUM_LOCK)) ? "on" : "- ",
(leds & (1 << USB_LED_CAPS_LOCK)) ? "on" : "- ",
(leds & (1 << USB_LED_SCROLL_LOCK)) ? "on" : "- ");
(led_state.num_lock) ? "on" : "- ",
(led_state.caps_lock) ? "on" : "- ",
(led_state.scroll_lock) ? "on" : "- ");
return host_led_state_str;
}

+ 2
- 2
keyboards/duck/octagon/v1/v1.c View File

@ -43,8 +43,8 @@ void backlight_set(uint8_t level) {
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
backlight_os_state & 2 ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
backlight_os_state & 4 ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
}
return res;
}

+ 5
- 5
keyboards/duck/octagon/v2/v2.c View File

@ -101,17 +101,17 @@ bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if(res) {
bool status[7] = {
backlight_os_state & (1<<USB_LED_CAPS_LOCK),
backlight_os_state & (1<<USB_LED_SCROLL_LOCK),
backlight_os_state & (1<<USB_LED_NUM_LOCK),
backlight_os_state & 2,
backlight_os_state & 4,
backlight_os_state & 1,
backlight_layer_state & (1<<1),
backlight_layer_state & (1<<2),
backlight_layer_state & (1<<3),
backlight_layer_state & (1<<4)
};
indicator_leds_set(status);
backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
backlight_os_state & 2 ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
backlight_os_state & 4 ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
}
return res;
}

+ 0
- 83
keyboards/duck/tcv3/tcv3.c View File

@ -24,69 +24,6 @@ enum BACKLIGHT_AREAS {
BACKLIGHT_SWITCH = 0b0001111
};
// uint8_t backlight_rgb_r = 255;
// uint8_t backlight_rgb_g = 0;
// uint8_t backlight_rgb_b = 0;
// uint8_t backlight_os_state = 0;
// uint32_t backlight_layer_state = 0;
// void backlight_toggle_rgb(bool enabled)
// {
// if(enabled) {
// uint8_t rgb[17][3] = {
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b},
// {backlight_rgb_r, backlight_rgb_g, backlight_rgb_b}
// };
// backlight_set_rgb(rgb);
// } else {
// uint8_t rgb[17][3] = {
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0},
// {0, 0, 0}
// };
// backlight_set_rgb(rgb);
// }
// }
// void backlight_set_rgb(uint8_t cfg[17][3])
// {
// cli();
// for(uint8_t i = 0; i < 17; ++i) {
// send_color(cfg[i][0], cfg[i][1], cfg[i][2], Device_PCBRGB);
// }
// sei();
// show();
// }
// Q5, Q6, Q7 is connected to B1 - alphas
// Q8, Q9 is connected to B2 - frow
// Q1, Q2, Q3 is connected to B3 - mods
@ -99,26 +36,6 @@ void backlight_set(uint8_t level) {
level & BACKLIGHT_MACRO ? (PORTE |= 0b01000000) : (PORTE &= ~0b01000000);
}
// // Port from backlight_update_state
// bool led_update_kb(led_t led_state) {
// bool res = led_update_user(led_state);
// if(res) {
// bool status[7] = {
// backlight_os_state & (1<<USB_LED_CAPS_LOCK),
// backlight_os_state & (1<<USB_LED_SCROLL_LOCK),
// backlight_os_state & (1<<USB_LED_NUM_LOCK),
// backlight_layer_state & (1<<1),
// backlight_layer_state & (1<<2),
// backlight_layer_state & (1<<3),
// backlight_layer_state & (1<<4)
// };
// indicator_leds_set(status);
// backlight_os_state & (1<<USB_LED_CAPS_LOCK) ? (PORTB &= ~0b00000001) : (PORTB |= 0b00000001);
// backlight_os_state & (1<<USB_LED_SCROLL_LOCK) ? (PORTB &= ~0b00010000) : (PORTB |= 0b00010000);
// }
// return res;
// }
// U5 Pin 1, 2, 3 connected to top left LEDs
// U6 Pin 1, 2, 3 connected to bottom right leds col of 3


+ 8
- 12
keyboards/ergodox_ez/keymaps/bepo_tm_style/keymap.c View File

@ -253,12 +253,7 @@ void matrix_scan_user(void) {
};
// The state of the LEDs requested by the system, as a bitmask.
static uint8_t sys_led_state = 0;
// Use these masks to read the system LEDs state.
static const uint8_t sys_led_mask_num_lock = 1 << USB_LED_NUM_LOCK;
static const uint8_t sys_led_mask_caps_lock = 1 << USB_LED_CAPS_LOCK;
static const uint8_t sys_led_mask_scroll_lock = 1 << USB_LED_SCROLL_LOCK;
static led_t sys_led_state = {0};
// Value to use to switch LEDs on. The default value of 255 is far too bright.
static const uint8_t max_led_value = 20;
@ -294,25 +289,26 @@ void led_3_off(void) {
}
// Called when the computer wants to change the state of the keyboard LEDs.
void led_set_user(uint8_t usb_led) {
sys_led_state = usb_led;
bool led_update_user(led_t led_state) {
sys_led_state = led_state;
if (LAYER_ON(SYSLEDS)) {
if (sys_led_state & sys_led_mask_caps_lock) {
if (sys_led_state.caps_lock) {
led_1_on();
} else {
led_1_off();
}
if (sys_led_state & sys_led_mask_num_lock) {
if (sys_led_state.num_lock) {
led_2_on();
} else {
led_2_off();
}
if (sys_led_state & sys_led_mask_scroll_lock) {
if (sys_led_state.scroll_lock) {
led_3_on();
} else {
led_3_off();
}
}
return false;
}
layer_state_t layer_state_set_user(layer_state_t state) {
@ -327,7 +323,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
}
if (LAYER_ON(SYSLEDS)) {
led_set_user(sys_led_state);
led_update_user(sys_led_state);
return state;
}


+ 17
- 11
keyboards/gh80_3000/keymaps/ansi_std/keymap.c View File

@ -12,23 +12,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
void led_set_user(uint8_t usb_led) {
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
DDRB |= (1 << 5); PORTB &= ~(1 << 5);
bool led_update_user(led_t led_state) {
if (led_state.num_lock) {
DDRB |= (1 << 5);
PORTB &= ~(1 << 5);
} else {
DDRB &= ~(1 << 5); PORTB &= ~(1 << 5);
DDRB &= ~(1 << 5);
PORTB &= ~(1 << 5);
}
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
DDRB |= (1 << 6); PORTB &= ~(1 << 6);
if (led_state.caps_lock) {
DDRB |= (1 << 6);
PORTB &= ~(1 << 6);
} else {
DDRB &= ~(1 << 6); PORTB &= ~(1 << 6);
DDRB &= ~(1 << 6);
PORTB &= ~(1 << 6);
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
DDRB |= (1 << 7); PORTB &= ~(1 << 7);
if (led_state.scroll_lock) {
DDRB |= (1 << 7);
PORTB &= ~(1 << 7);
} else {
DDRB &= ~(1 << 7); PORTB &= ~(1 << 7);
DDRB &= ~(1 << 7);
PORTB &= ~(1 << 7);
}
return false;
}

+ 23
- 17
keyboards/gh80_3000/keymaps/ansi_wkl/keymap.c View File

@ -12,23 +12,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
void led_set_user(uint8_t usb_led) {
bool led_update_user(led_t led_state) {
if (led_state.num_lock) {
DDRB |= (1 << 5);
PORTB &= ~(1 << 5);
} else {
DDRB &= ~(1 << 5);
PORTB &= ~(1 << 5);
}
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
DDRB |= (1 << 5); PORTB &= ~(1 << 5);
} else {
DDRB &= ~(1 << 5); PORTB &= ~(1 << 5);
}
if (led_state.caps_lock) {
DDRB |= (1 << 6);
PORTB &= ~(1 << 6);
} else {
DDRB &= ~(1 << 6);
PORTB &= ~(1 << 6);
}
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
DDRB |= (1 << 6); PORTB &= ~(1 << 6);
} else {
DDRB &= ~(1 << 6); PORTB &= ~(1 << 6);
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
DDRB |= (1 << 7); PORTB &= ~(1 << 7);
} else {
DDRB &= ~(1 << 7); PORTB &= ~(1 << 7);
}
if (led_state.scroll_lock) {
DDRB |= (1 << 7);
PORTB &= ~(1 << 7);
} else {
DDRB &= ~(1 << 7);
PORTB &= ~(1 << 7);
}
return false;
}

+ 17
- 11
keyboards/gh80_3000/keymaps/default/keymap.c View File

@ -12,23 +12,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
void led_set_user(uint8_t usb_led) {
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
DDRB |= (1 << 5); PORTB &= ~(1 << 5);
bool led_update_user(led_t led_state) {
if (led_state.num_lock) {
DDRB |= (1 << 5);
PORTB &= ~(1 << 5);
} else {
DDRB &= ~(1 << 5); PORTB &= ~(1 << 5);
DDRB &= ~(1 << 5);
PORTB &= ~(1 << 5);
}
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
DDRB |= (1 << 6); PORTB &= ~(1 << 6);
if (led_state.caps_lock) {
DDRB |= (1 << 6);
PORTB &= ~(1 << 6);
} else {
DDRB &= ~(1 << 6); PORTB &= ~(1 << 6);
DDRB &= ~(1 << 6);
PORTB &= ~(1 << 6);
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
DDRB |= (1 << 7); PORTB &= ~(1 << 7);
if (led_state.scroll_lock) {
DDRB |= (1 << 7);
PORTB &= ~(1 << 7);
} else {
DDRB &= ~(1 << 7); PORTB &= ~(1 << 7);
DDRB &= ~(1 << 7);
PORTB &= ~(1 << 7);
}
return false;
}

+ 17
- 11
keyboards/gh80_3000/keymaps/iso_default/keymap.c View File

@ -12,23 +12,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
void led_set_user(uint8_t usb_led) {
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
DDRB |= (1 << 5); PORTB &= ~(1 << 5);
bool led_update_user(led_t led_state) {
if (led_state.num_lock) {
DDRB |= (1 << 5);
PORTB &= ~(1 << 5);
} else {
DDRB &= ~(1 << 5); PORTB &= ~(1 << 5);
DDRB &= ~(1 << 5);
PORTB &= ~(1 << 5);
}
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
DDRB |= (1 << 6); PORTB &= ~(1 << 6);
if (led_state.caps_lock) {
DDRB |= (1 << 6);
PORTB &= ~(1 << 6);
} else {
DDRB &= ~(1 << 6); PORTB &= ~(1 << 6);
DDRB &= ~(1 << 6);
PORTB &= ~(1 << 6);
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
DDRB |= (1 << 7); PORTB &= ~(1 << 7);
if (led_state.scroll_lock) {
DDRB |= (1 << 7);
PORTB &= ~(1 << 7);
} else {
DDRB &= ~(1 << 7); PORTB &= ~(1 << 7);
DDRB &= ~(1 << 7);
PORTB &= ~(1 << 7);
}
return false;
}

+ 23
- 17
keyboards/gh80_3000/keymaps/iso_std/keymap.c View File

@ -12,23 +12,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
void led_set_user(uint8_t usb_led) {
bool led_update_user(led_t led_state) {
if (led_state.num_lock) {
DDRB |= (1 << 5);
PORTB &= ~(1 << 5);
} else {
DDRB &= ~(1 << 5);
PORTB &= ~(1 << 5);
}
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
DDRB |= (1 << 5); PORTB &= ~(1 << 5);
} else {
DDRB &= ~(1 << 5); PORTB &= ~(1 << 5);
}
if (led_state.caps_lock) {
DDRB |= (1 << 6);
PORTB &= ~(1 << 6);
} else {
DDRB &= ~(1 << 6);
PORTB &= ~(1 << 6);
}
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
DDRB |= (1 << 6); PORTB &= ~(1 << 6);
} else {
DDRB &= ~(1 << 6); PORTB &= ~(1 << 6);
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
DDRB |= (1 << 7); PORTB &= ~(1 << 7);
} else {
DDRB &= ~(1 << 7); PORTB &= ~(1 << 7);
}
if (led_state.scroll_lock) {
DDRB |= (1 << 7);
PORTB &= ~(1 << 7);
} else {
DDRB &= ~(1 << 7);
PORTB &= ~(1 << 7);
}
return false;
}

+ 23
- 17
keyboards/gh80_3000/keymaps/iso_wkl/keymap.c View File

@ -12,23 +12,29 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
void led_set_user(uint8_t usb_led) {
bool led_update_user(led_t led_state) {
if (led_state.num_lock) {
DDRB |= (1 << 5);
PORTB &= ~(1 << 5);
} else {
DDRB &= ~(1 << 5);
PORTB &= ~(1 << 5);
}
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
DDRB |= (1 << 5); PORTB &= ~(1 << 5);
} else {
DDRB &= ~(1 << 5); PORTB &= ~(1 << 5);
}
if (led_state.caps_lock) {
DDRB |= (1 << 6);
PORTB &= ~(1 << 6);
} else {
DDRB &= ~(1 << 6);
PORTB &= ~(1 << 6);
}
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
DDRB |= (1 << 6); PORTB &= ~(1 << 6);
} else {
DDRB &= ~(1 << 6); PORTB &= ~(1 << 6);
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
DDRB |= (1 << 7); PORTB &= ~(1 << 7);
} else {
DDRB &= ~(1 << 7); PORTB &= ~(1 << 7);
}
if (led_state.scroll_lock) {
DDRB |= (1 << 7);
PORTB &= ~(1 << 7);
} else {
DDRB &= ~(1 << 7);
PORTB &= ~(1 << 7);
}
return false;
}

+ 5
- 4
keyboards/handwired/datahand/keymaps/default/keymap.c View File

@ -302,8 +302,9 @@ void matrix_init_user(void) {
#endif
}
void led_set_user(uint8_t usb_led) {
lock_led_set(usb_led & (1<<USB_LED_NUM_LOCK), LED_NUM_LOCK);
lock_led_set(usb_led & (1<<USB_LED_CAPS_LOCK), LED_CAPS_LOCK);
lock_led_set(usb_led & (1<<USB_LED_SCROLL_LOCK), LED_SCROLL_LOCK);
bool led_update_user(led_t led_state) {
lock_led_set(led_state.num_lock, LED_NUM_LOCK);
lock_led_set(led_state.caps_lock, LED_CAPS_LOCK);
lock_led_set(led_state.scroll_lock, LED_SCROLL_LOCK);
return false;
}

+ 5
- 4
keyboards/handwired/jopr/keymaps/default/keymap.c View File

@ -22,23 +22,24 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
void led_set_user(uint8_t usb_led) {
bool led_update_user(led_t led_state) {
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
if (led_state.caps_lock) {
writePinHigh(F1);
} else {
writePinLow(F1);
}
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
writePinHigh(F0);
} else {
writePinLow(F0);
}
if (!(IS_LED_ON(usb_led, USB_LED_NUM_LOCK))) {
if (!led_state.num_lock) {
tap_code(KC_NUM_LOCK);
}
return false;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static bool sysreq_led = false;


+ 5
- 4
keyboards/handwired/jopr/keymaps/modded_white/keymap.c View File

@ -22,23 +22,24 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
void led_set_user(uint8_t usb_led) {
bool led_update_user(led_t led_state) {
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
if (led_state.caps_lock) {
writePinHigh(F1);
} else {
writePinLow(F1);
}
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
writePinHigh(F0);
} else {
writePinLow(F0);
}
if (!(IS_LED_ON(usb_led, USB_LED_NUM_LOCK))) {
if (!led_state.num_lock) {
tap_code(KC_NUM_LOCK);
}
return false;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
static bool sysreq_led = false;


+ 5
- 5
keyboards/handwired/myskeeb/oled.c View File

@ -127,13 +127,13 @@ void render_layer_state(void){
}
// Keylock State
void render_keylock_status(uint8_t led_usb_state) {
void render_keylock_status(led_t led_state) {
oled_write_P(PSTR(" "), false);
oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("-NUML") : PSTR("-----"), false);
oled_write_P(led_state.num_lock ? PSTR("-NUML") : PSTR("-----"), false);
oled_write_P(PSTR(" "), false);
oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("-CAPS") : PSTR("-----"), false);
oled_write_P(led_state.caps_lock ? PSTR("-CAPS") : PSTR("-----"), false);
oled_write_P(PSTR(" "), false);
oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("-SCRL") : PSTR("-----"), false);
oled_write_P(led_state.scroll_lock ? PSTR("-SCRL") : PSTR("-----"), false);
oled_write_P(PSTR(" "), false);
}
@ -213,7 +213,7 @@ if (is_keyboard_master()) {
oled_write_P(oled_layer_line_end, false);
oled_write_P(oled_layer_keylog_bottom, false);
oled_write_P(oled_line_start, false);
render_keylock_status(host_keyboard_leds());
render_keylock_status(host_keyboard_led_state());
oled_write_P(oled_layer_line_end, false);
oled_write_P(oled_mods_bottom, false);
oled_write_P(oled_line_start, false);


+ 2
- 6
keyboards/helix/rev2/keymaps/edvorakjp/oled.c View File

@ -5,13 +5,9 @@
#ifdef OLED_ENABLE
void render_host_led_state(void) {
char led_state_str[24];
uint8_t leds = host_keyboard_leds();
led_t led_state = host_keyboard_led_state();
bool is_num_lock_enabled = leds & (1 << USB_LED_NUM_LOCK);
bool is_caps_lock_enabled = leds & (1 << USB_LED_CAPS_LOCK);
bool is_scroll_lock_enabled = leds & (1 << USB_LED_SCROLL_LOCK);
snprintf(led_state_str, sizeof(led_state_str), "NL:%s CL:%s SL:%s", is_num_lock_enabled ? "on" : "- ", is_caps_lock_enabled ? "on" : "- ", is_scroll_lock_enabled ? "on" : "- ");
snprintf(led_state_str, sizeof(led_state_str), "NL:%s CL:%s SL:%s", led_state.num_lock ? "on" : "- ", led_state.caps_lock ? "on" : "- ", led_state.scroll_lock ? "on" : "- ");
oled_write(led_state_str, false);
}


+ 4
- 4
keyboards/helix/rev2/keymaps/five_rows_jis/keymap.c View File

@ -205,7 +205,7 @@ const char code_to_name[60] = {
static inline void set_keylog(uint16_t keycode, keyrecord_t *record)
{
char name = ' ';
uint8_t leds = host_keyboard_leds();
led_t led_state = host_keyboard_led_state();
if (keycode < 60)
{
@ -218,9 +218,9 @@ static inline void set_keylog(uint16_t keycode, keyrecord_t *record)
record->event.key.col,
keycode,
name,
(leds & (1<<USB_LED_NUM_LOCK)) ? 'N' : ' ',
(leds & (1<<USB_LED_CAPS_LOCK)) ? 'C' : ' ',
(leds & (1<<USB_LED_SCROLL_LOCK)) ? 'S' : ' '
led_state.num_lock ? 'N' : ' ',
led_state.caps_lock ? 'C' : ' ',
led_state.scroll_lock ? 'S' : ' '
);
}
#endif


+ 8
- 6
keyboards/helix/rev2/keymaps/froggy/keymap.c View File

@ -704,9 +704,10 @@ void render_status(struct CharacterMatrix *matrix) {
int rows = 0;
//Set Indicator icon
if (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) { rown = 4; } else { rown = 0; }
if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { rowa = 4; } else { rowa = 0; }
if (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) { rows = 4; } else { rows = 0; }
led_t led_state = host_keyboard_led_state();
if (led_state.num_lock) { rown = 4; } else { rown = 0; }
if (led_state.caps_lock) { rowa = 4; } else { rowa = 0; }
if (led_state.scroll_lock) { rows = 4; } else { rows = 0; }
if (layer_state == L_FUNC) { rowf = 4; }
matrix_write(matrix, indctr[rown] [0]);
@ -813,9 +814,10 @@ void render_status(void) {
int rows = 0;
//Set Indicator icon
if (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) { rown = 4; } else { rown = 0; }
if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { rowa = 4; } else { rowa = 0; }
if (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) { rows = 4; } else { rows = 0; }
led_t led_state = host_keyboard_led_state();
if (led_state.num_lock) { rown = 4; } else { rown = 0; }
if (led_state.caps_lock) { rowa = 4; } else { rowa = 0; }
if (led_state.scroll_lock) { rows = 4; } else { rows = 0; }
if (layer_state == L_FUNC) { rowf = 4; }
oled_write(indctr[rown] [0], false);


+ 8
- 6
keyboards/helix/rev2/keymaps/froggy_106/keymap.c View File

@ -782,9 +782,10 @@ void render_status(struct CharacterMatrix *matrix) {
int rowj = 1;
//Set Indicator icon
if (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) { rown = 4; }
if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { rowa = 4; }
if (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) { rows = 4; }
led_t led_state = host_keyboard_led_state();
if (led_state.num_lock) { rown = 4; }
if (led_state.caps_lock) { rowa = 4; }
if (led_state.scroll_lock) { rows = 4; }
if (IS_LAYER_ON(_FUNC)) { rowf = 4; }
//Set Mode icon
@ -909,9 +910,10 @@ void render_status(void) {
int rowj = 1;
//Set Indicator icon
if (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) { rown = 4; }
if (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) { rowa = 4; }
if (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) { rows = 4; }
led_t led_state = host_keyboard_led_state();
if (led_state.num_lock) { rown = 4; }
if (led_state.caps_lock) { rowa = 4; }
if (led_state.scroll_lock) { rows = 4; }
if (IS_LAYER_ON(_FUNC)) { rowf = 4; }
//Set Mode icon


+ 8
- 12
keyboards/helix/rev2/keymaps/yshrsmz/keymap.c View File

@ -459,12 +459,10 @@ void render_status(struct CharacterMatrix *matrix) {
matrix_write_P(matrix, PSTR("\n"));
// Host Keyboard LED Status
matrix_write_P(matrix, (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ?
PSTR("NUMLOCK") : PSTR(" "));
matrix_write_P(matrix, (host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ?
PSTR("CAPS") : PSTR(" "));
matrix_write_P(matrix, (host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ?
PSTR("SCLK") : PSTR(" "));
led_t led_state = host_keyboard_led_state();
matrix_write_P(matrix, led_state.num_lock ? PSTR("NUMLOCK") : PSTR(" "));
matrix_write_P(matrix, led_state.caps_lock ? PSTR("CAPS") : PSTR(" "));
matrix_write_P(matrix, led_state.scroll_lock ? PSTR("SCLK") : PSTR(" "));
matrix_write_P(matrix, PSTR("\n"));
render_rgbled_status(true, matrix);
}
@ -580,12 +578,10 @@ void render_status(void) {
render_layer_status();
// Host Keyboard LED Status
oled_write_P((host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ?
PSTR("NUMLOCK") : PSTR(" "), false);
oled_write_P((host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ?
PSTR("CAPS") : PSTR(" "), false);
oled_write_P((host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ?
PSTR("SCLK") : PSTR(" "), false);
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUMLOCK") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPS") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCLK") : PSTR(" "), false);
oled_write_P(PSTR("\n"), false);
render_rgbled_status(true);
oled_write_P(PSTR("\n"), false);


+ 4
- 3
keyboards/hineybush/h87a/keymaps/gam3cat/keymap.c View File

@ -278,15 +278,16 @@ void led_init_ports(void) {
DDRE |= (1<<6); // OUT
}
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) {
DDRD |= (1 << 5); PORTD &= ~(1 << 5);
} else {
DDRD &= ~(1 << 5); PORTD &= ~(1 << 5);
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
DDRE |= (1 << 6); PORTE &= ~(1 << 6);
} else {
DDRE &= ~(1 << 6); PORTE &= ~(1 << 6);
}
return false;
}

+ 27
- 19
keyboards/hineybush/hbcp/hbcp.c View File

@ -45,32 +45,40 @@ void eeconfig_init_kb(void) { // EEPROM is getting reset!
#ifdef RGBLIGHT_ENABLE
__attribute__ ((weak))
void led_set_user(uint8_t usb_led) {
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
sethsv_raw(HSV_CAPS, (LED_TYPE *)&led[0]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[0]);
}
if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
sethsv_raw(HSV_NLCK, (LED_TYPE *)&led[1]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[1]);
}
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
sethsv_raw(HSV_SCRL, (LED_TYPE *)&led[2]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[2]);
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if (res) {
if (led_state.caps_lock) {
sethsv_raw(HSV_CAPS, (LED_TYPE *)&led[0]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[0]);
}
if (led_state.num_lock) {
sethsv_raw(HSV_NLCK, (LED_TYPE *)&led[1]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[1]);
}
if (led_state.scroll_lock) {
sethsv_raw(HSV_SCRL, (LED_TYPE *)&led[2]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[2]);
}
rgblight_set();
}
rgblight_set();
return false;
}
__attribute__ ((weak))
void keyboard_post_init_user(void) {
rgblight_set_effect_range(3, RGBLED_NUM-3);
led_set_user(_BV(USB_LED_CAPS_LOCK)|_BV(USB_LED_NUM_LOCK)|_BV(USB_LED_SCROLL_LOCK));
led_t led_state = {
.caps_lock = true,
.num_lock = true,
.scroll_lock = true
};
led_update_kb(led_state);
wait_ms(300);
led_set_user(0);
led_update_kb((led_t){0});
}
__attribute__ ((weak))


+ 5
- 4
keyboards/hineybush/hbcp/keymaps/hiney/keymap.c View File

@ -77,23 +77,24 @@ void matrix_scan_user(void) {
#ifdef RGBLIGHT_ENABLE
// The first three LEDs are used as indicators for CAPS_LOCK, NUM_LOCK and SCROLL_LOCK.
void led_set_user(uint8_t usb_led) {
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
bool led_update_user(led_t led_state) {
if (led_state.caps_lock) {
sethsv_raw(HSV_SOFT_RED, (LED_TYPE *)&led[0]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[0]);
}
if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
if (led_state.num_lock) {
sethsv_raw(HSV_WARM_WHITE, (LED_TYPE *)&led[1]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[1]);
}
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
sethsv_raw(HSV_SOFT_BLUE, (LED_TYPE *)&led[2]);
} else {
sethsv(HSV_BLACK, (LED_TYPE *)&led[2]);
}
rgblight_set();
return false;
}
#endif

+ 4
- 4
keyboards/kingly_keys/romac_plus/keymaps/default/keymap.c View File

@ -57,10 +57,10 @@ bool oled_task_user(void) {
}
// Host Keyboard LED Status
uint8_t led_usb_state = host_keyboard_leds();
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR("NLCK ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR("CAPS ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false);
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NLCK ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPS ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLK") : PSTR(" "), false);
return false;
}


+ 4
- 4
keyboards/marksard/treadstone48/common/oled_helper.c View File

@ -43,10 +43,10 @@ void render_key_status(void) {
static char lock_buf[24] = "Lock state ready.\n";
void update_lock_status(void) {
uint8_t leds = host_keyboard_leds();
char *num_lock = (leds & (1<<USB_LED_NUM_LOCK)) ? "Num" : "";
char *caps_lock = (leds & (1<<USB_LED_CAPS_LOCK)) ? "Caps" : "";
char *scrl_lock = (leds & (1<<USB_LED_SCROLL_LOCK)) ? "Scrn" : "";
led_t led_state = host_keyboard_led_state();
char *num_lock = led_state.num_lock ? "Num" : "";
char *caps_lock = led_state.caps_lock ? "Caps" : "";
char *scrl_lock = led_state.scroll_lock ? "Scrn" : "";
snprintf(lock_buf, sizeof(lock_buf) - 1, "Lock:%s %s %s\n",
num_lock, caps_lock, scrl_lock);
}


+ 4
- 4
keyboards/matrix/noah/noah.c View File

@ -32,14 +32,14 @@ void rgblight_set(void) {
}
}
if (noah_led_mode) {
uint8_t ind_led = host_keyboard_leds();
if (IS_LED_ON(ind_led, USB_LED_CAPS_LOCK)) {
led_t led_state = host_keyboard_led_state();
if (led_state.caps_lock) {
noah_leds[0] = led[0];
}
if (IS_LED_ON(ind_led, USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
noah_leds[1] = led[1];
}
if (IS_LED_ON(ind_led, USB_LED_NUM_LOCK)) {
if (led_state.num_lock) {
noah_leds[2] = led[2];
}
for (int32_t i = 0; i < 4; i++) {


+ 7
- 7
keyboards/nullbitsco/snap/keymaps/bongo_reactive/keymap.c View File

@ -87,27 +87,27 @@ static void render_status(void) {
// Host Keyboard LED Status
oled_set_cursor(0, 1);
static uint8_t persistent_led_state = 0;
uint8_t led_usb_state = host_keyboard_leds();
static led_t persistent_led_state = {0};
led_t led_state = host_keyboard_led_state();
// Only update if the LED state has changed
// Otherwise, the OLED will not turn off if an LED is on.
if (persistent_led_state != led_usb_state) {
persistent_led_state = led_usb_state;
if (persistent_led_state != led_state) {
persistent_led_state = led_state;
oled_write_ln_P(PSTR(""), false);
if (IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK)) {
if (led_state.caps_lock) {
oled_set_cursor(0, 1);
oled_write_P(PSTR("CAPS"), false);
}
if (IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK)) {
if (led_state.num_lock) {
oled_set_cursor(5, 1);
oled_write_P(PSTR("NUM"), true);
}
if (IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
oled_set_cursor(9, 1);
oled_write_P(PSTR("SCR"), false);
}


+ 7
- 7
keyboards/nullbitsco/snap/keymaps/oled/keymap.c View File

@ -114,27 +114,27 @@ static void render_status(void) {
// Host Keyboard LED Status
oled_set_cursor(0, 1);
static uint8_t persistent_led_state = 0;
uint8_t led_usb_state = host_keyboard_leds();
static led_t persistent_led_state = {0};
led_t led_state = host_keyboard_led_state();
// Only update if the LED state has changed
// Otherwise, the OLED will not turn off if an LED is on.
if (persistent_led_state != led_usb_state) {
persistent_led_state = led_usb_state;
if (persistent_led_state != led_state) {
persistent_led_state = led_state;
oled_write_ln_P(PSTR(""), false);
if (IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK)) {
if (led_state.caps_lock) {
oled_set_cursor(0, 1);
oled_write_P(PSTR("CAPS"), false);
}
if (IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK)) {
if (led_state.num_lock) {
oled_set_cursor(5, 1);
oled_write_P(PSTR("NUM"), true);
}
if (IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
oled_set_cursor(9, 1);
oled_write_P(PSTR("SCR"), false);
}


+ 7
- 7
keyboards/nullbitsco/snap/keymaps/typehud/keymap.c View File

@ -94,27 +94,27 @@ static void render_status(void) {
// Host Keyboard LED Status
oled_set_cursor(0, 1);
static uint8_t persistent_led_state = 0;
uint8_t led_usb_state = host_keyboard_leds();
static led_t persistent_led_state = {0};
led_t led_state = host_keyboard_led_state();
// Only update if the LED state has changed
// Otherwise, the OLED will not turn off if an LED is on.
if (persistent_led_state != led_usb_state) {
persistent_led_state = led_usb_state;
if (persistent_led_state != led_state) {
persistent_led_state = led_state;
oled_write_ln_P(PSTR(" "), false);
if (IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK)) {
if (led_state.caps_lock) {
oled_set_cursor(0, 1);
oled_write_P(PSTR("CAPS"), false);
}
if (IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK)) {
if (led_state.num_lock) {
oled_set_cursor(5, 1);
oled_write_P(PSTR("NUM"), true);
}
if (IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
oled_set_cursor(9, 1);
oled_write_P(PSTR("SCR"), false);
}


+ 4
- 4
keyboards/nullbitsco/tidbit/keymaps/snailmap_lite/keymap.c View File

@ -179,13 +179,13 @@ static void render_wpm_counters(uint8_t current_wpm) {
static void render_led_status(void) {
// Host Keyboard LED Status
uint8_t led_usb_state = host_keyboard_leds();
led_t led_state = host_keyboard_led_state();
oled_set_cursor(0, 8);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR(CAPLCK_STR) : PSTR(EMPTY_STR), false);
oled_write_P(led_state.caps_lock ? PSTR(CAPLCK_STR) : PSTR(EMPTY_STR), false);
oled_set_cursor(0, 9);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR(NUMLCK_STR) : PSTR(EMPTY_STR), false);
oled_write_P(led_state.num_lock ? PSTR(NUMLCK_STR) : PSTR(EMPTY_STR), false);
oled_set_cursor(0, 10);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK) ? PSTR(SCRLK_STR) : PSTR(EMPTY_STR), false);
oled_write_P(led_state.scroll_lock ? PSTR(SCRLK_STR) : PSTR(EMPTY_STR), false);
}
// Update WPM snail icon


+ 5
- 4
keyboards/orange75/keymaps/default/keymap.c View File

@ -52,9 +52,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
void led_set_user(uint8_t usb_led) {
bool led_update_user(led_t led_state) {
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
if (led_state.num_lock) {
setPinOutput(B0);
writePinLow(B0);
} else {
@ -62,7 +62,7 @@ void led_set_user(uint8_t usb_led) {
writePinLow(B0);
}
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
if (led_state.caps_lock) {
setPinOutput(B1);
writePinLow(B1);
} else {
@ -70,11 +70,12 @@ void led_set_user(uint8_t usb_led) {
writePinLow(B1);
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
setPinOutput(B2);
writePinLow(B2);
} else {
setPinInput(B2);
writePinLow(B2);
}
return false;
}

+ 10
- 9
keyboards/planck/keymaps/vaire/keymap.c View File

@ -80,47 +80,48 @@ void matrix_init_user(void)
println("Matrix Init");
}
void led_set_user(uint8_t usb_led)
bool led_update_user(led_t led_state)
{
static uint8_t old_usb_led = 0;
static led_t old_led_state = {0};
_delay_ms(10); // gets rid of tick
if (!is_playing_notes())
{
if ((usb_led & (1<<USB_LED_CAPS_LOCK)) && !(old_usb_led & (1<<USB_LED_CAPS_LOCK)))
if (led_state.caps_lock && !old_led_state.caps_lock)
{
// If CAPS LK LED is turning on...
PLAY_SONG(tone_caps_on);
}
else if (!(usb_led & (1<<USB_LED_CAPS_LOCK)) && (old_usb_led & (1<<USB_LED_CAPS_LOCK)))
else if (!led_state.caps_lock && old_led_state.caps_lock)
{
// If CAPS LK LED is turning off...
PLAY_SONG(tone_caps_off);
}
else if ((usb_led & (1<<USB_LED_NUM_LOCK)) && !(old_usb_led & (1<<USB_LED_NUM_LOCK)))
else if (led_state.num_lock && !old_led_state.num_lock)
{
// If NUM LK LED is turning on...
PLAY_SONG(tone_numlk_on);
}
else if (!(usb_led & (1<<USB_LED_NUM_LOCK)) && (old_usb_led & (1<<USB_LED_NUM_LOCK)))
else if (!led_state.num_lock && old_led_state.num_lock)
{
// If NUM LED is turning off...
PLAY_SONG(tone_numlk_off);
}
else if ((usb_led & (1<<USB_LED_SCROLL_LOCK)) && !(old_usb_led & (1<<USB_LED_SCROLL_LOCK)))
else if (led_state.scroll_lock && !old_led_state.scroll_lock)
{
// If SCROLL LK LED is turning on...
PLAY_SONG(tone_scroll_on);
}
else if (!(usb_led & (1<<USB_LED_SCROLL_LOCK)) && (old_usb_led & (1<<USB_LED_SCROLL_LOCK)))
else if (!led_state.scroll_lock && old_led_state.scroll_lock)
{
// If SCROLL LED is turning off...
PLAY_SONG(tone_scroll_off);
}
}
old_usb_led = usb_led;
old_led_state = led_state;
return false;
}


+ 0
- 8
keyboards/plut0nium/0x3e/keymaps/default/keymap.c View File

@ -136,14 +136,6 @@ bool oled_task_user(void) {
oled_write_ln_P(PSTR("Undf"), false);
}
// Host Keyboard LED Status
// uint8_t led_usb_state = host_keyboard_leds();
// oled_write_P(PSTR("-----"), false);
// oled_write_P(PSTR("Stats"), false);
// oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("num:*") : PSTR("num:."), false);
// oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("cap:*") : PSTR("cap:."), false);
// oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("scr:*") : PSTR("scr:."), false);
oled_write_P(PSTR("-----"), false);
render_backlight_status();


+ 4
- 10
keyboards/primekb/prime_e/keymaps/default/keymap.c View File

@ -57,24 +57,18 @@ void matrix_init_user(void) {
writePinLow(B3);
}
void led_set_user(uint8_t usb_led) {
if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
bool led_update_user(led_t led_state) {
if (led_state.num_lock) {
writePinHigh(B2);
} else {
writePinLow(B2);
}
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
if (led_state.caps_lock) {
writePinHigh(B1);
} else {
writePinLow(B1);
}
/*
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
writePinHigh(B3);
} else {
writePinLow(B3);
}*/
return false;
}
//function for layer indicator LED


+ 4
- 10
keyboards/primekb/prime_e/keymaps/via/keymap.c View File

@ -85,24 +85,18 @@ void matrix_init_user(void) {
writePinLow(B3);
}
void led_set_user(uint8_t usb_led) {
if (IS_LED_ON(usb_led, USB_LED_NUM_LOCK)) {
bool led_update_user(led_t led_state) {
if (led_state.num_lock) {
writePinHigh(B2);
} else {
writePinLow(B2);
}
if (IS_LED_ON(usb_led, USB_LED_CAPS_LOCK)) {
if (led_state.caps_lock) {
writePinHigh(B1);
} else {
writePinLow(B1);
}
/*
if (IS_LED_ON(usb_led, USB_LED_SCROLL_LOCK)) {
writePinHigh(B3);
} else {
writePinLow(B3);
}*/
return false;
}
//function for layer indicator LED


+ 4
- 4
keyboards/rgbkb/sol/keymaps/brianweyer/keymap.c View File

@ -254,10 +254,10 @@ static void render_status(void) {
}
// Host Keyboard LED Status
uint8_t led_usb_state = host_keyboard_leds();
oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLOCK ") : PSTR(" "), false);
oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPS ") : PSTR(" "), false);
oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCLK ") : PSTR(" "), false);
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUMLOCK ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPS ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCLK ") : PSTR(" "), false);
}
bool oled_task_user(void) {


+ 4
- 4
keyboards/rgbkb/sol/keymaps/danielhklein/keymap.c View File

@ -318,10 +318,10 @@ static void render_status(void) {
}
// Host Keyboard LED Status
uint8_t led_usb_state = host_keyboard_leds();
oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLOCK ") : PSTR(" "), false);
oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPS ") : PSTR(" "), false);
oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCLK ") : PSTR(" "), false);
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUMLOCK ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPS ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCLK ") : PSTR(" "), false);
}
bool oled_task_user(void) {


+ 4
- 4
keyboards/rgbkb/sol/keymaps/default/keymap.c View File

@ -344,11 +344,11 @@ static void render_status(void) {
}
// Host Keyboard LED Status
uint8_t led_state = host_keyboard_leds();
led_t led_state = host_keyboard_led_state();
oled_write_P(PSTR("-----"), false);
oled_write_P(IS_LED_ON(led_state, USB_LED_NUM_LOCK) ? PSTR("NUMLK") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false);
oled_write_P(led_state.num_lock ? PSTR("NUMLK") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPLK") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLK") : PSTR(" "), false);
#ifdef RGB_OLED_MENU
static char buffer[31] = { 0 };


+ 4
- 4
keyboards/rgbkb/sol/keymaps/xyverz/keymap.c View File

@ -334,11 +334,11 @@ static void render_status(void) {
}
// Host Keyboard LED Status
uint8_t led_state = host_keyboard_leds();
led_t led_state = host_keyboard_led_state();
oled_write_P(PSTR("-----"), false);
oled_write_P(IS_LED_ON(led_state, USB_LED_NUM_LOCK) ? PSTR("NUMLK") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false);
oled_write_P(led_state.num_lock ? PSTR("NUMLK") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPLK") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLK") : PSTR(" "), false);
#ifdef RGB_OLED_MENU
static char buffer[31] = { 0 };


+ 4
- 4
keyboards/rgbkb/zen/rev2/rev2.c View File

@ -40,11 +40,11 @@ void render_status(void) {
oled_write_P(layer_name_user(get_highest_layer(layer_state)), false);
// Host Keyboard LED Status
uint8_t led_usb_state = host_keyboard_leds();
led_t led_state = host_keyboard_led_state();
oled_set_cursor(0, oled_max_lines() - 4); // Line 13
oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLK") : PSTR(" "), false); // Line 14
oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false); // Line 15
oled_write_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false); // Line 16
oled_write_P(led_state.num_lock ? PSTR("NUMLK") : PSTR(" "), false); // Line 14
oled_write_P(led_state.caps_lock ? PSTR("CAPLK") : PSTR(" "), false); // Line 15
oled_write_P(led_state.scroll_lock ? PSTR("SCRLK") : PSTR(" "), false); // Line 16
}
oled_rotation_t oled_init_kb(oled_rotation_t rotation) {


+ 4
- 3
keyboards/rgbkb/zygomorph/keymaps/5x6pad/keymap.c View File

@ -253,10 +253,11 @@ void render_status(struct CharacterMatrix *matrix) {
// Host Keyboard LED Status
char led[40];
led_t led_state = host_keyboard_led_state();
snprintf(led, sizeof(led), "\n%s %s %s",
(host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
(host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
led_state.num_lock ? "NUMLOCK" : " ",
led_state.caps_lock ? "CAPS" : " ",
led_state.scroll_lock ? "SCLK" : " ");
matrix_write(matrix, led);
}


+ 4
- 4
keyboards/rgbkb/zygomorph/keymaps/default_oled/keymap.c View File

@ -216,10 +216,10 @@ static void render_status(void) {
}
// Host Keyboard LED Status
uint8_t led_usb_state = host_keyboard_leds();
oled_write_P(led_usb_state & (1<<USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(led_usb_state & (1<<USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_ln_P(led_usb_state & (1<<USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false);
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_ln_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false);
}
bool oled_task_user(void) {


+ 4
- 4
keyboards/satt/comet46/lib/host_led_state_reader.c View File

@ -4,12 +4,12 @@
char host_led_state_str[22];
const char *read_host_led_state(void) {
uint8_t leds = host_keyboard_leds();
led_t led_state = host_keyboard_led_state();
snprintf(host_led_state_str, sizeof(host_led_state_str), "Lock: %s%s%s",
(leds & (1 << USB_LED_CAPS_LOCK)) ? "CAPL " : "",
(leds & (1 << USB_LED_SCROLL_LOCK)) ? "SCRL " : "",
(leds & (1 << USB_LED_NUM_LOCK)) ? "NUML" : "");
led_state.caps_lock ? "CAPL " : "",
led_state.scroll_lock ? "SCRL " : "",
led_state.num_lock ? "NUML" : "");
return host_led_state_str;
}

+ 4
- 4
keyboards/splitkb/kyria/keymaps/cwebster2/keymap.c View File

@ -384,10 +384,10 @@ static void render_status(void) {
oled_write_P(PSTR("\n"), false);
// Host Keyboard LED Status
uint8_t led_usb_state = host_keyboard_leds();
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false);
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false);
}


+ 4
- 4
keyboards/splitkb/kyria/keymaps/shinze/keymap.c View File

@ -210,10 +210,10 @@ static void render_status(void) {
}
// Host Keyboard LED Status
uint8_t led_usb_state = host_keyboard_leds();
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false);
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false);
}
bool oled_task_user(void) {


+ 4
- 4
keyboards/splitkb/kyria/keymaps/tessachka/keymap.c View File

@ -225,10 +225,10 @@ static void render_status(void) {
}
// Host Keyboard LED Status
uint8_t led_usb_state = host_keyboard_leds();
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false);
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false);
}
bool oled_task_user(void) {


+ 4
- 4
keyboards/splitkb/kyria/keymaps/thomasbaart/keymap.c View File

@ -286,10 +286,10 @@ static void render_status(void) {
}
// Host Keyboard LED Status
uint8_t led_usb_state = host_keyboard_leds();
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_NUM_LOCK) ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_usb_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLCK ") : PSTR(" "), false);
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false);
}
bool oled_task_user(void) {


+ 5
- 4
keyboards/viktus/at101_bh/keymaps/default/keymap.c View File

@ -19,26 +19,27 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
};
void led_set_user(uint8_t usb_led) {
bool led_update_user(led_t led_state) {
setPinOutput(B4);
setPinOutput(D6);
setPinOutput(D7);
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
if (led_state.num_lock) {
writePinHigh(D7);
} else {
writePinLow(D7);
}
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
if (led_state.caps_lock) {
writePinHigh(B4);
} else {
writePinLow(B4);
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
writePinHigh(D6);
} else {
writePinLow(D6);
}
return false;
}

+ 5
- 4
keyboards/viktus/omnikey_bh/keymaps/default/keymap.c View File

@ -22,24 +22,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
};
void led_set_user(uint8_t usb_led) {
bool led_update_user(led_t led_state) {
DDRB |= (1 << 4) | (1 << 5) | (1 << 6);
if (usb_led & (1 << USB_LED_NUM_LOCK)) {
if (led_state.num_lock) {
PORTB |= (1 << 4);
} else {
PORTB &= ~(1 << 4);
}
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
if (led_state.caps_lock) {
PORTB |= (1 << 5);
} else {
PORTB &= ~(1 << 5);
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
PORTB |= (1 << 6);
} else {
PORTB &= ~(1 << 6);
}
return false;
}

+ 4
- 4
keyboards/yosino58/lib/host_led_state_reader.c View File

@ -4,11 +4,11 @@ char host_led_state_str[24];
const char *read_host_led_state(void)
{
uint8_t leds = host_keyboard_leds();
led_t led_state = host_keyboard_led_state();
snprintf(host_led_state_str, sizeof(host_led_state_str), "NL:%s CL:%s SL:%s",
(leds & (1 << USB_LED_NUM_LOCK)) ? "on" : "- ",
(leds & (1 << USB_LED_CAPS_LOCK)) ? "on" : "- ",
(leds & (1 << USB_LED_SCROLL_LOCK)) ? "on" : "- ");
led_state.num_lock ? "on" : "- ",
led_state.caps_lock ? "on" : "- ",
led_state.scroll_lock ? "on" : "- ");
return host_led_state_str;
}

+ 6
- 6
quantum/action.c View File

@ -882,7 +882,7 @@ __attribute__((weak)) void register_code(uint8_t code) {
} else if (KC_LOCKING_CAPS_LOCK == code) {
# ifdef LOCKING_RESYNC_ENABLE
// Resync: ignore if caps lock already is on
if (host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK)) return;
if (host_keyboard_led_state().caps_lock) return;
# endif
add_key(KC_CAPS_LOCK);
send_keyboard_report();
@ -892,7 +892,7 @@ __attribute__((weak)) void register_code(uint8_t code) {
} else if (KC_LOCKING_NUM_LOCK == code) {
# ifdef LOCKING_RESYNC_ENABLE
if (host_keyboard_leds() & (1 << USB_LED_NUM_LOCK)) return;
if (host_keyboard_led_state().num_lock) return;
# endif
add_key(KC_NUM_LOCK);
send_keyboard_report();
@ -902,7 +902,7 @@ __attribute__((weak)) void register_code(uint8_t code) {
} else if (KC_LOCKING_SCROLL_LOCK == code) {
# ifdef LOCKING_RESYNC_ENABLE
if (host_keyboard_leds() & (1 << USB_LED_SCROLL_LOCK)) return;
if (host_keyboard_led_state().scroll_lock) return;
# endif
add_key(KC_SCROLL_LOCK);
send_keyboard_report();
@ -952,7 +952,7 @@ __attribute__((weak)) void unregister_code(uint8_t code) {
} else if (KC_LOCKING_CAPS_LOCK == code) {
# ifdef LOCKING_RESYNC_ENABLE
// Resync: ignore if caps lock already is off
if (!(host_keyboard_leds() & (1 << USB_LED_CAPS_LOCK))) return;
if (!host_keyboard_led_state().caps_lock) return;
# endif
add_key(KC_CAPS_LOCK);
send_keyboard_report();
@ -961,7 +961,7 @@ __attribute__((weak)) void unregister_code(uint8_t code) {
} else if (KC_LOCKING_NUM_LOCK == code) {
# ifdef LOCKING_RESYNC_ENABLE
if (!(host_keyboard_leds() & (1 << USB_LED_NUM_LOCK))) return;
if (!host_keyboard_led_state().num_lock) return;
# endif
add_key(KC_NUM_LOCK);
send_keyboard_report();
@ -970,7 +970,7 @@ __attribute__((weak)) void unregister_code(uint8_t code) {
} else if (KC_LOCKING_SCROLL_LOCK == code) {
# ifdef LOCKING_RESYNC_ENABLE
if (!(host_keyboard_leds() & (1 << USB_LED_SCROLL_LOCK))) return;
if (!host_keyboard_led_state().scroll_lock) return;
# endif
add_key(KC_SCROLL_LOCK);
send_keyboard_report();


+ 0
- 1
quantum/led.h View File

@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* keyboard LEDs */
#define USB_LED_NUM_LOCK 0
#define USB_LED_CAPS_LOCK 1
#define USB_LED_SCROLL_LOCK 2
#ifdef __cplusplus
extern "C" {


+ 5
- 5
users/curry/oled.c View File

@ -86,12 +86,12 @@ void render_layer_state(void) {
oled_write_P(PSTR(" Mods"), layer_state_is(_MODS));
}
void render_keylock_status(uint8_t led_usb_state) {
void render_keylock_status(led_t led_state) {
oled_write_P(PSTR("Lock:"), false);
oled_write_P(PSTR(" "), false);
oled_write_P(PSTR("N"), led_usb_state & (1 << USB_LED_NUM_LOCK));
oled_write_P(PSTR("C"), led_usb_state & (1 << USB_LED_CAPS_LOCK));
oled_write_ln_P(PSTR("S"), led_usb_state & (1 << USB_LED_SCROLL_LOCK));
oled_write_P(PSTR("N"), led_state.num_lock);
oled_write_P(PSTR("C"), led_state.caps_lock);
oled_write_ln_P(PSTR("S"), led_state.scroll_lock);
}
void render_mod_status(uint8_t modifiers) {
@ -129,7 +129,7 @@ void render_user_status(void) {
void render_status_main(void) {
/* Show Keyboard Layout */
render_default_layer_state();
render_keylock_status(host_keyboard_leds());
render_keylock_status(host_keyboard_led_state());
render_bootmagic_status();
render_user_status();


+ 5
- 8
users/ericgebhart/oled/oled_stuff.c View File

@ -32,11 +32,11 @@ void oled_render_locale(void) {
}
}
void oled_render_keylock_status(uint8_t led_usb_state) {
void oled_render_keylock_status(led_t led_state) {
oled_write_P(PSTR(" Lock:"), false);
oled_write_P(PSTR("N"), led_usb_state & (1 << USB_LED_NUM_LOCK));
oled_write_P(PSTR("C"), led_usb_state & (1 << USB_LED_CAPS_LOCK));
oled_write_P(PSTR("S"), led_usb_state & (1 << USB_LED_SCROLL_LOCK));
oled_write_P(PSTR("N"), led_state.num_lock);
oled_write_P(PSTR("C"), led_state.caps_lock);
oled_write_P(PSTR("S"), led_state.scroll_lock);
}
void oled_render_mod_status(uint8_t modifiers) {
@ -49,7 +49,7 @@ void oled_render_mod_status(uint8_t modifiers) {
void oled_render_mod_lock_status(void){
oled_render_mod_status(get_mods() | get_oneshot_mods());
oled_render_keylock_status(host_keyboard_leds());
oled_render_keylock_status(host_keyboard_led_state());
}
@ -187,6 +187,3 @@ bool oled_task_user(void) {
}
#endif
/* oled_render_keylock_status(host_keyboard_leds()); */
/* oled_render_mod_status(get_mods() | get_oneshot_mods()); */

+ 6
- 6
users/spidey3/layer_rgb.c View File

@ -73,9 +73,9 @@ const rgblight_segment_t *const PROGMEM _rgb_layers[] = {
[LAYER_OFFSET + _NUMPAD] = _layer1_layer,
[LAYER_OFFSET + _FN] = _layer2_layer,
[LOCK_OFFSET + USB_LED_NUM_LOCK] = _numlock_layer,
[LOCK_OFFSET + USB_LED_CAPS_LOCK] = _capslock_layer,
[LOCK_OFFSET + USB_LED_SCROLL_LOCK] = _scrolllock_layer,
[LOCK_OFFSET + 0] = _numlock_layer,
[LOCK_OFFSET + 1] = _capslock_layer,
[LOCK_OFFSET + 2] = _scrolllock_layer,
[MISC_OFFSET + 0] = _gflock_layer,
[MISC_OFFSET + 1] = _glyphreplace_layer,
@ -374,9 +374,9 @@ layer_state_t layer_state_set_user_rgb(layer_state_t state) {
}
bool led_update_user_rgb(led_t led_state) {
rgblight_set_layer_state(LOCK_OFFSET + USB_LED_NUM_LOCK, led_state.num_lock);
rgblight_set_layer_state(LOCK_OFFSET + USB_LED_CAPS_LOCK, led_state.caps_lock);
rgblight_set_layer_state(LOCK_OFFSET + USB_LED_SCROLL_LOCK, led_state.scroll_lock);
rgblight_set_layer_state(LOCK_OFFSET + 0, led_state.num_lock);
rgblight_set_layer_state(LOCK_OFFSET + 1, led_state.caps_lock);
rgblight_set_layer_state(LOCK_OFFSET + 2, led_state.scroll_lock);
return true;
}


+ 7
- 7
users/xulkal/custom_oled.c View File

@ -71,15 +71,15 @@ static void render_layer(void)
static void render_keyboard_leds(void)
{
// Host Keyboard LED Status
uint8_t led_state = host_keyboard_leds();
led_t led_state = host_keyboard_led_state();
#ifdef OLED_90ROTATION
oled_write_P(IS_LED_ON(led_state, USB_LED_NUM_LOCK) ? PSTR("NUMLK") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_state, USB_LED_CAPS_LOCK) ? PSTR("CAPLK") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRLK") : PSTR(" "), false);
oled_write_P(led_state.num_lock ? PSTR("NUMLK") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPLK") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRLK") : PSTR(" "), false);
#else
oled_write_P(IS_LED_ON(led_state, USB_LED_NUM_LOCK) ? PSTR("NUM ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_state, USB_LED_CAPS_LOCK) ? PSTR("CAPS ") : PSTR(" "), false);
oled_write_P(IS_LED_ON(led_state, USB_LED_SCROLL_LOCK) ? PSTR("SCRL") : PSTR(" "), false);
oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPS ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCRL") : PSTR(" "), false);
#endif
}


+ 5
- 4
users/zer09/zer09.c View File

@ -69,8 +69,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return process_record_keymap(keycode, record);
}
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) {
rbw_led_keys[RBW_LCAP].status = ENABLED;
rbw_led_keys[RBW_RCAP].status = ENABLED;
} else {
@ -78,11 +78,12 @@ void led_set_user(uint8_t usb_led) {
rbw_led_keys[RBW_RCAP].status = DISABLED;
}
if (usb_led & (1 << USB_LED_SCROLL_LOCK)) {
if (led_state.scroll_lock) {
rbw_led_keys[RBW_SCRL].status = ENABLED;
} else {
rbw_led_keys[RBW_SCRL].status = DISABLED;
}
led_set_keymap(usb_led);
led_set_keymap(led_state.raw);
return false;
}

Loading…
Cancel
Save