Skip to content

Instantly share code, notes, and snippets.

@sylph01
Last active November 24, 2024 04:44
Show Gist options
  • Save sylph01/0cdefeaf5fd1854cdd9f6f5e45e2a1cd to your computer and use it in GitHub Desktop.
Save sylph01/0cdefeaf5fd1854cdd9f6f5e45e2a1cd to your computer and use it in GitHub Desktop.
keymap.rb (keymap file of prk firmware) for crkbd
# Initialize a Keyboard
kbd = Keyboard.new
# `split=` should happen before `init_pins`
kbd.split = true
# If your right hand of CRKBD is the "anchor"
# kbd.set_anchor(:right)
# Initialize GPIO assign
kbd.init_pins(
[ 4, 5, 6, 7 ], # row0, row1,... respectively
[ 29, 28, 27, 26, 22, 20 ] # col0, col1,... respectively
)
kbd.add_layer :default, %i[
KC_TAB KC_Q KC_W KC_E KC_R KC_T KC_Y KC_U KC_I KC_O KC_P KC_BSPACE
KC_LCTL KC_A KC_S KC_D KC_F KC_G KC_H KC_J KC_K KC_L KC_SCOLON KC_MINUS
KC_LSFT KC_Z KC_X KC_C KC_V KC_B KC_N KC_M KC_COMMA KC_DOT KC_SLASH KC_RSFT
KC_NO KC_NO KC_NO KC_LGUI LOWER_MHEN KC_SPC KC_ENT RAISE_HENK KC_RALT KC_NO KC_NO KC_NO
]
kbd.add_layer :lower, %i[
KC_ESCAPE KC_1 KC_2 KC_3 KC_4 KC_5 KC_6 KC_7 KC_8 KC_9 KC_0 KC_DEL
KC_LCTL KC_NO KC_DQUO KC_QUOT KC_HOME KC_LBRC KC_RBRC KC_END KC_UP KC_MINS KC_PLUS KC_GRV
KC_LSFT KC_NO KC_NO KC_PIPE KC_GT KC_LCBR KC_RCBR KC_LEFT KC_DOWN KC_RGHT KC_BSLS KC_RSFT
KC_NO KC_NO KC_NO KC_NO LOWER_MHEN KC_NO KC_NO RAISE_HENK KC_RALT KC_NO KC_NO KC_NO
]
kbd.add_layer :raise, %i[
KC_F12 KC_F1 KC_F2 KC_F3 KC_F4 KC_F5 KC_F6 KC_F7 KC_F8 KC_F9 KC_F10 KC_F11
KC_LCTL KC_EXLM KC_AT KC_HASH KC_DLR KC_PERC KC_CIRC KC_AMPR KC_ASTR KC_LPRN KC_RPRN KC_QUOT
KC_LSFT KC_PSCR KC_NO KC_PGUP KC_MINS KC_UNDS KC_EQL KC_PLUS KC_PGDN KC_NO KC_BSLS KC_RSFT
KC_NO KC_NO KC_NO KC_NO LOWER_MHEN KC_NO KC_NO RAISE_HENK KC_RALT KC_NO KC_NO KC_NO
]
kbd.define_mode_key :LOWER_MHEN, [ :KC_MHEN, :lower, 150, nil ]
kbd.define_mode_key :RAISE_HENK, [ :KC_HENK, :raise, 150, nil ]
kbd.start!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment