Keyboard: Add caps lock led support to DZ60 (#3506)
* add caps lock led support to DZ60 * changes from drashna's code review comments * call led_set_user at the end of led_set_kb
This commit is contained in:
parent
54517f8b34
commit
841ea7ceb6
4 changed files with 9 additions and 27 deletions
|
@ -22,7 +22,13 @@ void led_init_ports(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void led_set_kb(uint8_t usb_led) {
|
void led_set_kb(uint8_t usb_led) {
|
||||||
// Code for caps lock LED as reported by the OS
|
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
|
||||||
// Set this per keymap, instead of globally
|
DDRB |= (1 << 2);
|
||||||
led_set_user(usb_led);
|
PORTB &= ~(1 << 2);
|
||||||
|
} else {
|
||||||
|
DDRB &= ~(1 << 2);
|
||||||
|
PORTB &= ~(1 << 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
led_set_user(usb_led);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,11 +59,3 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void led_set_user(uint8_t usb_led) {
|
|
||||||
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
|
|
||||||
DDRB |= (1 << 2); PORTB &= ~(1 << 2);
|
|
||||||
} else {
|
|
||||||
DDRB &= ~(1 << 2); PORTB &= ~(1 << 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -84,11 +84,3 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void led_set_user(uint8_t usb_led) {
|
|
||||||
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
|
|
||||||
DDRB |= (1 << 2); PORTB &= ~(1 << 2);
|
|
||||||
} else {
|
|
||||||
DDRB &= ~(1 << 2); PORTB &= ~(1 << 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -19,11 +19,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
_______, KC_NO, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______,
|
_______, KC_NO, _______, _______, _______, _______, _______, KC_PPLS, KC_PMNS, KC_END, KC_PGDN, KC_DOWN, _______, _______,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______)
|
||||||
};
|
};
|
||||||
|
|
||||||
void led_set_user(uint8_t usb_led) {
|
|
||||||
if (usb_led & (1 << USB_LED_CAPS_LOCK)) {
|
|
||||||
DDRB |= (1 << 2); PORTB &= ~(1 << 2);
|
|
||||||
} else {
|
|
||||||
DDRB &= ~(1 << 2); PORTB &= ~(1 << 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue