capslock_led (#7359)

This commit is contained in:
jotix 2019-11-14 19:46:53 -03:00 committed by fauxpark
parent 1cf63a193b
commit a2eb962704
1 changed files with 27 additions and 44 deletions

View File

@ -4,13 +4,11 @@ enum layers {
_QWERTY,
_LOWER,
_RAISE,
_GAME
};
#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)
#define TGLOWER TG(_LOWER)
#define TGGAME TG(_GAME)
static bool is_ctl_pressed;
static bool is_esc_pressed;
@ -34,9 +32,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// ┌───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┐
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______,
// ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
_______,KC_VOLD,KC_MUTE,KC_VOLU,_______, TGGAME,_______,_______,_______,_______,_______,_______,
_______,KC_VOLD,KC_MUTE,KC_VOLU,KC_MINS, KC_EQL,KC_LBRC,KC_RBRC,_______,_______,_______,_______,
// ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
_______,KC_MPRV,KC_MPLY,KC_MNXT,_______,_______,_______,_______,_______,_______,_______,_______,
_______,KC_MPRV,KC_MPLY,KC_MNXT,KC_UNDS,KC_PLUS,KC_LCBR,KC_RCBR,_______,_______,_______,_______,
// ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______
// └───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘
@ -54,51 +52,36 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// └───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘
),
[_GAME] = LAYOUT_ortho_4x12 (
// ┌───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┐
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
// ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,
// ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, KC_UP ,_______,
// ├───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┼───────┤
_______,_______,_______,_______,_______,_______,_______,_______,KC_SLSH,KC_LEFT,KC_DOWN,KC_RGHT
// └───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┴───────┘
),
};
uint32_t layer_state_set_user(uint32_t state) {
#ifdef JOTANCK_LEDS
switch (biton32(state)) {
case _LOWER:
if (biton32(state) == _LOWER) {
writePinHigh(JOTANCK_LED1);
writePinLow(JOTANCK_LED2);
break;
case _RAISE:
} else {
writePinLow(JOTANCK_LED1);
writePinHigh(JOTANCK_LED2);
break;
case _GAME:
writePinHigh(JOTANCK_LED1);
writePinHigh(JOTANCK_LED2);
break;
default:
writePinLow(JOTANCK_LED1);
writePinLow(JOTANCK_LED2);
break;
};
}
#endif
return state;
}
/*
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) {
// NumLock allways on
if (!led_state.num_lock) {
tap_code(KC_NUMLOCK);
}
#ifdef JOTANCK_LEDS
// CapsLock led
if (led_state.caps_lock) {
writePinHigh(JOTANCK_LED2);
} else {
writePinLow(JOTANCK_LED2);
}
#endif
return true;
}
*/
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {