Compare commits
17 Commits
main
...
examples/f
Author | SHA1 | Date |
---|---|---|
Gergely Nagy | b2d4b8b367 | 3 years ago |
Gergely Nagy | 0d92977882 | 3 years ago |
Gergely Nagy | d4b9e8758c | 3 years ago |
Gergely Nagy | bf0dc00174 | 3 years ago |
Gergely Nagy | acd312c94c | 3 years ago |
Gergely Nagy | 4b9a9c2b14 | 3 years ago |
Gergely Nagy | ba764a6f47 | 3 years ago |
Gergely Nagy | a5d043b2b3 | 3 years ago |
Gergely Nagy | 6aef9b99bb | 3 years ago |
Gergely Nagy | e857491953 | 3 years ago |
Gergely Nagy | 87c360716a | 3 years ago |
Gergely Nagy | 510c8bf800 | 3 years ago |
Gergely Nagy | 76f5b3ca1d | 3 years ago |
Gergely Nagy | 883883e99c | 3 years ago |
Gergely Nagy | 4993ce4c7d | 3 years ago |
Gergely Nagy | c6699ad080 | 3 years ago |
Gergely Nagy | 93f37b71de | 3 years ago |
@ -0,0 +1,24 @@
|
|||||||
|
name: Build firmware for Chrysalis
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- examples/factory-firmware
|
||||||
|
|
||||||
|
env:
|
||||||
|
LC_ALL: C
|
||||||
|
ARDUINO_DIRECTORIES_USER: ${{ github.workspace }}/.arduino/user
|
||||||
|
ARDUINO_DIRECTORIES_DATA: ${{ github.workspace }}/.arduino/data
|
||||||
|
jobs:
|
||||||
|
compile-chrysalis-firmware:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Cache arduino dep downloads
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: ${{ github.workspace}}/.arduino/downloads
|
||||||
|
key: ${{ runner.os }}-arduino-downloads
|
||||||
|
- run: make setup
|
||||||
|
- run: bin/arduino-cli core list
|
||||||
|
- run: git rev-parse HEAD
|
@ -0,0 +1,107 @@
|
|||||||
|
# Chrysalis-enabled firmware
|
||||||
|
|
||||||
|
In this document, we'll go over what is required - at a minimum - to let a
|
||||||
|
sketch work with Chrysalis, assuming the hardware itself is supported by it.
|
||||||
|
|
||||||
|
## Basic requirements
|
||||||
|
|
||||||
|
Any sketch that wants to work with Chrysalis has to have at a mininum, the
|
||||||
|
[FocusSerial][plugin:focus-serial] and [EEPROM-Settings][plugin:eeprom-settings]
|
||||||
|
libraries included, and the `Focus`, `FocusEEPROMCommand`,
|
||||||
|
`FocusSettingsCommand` (provided by `FocusSerial`), and `EEPROMSettings`
|
||||||
|
(provided by `EEPROM-Settings`) plugins enabled, by listing them in
|
||||||
|
`KALEIDOSCOPE_INIT_PLUGINS()`.
|
||||||
|
|
||||||
|
To edit the keymap, the sketch will also need
|
||||||
|
[EEPROM-Keymap][plugin:eeprom-keymap] included, enabled, and configured. To have
|
||||||
|
colormap editing support, [Colormap][plugin:colormap] is also required. If
|
||||||
|
`Colormap` is enabled, its dependencies,
|
||||||
|
[LEDPaletteTheme][plugin:led-palette-theme] and [LEDControl][plugin:led-control]
|
||||||
|
must also be enabled.
|
||||||
|
|
||||||
|
These are the absolute essentials to have basic functionality in Chrysalis.
|
||||||
|
There are a lot of other plugins included in most Chrysalis-enabled firmware
|
||||||
|
that further enhance the configurability. For guidelines about what to include
|
||||||
|
in sketches that are intended to be shipped with Chrysalis, see the next
|
||||||
|
section.
|
||||||
|
|
||||||
|
## Firmware shipped with Chrysalis
|
||||||
|
|
||||||
|
Firmware we ship with Chrysalis should come with reasonable defaults, nothing
|
||||||
|
surprising, strange, or uncommon should be enabled by default, unless users of
|
||||||
|
the device can be reasonably expected to know about these features. One such
|
||||||
|
case is when Kaleidoscope is not the default on a particular device, and the
|
||||||
|
firmware we ship with Chrysalis mimics the original default firmware. Whatever
|
||||||
|
features the original firmware had, are safe to include in the
|
||||||
|
Kaleidoscope-based one too, if Kaleidoscope supports a given feature.
|
||||||
|
|
||||||
|
With that said, the recommended list of features in a Chrysalis-enabled firmware are:
|
||||||
|
|
||||||
|
### The Basics
|
||||||
|
|
||||||
|
At a minimum, we need to support the keyboard's basic features. As such, we'll
|
||||||
|
need the required plugins first: `Focus`, `FocusEEPROMCommand`, and
|
||||||
|
`FocusSettingsCommand` (provided by [FocusSerial][plugin:focus-serial]), and
|
||||||
|
`EEPROMSettings` (provided by [EEPROM-Settings][plugin:eeprom-settings]).
|
||||||
|
|
||||||
|
Because we're talking keyboards, we will also need `EEPROMKeymap`, as provided
|
||||||
|
by the [EEPROM-Keymap][plugin:eeprom-keymap] plugin.
|
||||||
|
|
||||||
|
If the device has per-key LEDs, the sketch should also include the `LEDOff` and
|
||||||
|
`LEDControl` (provided by `LEDControl`), `LEDPaletteTheme`
|
||||||
|
(provided by [LED-Palette-Theme][plugin:led-palette-theme]), `ColormapEffect`
|
||||||
|
and `DefaultColormap` plugins, provided by the [Colormap][plugin:colormap]
|
||||||
|
plugin. The latter is optional, depending on whether there's enough space on the
|
||||||
|
device to include a default palette and colormap.
|
||||||
|
|
||||||
|
The number of layers configured for `ColormapEffect` and `EEPROMKeymap` **must**
|
||||||
|
be identical, and the number of default layers should leave ample opportunity
|
||||||
|
for the end-user to customize them. They should not be restricted to the number
|
||||||
|
of layers the keyboard ships with out of the box, unless storage space
|
||||||
|
restrictions prevent us from having more. A sensible default is eight layers for
|
||||||
|
both, as that is the limit the Chrysalis-configurable secondary actions and
|
||||||
|
one-shot keys support.
|
||||||
|
|
||||||
|
If the hardware supports it, including the `HardwareTestMode` plugin is highly
|
||||||
|
recommended, likewise for [HostPowerManagement][plugin:host-power-management].
|
||||||
|
|
||||||
|
When `HostPowerManagement` is included, and the hardware has LEDs, then the
|
||||||
|
sketch should be set up so that upon suspending, the LEDs are turned off, and
|
||||||
|
they're turned back on when the host is resumed.
|
||||||
|
|
||||||
|
### Additional Features
|
||||||
|
|
||||||
|
Space permitting, the following features are recommended to be included in any
|
||||||
|
firmware we expect to ship with Chrysalis, roughly in order of importance:
|
||||||
|
|
||||||
|
- Mouse keys via the [MouseKeys][plugin:mousekeys] plugin.
|
||||||
|
- Secondary actions via [Qukeys][plugin:qukeys].
|
||||||
|
- OneShot functionality via [OneShot][plugin:oneshot] and `EscapeOneShot`, and `EscapeOneShotConfig` (provided by [EscapeOneShot][plugin:escape-oneshot]).
|
||||||
|
- Default LED mode configurability via
|
||||||
|
[DefaultLEDModeConfig][plugin:default-led-mode-config], if the device supports
|
||||||
|
LEDs.
|
||||||
|
- Automatically turning LEDs off after some time, via `IdleLEDs` and
|
||||||
|
`PersistentIdleLEDs`, provided by th [IdleLEDs][plugin:idle-leds] plugin.
|
||||||
|
- Chrysalis-editable macros via [DynamicMacros][plugins:dynamic-macros],
|
||||||
|
configured to leave a fair amount of storage space available for macros, space
|
||||||
|
permitting. Around 512 bytes is a reasonable minimum, with 4096 bytes being a
|
||||||
|
very generous amount. At this time, more than 4k storage space reserved for
|
||||||
|
macros is likely unnecessary.
|
||||||
|
|
||||||
|
All of these should be configured for sensible, not surprising behaviour.
|
||||||
|
Additional plugins on top of these may be enabled if they make sense, but the
|
||||||
|
principle of least surprise should always be kept in mind.
|
||||||
|
|
||||||
|
[plugin:focus-serial]: ../plugins/FocusSerial.md
|
||||||
|
[plugin:eeprom-settings]: ../plugins/EEPROM-Settings.md
|
||||||
|
[plugin:eeprom-keymap]: ../plugins/EEPROM-Keymap.md
|
||||||
|
[plugin:colormap]: ../plugins/Colormap.md
|
||||||
|
[plugin:led-palette-theme]: ../plugins/LED-Palette-Theme.md
|
||||||
|
[plugin:host-power-management]: ../plugins/HostPowerManagement.md
|
||||||
|
[plugin:mousekeys]: ../plugins/MouseKeys.md
|
||||||
|
[plugin:qukeys]: ../plugins/Qukeys.md
|
||||||
|
[plugin:oneshot]: ../plugins/OneShot.md
|
||||||
|
[plugin:escape-oneshot]: ../plugins/Escape-OneShot.md
|
||||||
|
[plugin:default-led-mode-config]: ../plugins/DefaultLEDModeConfig.md
|
||||||
|
[plugin:idle-leds]: ../plugins/IdleLEDs.md
|
||||||
|
[plugin:dynamic-macros]: ../plugins/DynamicMacros.md
|
@ -1,57 +0,0 @@
|
|||||||
/* -*- mode: c++ -*-
|
|
||||||
* ErgoDox -- A very basic Kaleidoscope example for the ErgoDox
|
|
||||||
* Copyright (C) 2018 Keyboard.io, Inc
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "Kaleidoscope.h"
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
KEYMAPS(
|
|
||||||
[0] = KEYMAP_STACKED
|
|
||||||
(
|
|
||||||
// left hand
|
|
||||||
Key_Equals, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LeftArrow,
|
|
||||||
Key_Delete, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_NoKey,
|
|
||||||
Key_Backspace, Key_A, Key_S, Key_D, Key_F, Key_G,
|
|
||||||
Key_LeftShift, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_LeftControl,
|
|
||||||
Key_Backtick, Key_Quote, Key_NoKey, Key_LeftArrow, Key_RightArrow,
|
|
||||||
|
|
||||||
Key_NoKey, Key_LeftGui,
|
|
||||||
Key_Home,
|
|
||||||
Key_Space, Key_Backspace, Key_End,
|
|
||||||
|
|
||||||
// right hand
|
|
||||||
Key_RightArrow, Key_6, Key_7, Key_8, Key_9, Key_0, Key_Minus,
|
|
||||||
Key_NoKey, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Backslash,
|
|
||||||
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
|
|
||||||
Key_RightControl, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_RightShift,
|
|
||||||
Key_UpArrow, Key_DownArrow, XXX, XXX, Key_NoKey,
|
|
||||||
|
|
||||||
Key_LeftAlt, Key_Esc,
|
|
||||||
Key_PageUp,
|
|
||||||
Key_PageDown, Key_Tab, Key_Enter
|
|
||||||
),
|
|
||||||
)
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Kaleidoscope.setup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
Kaleidoscope.loop();
|
|
||||||
}
|
|
@ -1,147 +0,0 @@
|
|||||||
/* -*- mode: c++ -*-
|
|
||||||
* Kaleidoscope - A Kaleidoscope example
|
|
||||||
* Copyright (C) 2016-2019 Keyboard.io, Inc.
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify it under
|
|
||||||
* the terms of the GNU General Public License as published by the Free Software
|
|
||||||
* Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
||||||
* details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with
|
|
||||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define DEBUG_SERIAL false
|
|
||||||
|
|
||||||
#include "Kaleidoscope.h"
|
|
||||||
#include "Kaleidoscope-MouseKeys.h"
|
|
||||||
#include "Kaleidoscope-Macros.h"
|
|
||||||
#include "Kaleidoscope-LEDControl.h"
|
|
||||||
#include "Kaleidoscope-NumPad.h"
|
|
||||||
#include "Kaleidoscope-HardwareTestMode.h"
|
|
||||||
#include "Kaleidoscope-MagicCombo.h"
|
|
||||||
|
|
||||||
#include "Kaleidoscope-LEDEffect-SolidColor.h"
|
|
||||||
#include "Kaleidoscope-LEDEffect-Breathe.h"
|
|
||||||
#include "Kaleidoscope-LEDEffect-Chase.h"
|
|
||||||
#include "Kaleidoscope-LEDEffect-Rainbow.h"
|
|
||||||
|
|
||||||
#define NUMPAD_KEYMAP 2
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
#define GENERIC_FN2 KEYMAP_STACKED ( \
|
|
||||||
___, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, XXX, \
|
|
||||||
Key_Tab, Key_mouseBtnM, Key_mouseUp, ___, Key_mouseWarpNW, Key_mouseWarpNE, Consumer_ScanNextTrack, \
|
|
||||||
Key_Home, Key_mouseL, Key_mouseDn, Key_mouseR, Key_mouseWarpSW, Key_mouseWarpSE, \
|
|
||||||
Key_End, Key_Z, Key_X, Key_C, Key_V, Key_mouseWarpEnd, ___, \
|
|
||||||
Key_LeftControl, Key_mouseBtnL, Key_LeftGui, Key_LeftShift, \
|
|
||||||
___, \
|
|
||||||
\
|
|
||||||
XXX, Key_F6, Key_F7, Key_F8, Key_F9, ___, ___, \
|
|
||||||
Key_Delete, Consumer_PlaySlashPause, Key_LeftCurlyBracket, Key_RightCurlyBracket, Key_LeftBracket, Key_RightBracket, System_Sleep, \
|
|
||||||
Key_LeftArrow, Key_DownArrow, Key_UpArrow, Key_RightArrow, Key_F11, Key_F12, \
|
|
||||||
___, Consumer_VolumeDecrement, Consumer_VolumeIncrement, Key_BacklightDown, Key_BacklightUp, Key_Backslash, Key_Pipe, \
|
|
||||||
Key_RightShift, Key_RightAlt, Key_mouseBtnR, Key_RightControl, \
|
|
||||||
___\
|
|
||||||
)
|
|
||||||
|
|
||||||
#define NUMPAD KEYMAP (\
|
|
||||||
___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad7, Key_Keypad8, Key_Keypad9, Key_KeypadSubtract, ___, \
|
|
||||||
___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad4, Key_Keypad5, Key_Keypad6, Key_KeypadAdd, ___, \
|
|
||||||
___, ___, ___, ___, ___, ___, ___, Key_Keypad1, Key_Keypad2, Key_Keypad3, Key_Equals, Key_Quote, \
|
|
||||||
___, ___, ___, ___, ___, ___, ___, ___, ___, Key_Keypad0, Key_KeypadDot, Key_KeypadMultiply, Key_KeypadDivide, Key_Enter, \
|
|
||||||
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, \
|
|
||||||
Key_Keymap1_Momentary, Key_Keymap1_Momentary \
|
|
||||||
)
|
|
||||||
|
|
||||||
#define QWERTY KEYMAP ( \
|
|
||||||
___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext, ___, Key_6, Key_7, Key_8, Key_9, Key_0, Key_KeypadNumLock, \
|
|
||||||
Key_Backtick, Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Tab, Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals, \
|
|
||||||
Key_PageUp, Key_A, Key_S, Key_D, Key_F, Key_G, Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote, \
|
|
||||||
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape, ___, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus, \
|
|
||||||
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift, Key_RightShift, Key_RightAlt, Key_Spacebar, Key_RightControl, \
|
|
||||||
Key_KeymapNext_Momentary, Key_KeymapNext_Momentary \
|
|
||||||
)
|
|
||||||
|
|
||||||
KEYMAPS(
|
|
||||||
QWERTY,
|
|
||||||
GENERIC_FN2,
|
|
||||||
NUMPAD
|
|
||||||
)
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
static kaleidoscope::plugin::LEDSolidColor solidRed(60, 0, 0);
|
|
||||||
static kaleidoscope::plugin::LEDSolidColor solidOrange(60, 20, 0);
|
|
||||||
static kaleidoscope::plugin::LEDSolidColor solidYellow(40, 35, 0);
|
|
||||||
static kaleidoscope::plugin::LEDSolidColor solidGreen(0, 100, 0);
|
|
||||||
static kaleidoscope::plugin::LEDSolidColor solidBlue(0, 15, 100);
|
|
||||||
static kaleidoscope::plugin::LEDSolidColor solidIndigo(0, 0, 100);
|
|
||||||
static kaleidoscope::plugin::LEDSolidColor solidViolet(70, 0, 60);
|
|
||||||
|
|
||||||
const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
|
|
||||||
if (macro_id == 1 && keyToggledOn(event.state)) {
|
|
||||||
Kaleidoscope.serialPort().print("Keyboard.IO keyboard driver v0.00");
|
|
||||||
return MACRO(I(25),
|
|
||||||
D(LeftShift),
|
|
||||||
T(M),
|
|
||||||
U(LeftShift),
|
|
||||||
T(O),
|
|
||||||
T(D),
|
|
||||||
T(E),
|
|
||||||
T(L),
|
|
||||||
T(Spacebar),
|
|
||||||
W(100),
|
|
||||||
T(0),
|
|
||||||
T(1));
|
|
||||||
}
|
|
||||||
return MACRO_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This enters the hardware test mode
|
|
||||||
*/
|
|
||||||
static void enterHardwareTestMode(uint8_t combo_index) {
|
|
||||||
HardwareTestMode.runTests();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Magic combo list, a list of key combo and action pairs the firmware should
|
|
||||||
* recognise.
|
|
||||||
*/
|
|
||||||
USE_MAGIC_COMBOS({.action = enterHardwareTestMode,
|
|
||||||
// Left Fn + Prog + LED
|
|
||||||
.keys = {R3C6, R0C0, R0C6}});
|
|
||||||
|
|
||||||
KALEIDOSCOPE_INIT_PLUGINS(HardwareTestMode,
|
|
||||||
LEDControl,
|
|
||||||
LEDOff,
|
|
||||||
solidRed,
|
|
||||||
solidOrange,
|
|
||||||
solidYellow,
|
|
||||||
solidGreen,
|
|
||||||
solidBlue,
|
|
||||||
solidIndigo,
|
|
||||||
solidViolet,
|
|
||||||
LEDBreatheEffect,
|
|
||||||
LEDRainbowEffect,
|
|
||||||
LEDChaseEffect,
|
|
||||||
NumPad,
|
|
||||||
Macros,
|
|
||||||
MouseKeys,
|
|
||||||
MagicCombo);
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Kaleidoscope.setup();
|
|
||||||
|
|
||||||
NumPad.numPadLayer = NUMPAD_KEYMAP;
|
|
||||||
LEDOff.activate();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
Kaleidoscope.loop();
|
|
||||||
}
|
|
@ -1,59 +0,0 @@
|
|||||||
/* -*- mode: c++ -*-
|
|
||||||
* Splitography -- A very basic Kaleidoscope example for the SOFT/HRUF Splitography keyboard
|
|
||||||
* Copyright (C) 2018 Keyboard.io, Inc
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTabILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "Kaleidoscope.h"
|
|
||||||
#include "Kaleidoscope-Steno.h"
|
|
||||||
|
|
||||||
enum {
|
|
||||||
_STENO,
|
|
||||||
};
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
KEYMAPS(
|
|
||||||
|
|
||||||
/* Steno (GeminiPR)
|
|
||||||
* ,-----------------------. ,-----------------------.
|
|
||||||
* | # | # | # | # | # | # | | # | # | # | # | # | # |
|
|
||||||
* |---+---+---+---+---+---| |---+---+---+---+---+---|
|
|
||||||
* | | S | T | P | H | * | | * | F | P | L | T | D |
|
|
||||||
* |---+---+---+---+---+---| |---+---+---+---+---+---|
|
|
||||||
* | | S | K | W | R | * | | * | R | B | G | S | Z |
|
|
||||||
* `-------------+---+---+-' `-+---+---+-------------'
|
|
||||||
* | A | O | | E | U |
|
|
||||||
* `-------' `-------'
|
|
||||||
*/
|
|
||||||
[_STENO] = KEYMAP(
|
|
||||||
S(N1) ,S(N2) ,S(N3) ,S(N4) ,S(N5) ,S(N6) ,S(N7) ,S(N8) ,S(N9) ,S(NA) ,S(NB) ,S(NC)
|
|
||||||
,XXX ,S(S1) ,S(TL) ,S(PL) ,S(HL) ,S(ST1) ,S(ST3) ,S(FR) ,S(PR) ,S(LR) ,S(TR) ,S(DR)
|
|
||||||
,XXX ,S(S2) ,S(KL) ,S(WL) ,S(RL) ,S(ST2) ,S(ST4) ,S(RR) ,S(BR) ,S(GR) ,S(SR) ,S(ZR)
|
|
||||||
,S(A) ,S(O) ,S(E) ,S(U)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
KALEIDOSCOPE_INIT_PLUGINS(GeminiPR);
|
|
||||||
|
|
||||||
void setup() {
|
|
||||||
Kaleidoscope.serialPort().begin(9600);
|
|
||||||
Kaleidoscope.setup();
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop() {
|
|
||||||
Kaleidoscope.loop();
|
|
||||||
}
|
|
@ -0,0 +1,153 @@
|
|||||||
|
/* -*- mode: c++ -*-
|
||||||
|
* ErgoDox -- Chrysalis-enabled Sketch for ErgoDox-compatible boards
|
||||||
|
* Copyright (C) 2019-2022 Keyboard.io, Inc
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is based on the QMK factory firmware the ErgoDox EZ ships with. Modeled
|
||||||
|
* after the layout in
|
||||||
|
* https://configure.ergodox-ez.com/layouts/default/latest/0, as of 2019-01-04.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Kaleidoscope.h"
|
||||||
|
#include "Kaleidoscope-EEPROM-Settings.h"
|
||||||
|
#include "Kaleidoscope-EEPROM-Keymap.h"
|
||||||
|
#include "Kaleidoscope-FocusSerial.h"
|
||||||
|
#include "Kaleidoscope-MouseKeys.h"
|
||||||
|
#include "Kaleidoscope-Qukeys.h"
|
||||||
|
#include "Kaleidoscope-OneShot.h"
|
||||||
|
#include "Kaleidoscope-Escape-OneShot.h"
|
||||||
|
#include "Kaleidoscope-DynamicMacros.h"
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
KEYMAPS(
|
||||||
|
[0] = KEYMAP_STACKED
|
||||||
|
(
|
||||||
|
// left hand
|
||||||
|
Key_Equals, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LeftArrow,
|
||||||
|
Key_Delete, Key_Q, Key_W, Key_E, Key_R, Key_T, LockLayer(1),
|
||||||
|
Key_Backspace, Key_A, Key_S, Key_D, Key_F, Key_G,
|
||||||
|
Key_LeftShift, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Hyper,
|
||||||
|
LT(1, Backtick), Key_Quote, LALT(Key_LeftShift), Key_LeftArrow, Key_RightArrow,
|
||||||
|
|
||||||
|
MT(LeftAlt, PcApplication), Key_LeftGui,
|
||||||
|
Key_Home,
|
||||||
|
Key_Space, Key_Backspace, Key_End,
|
||||||
|
|
||||||
|
// right hand
|
||||||
|
Key_RightArrow, Key_6, Key_7, Key_8, Key_9, Key_0, Key_Minus,
|
||||||
|
LockLayer(1), Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Backslash,
|
||||||
|
Key_H, Key_J, Key_K, Key_L, LT(2, Semicolon), MT(LeftGui, Quote),
|
||||||
|
Key_Meh, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_RightShift,
|
||||||
|
Key_UpArrow, Key_DownArrow, Key_LeftBracket, Key_RightBracket, ShiftToLayer(1),
|
||||||
|
|
||||||
|
Key_LeftAlt, MT(LeftControl, Esc),
|
||||||
|
Key_PageUp,
|
||||||
|
Key_PageDown, Key_Tab, Key_Enter
|
||||||
|
),
|
||||||
|
[1] = KEYMAP_STACKED
|
||||||
|
(
|
||||||
|
// left hand
|
||||||
|
Key_Esc, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, XXX,
|
||||||
|
XXX, LSHIFT(Key_1), LSHIFT(Key_2), LSHIFT(Key_LeftBracket), LSHIFT(Key_RightBracket), LSHIFT(Key_Backslash), ___,
|
||||||
|
XXX, LSHIFT(Key_3), LSHIFT(Key_4), LSHIFT(Key_9), LSHIFT(Key_0), Key_Backtick,
|
||||||
|
XXX, LSHIFT(Key_5), LSHIFT(Key_6), Key_LeftBracket, Key_RightBracket, LSHIFT(Key_Backtick), XXX,
|
||||||
|
___, XXX, XXX, XXX, XXX,
|
||||||
|
|
||||||
|
XXX, XXX,
|
||||||
|
XXX,
|
||||||
|
XXX, XXX, XXX,
|
||||||
|
|
||||||
|
// right hand
|
||||||
|
XXX, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_F11,
|
||||||
|
___, Key_UpArrow, Key_7, Key_8, Key_9, LSHIFT(Key_8), Key_F12,
|
||||||
|
Key_DownArrow, Key_4, Key_5, Key_6, XXX, XXX,
|
||||||
|
XXX, LSHIFT(Key_7), Key_1, Key_2, Key_3, Key_Backslash, XXX,
|
||||||
|
XXX, Key_Period, Key_0, Key_Equals, ___,
|
||||||
|
|
||||||
|
XXX, XXX,
|
||||||
|
XXX,
|
||||||
|
XXX, XXX, XXX
|
||||||
|
),
|
||||||
|
[2] = KEYMAP_STACKED
|
||||||
|
(
|
||||||
|
// left hand
|
||||||
|
XXX, XXX, XXX, XXX, XXX, XXX, XXX,
|
||||||
|
XXX, XXX, XXX, Key_mouseUp, XXX, XXX, XXX,
|
||||||
|
XXX, XXX, Key_mouseL, Key_mouseDn, Key_mouseR, XXX,
|
||||||
|
XXX, XXX, XXX, XXX, XXX, XXX, XXX,
|
||||||
|
XXX, XXX, XXX, Key_mouseBtnL, Key_mouseBtnR,
|
||||||
|
|
||||||
|
XXX, XXX,
|
||||||
|
XXX,
|
||||||
|
XXX, XXX, XXX,
|
||||||
|
|
||||||
|
// right hand
|
||||||
|
XXX, XXX, XXX, XXX, XXX, XXX, XXX,
|
||||||
|
XXX, XXX, XXX, XXX, XXX, XXX, XXX,
|
||||||
|
XXX, XXX, XXX, XXX, ___, Consumer_PlaySlashPause,
|
||||||
|
XXX, XXX, XXX, Consumer_ScanPreviousTrack, Consumer_ScanNextTrack, XXX, XXX,
|
||||||
|
Consumer_VolumeIncrement, Consumer_VolumeDecrement, Consumer_Mute, XXX, XXX,
|
||||||
|
|
||||||
|
XXX, XXX,
|
||||||
|
XXX,
|
||||||
|
XXX, XXX, XXX
|
||||||
|
),
|
||||||
|
)
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
KALEIDOSCOPE_INIT_PLUGINS(
|
||||||
|
EEPROMSettings,
|
||||||
|
EEPROMKeymap,
|
||||||
|
Focus,
|
||||||
|
FocusEEPROMCommand,
|
||||||
|
FocusSettingsCommand,
|
||||||
|
Qukeys,
|
||||||
|
OneShot,
|
||||||
|
EscapeOneShot,
|
||||||
|
EscapeOneShotConfig,
|
||||||
|
DynamicMacros,
|
||||||
|
MouseKeys);
|
||||||
|
|
||||||
|
void blinkAllStatusLEDs() {
|
||||||
|
for (auto i = 0; i <= 3; i++) {
|
||||||
|
Kaleidoscope.device().setStatusLED(i, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto i = 1; i <= 3; i++) {
|
||||||
|
Kaleidoscope.device().setStatusLED(i, true);
|
||||||
|
_delay_ms(50);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto i = 1; i <= 3; i++) {
|
||||||
|
Kaleidoscope.device().setStatusLED(i, false);
|
||||||
|
_delay_ms(50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Kaleidoscope.setup();
|
||||||
|
|
||||||
|
EEPROMKeymap.setup(5);
|
||||||
|
DynamicMacros.reserve_storage(256);
|
||||||
|
|
||||||
|
blinkAllStatusLEDs();
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
Kaleidoscope.loop();
|
||||||
|
}
|
@ -0,0 +1,669 @@
|
|||||||
|
// -*- mode: c++ -*-
|
||||||
|
// Copyright 2016-2022 Keyboardio, inc. <jesse@keyboard.io>
|
||||||
|
// See "LICENSE" for license details
|
||||||
|
|
||||||
|
#ifndef BUILD_INFORMATION
|
||||||
|
#define BUILD_INFORMATION "locally built on " __DATE__ " at " __TIME__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These #include directives pull in the Kaleidoscope firmware core,
|
||||||
|
* as well as the Kaleidoscope plugins we use in the Model 100's firmware
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// The Kaleidoscope core
|
||||||
|
#include "Kaleidoscope.h"
|
||||||
|
|
||||||
|
// Support for storing the keymap in EEPROM
|
||||||
|
#include "Kaleidoscope-EEPROM-Settings.h"
|
||||||
|
#include "Kaleidoscope-EEPROM-Keymap.h"
|
||||||
|
|
||||||
|
// Support for communicating with the host via a simple Serial protocol
|
||||||
|
#include "Kaleidoscope-FocusSerial.h"
|
||||||
|
|
||||||
|
// Support for keys that move the mouse
|
||||||
|
#include "Kaleidoscope-MouseKeys.h"
|
||||||
|
|
||||||
|
// Support for macros
|
||||||
|
#include "Kaleidoscope-Macros.h"
|
||||||
|
|
||||||
|
// Support for controlling the keyboard's LEDs
|
||||||
|
#include "Kaleidoscope-LEDControl.h"
|
||||||
|
|
||||||
|
// Support for the "Boot greeting" effect, which pulses the 'LED' button for 10s
|
||||||
|
// when the keyboard is connected to a computer (or that computer is powered on)
|
||||||
|
#include "Kaleidoscope-LEDEffect-BootGreeting.h"
|
||||||
|
|
||||||
|
// Support for LED modes that set all LEDs to a single color
|
||||||
|
#include "Kaleidoscope-LEDEffect-SolidColor.h"
|
||||||
|
|
||||||
|
// Support for an LED mode that makes all the LEDs 'breathe'
|
||||||
|
#include "Kaleidoscope-LEDEffect-Breathe.h"
|
||||||
|
|
||||||
|
// Support for an LED mode that makes a red pixel chase a blue pixel across the keyboard
|
||||||
|
#include "Kaleidoscope-LEDEffect-Chase.h"
|
||||||
|
|
||||||
|
// Support for LED modes that pulse the keyboard's LED in a rainbow pattern
|
||||||
|
#include "Kaleidoscope-LEDEffect-Rainbow.h"
|
||||||
|
|
||||||
|
// Support for an LED mode that lights up the keys as you press them
|
||||||
|
#include "Kaleidoscope-LED-Stalker.h"
|
||||||
|
|
||||||
|
// Support for an LED mode that prints the keys you press in letters 4px high
|
||||||
|
#include "Kaleidoscope-LED-AlphaSquare.h"
|
||||||
|
|
||||||
|
// Support for shared palettes for other plugins, like Colormap below
|
||||||
|
#include "Kaleidoscope-LED-Palette-Theme.h"
|
||||||
|
|
||||||
|
// Support for an LED mode that lets one configure per-layer color maps
|
||||||
|
#include "Kaleidoscope-Colormap.h"
|
||||||
|
|
||||||
|
// Support for turning the LEDs off after a certain amount of time
|
||||||
|
#include "Kaleidoscope-IdleLEDs.h"
|
||||||
|
|
||||||
|
// Support for setting a default LED mode
|
||||||
|
#include "Kaleidoscope-DefaultLEDModeConfig.h"
|
||||||
|
|
||||||
|
// Support for Keyboardio's internal keyboard testing mode
|
||||||
|
#include "Kaleidoscope-HardwareTestMode.h"
|
||||||
|
|
||||||
|
// Support for host power management (suspend & wakeup)
|
||||||
|
#include "Kaleidoscope-HostPowerManagement.h"
|
||||||
|
|
||||||
|
// Support for magic combos (key chords that trigger an action)
|
||||||
|
#include "Kaleidoscope-MagicCombo.h"
|
||||||
|
|
||||||
|
// Support for USB quirks, like changing the key state report protocol
|
||||||
|
#include "Kaleidoscope-USB-Quirks.h"
|
||||||
|
|
||||||
|
// Support for secondary actions on keys
|
||||||
|
#include "Kaleidoscope-Qukeys.h"
|
||||||
|
|
||||||
|
// Support for one-shot modifiers and layer keys
|
||||||
|
#include "Kaleidoscope-OneShot.h"
|
||||||
|
#include "Kaleidoscope-Escape-OneShot.h"
|
||||||
|
|
||||||
|
// Support for dynamic, Chrysalis-editable macros
|
||||||
|
#include "Kaleidoscope-DynamicMacros.h"
|
||||||
|
|
||||||
|
/** This 'enum' is a list of all the macros used by the Model 100's firmware
|
||||||
|
* The names aren't particularly important. What is important is that each
|
||||||
|
* is unique.
|
||||||
|
*
|
||||||
|
* These are the names of your macros. They'll be used in two places.
|
||||||
|
* The first is in your keymap definitions. There, you'll use the syntax
|
||||||
|
* `M(MACRO_NAME)` to mark a specific keymap position as triggering `MACRO_NAME`
|
||||||
|
*
|
||||||
|
* The second usage is in the 'switch' statement in the `macroAction` function.
|
||||||
|
* That switch statement actually runs the code associated with a macro when
|
||||||
|
* a macro key is pressed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum {
|
||||||
|
MACRO_VERSION_INFO,
|
||||||
|
MACRO_ANY,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/** The Model 100's key layouts are defined as 'keymaps'. By default, there are three
|
||||||
|
* keymaps: The standard QWERTY keymap, the "Function layer" keymap and the "Numpad"
|
||||||
|
* keymap.
|
||||||
|
*
|
||||||
|
* Each keymap is defined as a list using the 'KEYMAP_STACKED' macro, built
|
||||||
|
* of first the left hand's layout, followed by the right hand's layout.
|
||||||
|
*
|
||||||
|
* Keymaps typically consist mostly of `Key_` definitions. There are many, many keys
|
||||||
|
* defined as part of the USB HID Keyboard specification. You can find the names
|
||||||
|
* (if not yet the explanations) for all the standard `Key_` defintions offered by
|
||||||
|
* Kaleidoscope in these files:
|
||||||
|
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/keyboard.h
|
||||||
|
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/consumerctl.h
|
||||||
|
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/sysctl.h
|
||||||
|
* https://github.com/keyboardio/Kaleidoscope/blob/master/src/kaleidoscope/key_defs/keymaps.h
|
||||||
|
*
|
||||||
|
* Additional things that should be documented here include
|
||||||
|
* using ___ to let keypresses fall through to the previously active layer
|
||||||
|
* using XXX to mark a keyswitch as 'blocked' on this layer
|
||||||
|
* using ShiftToLayer() and LockLayer() keys to change the active keymap.
|
||||||
|
* keeping NUM and FN consistent and accessible on all layers
|
||||||
|
*
|
||||||
|
* The PROG key is special, since it is how you indicate to the board that you
|
||||||
|
* want to flash the firmware. However, it can be remapped to a regular key.
|
||||||
|
* When the keyboard boots, it first looks to see whether the PROG key is held
|
||||||
|
* down; if it is, it simply awaits further flashing instructions. If it is
|
||||||
|
* not, it continues loading the rest of the firmware and the keyboard
|
||||||
|
* functions normally, with whatever binding you have set to PROG. More detail
|
||||||
|
* here: https://community.keyboard.io/t/how-the-prog-key-gets-you-into-the-bootloader/506/8
|
||||||
|
*
|
||||||
|
* The "keymaps" data structure is a list of the keymaps compiled into the firmware.
|
||||||
|
* The order of keymaps in the list is important, as the ShiftToLayer(#) and LockLayer(#)
|
||||||
|
* macros switch to key layers based on this list.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
|
||||||
|
* A key defined as 'ShiftToLayer(FUNCTION)' will switch to FUNCTION while held.
|
||||||
|
* Similarly, a key defined as 'LockLayer(NUMPAD)' will switch to NUMPAD when tapped.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Layers are "0-indexed" -- That is the first one is layer 0. The second one is layer 1.
|
||||||
|
* The third one is layer 2.
|
||||||
|
* This 'enum' lets us use names like QWERTY, FUNCTION, and NUMPAD in place of
|
||||||
|
* the numbers 0, 1 and 2.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PRIMARY,
|
||||||
|
NUMPAD,
|
||||||
|
FUNCTION,
|
||||||
|
}; // layers
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To change your keyboard's layout from QWERTY to DVORAK or COLEMAK, comment out the line
|
||||||
|
*
|
||||||
|
* #define PRIMARY_KEYMAP_QWERTY
|
||||||
|
*
|
||||||
|
* by changing it to
|
||||||
|
*
|
||||||
|
* // #define PRIMARY_KEYMAP_QWERTY
|
||||||
|
*
|
||||||
|
* Then uncomment the line corresponding to the layout you want to use.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define PRIMARY_KEYMAP_QWERTY
|
||||||
|
// #define PRIMARY_KEYMAP_DVORAK
|
||||||
|
// #define PRIMARY_KEYMAP_COLEMAK
|
||||||
|
// #define PRIMARY_KEYMAP_CUSTOM
|
||||||
|
|
||||||
|
|
||||||
|
/* This comment temporarily turns off astyle's indent enforcement
|
||||||
|
* so we can make the keymaps actually resemble the physical key layout better
|
||||||
|
*/
|
||||||
|
// clang-format off
|
||||||
|
|
||||||
|
KEYMAPS(
|
||||||
|
|
||||||
|
#if defined (PRIMARY_KEYMAP_QWERTY)
|
||||||
|
[PRIMARY] = KEYMAP_STACKED
|
||||||
|
(___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
|
||||||
|
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_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
|
||||||
|
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
|
||||||
|
ShiftToLayer(FUNCTION),
|
||||||
|
|
||||||
|
M(MACRO_ANY), Key_6, Key_7, Key_8, Key_9, Key_0, LockLayer(NUMPAD),
|
||||||
|
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
|
||||||
|
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
|
||||||
|
Key_RightAlt, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
|
||||||
|
Key_RightShift, Key_LeftAlt, Key_Spacebar, Key_RightControl,
|
||||||
|
ShiftToLayer(FUNCTION)),
|
||||||
|
|
||||||
|
#elif defined (PRIMARY_KEYMAP_DVORAK)
|
||||||
|
|
||||||
|
[PRIMARY] = KEYMAP_STACKED
|
||||||
|
(___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
|
||||||
|
Key_Backtick, Key_Quote, Key_Comma, Key_Period, Key_P, Key_Y, Key_Tab,
|
||||||
|
Key_PageUp, Key_A, Key_O, Key_E, Key_U, Key_I,
|
||||||
|
Key_PageDown, Key_Semicolon, Key_Q, Key_J, Key_K, Key_X, Key_Escape,
|
||||||
|
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
|
||||||
|
ShiftToLayer(FUNCTION),
|
||||||
|
|
||||||
|
M(MACRO_ANY), Key_6, Key_7, Key_8, Key_9, Key_0, LockLayer(NUMPAD),
|
||||||
|
Key_Enter, Key_F, Key_G, Key_C, Key_R, Key_L, Key_Slash,
|
||||||
|
Key_D, Key_H, Key_T, Key_N, Key_S, Key_Minus,
|
||||||
|
Key_RightAlt, Key_B, Key_M, Key_W, Key_V, Key_Z, Key_Equals,
|
||||||
|
Key_RightShift, Key_LeftAlt, Key_Spacebar, Key_RightControl,
|
||||||
|
ShiftToLayer(FUNCTION)),
|
||||||
|
|
||||||
|
#elif defined (PRIMARY_KEYMAP_COLEMAK)
|
||||||
|
|
||||||
|
[PRIMARY] = KEYMAP_STACKED
|
||||||
|
(___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
|
||||||
|
Key_Backtick, Key_Q, Key_W, Key_F, Key_P, Key_G, Key_Tab,
|
||||||
|
Key_PageUp, Key_A, Key_R, Key_S, Key_T, Key_D,
|
||||||
|
Key_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
|
||||||
|
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
|
||||||
|
ShiftToLayer(FUNCTION),
|
||||||
|
|
||||||
|
M(MACRO_ANY), Key_6, Key_7, Key_8, Key_9, Key_0, LockLayer(NUMPAD),
|
||||||
|
Key_Enter, Key_J, Key_L, Key_U, Key_Y, Key_Semicolon, Key_Equals,
|
||||||
|
Key_H, Key_N, Key_E, Key_I, Key_O, Key_Quote,
|
||||||
|
Key_RightAlt, Key_K, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
|
||||||
|
Key_RightShift, Key_LeftAlt, Key_Spacebar, Key_RightControl,
|
||||||
|
ShiftToLayer(FUNCTION)),
|
||||||
|
|
||||||
|
#elif defined (PRIMARY_KEYMAP_CUSTOM)
|
||||||
|
// Edit this keymap to make a custom layout
|
||||||
|
[PRIMARY] = KEYMAP_STACKED
|
||||||
|
(___, Key_1, Key_2, Key_3, Key_4, Key_5, Key_LEDEffectNext,
|
||||||
|
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_PageDown, Key_Z, Key_X, Key_C, Key_V, Key_B, Key_Escape,
|
||||||
|
Key_LeftControl, Key_Backspace, Key_LeftGui, Key_LeftShift,
|
||||||
|
ShiftToLayer(FUNCTION),
|
||||||
|
|
||||||
|
M(MACRO_ANY), Key_6, Key_7, Key_8, Key_9, Key_0, LockLayer(NUMPAD),
|
||||||
|
Key_Enter, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_Equals,
|
||||||
|
Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Quote,
|
||||||
|
Key_RightAlt, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash, Key_Minus,
|
||||||
|
Key_RightShift, Key_LeftAlt, Key_Spacebar, Key_RightControl,
|
||||||
|
ShiftToLayer(FUNCTION)),
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#error "No default keymap defined. You should make sure that you have a line like '#define PRIMARY_KEYMAP_QWERTY' in your sketch"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[NUMPAD] = KEYMAP_STACKED
|
||||||
|
(___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___, ___, ___, ___,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___,
|
||||||
|
|
||||||
|
M(MACRO_VERSION_INFO), ___, Key_7, Key_8, Key_9, Key_KeypadSubtract, ___,
|
||||||
|
___, ___, Key_4, Key_5, Key_6, Key_KeypadAdd, ___,
|
||||||
|
___, Key_1, Key_2, Key_3, Key_Equals, ___,
|
||||||
|
___, ___, Key_0, Key_Period, Key_KeypadMultiply, Key_KeypadDivide, Key_Enter,
|
||||||
|
___, ___, ___, ___,
|
||||||
|
___),
|
||||||
|
|
||||||
|
[FUNCTION] = KEYMAP_STACKED
|
||||||
|
(___, Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_CapsLock,
|
||||||
|
Key_Tab, ___, Key_mouseUp, ___, Key_mouseBtnR, Key_mouseWarpEnd, Key_mouseWarpNE,
|
||||||
|
Key_Home, Key_mouseL, Key_mouseDn, Key_mouseR, Key_mouseBtnL, Key_mouseWarpNW,
|
||||||
|
Key_End, Key_PrintScreen, Key_Insert, ___, Key_mouseBtnM, Key_mouseWarpSW, Key_mouseWarpSE,
|
||||||
|
___, Key_Delete, ___, ___,
|
||||||
|
___,
|
||||||
|
|
||||||
|
Consumer_ScanPreviousTrack, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10, Key_F11,
|
||||||
|
Consumer_PlaySlashPause, Consumer_ScanNextTrack, Key_LeftCurlyBracket, Key_RightCurlyBracket, Key_LeftBracket, Key_RightBracket, Key_F12,
|
||||||
|
Key_LeftArrow, Key_DownArrow, Key_UpArrow, Key_RightArrow, ___, ___,
|
||||||
|
Key_PcApplication, Consumer_Mute, Consumer_VolumeDecrement, Consumer_VolumeIncrement, ___, Key_Backslash, Key_Pipe,
|
||||||
|
___, ___, Key_Enter, ___,
|
||||||
|
___)
|
||||||
|
) // KEYMAPS(
|
||||||
|
|
||||||
|
// Define an EGA palette. Conveniently, that's exactly 16 colors, just like the
|
||||||
|
// limit of LEDPaletteTheme.
|
||||||
|
//
|
||||||
|
// We have black and white swapped compared to a normal palette, because of
|
||||||
|
// technical reasons: colormap defaults to the last color of the palette.
|
||||||
|
PALETTE(
|
||||||
|
CRGB(0xff, 0xff, 0xff), // [0x0] white
|
||||||
|
CRGB(0x00, 0x00, 0xaa), // [0x1] blue
|
||||||
|
CRGB(0x00, 0xaa, 0x00), // [0x2] green
|
||||||
|
CRGB(0x00, 0xaa, 0xaa), // [0x3] cyan
|
||||||
|
CRGB(0xaa, 0x00, 0x00), // [0x4] red
|
||||||
|
CRGB(0xaa, 0x00, 0xaa), // [0x5] magenta
|
||||||
|
CRGB(0xaa, 0x55, 0x00), // [0x6] brown
|
||||||
|
CRGB(0xaa, 0xaa, 0xaa), // [0x7] light gray
|
||||||
|
CRGB(0x55, 0x55, 0x55), // [0x8] dark gray
|
||||||
|
CRGB(0x55, 0x55, 0xff), // [0x9] bright blue
|
||||||
|
CRGB(0x55, 0xff, 0x55), // [0xa] bright green
|
||||||
|
CRGB(0x55, 0xff, 0xff), // [0xb] bright cyan
|
||||||
|
CRGB(0xff, 0x55, 0x55), // [0xc] bright red
|
||||||
|
CRGB(0xff, 0x55, 0xff), // [0xd] bright magenta
|
||||||
|
CRGB(0xff, 0xff, 0x55), // [0xe] yellow
|
||||||
|
CRGB(0x00, 0x00, 0x00) // [0xf] black
|
||||||
|
) // PALETTE
|
||||||
|
|
||||||
|
COLORMAPS(
|
||||||
|
// Our Primary layer has all LEDs off
|
||||||
|
[PRIMARY] = COLORMAP_STACKED(
|
||||||
|
0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf, 0xf, 0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf,
|
||||||
|
|
||||||
|
0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf, 0xf, 0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf),
|
||||||
|
// For the Numpad layer, we set the num lock key to blue, and the numpad keys
|
||||||
|
// to red.
|
||||||
|
[NUMPAD] = COLORMAP_STACKED(
|
||||||
|
0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf, 0xf, 0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf, 0xf, 0xf, 0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf,
|
||||||
|
|
||||||
|
0xf, 0xf, 0x4, 0x4, 0x4, 0x4, 0x1,
|
||||||
|
0xf, 0xf, 0x4, 0x4, 0x4, 0x4, 0xf,
|
||||||
|
0xf, 0x4, 0x4, 0x4, 0x4, 0xf,
|
||||||
|
0xf, 0xf, 0x4, 0x4, 0x4, 0x4, 0x4,
|
||||||
|
0xf, 0xf, 0xf, 0xf,
|
||||||
|
0xf)
|
||||||
|
)
|
||||||
|
|
||||||
|
/* Re-enable astyle's indent enforcement */
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
/** versionInfoMacro handles the 'firmware version info' macro
|
||||||
|
* When a key bound to the macro is pressed, this macro
|
||||||
|
* prints out the firmware build information as virtual keystrokes
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void versionInfoMacro(uint8_t key_state) {
|
||||||
|
if (keyToggledOn(key_state)) {
|
||||||
|
Macros.type(PSTR("Keyboardio Model 100 - Kaleidoscope "));
|
||||||
|
Macros.type(PSTR(BUILD_INFORMATION));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** anyKeyMacro is used to provide the functionality of the 'Any' key.
|
||||||
|
*
|
||||||
|
* When the 'any key' macro is toggled on, a random alphanumeric key is
|
||||||
|
* selected. While the key is held, the function generates a synthetic
|
||||||
|
* keypress event repeating that randomly selected key.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void anyKeyMacro(KeyEvent &event) {
|
||||||
|
if (keyToggledOn(event.state)) {
|
||||||
|
event.key.setKeyCode(Key_A.getKeyCode() + (uint8_t)(millis() % 36));
|
||||||
|
event.key.setFlags(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** macroAction dispatches keymap events that are tied to a macro
|
||||||
|
to that macro. It takes two uint8_t parameters.
|
||||||
|
|
||||||
|
The first is the macro being called (the entry in the 'enum' earlier in this file).
|
||||||
|
The second is the state of the keyswitch. You can use the keyswitch state to figure out
|
||||||
|
if the key has just been toggled on, is currently pressed or if it's just been released.
|
||||||
|
|
||||||
|
The 'switch' statement should have a 'case' for each entry of the macro enum.
|
||||||
|
Each 'case' statement should call out to a function to handle the macro in question.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
const macro_t *macroAction(uint8_t macro_id, KeyEvent &event) {
|
||||||
|
switch (macro_id) {
|
||||||
|
|
||||||
|
case MACRO_VERSION_INFO:
|
||||||
|
versionInfoMacro(event.state);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MACRO_ANY:
|
||||||
|
anyKeyMacro(event);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return MACRO_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// These 'solid' color effect definitions define a rainbow of
|
||||||
|
// LED color modes calibrated to draw 500mA or less on the
|
||||||
|
// Keyboardio Model 100.
|
||||||
|
|
||||||
|
|
||||||
|
static kaleidoscope::plugin::LEDSolidColor solidRed(160, 0, 0);
|
||||||
|
static kaleidoscope::plugin::LEDSolidColor solidOrange(140, 70, 0);
|
||||||
|
static kaleidoscope::plugin::LEDSolidColor solidYellow(130, 100, 0);
|
||||||
|
static kaleidoscope::plugin::LEDSolidColor solidGreen(0, 160, 0);
|
||||||
|
static kaleidoscope::plugin::LEDSolidColor solidBlue(0, 70, 130);
|
||||||
|
static kaleidoscope::plugin::LEDSolidColor solidIndigo(0, 0, 170);
|
||||||
|
static kaleidoscope::plugin::LEDSolidColor solidViolet(130, 0, 120);
|
||||||
|
|
||||||
|
/** toggleLedsOnSuspendResume toggles the LEDs off when the host goes to sleep,
|
||||||
|
* and turns them back on when it wakes up.
|
||||||
|
*/
|
||||||
|
void toggleLedsOnSuspendResume(kaleidoscope::plugin::HostPowerManagement::Event event) {
|
||||||
|
switch (event) {
|
||||||
|
case kaleidoscope::plugin::HostPowerManagement::Suspend:
|
||||||
|
LEDControl.disable();
|
||||||
|
break;
|
||||||
|
case kaleidoscope::plugin::HostPowerManagement::Resume:
|
||||||
|
LEDControl.enable();
|
||||||
|
break;
|
||||||
|
case kaleidoscope::plugin::HostPowerManagement::Sleep:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** hostPowerManagementEventHandler dispatches power management events (suspend,
|
||||||
|
* resume, and sleep) to other functions that perform action based on these
|
||||||
|
* events.
|
||||||
|
*/
|
||||||
|
void hostPowerManagementEventHandler(kaleidoscope::plugin::HostPowerManagement::Event event) {
|
||||||
|
toggleLedsOnSuspendResume(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** This 'enum' is a list of all the magic combos used by the Model 100's
|
||||||
|
* firmware The names aren't particularly important. What is important is that
|
||||||
|
* each is unique.
|
||||||
|
*
|
||||||
|
* These are the names of your magic combos. They will be used by the
|
||||||
|
* `USE_MAGIC_COMBOS` call below.
|
||||||
|
*/
|
||||||
|
enum {
|
||||||
|
// Toggle between Boot (6-key rollover; for BIOSes and early boot) and NKRO
|
||||||
|
// mode.
|
||||||
|
COMBO_TOGGLE_NKRO_MODE,
|
||||||
|
// Enter test mode
|
||||||
|
COMBO_ENTER_TEST_MODE
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Wrappers, to be used by MagicCombo. **/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This simply toggles the keyboard protocol via USBQuirks, and wraps it within
|
||||||
|
* a function with an unused argument, to match what MagicCombo expects.
|
||||||
|
*/
|
||||||
|
static void toggleKeyboardProtocol(uint8_t combo_index) {
|
||||||
|
USBQuirks.toggleKeyboardProtocol();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This enters the hardware test mode
|
||||||
|
*/
|
||||||
|
static void enterHardwareTestMode(uint8_t combo_index) {
|
||||||
|
HardwareTestMode.runTests();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Magic combo list, a list of key combo and action pairs the firmware should
|
||||||
|
* recognise.
|
||||||
|
*/
|
||||||
|
USE_MAGIC_COMBOS({.action = toggleKeyboardProtocol,
|
||||||
|
// Left Fn + Esc + Shift
|
||||||
|
.keys = {R3C6, R2C6, R3C7}},
|
||||||
|
{.action = enterHardwareTestMode,
|
||||||
|
// Left Fn + Prog + LED
|
||||||
|
.keys = {R3C6, R0C0, R0C6}});
|
||||||
|
|
||||||
|
// First, tell Kaleidoscope which plugins you want to use.
|
||||||
|
// The order can be important. For example, LED effects are
|
||||||
|
// added in the order they're listed here.
|
||||||
|
KALEIDOSCOPE_INIT_PLUGINS(
|
||||||
|
// The EEPROMSettings & EEPROMKeymap plugins make it possible to have an
|
||||||
|
// editable keymap in EEPROM.
|
||||||
|
EEPROMSettings,
|
||||||
|
EEPROMKeymap,
|
||||||
|
|
||||||
|
// Focus allows bi-directional communication with the host, and is the
|
||||||
|
// interface through which the keymap in EEPROM can be edited.
|
||||||
|
Focus,
|
||||||
|
|
||||||
|
// FocusSettingsCommand adds a few Focus commands, intended to aid in
|
||||||
|
// changing some settings of the keyboard, such as the default layer (via the
|
||||||
|
// `settings.defaultLayer` command)
|
||||||
|
FocusSettingsCommand,
|
||||||
|
|
||||||
|
// FocusEEPROMCommand adds a set of Focus commands, which are very helpful in
|
||||||
|
// both debugging, and in backing up one's EEPROM contents.
|
||||||
|
FocusEEPROMCommand,
|
||||||
|
|
||||||
|
// The boot greeting effect pulses the LED button for 10 seconds after the
|
||||||
|
// keyboard is first connected
|
||||||
|
BootGreetingEffect,
|
||||||
|
|
||||||
|
// The hardware test mode, which can be invoked by tapping Prog, LED and the
|
||||||
|
// left Fn button at the same time.
|
||||||
|
HardwareTestMode,
|
||||||
|
|
||||||
|
// LEDControl provides support for other LED modes
|
||||||
|
LEDControl,
|
||||||
|
|
||||||
|
// We start with the LED effect that turns off all the LEDs.
|
||||||
|
LEDOff,
|
||||||
|
|
||||||
|
// The rainbow effect changes the color of all of the keyboard's keys at the same time
|
||||||
|
// running through all the colors of the rainbow.
|
||||||
|
LEDRainbowEffect,
|
||||||
|
|
||||||
|
// The rainbow wave effect lights up your keyboard with all the colors of a rainbow
|
||||||
|
// and slowly moves the rainbow across your keyboard
|
||||||
|
LEDRainbowWaveEffect,
|
||||||
|
|
||||||
|
// The chase effect follows the adventure of a blue pixel which chases a red pixel across
|
||||||
|
// your keyboard. Spoiler: the blue pixel never catches the red pixel
|
||||||
|
LEDChaseEffect,
|
||||||
|
|
||||||
|
// These static effects turn your keyboard's LEDs a variety of colors
|
||||||
|
solidRed,
|
||||||
|
solidOrange,
|
||||||
|
solidYellow,
|
||||||
|
solidGreen,
|
||||||
|
solidBlue,
|
||||||
|
solidIndigo,
|
||||||
|
solidViolet,
|
||||||
|
|
||||||
|
// The breathe effect slowly pulses all of the LEDs on your keyboard
|
||||||
|
LEDBreatheEffect,
|
||||||
|
|
||||||
|
// The AlphaSquare effect prints each character you type, using your
|
||||||
|
// keyboard's LEDs as a display
|
||||||
|
AlphaSquareEffect,
|
||||||
|
|
||||||
|
// The stalker effect lights up the keys you've pressed recently
|
||||||
|
StalkerEffect,
|
||||||
|
|
||||||
|
// The LED Palette Theme plugin provides a shared palette for other plugins,
|
||||||
|
// like Colormap below
|
||||||
|
LEDPaletteTheme,
|
||||||
|
|
||||||
|
// The Colormap effect makes it possible to set up per-layer colormaps
|
||||||
|
ColormapEffect,
|
||||||
|
// The default colormap plugin allows us to set up a default palette &
|
||||||
|
// colormap.
|
||||||
|
DefaultColormap,
|
||||||
|
|
||||||
|
// The macros plugin adds support for macros
|
||||||
|
Macros,
|
||||||
|
|
||||||
|
// The MouseKeys plugin lets you add keys to your keymap which move the mouse.
|
||||||
|
MouseKeys,
|
||||||
|
|
||||||
|
// The HostPowerManagement plugin allows us to turn LEDs off when then host
|
||||||
|
// goes to sleep, and resume them when it wakes up.
|
||||||
|
HostPowerManagement,
|
||||||
|
|
||||||
|
// The MagicCombo plugin lets you use key combinations to trigger custom
|
||||||
|
// actions - a bit like Macros, but triggered by pressing multiple keys at the
|
||||||
|
// same time.
|
||||||
|
MagicCombo,
|
||||||
|
|
||||||
|
// The USBQuirks plugin lets you do some things with USB that we aren't
|
||||||
|
// comfortable - or able - to do automatically, but can be useful
|
||||||
|
// nevertheless. Such as toggling the key report protocol between Boot (used
|
||||||
|
// by BIOSes) and Report (NKRO).
|
||||||
|
USBQuirks,
|
||||||
|
|
||||||
|
// The Qukeys plugin enables the "Secondary action" functionality in
|
||||||
|
// Chrysalis. Keys with secondary actions will have their primary action
|
||||||
|
// performed when tapped, but the secondary action when held.
|
||||||
|
Qukeys,
|
||||||
|
|
||||||
|
// Enables the "Sticky" behavior for modifiers, and the "Layer shift when
|
||||||
|
// held" functionality for layer keys.
|
||||||
|
OneShot,
|
||||||
|
EscapeOneShot,
|
||||||
|
EscapeOneShotConfig,
|
||||||
|
|
||||||
|
// Turns LEDs off after a configurable amount of idle time.
|
||||||
|
IdleLEDs,
|
||||||
|
PersistentIdleLEDs,
|
||||||
|
|
||||||
|
// Enables setting a default LED mode without compiling new firmware.
|
||||||
|
DefaultLEDModeConfig,
|
||||||
|
|
||||||
|
// Enables dynamic, Chrysalis-editable macros.
|
||||||
|
DynamicMacros);
|
||||||
|
|
||||||
|
/** The 'setup' function is one of the two standard Arduino sketch functions.
|
||||||
|
* It's called when your keyboard first powers up. This is where you set up
|
||||||
|
* Kaleidoscope and any plugins.
|
||||||
|
*/
|
||||||
|
void setup() {
|
||||||
|
// First, call Kaleidoscope's internal setup function
|
||||||
|
Kaleidoscope.setup();
|
||||||
|
|
||||||
|
// We configure the AlphaSquare effect to use RED letters
|
||||||
|
AlphaSquare.color = CRGB(255, 0, 0);
|
||||||
|
|
||||||
|
// We set the brightness of the rainbow effects to 150 (on a scale of 0-255)
|
||||||
|
// This draws more than 500mA, but looks much nicer than a dimmer effect
|
||||||
|
LEDRainbowEffect.brightness(255);
|
||||||
|
LEDRainbowWaveEffect.brightness(255);
|
||||||
|
|
||||||
|
// Set the action key the test mode should listen for to Left Fn
|
||||||
|
HardwareTestMode.setActionKey(R3C6);
|
||||||
|
|
||||||
|
// The LED Stalker mode has a few effects. The one we like is called
|
||||||
|
// 'BlazingTrail'. For details on other options, see
|
||||||
|
// https://github.com/keyboardio/Kaleidoscope/blob/master/docs/plugins/LED-Stalker.md
|
||||||
|
StalkerEffect.variant = STALKER(BlazingTrail);
|
||||||
|
|
||||||
|
// To make the keymap editable without flashing new firmware, we store
|
||||||
|
// additional layers in EEPROM. For now, we reserve space for eight layers. If
|
||||||
|
// one wants to use these layers, just set the default layer to one in EEPROM,
|
||||||
|
// by using the `settings.defaultLayer` Focus command, or by using the
|
||||||
|
// `keymap.onlyCustom` command to use EEPROM layers only.
|
||||||
|
EEPROMKeymap.setup(8);
|
||||||
|
|
||||||
|
// We need to tell the Colormap plugin how many layers we want to have custom
|
||||||
|
// maps for. To make things simple, we set it to eight layers, which is how
|
||||||
|
// many editable layers we have (see above).
|
||||||
|
ColormapEffect.max_layers(8);
|
||||||
|
|
||||||
|
// For Dynamic Macros, we need to reserve storage space for the editable
|
||||||
|
// macros. A kilobyte is a reasonable default.
|
||||||
|
DynamicMacros.reserve_storage(1024);
|
||||||
|
|
||||||
|
// Install a default palette & colormap if none are present
|
||||||
|
DefaultColormap.setup();
|
||||||
|
|
||||||
|
// If our EEPROM is uninitialized, default to the ColormapEffect as our
|
||||||
|
// default LED mode.
|
||||||
|
DefaultLEDModeConfig.activateLEDModeIfUnconfigured(&ColormapEffect);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** loop is the second of the standard Arduino sketch functions.
|
||||||
|
* As you might expect, it runs in a loop, never exiting.
|
||||||
|
*
|
||||||
|
* For Kaleidoscope-based keyboard firmware, you usually just want to
|
||||||
|
* call Kaleidoscope.loop(); and not do anything custom here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
Kaleidoscope.loop();
|
||||||
|
}
|
@ -0,0 +1,275 @@
|
|||||||
|
/* -*- mode: c++ -*-
|
||||||
|
* Splitography-Sketch -- Chrysalis-enabled sketch for the Splitography
|
||||||
|
* Copyright (C) 2018-2022 Keyboard.io, Inc
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Modeled after the default QMK layout:
|
||||||
|
* https://github.com/sdothum/qmk_firmware/blob/d865c82efa19beb7cb593e7d3affb2311017833e/keyboards/splitography/keymaps/default/keymap.c
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "Kaleidoscope.h"
|
||||||
|
#include "Kaleidoscope-EEPROM-Settings.h"
|
||||||
|
#include "Kaleidoscope-EEPROM-Keymap.h"
|
||||||
|
#include "Kaleidoscope-FocusSerial.h"
|
||||||
|
#include "Kaleidoscope-Ranges.h"
|
||||||
|
#include "Kaleidoscope-Steno.h"
|
||||||
|
#include "Kaleidoscope-MouseKeys.h"
|
||||||
|
#include "Kaleidoscope-Qukeys.h"
|
||||||
|
#include "Kaleidoscope-OneShot.h"
|
||||||
|
#include "Kaleidoscope-Escape-OneShot.h"
|
||||||
|
#include "Kaleidoscope-DynamicMacros.h"
|
||||||
|
|
||||||
|
// Layers
|
||||||
|
enum {
|
||||||
|
_QWERTY,
|
||||||
|
_BLUE,
|
||||||
|
_ORANGE,
|
||||||
|
_GREEN,
|
||||||
|
_STENO,
|
||||||
|
_PLOVER
|
||||||
|
};
|
||||||
|
|
||||||
|
// Custom keys
|
||||||
|
enum {
|
||||||
|
QWERTY_1 = kaleidoscope::ranges::SAFE_START,
|
||||||
|
QWERTY_2
|
||||||
|
};
|
||||||
|
|
||||||
|
#define QWERTY1 Key(QWERTY_1)
|
||||||
|
#define QWERTY2 Key(QWERTY_2)
|
||||||
|
|
||||||
|
#define MO(layer) ShiftToLayer(layer)
|
||||||
|
#define TO(layer) LockLayer(layer)
|
||||||
|
|
||||||
|
#define K_STP Consumer_Stop
|
||||||
|
#define K_PRV Consumer_ScanPreviousTrack
|
||||||
|
#define K_NXT Consumer_ScanNextTrack
|
||||||
|
#define K_PLY Consumer_PlaySlashPause
|
||||||
|
|
||||||
|
// Key aliases
|
||||||
|
#define Key_PgUp Key_PageUp
|
||||||
|
#define Key_PageDn Key_PageDown
|
||||||
|
#define Key_PgDn Key_PageDown
|
||||||
|
#define Key_Del Key_Delete
|
||||||
|
#define Key_Grave Key_Backtick
|
||||||
|
#define K_APP Key_PcApplication
|
||||||
|
#define K_SCRLK Key_ScrollLock
|
||||||
|
#define K_CPSLK Key_CapsLock
|
||||||
|
#define K_PAUSE Key_Pause
|
||||||
|
#define K_PRSCR Key_PrintScreen
|
||||||
|
#define K_MUTE Consumer_Mute
|
||||||
|
#define K_VUp Consumer_VolumeIncrement
|
||||||
|
#define K_VDn Consumer_VolumeDecrement
|
||||||
|
#define K_PST LCTRL(Key_V)
|
||||||
|
#define K_CPY LCTRL(Key_LeftControl)
|
||||||
|
#define K_CUT LCTRL(Key_X)
|
||||||
|
#define K_UDO LCTRL(Key_Z)
|
||||||
|
|
||||||
|
#define KP_0 Key_Keypad0
|
||||||
|
#define KP_1 Key_Keypad1
|
||||||
|
#define KP_2 Key_Keypad2
|
||||||
|
#define KP_3 Key_Keypad3
|
||||||
|
#define KP_4 Key_Keypad4
|
||||||
|
#define KP_5 Key_Keypad5
|
||||||
|
#define KP_6 Key_Keypad6
|
||||||
|
#define KP_7 Key_Keypad7
|
||||||
|
#define KP_8 Key_Keypad8
|
||||||
|
#define KP_9 Key_Keypad9
|
||||||
|
|
||||||
|
#define Key_Up Key_UpArrow
|
||||||
|
#define Key_Dn Key_DownArrow
|
||||||
|
#define Key_Left Key_LeftArrow
|
||||||
|
#define Key_Rgt Key_RightArrow
|
||||||
|
#define KP_SLS Key_KeypadDivide
|
||||||
|
#define KP_STR Key_KeypadMultiply
|
||||||
|
#define Key_Plus Key_KeypadAdd
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
KEYMAPS(
|
||||||
|
/* QWERTY
|
||||||
|
* ,-------------------------. ,--------------------------.
|
||||||
|
* | Esc | Q | W | E | R | T | | Y | U | I | O | P | Bspc |
|
||||||
|
* |-----+---+---+---+---+---| |---+---+---+---+---+------|
|
||||||
|
* | Alt | A | S | D | F | G | | H | J | K | L | ; | Entr |
|
||||||
|
* |-----+---+---+---+---+---| |---+---+---+---+---+------|
|
||||||
|
* | Sft | Z | X | C | V | B | | N | M | , | . | / | Gui |
|
||||||
|
* `-------------+---+---+---' `-+---+---+----------------'
|
||||||
|
* |ORG|BLU| |SPC|CTR|
|
||||||
|
* `-------' `-------'
|
||||||
|
*/
|
||||||
|
[_QWERTY] = KEYMAP(
|
||||||
|
Key_Esc ,Key_Q ,Key_W ,Key_E ,Key_R ,Key_T ,Key_Y ,Key_U ,Key_I ,Key_O ,Key_P ,Key_Backspace
|
||||||
|
,Key_LeftAlt ,Key_A ,Key_S ,Key_D ,Key_F ,Key_G ,Key_H ,Key_J ,Key_K ,Key_L ,Key_Semicolon ,Key_Enter
|
||||||
|
,Key_LeftShift ,Key_Z ,Key_X ,Key_C ,Key_V ,Key_B ,Key_N ,Key_M ,Key_Comma ,Key_Period ,Key_Slash ,Key_LeftGui
|
||||||
|
,MO(_ORANGE) ,MO(_BLUE) ,Key_Space ,Key_LeftControl
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Blue
|
||||||
|
* ,-----------------------------------------. ,----------------------------.
|
||||||
|
* | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | |
|
||||||
|
* |-----+------+------+------+-------+------| |------+---+---+---+---+-----|
|
||||||
|
* | Alt | Stop | Prev | Play | Next | Vol+ | | | | | [ | ] | ' |
|
||||||
|
* |-----+------+------+------+-------+------| |------+---+---+---+---+-----|
|
||||||
|
* | Sft | Undo | Cut | Copy | Paste | Vol- | | Mute | | | - | = | Gui |
|
||||||
|
* `----------------------+------+------+----' `-+---+---+------------------'
|
||||||
|
* | GRN | [] | |Del|CTR|
|
||||||
|
* `-------------' `-------'
|
||||||
|
*/
|
||||||
|
[_BLUE] = KEYMAP(
|
||||||
|
Key_Grave ,Key_1 ,Key_2 ,Key_3 ,Key_4 ,Key_5 ,Key_6 ,Key_7 ,Key_8 ,Key_9 ,Key_0 ,XXX
|
||||||
|
,Key_LeftAlt ,K_STP ,K_PRV ,K_PLY ,K_NXT ,K_VUp ,XXX ,XXX ,XXX ,Key_LeftBracket ,Key_RightBracket ,Key_Quote
|
||||||
|
,Key_LeftShift ,K_UDO ,K_CUT ,K_CPY ,K_PST ,K_VDn ,K_MUTE ,XXX ,XXX ,Key_Minus ,Key_Equals ,Key_LeftGui
|
||||||
|
,MO(_GREEN) ,___ ,Key_Del ,Key_LeftControl
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Orange
|
||||||
|
* ,------------------------------------------. ,-----------------------------------------.
|
||||||
|
* | Plvr | F1 | F2 | F3 | F4 | | | App | PrScr | ScrLck | Pause | | |
|
||||||
|
* |------+------+------+------+-------+------| |------+-------+--------+-------+---+-----|
|
||||||
|
* | Alt | F5 | F6 | F7 | F8 | | | | Ins | Home | PgUp | | |
|
||||||
|
* |------+------+------+------+-------+------| |------+-------+--------+-------+---+-----|
|
||||||
|
* | Sft | F9 | F10 | F11 | F12 | | | | Del | End | PgDn | \ | Gui |
|
||||||
|
* `----------------------+------+------+-----' `-+---+---+-------------------------------'
|
||||||
|
* | [] | GRN | |Tab|CTR|
|
||||||
|
* `-------------' `-------'
|
||||||
|
*/
|
||||||
|
[_ORANGE] = KEYMAP(
|
||||||
|
TO(_PLOVER) ,Key_F1 ,Key_F2 ,Key_F3 ,Key_F4 ,XXX ,K_APP ,K_PRSCR ,K_SCRLK ,K_PAUSE ,XXX ,XXX
|
||||||
|
,Key_LeftAlt ,Key_F5 ,Key_F6 ,Key_F7 ,Key_F8 ,XXX ,XXX ,Key_Insert ,Key_Home ,Key_PageUp ,XXX ,XXX
|
||||||
|
,Key_LeftShift ,Key_F9 ,Key_F10 ,Key_F11 ,Key_F12 ,XXX ,XXX ,Key_Delete ,Key_End ,Key_PageDn ,Key_Backslash ,Key_LeftGui
|
||||||
|
,___ ,MO(_GREEN) ,Key_Tab ,Key_LeftControl
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Green
|
||||||
|
* ,----------------------------------------. ,--------------------------.
|
||||||
|
* | STENO | | | | | ScrLk | | / | 7 | 8 | 9 | - | |
|
||||||
|
* |-------+------+----+-----+------+-------| |---+---+---+---+---+------|
|
||||||
|
* | Alt | Home | Up | End | PgUp | CpsLk | | * | 4 | 5 | 6 | + | Entr |
|
||||||
|
* |-------+------+----+-----+------+-------| |---+---+---+---+---+------|
|
||||||
|
* | Sft | Left | Dn | Rgt | PgDn | | | 0 | 1 | 2 | 3 | | Gui |
|
||||||
|
* `---------------------------+----+----+--' `-+---+---+----------------'
|
||||||
|
* | [] | [] | | |CTR|
|
||||||
|
* `---------' `-------'
|
||||||
|
*/
|
||||||
|
|
||||||
|
[_GREEN] = KEYMAP(
|
||||||
|
TO(_STENO) ,XXX ,XXX ,XXX ,XXX ,K_SCRLK ,KP_SLS ,KP_7 ,KP_8 ,KP_9 ,Key_Minus ,XXX
|
||||||
|
,Key_LeftAlt ,Key_Home ,Key_Up ,Key_End ,Key_PgUp ,K_CPSLK ,KP_STR ,KP_4 ,KP_5 ,KP_6 ,Key_Plus ,Key_Enter
|
||||||
|
,Key_LeftShift ,Key_Left ,Key_Dn ,Key_Rgt ,Key_PgDn ,XXX ,KP_0 ,KP_1 ,KP_2 ,KP_3 ,XXX ,Key_LeftGui
|
||||||
|
,___ ,___ ,XXX ,Key_LeftControl
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Steno (GeminiPR)
|
||||||
|
* ,-----------------------. ,-----------------------.
|
||||||
|
* | # | # | # | # | # | # | | # | # | # | # | # | # |
|
||||||
|
* |---+---+---+---+---+---| |---+---+---+---+---+---|
|
||||||
|
* |QWR| S | T | P | H | * | | * | F | P | L | T | D |
|
||||||
|
* |---+---+---+---+---+---| |---+---+---+---+---+---|
|
||||||
|
* |QWR| S | K | W | R | * | | * | R | B | G | S | Z |
|
||||||
|
* `-------------+---+---+-' `-+---+---+-------------'
|
||||||
|
* | A | O | | E | U |
|
||||||
|
* `-------' `-------'
|
||||||
|
*/
|
||||||
|
[_STENO] = KEYMAP(
|
||||||
|
S(N1) ,S(N2) ,S(N3) ,S(N4) ,S(N5) ,S(N6) ,S(N7) ,S(N8) ,S(N9) ,S(NA) ,S(NB) ,S(NC)
|
||||||
|
,QWERTY1 ,S(S1) ,S(TL) ,S(PL) ,S(HL) ,S(ST1) ,S(ST3) ,S(FR) ,S(PR) ,S(LR) ,S(TR) ,S(DR)
|
||||||
|
,QWERTY2 ,S(S2) ,S(KL) ,S(WL) ,S(RL) ,S(ST2) ,S(ST4) ,S(RR) ,S(BR) ,S(GR) ,S(SR) ,S(ZR)
|
||||||
|
,S(A) ,S(O) ,S(E) ,S(U)
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Steno (Keyboard, QWERTY)
|
||||||
|
* ,-----------------------. ,-----------------------.
|
||||||
|
* | 1 | 1 | 1 | 1 | 1 | 1 | | 1 | 1 | 1 | 1 | 1 | 1 |
|
||||||
|
* |---+---+---+---+---+---| |---+---+---+---+---+---|
|
||||||
|
* |QWR| S | T | P | H | * | | * | F | P | L | T | D |
|
||||||
|
* |---+---+---+---+---+---| |---+---+---+---+---+---|
|
||||||
|
* |QWR| S | K | W | R | * | | * | R | B | G | S | Z |
|
||||||
|
* `-------------+---+---+-' `-+---+---+-------------'
|
||||||
|
* | A | O | | E | U |
|
||||||
|
* `-------' `-------'
|
||||||
|
*/
|
||||||
|
[_PLOVER] = KEYMAP(
|
||||||
|
Key_1 ,Key_1 ,Key_1 ,Key_1 ,Key_1 ,Key_1 ,Key_1 ,Key_1 ,Key_1 ,Key_1 ,Key_1 ,Key_1
|
||||||
|
,QWERTY1 ,Key_Q ,Key_W ,Key_E ,Key_R ,Key_T ,Key_Y ,Key_U ,Key_I ,Key_O ,Key_P ,Key_LeftBracket
|
||||||
|
,QWERTY2 ,Key_A ,Key_S ,Key_D ,Key_F ,Key_G ,Key_H ,Key_J ,Key_K ,Key_L ,Key_Semicolon ,Key_Quote
|
||||||
|
,Key_C ,Key_V ,Key_N ,Key_M
|
||||||
|
)
|
||||||
|
);
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
namespace kaleidoscope {
|
||||||
|
namespace plugin {
|
||||||
|
class MultiSwitcher : public kaleidoscope::Plugin {
|
||||||
|
public:
|
||||||
|
MultiSwitcher() {}
|
||||||
|
|
||||||
|
EventHandlerResult onKeyEvent(KeyEvent &event) {
|
||||||
|
if (event.key < QWERTY_1 || event.key > QWERTY_2)
|
||||||
|
return EventHandlerResult::OK;
|
||||||
|
|
||||||
|
uint8_t bit = event.key.getRaw() - QWERTY_1;
|
||||||
|
|
||||||
|
if (keyToggledOn(event.state)) {
|
||||||
|
switch_state_ |= (1 << bit);
|
||||||
|
|
||||||
|
if (switch_state_ == (1 << 0 | 1 << 1)) {
|
||||||
|
Layer.move(_QWERTY);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch_state_ &= ~(1 << bit);
|
||||||
|
}
|
||||||
|
|
||||||
|
return EventHandlerResult::EVENT_CONSUMED;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t switch_state_ = 0;
|
||||||
|
};
|
||||||
|
} // namespace plugin
|
||||||
|
} // namespace kaleidoscope
|
||||||
|
|
||||||
|
kaleidoscope::plugin::MultiSwitcher MultiSwitcher;
|
||||||
|
|
||||||
|
#include "Kaleidoscope-MouseKeys.h"
|
||||||
|
#include "Kaleidoscope-Qukeys.h"
|
||||||
|
#include "Kaleidoscope-OneShot.h"
|
||||||
|
#include "Kaleidoscope-Escape-OneShot.h"
|
||||||
|
#include "Kaleidoscope-DynamicMacros.h"
|
||||||
|
|
||||||
|
KALEIDOSCOPE_INIT_PLUGINS(
|
||||||
|
GeminiPR,
|
||||||
|
MultiSwitcher,
|
||||||
|
Focus,
|
||||||
|
EEPROMSettings,
|
||||||
|
EEPROMKeymap,
|
||||||
|
FocusEEPROMCommand,
|
||||||
|
FocusSettingsCommand,
|
||||||
|
MouseKeys,
|
||||||
|
Qukeys,
|
||||||
|
OneShot,
|
||||||
|
EscapeOneShot,
|
||||||
|
EscapeOneShotConfig,
|
||||||
|
DynamicMacros);
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Kaleidoscope.setup();
|
||||||
|
|
||||||
|
EEPROMKeymap.setup(8);
|
||||||
|
DynamicMacros.reserve_storage(256);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
Kaleidoscope.loop();
|
||||||
|
}
|
Loading…
Reference in new issue