aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2022-09-23 12:48:47 +0100
committerdakkar <dakkar@thenautilus.net>2022-09-23 12:52:38 +0100
commitb7ffead547641b904199547d4bd2607b35c4b0bc (patch)
tree72dbd5d2993b88f516f19719a3e1669f831439a9
parentchange names for plugins header files (diff)
downloadkeyboardio-model01-b7ffead547641b904199547d4bd2607b35c4b0bc.tar.gz
keyboardio-model01-b7ffead547641b904199547d4bd2607b35c4b0bc.tar.bz2
keyboardio-model01-b7ffead547641b904199547d4bd2607b35c4b0bc.zip
now it compiles
-rw-r--r--DakkarColor.h11
-rw-r--r--Makefile2
-rw-r--r--color-themes.h4
-rw-r--r--keymap-layers.h3
-rw-r--r--keymap-wrapper.h10
-rw-r--r--keymaps.h30
-rw-r--r--macros.h27
-rw-r--r--power-management.h7
8 files changed, 29 insertions, 65 deletions
diff --git a/DakkarColor.h b/DakkarColor.h
index 2165764..2f8b921 100644
--- a/DakkarColor.h
+++ b/DakkarColor.h
@@ -40,19 +40,12 @@ private:
}
protected:
void update(void) final {
- uint8_t layer = Layer.top();
+ uint8_t layer = Layer.mostRecent();
for (auto key_addr : KeyAddr::all()) {
LEDControl.setCrgbAt(key_addr, getColor(layer,key_addr));
}
}
void refreshAt(KeyAddr key_addr) final {
- LEDControl.setCrgbAt(key_addr, getColor(Layer.top(),key_addr));
- }
- // not sure why I need this here, but if I remove it, I get «virtual
- // void kaleidoscope::plugin::LEDMode::refreshAt(byte, byte)' was
- // hidden by 'virtual void DakkarColor::refreshAt(KeyAddr)'
- // [-Woverloaded-virtual]»
- DEPRECATED(ROW_COL_FUNC) virtual void refreshAt(byte row, byte col) {
- refreshAt(KeyAddr(row, col));
+ LEDControl.setCrgbAt(key_addr, getColor(Layer.mostRecent(),key_addr));
}
};
diff --git a/Makefile b/Makefile
index 8807c96..7d18df8 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,6 @@ export KALEIDOSCOPE_DIR = $(shell readlink -f $(THISDIR)/../Kaleidoscope)
DAKKAR_VERSION := $(shell git describe --dirty --always --tags --first-parent)
-export LOCAL_CFLAGS = -DBUILD_INFORMATION="$(DAKKAR_VERSION)"
+export LOCAL_CFLAGS = -DBUILD_INFORMATION=\""$(DAKKAR_VERSION)"\"
include $(KALEIDOSCOPE_DIR)/etc/makefiles/sketch.mk
diff --git a/color-themes.h b/color-themes.h
index b612fd0..4bdc737 100644
--- a/color-themes.h
+++ b/color-themes.h
@@ -58,5 +58,5 @@ static constexpr DakkarColor::colorSrc bright_colors[COLOR_COUNT] =
[NumBreathe] = D_F(num_breathe),
};
-static DakkarColor DakkarColorDark(color_keymaps,dark_colors);
-static DakkarColor DakkarColorBright(color_keymaps,bright_colors);
+static DakkarColor DakkarColorDark(kaleidoscope::plugin::defaultcolormap::colormaps,dark_colors);
+static DakkarColor DakkarColorBright(kaleidoscope::plugin::defaultcolormap::colormaps,bright_colors);
diff --git a/keymap-layers.h b/keymap-layers.h
index 2efc6b6..a120cc6 100644
--- a/keymap-layers.h
+++ b/keymap-layers.h
@@ -2,6 +2,3 @@
#pragma once
enum { PRIMARY, FUNCTION, FVWM }; // layers
-
-// #define PRIMARY_KEYMAP_QWERTY
-#define PRIMARY_KEYMAP_DVORAK
diff --git a/keymap-wrapper.h b/keymap-wrapper.h
index 9418ebb..85fc4a3 100644
--- a/keymap-wrapper.h
+++ b/keymap-wrapper.h
@@ -2,6 +2,7 @@
#pragma once
#include "Kaleidoscope-MouseKeys.h"
+#include <Kaleidoscope-Colormap.h>
#include "keymap-layers.h"
/* hack hack hack!
@@ -25,17 +26,22 @@
#define ColorKeymaps(layers...) KEYMAPS(layers)
+#define MYMAP_STACKED KEYMAP_STACKED
+
#include "keymaps.h"
#undef CK
#undef ColorKeymaps
+#undef MYMAP_STACKED
#define CK(k,c) c
-#define ColorKeymaps(layers...) \
- static constexpr uint8_t color_keymaps[][Kaleidoscope.device().matrix_rows * Kaleidoscope.device().matrix_columns] = { layers };
+#define ColorKeymaps(layers...) COLORMAPS(layers)
+
+#define MYMAP_STACKED COLORMAP_STACKED
#include "keymaps.h"
#undef CK
#undef ColorKeymaps
+#undef MYMAP_STACKED
diff --git a/keymaps.h b/keymaps.h
index da76be2..02015a9 100644
--- a/keymaps.h
+++ b/keymaps.h
@@ -3,25 +3,7 @@
ColorKeymaps(
-#if defined (PRIMARY_KEYMAP_QWERTY)
- [PRIMARY] = KEYMAP_STACKED
- (CK(___,Base), CK(Key_1,Base), CK(Key_2,Base), CK(Key_3,Base), CK(Key_4,Base), CK(Key_5,Base), CK(Key_LEDEffectNext,Base),
- CK(Key_Backtick,Base), CK(Key_Q,Base), CK(Key_W,Base), CK(Key_E,Base), CK(Key_R,Base), CK(Key_T,Base), CK(Key_Tab,Base),
- CK(Key_PageUp,Base), CK(Key_A,Base), CK(Key_S,Base), CK(Key_D,Base), CK(Key_F,Base), CK(Key_G,Base),
- CK(Key_PageDown,Base), CK(Key_Z,Base), CK(Key_X,Base), CK(Key_C,Base), CK(Key_V,Base), CK(Key_B,Base), CK(Key_Escape,Base),
- CK(Key_LeftControl,Base), CK(Key_Backspace,Base), CK(Key_LeftGui,Base), CK(Key_LeftShift,Base),
- CK(M(MACRO_FVWM),Base),
-
- CK(M(MACRO_ANY),Base), CK(Key_6,Base), CK(Key_7,Base), CK(Key_8,Base), CK(Key_9,Base), CK(Key_0,Base), CK(___,Base),
- CK(Key_Enter,Base), CK(Key_Y,Base), CK(Key_U,Base), CK(Key_I,Base), CK(Key_O,Base), CK(Key_P,Base), CK(Key_Equals,Base),
- CK(Key_H,Base), CK(Key_J,Base), CK(Key_K,Base), CK(Key_L,Base), CK(Key_Semicolon,Base), CK(Key_Quote,Base),
- CK(Key_RightAlt,Base), CK(Key_N,Base), CK(Key_M,Base), CK(Key_Comma,Base), CK(Key_Period,Base), CK(Key_Slash,Base), CK(Key_Minus,Base),
- CK(Key_RightShift,Base), CK(Key_LeftAlt,Base), CK(Key_Spacebar,Base), CK(Key_RightControl,Base),
- CK(ShiftToLayer(FUNCTION),Base)),
-
-#elif defined (PRIMARY_KEYMAP_DVORAK)
-
- [PRIMARY] = KEYMAP_STACKED
+ [PRIMARY] = MYMAP_STACKED
(CK(___,Base), CK(Key_1,Base), CK(Key_2,Base), CK(Key_3,Base), CK(Key_4,Base), CK(Key_5,Base), CK(Key_LEDEffectNext,Base),
CK(Key_Backtick,Base), CK(Key_Quote,Base), CK(Key_Comma,Base), CK(Key_Period,Base), CK(Key_P,Base), CK(Key_Y,Base), CK(Key_Tab,Base),
CK(Key_PageUp,Base), CK(Key_A,Base), CK(Key_O,Base), CK(Key_E,Base), CK(Key_U,Base), CK(Key_I,Base),
@@ -36,13 +18,7 @@ ColorKeymaps(
CK(Key_RightShift,Base), CK(Key_LeftAlt,Base), CK(Key_Spacebar,Base), CK(Key_RightControl,Base),
CK(ShiftToLayer(FUNCTION),Base)),
-#else
-
-#error "No default keymap defined. You should make sure that you have a line like '#define PRIMARY_KEYMAP_QWERTY' in your sketch"
-
-#endif
-
- [FUNCTION] = KEYMAP_STACKED
+ [FUNCTION] = MYMAP_STACKED
(CK(XXX,Off), CK(Key_F1,Func), CK(Key_F2,Func), CK(Key_F3,Func), CK(Key_F4,Func), CK(Key_F5,Func), CK(___,Off),
CK(Key_Tab,Func2), CK(XXX,Off), CK(Key_mouseUp,Ms), CK(XXX,Off), CK(Key_mouseBtnR,MsB), CK(Key_mouseWarpEnd,MsW), CK(Key_mouseWarpNE,MsW),
CK(Key_Home,Func2), CK(Key_mouseL,Ms), CK(Key_mouseDn,Ms), CK(Key_mouseR,Ms), CK(Key_mouseBtnL,MsB), CK(Key_mouseWarpNW,MsW),
@@ -57,7 +33,7 @@ ColorKeymaps(
CK(___,Off), CK(___,Off), CK(Key_Insert,Func2), CK(___,Off),
CK(___,Off)),
- [FVWM] = KEYMAP_STACKED
+ [FVWM] = MYMAP_STACKED
(CK(XXX,Off), CK(Key_BacklightDown,Screen), CK(Key_BacklightUp,Screen), CK(Key_F1,Lnch), CK(Key_F2,Lnch), CK(XXX,Off), CK(___,Off),
CK(XXX,Off), CK(XXX,Off), CK(XXX,Off), CK(XXX,Off), CK(XXX,Off), CK(XXX,Off), CK(Key_Tab,Wind),
CK(Key_KeypadAdd,Wind), CK(XXX,Off), CK(Key_Keypad4,Wind), CK(Key_Keypad2,Wind), CK(Key_Keypad8,Wind), CK(Key_Keypad6,Wind),
diff --git a/macros.h b/macros.h
index 81dfc7c..284a9f3 100644
--- a/macros.h
+++ b/macros.h
@@ -20,41 +20,36 @@ static void versionInfoMacro(uint8_t keyState) {
}
}
-static void anyKeyMacro(uint8_t keyState) {
- static Key lastKey;
- bool toggledOn = false;
- if (keyToggledOn(keyState)) {
- lastKey.keyCode = Key_A.keyCode + (uint8_t)(millis() % 36);
- toggledOn = true;
+static void anyKeyMacro(KeyEvent &event) {
+ if (keyToggledOn(event.state)) {
+ event.key.setKeyCode(Key_A.getKeyCode() + (uint8_t)(millis() % 36));
+ event.key.setFlags(0);
}
-
- if (keyIsPressed(keyState))
- kaleidoscope::hid::pressKey(lastKey, toggledOn);
}
-static const macro_t *fvwmMacro(uint8_t keyState) {
- if (keyIsPressed(keyState)) {
+static const macro_t *fvwmMacro(KeyEvent &event) {
+ if (keyToggledOn(event.state)) {
return MACRO(D(LeftAlt),Dr(ShiftToLayer(FVWM)));
}
- else if (keyWasPressed(keyState)) {
+ else if (keyToggledOff(event.state)) {
return MACRO(Ur(ShiftToLayer(FVWM)),U(LeftAlt));
}
return MACRO_NONE;
}
-const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) {
+const macro_t *macroAction(uint8_t macroIndex, KeyEvent &event) {
switch (macroIndex) {
case MACRO_VERSION_INFO:
- versionInfoMacro(keyState);
+ versionInfoMacro(event.state);
break;
case MACRO_ANY:
- anyKeyMacro(keyState);
+ anyKeyMacro(event);
break;
case MACRO_FVWM:
- return fvwmMacro(keyState);
+ return fvwmMacro(event);
break;
}
return MACRO_NONE;
diff --git a/power-management.h b/power-management.h
index d599226..0492e80 100644
--- a/power-management.h
+++ b/power-management.h
@@ -7,13 +7,10 @@
void toggleLedsOnSuspendResume(kaleidoscope::plugin::HostPowerManagement::Event event) {
switch (event) {
case kaleidoscope::plugin::HostPowerManagement::Suspend:
- LEDControl.set_all_leds_to({0, 0, 0});
- LEDControl.syncLeds();
- LEDControl.paused = true;
+ LEDControl.disable();
break;
case kaleidoscope::plugin::HostPowerManagement::Resume:
- LEDControl.paused = false;
- LEDControl.refreshAll();
+ LEDControl.enable();
break;
case kaleidoscope::plugin::HostPowerManagement::Sleep:
break;