From c892b4a30af9c7098c5369d58696124b5f6f488c Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sun, 21 May 2017 22:50:25 -0700 Subject: [PATCH] Update OneShot library to use new key defs --- README.md | 2 +- examples/OneShot/OneShot.ino | 14 +++++++------- src/Kaleidoscope/OneShot.cpp | 10 +++++----- src/Kaleidoscope/OneShot.h | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index e0c8bd20..bdb34d44 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ plugin: #include // somewhere in the keymap... -OSM(LCtrl), OSL(_FN) +OSM(LeftControl), OSL(_FN) void setup () { Kaleidoscope.setup (); diff --git a/examples/OneShot/OneShot.ino b/examples/OneShot/OneShot.ino index 473adb8f..60c19642 100644 --- a/examples/OneShot/OneShot.ino +++ b/examples/OneShot/OneShot.ino @@ -25,9 +25,9 @@ const Key keymaps[][ROWS][COLS] PROGMEM = { Key_NoKey, Key_1, Key_2, Key_3, Key_4, Key_5, Key_NoKey, Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab, Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G, - Key_PageDn, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Esc, + Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape, - OSM(LCtrl), Key_Backspace, OSM(LGUI), Key_LShift, + OSM(LeftControl), Key_Backspace, OSM(LeftGui), Key_LeftShift, Key_Keymap1_Momentary, Key_skip, Key_6, Key_7, Key_8, Key_9, Key_0, Key_skip, @@ -35,7 +35,7 @@ const Key keymaps[][ROWS][COLS] PROGMEM = { Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote, Key_skip, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus, - Key_RShift, OSM(RAlt), Key_Space, OSM(RCtrl), + Key_RightShift, OSM(RoghtAlt), Key_Spacebar, OSM(RightControl), OSL(1) ), @@ -49,10 +49,10 @@ const Key keymaps[][ROWS][COLS] PROGMEM = { ___, ___, ___, ___, ___, - ___, ___, ___, ___, ___, ___, ___, - ___, ___, ___, ___, ___, ___, ___, - Key_UpArrow, Key_DnArrow, Key_LArrow, Key_RArrow, ___, ___, - ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + ___, ___, ___, ___, ___, ___, ___, + Key_UpArrow, Key_DownArrow, Key_LeftArrow, Key_RightArrow, ___, ___, + ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___, ___ diff --git a/src/Kaleidoscope/OneShot.cpp b/src/Kaleidoscope/OneShot.cpp index 8fd06914..ad9ee20c 100644 --- a/src/Kaleidoscope/OneShot.cpp +++ b/src/Kaleidoscope/OneShot.cpp @@ -38,7 +38,7 @@ namespace KaleidoscopePlugins { // --- helper macros ------ #define isOS(key) (key.raw >= OS_FIRST && key.raw <= OS_LAST) -#define isModifier(key) (key.raw >= Key_LCtrl.raw && key.raw <= Key_RGUI.raw) +#define isModifier(key) (key.raw >= Key_LeftControl.raw && key.raw <= Key_RightGui.raw) #define isLayerKey(key) (key.flags == (KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP) && key.keyCode >= MOMENTARY_OFFSET && key.keyCode <= MOMENTARY_OFFSET + 23) #define isOneShot(idx) (bitRead (State.all, (idx))) @@ -64,8 +64,8 @@ namespace KaleidoscopePlugins { Key key; if (idx < 8) { - key.flags = Key_LCtrl.flags; - key.keyCode = Key_LCtrl.keyCode + idx; + key.flags = Key_LeftControl.flags; + key.keyCode = Key_LeftControl.keyCode + idx; } else { key.flags = KEY_FLAGS | SYNTHETIC | SWITCH_TO_KEYMAP; key.keyCode = MOMENTARY_OFFSET + idx - 8; @@ -257,10 +257,10 @@ namespace KaleidoscopePlugins { bool OneShot::isModifierActive (Key key) { - if (key.raw < Key_LCtrl.raw || key.raw > Key_RGUI.raw) + if (key.raw < Key_LeftControl.raw || key.raw > Key_RightGui.raw) return false; - return isOneShot (key.keyCode - Key_LCtrl.keyCode); + return isOneShot (key.keyCode - Key_LeftControl.keyCode); } void diff --git a/src/Kaleidoscope/OneShot.h b/src/Kaleidoscope/OneShot.h index 54539a5a..99096784 100644 --- a/src/Kaleidoscope/OneShot.h +++ b/src/Kaleidoscope/OneShot.h @@ -21,7 +21,7 @@ #include #include -#define OSM(kc) (Key) {.raw = KaleidoscopePlugins::Ranges::OSM_FIRST + (Key_ ## kc).keyCode - Key_LCtrl.keyCode} +#define OSM(kc) (Key) {.raw = KaleidoscopePlugins::Ranges::OSM_FIRST + (Key_ ## kc).keyCode - Key_LeftControl.keyCode} #define OSL(n) (Key) {.raw = KaleidoscopePlugins::Ranges::OSL_FIRST + n} namespace KaleidoscopePlugins {