Skip to content

Instantly share code, notes, and snippets.

@emorima
Created December 17, 2021 14:44
Show Gist options
  • Save emorima/6d15499f16a9d943c9da6304291213a6 to your computer and use it in GitHub Desktop.
Save emorima/6d15499f16a9d943c9da6304291213a6 to your computer and use it in GitHub Desktop.
Zinc rev1

default

 +-------+-------+-------+-------+-------+-------+        +-------+-------+-------+-------+-------+-------+
 | Tab   |   Q   |   W   |   E   |   R   |   T   |        |   Y   |   U   |   I   |   O   |   P   | Bksp  |
 |-------+-------+-------+-------+-------+-------|        |-------+-------+-------+-------+-------+-------|
 | Ctrl  |   A   |   S   |   D   |   F   |   G   |        |   H   |   J   |   K   |   L   |   ;   |   '   |
 |-------+-------+-------+-------+-------+-------|        |-------+-------+-------+-------+-------+-------|
 | Shift |   Z   |   X   |   C   |   V   |   B   |        |   N   |   M   |   ,   |   .   |   /   | Enter |
 |-------+-------+-------+-------+-------+-------|        |-------+-------+-------+-------+-------+-------|
 | Esc   |ADJUST |  Win  |  Alt  | LOWER | Space |        | Space | RAISE | Left  | Down  |  Up   | Right |
 +-------+-------+-------+-------+-------+-------+        +-------+-------+-------+-------+-------+-------+

raise

 +-------+-------+-------+-------+-------+-------+        +-------+-------+-------+-------+-------+-------+
 |   `   |   1   |   2   |   3   |   4   |   5   |        |   6   |   7   |   8   |   9   |   0   |  Del  |
 |-------+-------+-------+-------+-------+-------|        |-------+-------+-------+-------+-------+-------|
 |       |  F1   |  F2   |  F3   |  F4   |  F5   |        |  F6   |   -   |   =   |   [   |   ]   |   \   |
 |-------+-------+-------+-------+-------+-------|        |-------+-------+-------+-------+-------+-------|
 |       |  F7   |  F8   |  F9   |  F10  |  F11  |        |  F12  |       |       |       |       |       |
 |-------+-------+-------+-------+-------+-------|        |-------+-------+-------+-------+-------+-------|
 |       |       |       |       |       |       |        |       |       | Next  | Vol-  | Vol+  | Play  |
 +-------+-------+-------+-------+-------+-------+        +-------+-------+-------+-------+-------+-------+

lower

 +-------+-------+-------+-------+-------+-------+        +-------+-------+-------+-------+-------+-------+
 |       | Reset |RGBRST |       |       |       |        |       |       |       |       |       |  Ins  |
 |-------+-------+-------+-------+-------+-------|        |-------+-------+-------+-------+-------+-------|
 |       |RGB ON | HUE+  | SAT+  | VAL+  | Mac   |        |  Win  |  -    |   =   | Print |ScLock | Pause |
 |-------+-------+-------+-------+-------+-------|        |-------+-------+-------+-------+-------+-------|
 |MODE R | MODE  | HUE-  | SAT-  | VAL-  |       |        |       |       |       |       |PageUp |       |
 |-------+-------+-------+-------+-------+-------|        |-------+-------+-------+-------+-------+-------|
 |       |       |       | EISU  | EISU  | EISU  |        | KANA  | KANA  | Home  |PageDn |PageUp |  End  |
 +-------+-------+-------+-------+-------+-------+        +-------+-------+-------+-------+-------+-------+
# Initialize a Keyboard
kbd = Keyboard.new
# `split=` should happen before `init_pins`
kbd.split = true
# Initialize GPIO assign
kbd.init_pins(
[ 27, 26, 22, 20], # row0, row1,... respectively
[ 29, 4, 5, 6, 7, 8 ] # col0, col1,... respectively
)
# default layer should be added at first
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_QUOTE
KC_LSFT KC_Z KC_X KC_C KC_V KC_B KC_N KC_M KC_COMMA KC_DOT KC_SLASH KC_ENTER
KC_ESCAPE ADJUST KC_LGUI KC_LALT LOWER KC_SPACE KC_SPACE RAISE KC_LEFT KC_DOWN KC_UP KC_RIGHT
]
kbd.add_layer :raise, %i[
KC_GRAVE KC_1 KC_2 KC_3 KC_4 KC_5 KC_6 KC_7 KC_8 KC_9 KC_0 KC_DELETE
KC_NO KC_F1 KC_F2 KC_F3 KC_F4 KC_F5 KC_F6 KC_MINUS KC_EQUAL KC_LBRACKET KC_RBRACKET KC__BSLASH
KC_NO KC_F7 KC_F8 KC_F9 KC_F10 KC_F11 KC_F12 KC_NO KC_NO KC_NO KC_NO KC_NO
KC_NO KC_NO KC_NO KC_NO KC_NO KC_NO KC_NO KC_NO KC_MNXT KC_VOLD KC_VOLU KC_MPLY
]
kbd.add_layer :lower, %i[
KC_TILD KC_EXLM KC_AT KC_HASH KC_DLR KC_PERC KC_CIRC KC_AMPR KC_ASTR KC_LPRN KC_RPRN KC_NO
KC_NO KC_NO KC_NO KC_NO KC_NO KC_NO KC_MINUS KC_UNDS KC_PLUS KC_LCBR KC_RCBR KC_PIPE
KC_NO KC_NO KC_NO KC_NO KC_NO KC_NO KC_NO KC_NO KC_NO KC_HOME KC_END KC_NO
]
kbd.add_layer :adjust, %i[
KC_NO RESET RGBRST KC_NO KC_NO KC_NO KC_NO KC_NO KC_NO KC_NO KC_NO KC_INS
KC_NO RGB_TOG RGB_HUI RGB_SAI RGB_VAI AG_NORM AG_SWAP KC_MINUS KC_EQUAL KC_PSCR KC_SLCK KC_PAUS
RGB_RMOD RGB_MOD RGB_HUD RGB_SAD RGB_VAD KC_NO KC_NO KC_NO KC_NO KC_NO KC_PGUP KC_NO
KC_NO KC_NO KC_NO EISU EISU EISU KANA KANA KC_HOME KC_PGDN KGJPGUP KC_END
]
#
# 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 :ADJUST, [ :KC_NO, :adjust, 120, 150 ]
kbd.define_mode_key :LOWER, [ :KC_NO, :lower, 120, 150 ]
kbd.define_mode_key :RAISE, [ :KC_NO, :raise, 120, 150 ]
# Initialize RGB class with pin, underglow_size, backlight_size and is_rgbw.
rgb = RGB.new(
0, # pin number
0, # size of underglow pixel
32, # size of backlight pixel
false # 32bit data will be sent to a pixel if true while 24bit if false
)
sleep 1
# Set an effect
# `nil` or `:off` for turning off
rgb.effect = :swirl
# Set an action when you input
# `nil` or `:off` for turning off
#rgb.action = :thunder
# Append the feature. Will possibly be able to write `Keyboard#append(OLED.new)` in the future
kbd.append rgb
kbd.start!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment