[Keyboard] leds in default keymap (#6357)

master
jotix 2019-07-20 17:25:20 -03:00 committed by Drashna Jaelre
parent a2e91ebec9
commit c644299820
2 changed files with 43 additions and 11 deletions

View File

@ -13,11 +13,14 @@ extern keymap_config_t keymap_config;
#define _QWERTY 0 #define _QWERTY 0
#define _LOWER 1 #define _LOWER 1
#define _RAISE 2 #define _RAISE 2
#define _ADJUST 3
#define LOWER MO(_LOWER) #define LOWER MO(_LOWER)
#define RAISE MO(_RAISE) #define RAISE MO(_RAISE)
static bool is_ctl_pressed;
static bool is_esc_pressed;
static bool is_bspc_pressed;
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty /* Qwerty
@ -74,19 +77,46 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END
), ),
/* Adjust */
[_ADJUST] = LAYOUT_ortho_4x12 (
_______, RESET, _______, _______, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
),
}; };
uint32_t layer_state_set_user(uint32_t state) { uint32_t layer_state_set_user(uint32_t state) {
return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); #ifdef JOTANCK_LEDS
switch (biton32(state)) {
case _LOWER:
writePinHigh(JOTANCK_LED1);
writePinLow(JOTANCK_LED2);
break;
case _RAISE:
writePinLow(JOTANCK_LED1);
writePinHigh(JOTANCK_LED2);
break;
default:
writePinLow(JOTANCK_LED1);
writePinLow(JOTANCK_LED2);
break;
};
#endif
return state;
} }
void matrix_init_user(void) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_LCTL:
is_ctl_pressed = record->event.pressed;
break;
case KC_ESC:
is_esc_pressed = record->event.pressed;
break;
case KC_BSPC:
is_bspc_pressed = record->event.pressed;
break;
};
return true;
}
void matrix_scan_user(void) {
if (is_ctl_pressed && is_esc_pressed && is_bspc_pressed) {
reset_keyboard();
}
} }

View File

@ -35,4 +35,6 @@ Make example for this keyboard (after setting up your build environment):
![Default Keymap](https://i.imgur.com/xh7Dmd7.png) ![Default Keymap](https://i.imgur.com/xh7Dmd7.png)
To reset the keyboard press Ctrl+Esc+BackSpace
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).