Created
November 26, 2024 11:41
-
-
Save sago35/8a3d09b9930deb2be8ba5881110d2f99 to your computer and use it in GitHub Desktop.
keymap.rb for zero-kb02
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Initialize a Keyboard | |
kbd = Keyboard.new | |
# Initialize GPIO assign | |
kbd.init_pins( | |
[ 9, 10, 11 ], # row0, row1,... respectively | |
[ 5, 6, 7, 8 ] # col0, col1,... respectively | |
) | |
# default layer should be added at first | |
kbd.add_layer :default, %i[ | |
KC_1 KC_2 KC_3 KC_4 | |
KC_H KC_J KC_K KC_L | |
LOWER_SPC RAISE_N KC_M KC_COMMA | |
] | |
kbd.add_layer :raise, %i[ | |
KC_5 KC_6 KC_7 KC_8 | |
KC_CIRC KC_AMPR KC_ASTER KC_LPRN | |
KC_SPACE RAISE_N KC_INSERT KC_LBRC | |
] | |
kbd.add_layer :lower, %i[ | |
KC_A KC_B KC_C KC_D | |
KC_E KC_F KC_G KC_H | |
KC_I KC_J KC_K KC_L | |
] | |
# | |
# Your custom Keycode or Keycode (only modifiers) Release time Re-push time | |
# key name Array of Keycode or Layer Symbol to be held threshold(ms) threshold(ms) | |
# or Proc or Proc which will run to consider as to consider as | |
# when you click while you keep press `click the key` `hold the key` | |
kbd.define_mode_key :ALT_Q, [ :KC_Q, :KC_LALT, 150, 150] | |
kbd.define_mode_key :GUI_X, [ :KC_X, :KC_LGUI, 150, 150 ] | |
kbd.define_mode_key :RAISE_N, [ :KC_N, :raise, 150, 250 ] | |
kbd.define_mode_key :LOWER_SPC, [ :KC_SPACE, :lower, 150, 250 ] | |
encoder_1 = RotaryEncoder.new(3, 4) | |
encoder_1.clockwise do | |
kbd.send_key :KC_DOWN | |
end | |
encoder_1.counterclockwise do | |
kbd.send_key :KC_UP | |
end | |
kbd.append encoder_1 | |
kbd.start! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment