diff options
author | Takuya Urakawa <urkwtky@gmail.com> | 2022-03-07 12:27:41 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-06 19:27:41 -0800 |
commit | 5de86a05c31482b5c770888e33c98d933c42b34c (patch) | |
tree | 6c314f1e5d33fafe53c0ac76d14f4cc5f06600ce /keyboards/dm9records/lain/keymaps/default | |
parent | de10757f057d31a148d0b881535d875ff4af5c9c (diff) |
[Keyboard] Add Lain keyboard (#16345)
Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/dm9records/lain/keymaps/default')
-rw-r--r-- | keyboards/dm9records/lain/keymaps/default/keymap.c | 79 | ||||
-rw-r--r-- | keyboards/dm9records/lain/keymaps/default/readme.md | 5 |
2 files changed, 84 insertions, 0 deletions
diff --git a/keyboards/dm9records/lain/keymaps/default/keymap.c b/keyboards/dm9records/lain/keymaps/default/keymap.c new file mode 100644 index 0000000000..655e3211b2 --- /dev/null +++ b/keyboards/dm9records/lain/keymaps/default/keymap.c @@ -0,0 +1,79 @@ +// Copyright 2022 Takuya Urakawa @hsgw (dm9records.com, 5z6p.com) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +enum layers { BASE, NUM, FUNC, CONF }; +enum custom_keycodes { LED_EN = SAFE_RANGE }; + +// clang-format off +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [BASE] = LAYOUT( + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_RBRC, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_INS, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, + KC_LCTL, KC_LALT, KC_LGUI, MO(NUM), KC_SPC, KC_ENT, MO(FUNC), KC_RALT, KC_MENU, KC_RCTL, KC_RSFT + ), + [NUM] = LAYOUT( + KC_DEL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, + KC_CAPS, S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), S(KC_MINS),S(KC_EQL), + _______, _______, _______, _______, _______, _______, KC_PSCR, _______, _______, _______, _______, KC_BSLS, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [FUNC] = LAYOUT( + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT,_______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + ), + [CONF] = LAYOUT( + RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + LED_EN, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case LED_EN: + if (record->event.pressed) { + lain_enable_leds_toggle(); + } + return false; + default: + break; + } + return true; +} + +// clang-format on + +layer_state_t layer_state_set_user(layer_state_t state) { + layer_state_t computed = update_tri_layer_state(state, NUM, FUNC, CONF); + switch (get_highest_layer(computed)) { + case NUM: + lain_set_led(1, 1); + lain_set_led(2, 0); + break; + case FUNC: + lain_set_led(1, 0); + lain_set_led(2, 1); + break; + case CONF: + lain_set_led(1, 1); + lain_set_led(2, 1); + break; + default: + lain_set_led(1, 0); + lain_set_led(2, 0); + break; + } + return computed; +} + +bool led_update_user(led_t led_state) { + lain_set_led(0, led_state.caps_lock); + return false; +} diff --git a/keyboards/dm9records/lain/keymaps/default/readme.md b/keyboards/dm9records/lain/keymaps/default/readme.md new file mode 100644 index 0000000000..2f59c80ebc --- /dev/null +++ b/keyboards/dm9records/lain/keymaps/default/readme.md @@ -0,0 +1,5 @@ +# The default keymap for lain + +## Leds setting +1: CAPS LOCK +2-3: Layor indicator |