diff options
Diffstat (limited to 'Model01-Firmware.ino')
-rw-r--r-- | Model01-Firmware.ino | 94 |
1 files changed, 3 insertions, 91 deletions
diff --git a/Model01-Firmware.ino b/Model01-Firmware.ino index c77e319..24dc649 100644 --- a/Model01-Firmware.ino +++ b/Model01-Firmware.ino @@ -1,105 +1,17 @@ // -*- mode: c++ -*- -#ifndef BUILD_INFORMATION -#define BUILD_INFORMATION "locally built" -#endif - #include "Kaleidoscope.h" +#include "macros.h" -/* macros */ -#include "kaleidoscope/plugin/Macros.h" - -enum { MACRO_VERSION_INFO, - MACRO_ANY - }; -#include "kaleidoscope/plugin/HostPowerManagement.h" - -static void versionInfoMacro(uint8_t keyState) { - if (keyToggledOn(keyState)) { - Macros.type(PSTR("Keyboardio Model 01 - Kaleidoscope ")); - Macros.type(PSTR(BUILD_INFORMATION)); - } -} - -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; - } - - if (keyIsPressed(keyState)) - kaleidoscope::hid::pressKey(lastKey, toggledOn); -} - -const macro_t *macroAction(uint8_t macroIndex, uint8_t keyState) { - switch (macroIndex) { - - case MACRO_VERSION_INFO: - versionInfoMacro(keyState); - break; - - case MACRO_ANY: - anyKeyMacro(keyState); - break; - } - return MACRO_NONE; -} - -/* power management */ -#include "kaleidoscope/plugin/LEDControl.h" - -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; - break; - case kaleidoscope::plugin::HostPowerManagement::Resume: - LEDControl.paused = false; - LEDControl.refreshAll(); - break; - case kaleidoscope::plugin::HostPowerManagement::Sleep: - break; - } -} - -void hostPowerManagementEventHandler(kaleidoscope::plugin::HostPowerManagement::Event event) { - toggleLedsOnSuspendResume(event); -} - -/* combos */ -#include "kaleidoscope/plugin/MagicCombo.h" -#include "kaleidoscope/plugin/USB-Quirks.h" +#include "power-management.h" -enum { - // Toggle between Boot (6-key rollover; for BIOSes and early boot) and NKRO - // mode. - COMBO_TOGGLE_NKRO_MODE -}; - -static void toggleKeyboardProtocol(uint8_t combo_index) { - USBQuirks.toggleKeyboardProtocol(); -} - -USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol, - // Left Fn + Esc + Shift - .keys = { R3C6, R2C6, R3C7 } - }); - -/* keymaps */ +#include "combos.h" #include "keymap-wrapper.h" -/* LED & colors */ #include "color-themes.h" -static DakkarColor DakkarColorDark(color_keymaps,dark_colors); -static DakkarColor DakkarColorBright(color_keymaps,bright_colors); - /* plugins */ #include "kaleidoscope/plugin/EEPROM-Settings.h" #include "kaleidoscope/plugin/FocusSerial.h" |