Skip to content

Commit

Permalink
Update keycodes
Browse files Browse the repository at this point in the history
  • Loading branch information
srwi committed Sep 23, 2024
1 parent 847bdff commit 3168ee4
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 33 deletions.
122 changes: 120 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "VIA api implementation for QMK-based keyboards"
authors = ["Stephan Rumswinkel"]
repository = "https://github.com/srwi/qmk-via-api"
readme = "README.md"
version = "0.0.1"
version = "0.0.2"
edition = "2021"

[lib]
Expand All @@ -15,6 +15,9 @@ crate-type = ["cdylib", "lib"] # "cdylib" is necessary to produce a shared libr
[dependencies]
hidapi = "2.6.1"
itertools = "0.12.1"
num_enum = "0.7.3"
strum = "0.26.3"
strum_macros = "0.26.3"

[dependencies.pyo3]
version = "0.21.0"
Expand Down
87 changes: 57 additions & 30 deletions src/keycodes.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
use num_enum::TryFromPrimitive;
use strum_macros::AsRefStr;

#[derive(Debug, Clone, Eq, PartialEq, TryFromPrimitive, AsRefStr)]
#[repr(u16)]
pub enum Keycode {
KC_NO = 0x0000,
KC_TRANSPARENT = 0x0001,
Expand Down Expand Up @@ -192,25 +197,25 @@ pub enum Keycode {
KC_ASSISTANT = 0x00C0,
KC_MISSION_CONTROL = 0x00C1,
KC_LAUNCHPAD = 0x00C2,
KC_MS_UP = 0x00CD,
KC_MS_DOWN = 0x00CE,
KC_MS_LEFT = 0x00CF,
KC_MS_RIGHT = 0x00D0,
KC_MS_BTN1 = 0x00D1,
KC_MS_BTN2 = 0x00D2,
KC_MS_BTN3 = 0x00D3,
KC_MS_BTN4 = 0x00D4,
KC_MS_BTN5 = 0x00D5,
KC_MS_BTN6 = 0x00D6,
KC_MS_BTN7 = 0x00D7,
KC_MS_BTN8 = 0x00D8,
KC_MS_WH_UP = 0x00D9,
KC_MS_WH_DOWN = 0x00DA,
KC_MS_WH_LEFT = 0x00DB,
KC_MS_WH_RIGHT = 0x00DC,
KC_MS_ACCEL0 = 0x00DD,
KC_MS_ACCEL1 = 0x00DE,
KC_MS_ACCEL2 = 0x00DF,
QK_MOUSE_CURSOR_UP = 0x00CD,
QK_MOUSE_CURSOR_DOWN = 0x00CE,
QK_MOUSE_CURSOR_LEFT = 0x00CF,
QK_MOUSE_CURSOR_RIGHT = 0x00D0,
QK_MOUSE_BUTTON_1 = 0x00D1,
QK_MOUSE_BUTTON_2 = 0x00D2,
QK_MOUSE_BUTTON_3 = 0x00D3,
QK_MOUSE_BUTTON_4 = 0x00D4,
QK_MOUSE_BUTTON_5 = 0x00D5,
QK_MOUSE_BUTTON_6 = 0x00D6,
QK_MOUSE_BUTTON_7 = 0x00D7,
QK_MOUSE_BUTTON_8 = 0x00D8,
QK_MOUSE_WHEEL_UP = 0x00D9,
QK_MOUSE_WHEEL_DOWN = 0x00DA,
QK_MOUSE_WHEEL_LEFT = 0x00DB,
QK_MOUSE_WHEEL_RIGHT = 0x00DC,
QK_MOUSE_ACCELERATION_0 = 0x00DD,
QK_MOUSE_ACCELERATION_1 = 0x00DE,
QK_MOUSE_ACCELERATION_2 = 0x00DF,
KC_LEFT_CTRL = 0x00E0,
KC_LEFT_SHIFT = 0x00E1,
KC_LEFT_ALT = 0x00E2,
Expand Down Expand Up @@ -536,17 +541,26 @@ pub enum Keycode {
QK_BACKLIGHT_UP = 0x7804,
QK_BACKLIGHT_STEP = 0x7805,
QK_BACKLIGHT_TOGGLE_BREATHING = 0x7806,
RGB_TOG = 0x7820,
RGB_MODE_FORWARD = 0x7821,
RGB_MODE_REVERSE = 0x7822,
RGB_HUI = 0x7823,
RGB_HUD = 0x7824,
RGB_SAI = 0x7825,
RGB_SAD = 0x7826,
RGB_VAI = 0x7827,
RGB_VAD = 0x7828,
RGB_SPI = 0x7829,
RGB_SPD = 0x782A,
QK_LED_MATRIX_ON = 0x7810,
QK_LED_MATRIX_OFF = 0x7811,
QK_LED_MATRIX_TOGGLE = 0x7812,
QK_LED_MATRIX_MODE_NEXT = 0x7813,
QK_LED_MATRIX_MODE_PREVIOUS = 0x7814,
QK_LED_MATRIX_BRIGHTNESS_UP = 0x7815,
QK_LED_MATRIX_BRIGHTNESS_DOWN = 0x7816,
QK_LED_MATRIX_SPEED_UP = 0x7817,
QK_LED_MATRIX_SPEED_DOWN = 0x7818,
QK_UNDERGLOW_TOGGLE = 0x7820,
QK_UNDERGLOW_MODE_NEXT = 0x7821,
QK_UNDERGLOW_MODE_PREVIOUS = 0x7822,
QK_UNDERGLOW_HUE_UP = 0x7823,
QK_UNDERGLOW_HUE_DOWN = 0x7824,
QK_UNDERGLOW_SATURATION_UP = 0x7825,
QK_UNDERGLOW_SATURATION_DOWN = 0x7826,
QK_UNDERGLOW_VALUE_UP = 0x7827,
QK_UNDERGLOW_VALUE_DOWN = 0x7828,
QK_UNDERGLOW_SPEED_UP = 0x7829,
QK_UNDERGLOW_SPEED_DOWN = 0x782A,
RGB_MODE_PLAIN = 0x782B,
RGB_MODE_BREATHE = 0x782C,
RGB_MODE_RAINBOW = 0x782D,
Expand All @@ -557,6 +571,19 @@ pub enum Keycode {
RGB_MODE_GRADIENT = 0x7832,
RGB_MODE_RGBTEST = 0x7833,
RGB_MODE_TWINKLE = 0x7834,
QK_RGB_MATRIX_ON = 0x7840,
QK_RGB_MATRIX_OFF = 0x7841,
QK_RGB_MATRIX_TOGGLE = 0x7842,
QK_RGB_MATRIX_MODE_NEXT = 0x7843,
QK_RGB_MATRIX_MODE_PREVIOUS = 0x7844,
QK_RGB_MATRIX_HUE_UP = 0x7845,
QK_RGB_MATRIX_HUE_DOWN = 0x7846,
QK_RGB_MATRIX_SATURATION_UP = 0x7847,
QK_RGB_MATRIX_SATURATION_DOWN = 0x7848,
QK_RGB_MATRIX_VALUE_UP = 0x7849,
QK_RGB_MATRIX_VALUE_DOWN = 0x784A,
QK_RGB_MATRIX_SPEED_UP = 0x784B,
QK_RGB_MATRIX_SPEED_DOWN = 0x784C,
QK_BOOTLOADER = 0x7C00,
QK_REBOOT = 0x7C01,
QK_DEBUG_TOGGLE = 0x7C02,
Expand Down

0 comments on commit 3168ee4

Please sign in to comment.