Compare commits
75 Commits
examples/f
...
main
Author | SHA1 | Date |
---|---|---|
Alpha Chen | 0bb3928aea | 2 years ago |
Alpha Chen | 7954cc8f25 | 2 years ago |
Alpha Chen | 9fb691f44a | 2 years ago |
Gergely Nagy | ff19f144f8 | 2 years ago |
Michael Richters | a0045f4d9e | 2 years ago |
Michael Richters | 51125f215b | 2 years ago |
Michael Richters | c84aa58470 | 2 years ago |
Michael Richters | 789cc218c6 | 2 years ago |
Michael Richters | adaa3b7a01 | 2 years ago |
Alpha Chen | a43b89ce51 | 2 years ago |
Alpha Chen | 02157d30c7 | 2 years ago |
Gergely Nagy | 2f1c96ab4e | 2 years ago |
Gergely Nagy | 49a691e0f9 | 2 years ago |
Norwin | 3655f9a517 | 2 years ago |
Norwin | e22773ab5b | 2 years ago |
Jesse Vincent | fefc6699ba | 2 years ago |
Taylor Yu | e233e96be7 | 2 years ago |
Jesse Vincent | 18d0292d64 | 2 years ago |
Taylor Yu | af69f6a72b | 2 years ago |
Taylor Yu | 0ac320baeb | 2 years ago |
Jesse Vincent | 95ea4e3175 | 2 years ago |
Gergely Nagy | d0f1a812b0 | 2 years ago |
Gergely Nagy | 6a12467b84 | 2 years ago |
Jesse Vincent | b949ca89b1 | 2 years ago |
Jesse Vincent | cf798497e2 | 2 years ago |
Gergely Nagy | ca9b4cb50c | 2 years ago |
Taylor Yu | 04d608c9f6 | 2 years ago |
Jesse Vincent | 9bf6eba010 | 2 years ago |
Gergely Nagy | f21dda9a51 | 2 years ago |
Gergely Nagy | 28d6d66e98 | 2 years ago |
Jesse Vincent | ae9e561028 | 2 years ago |
Jesse Vincent | f181d55124 | 2 years ago |
Jesse Vincent | be28b367ce | 2 years ago |
Taylor Yu | 45bd9d1a3d | 2 years ago |
Gergely Nagy | 75b911b27d | 2 years ago |
Gergely Nagy | a5afaf1eb4 | 2 years ago |
Gergely Nagy | 26340b7edb | 2 years ago |
Gergely Nagy | 8ac4d9f5c1 | 2 years ago |
Gergely Nagy | a9f4f16e31 | 2 years ago |
Jesse Vincent | 7b66d8dfb5 | 2 years ago |
Jesse Vincent | 8196adab6c | 2 years ago |
Gergely Nagy | 96fbfb0628 | 2 years ago |
Gergely Nagy | a4b84057b0 | 2 years ago |
Jesse Vincent | 62a0fae04d | 2 years ago |
Gergely Nagy | cd82afd50a | 2 years ago |
Gergely Nagy | 7f4090f126 | 2 years ago |
Jesse Vincent | 63bcf212f3 | 2 years ago |
Gergely Nagy | db7b0af730 | 2 years ago |
Jesse Vincent | f3fe7c9023 | 2 years ago |
Taylor Yu | 1301bebc09 | 2 years ago |
Taylor Yu | d16f2c93b8 | 2 years ago |
Jesse Vincent | becf816dbe | 2 years ago |
Taylor Yu | af3dc61710 | 2 years ago |
Jesse Vincent | 35aa03b63d | 2 years ago |
Taylor Yu | 4a030ae7e8 | 2 years ago |
Taylor Yu | cf66803288 | 2 years ago |
Jesse Vincent | 8f3fab579b | 2 years ago |
Gergely Nagy | b114110645 | 2 years ago |
Gergely Nagy | e52cf5c821 | 2 years ago |
Jesse Vincent | f5639dd5ba | 2 years ago |
Gergely Nagy | 9d0dddb79a | 2 years ago |
Jesse Vincent | 51b272e598 | 2 years ago |
Tatsuhiko Miyagawa | 1e36ab17a6 | 2 years ago |
Jesse Vincent | 9d374292ba | 2 years ago |
Gergely Nagy | 9b9911bdb5 | 2 years ago |
Gergely Nagy | dde7caeee9 | 2 years ago |
Gergely Polonkai | d794035f6c | 2 years ago |
Jesse Vincent | 4087f43534 | 2 years ago |
Gergely Nagy | 6fd2fa153b | 2 years ago |
Jesse Vincent | bc0466aa22 | 2 years ago |
Gergely Nagy | 2a902e9b74 | 2 years ago |
Jesse Vincent | d12515105f | 2 years ago |
Gergely Nagy | b243b0c1c5 | 2 years ago |
Gergely Nagy | da024d6bf9 | 2 years ago |
Gergely Nagy | b5f0fc5ec9 | 2 years ago |
@ -1,24 +0,0 @@
|
||||
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,63 @@
|
||||
#!/usr/bin/env bash
|
||||
# focus-send - Trivial Focus testing tool
|
||||
# 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, 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/>.
|
||||
|
||||
set -e
|
||||
|
||||
OS=$(uname -s)
|
||||
|
||||
# igncr absorbs CR from Focus CRLF line endings
|
||||
# -echo is needed because raw doesn't turn it off on Linux
|
||||
STTY_ARGS="9600 raw igncr -echo"
|
||||
|
||||
case ${OS} in
|
||||
Linux)
|
||||
DEVICE="${DEVICE:-/dev/ttyACM0}"
|
||||
;;
|
||||
Darwin)
|
||||
# bash on macOS has a bug that randomly drops serial input
|
||||
if [ -n "$BASH_VERSION" ] && [ -x /bin/dash ]; then
|
||||
# Prevent loop in case someone exported it
|
||||
export -n BASH_VERSION
|
||||
exec /bin/dash "$0" "$@"
|
||||
fi
|
||||
DEVICE="${DEVICE:-/dev/cu.usbmodemCkbio01E}"
|
||||
;;
|
||||
*)
|
||||
echo "Error Unknown OS : ${OS}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Redirect prior to running stty, because macOS sometimes resets termios
|
||||
# state upon last close of a terminal device.
|
||||
exec < "${DEVICE}"
|
||||
# shellcheck disable=SC2086 # intentional word splitting
|
||||
stty $STTY_ARGS
|
||||
|
||||
read_reply () {
|
||||
while read -r line; do
|
||||
if [ "${line}" = "." ]; then
|
||||
break
|
||||
fi
|
||||
echo "${line}"
|
||||
done
|
||||
}
|
||||
|
||||
# Flush any invalid commands out of input buffer.
|
||||
# This could happen after a failed upload.
|
||||
echo ' ' > "${DEVICE}"
|
||||
read_reply > /dev/null
|
||||
echo "$@" >"${DEVICE}"
|
||||
read_reply
|
@ -1,45 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# focus-test - Trivial Focus testing tool
|
||||
# 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, 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/>.
|
||||
|
||||
set -e
|
||||
|
||||
OS=$(uname -s)
|
||||
|
||||
case ${OS} in
|
||||
Linux)
|
||||
DEVICE="${DEVICE:-/dev/ttyACM0}"
|
||||
stty -F "${DEVICE}" 9600 raw -echo
|
||||
;;
|
||||
Darwin)
|
||||
DEVICE="${DEVICE:-/dev/cu.usbmodemCkbio01E}"
|
||||
stty -f "${DEVICE}" 9600 raw -echo
|
||||
;;
|
||||
*)
|
||||
echo "Error Unknown OS : ${OS}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
exec 3<"${DEVICE}"
|
||||
echo "$@" >"${DEVICE}"
|
||||
|
||||
while read -r line <&3; do
|
||||
line="$(echo -n "${line}" | tr -d '\r')"
|
||||
if [ "${line}" == "." ]; then
|
||||
break
|
||||
fi
|
||||
echo "${line}"
|
||||
done
|
@ -1,107 +0,0 @@
|
||||
# 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
|
@ -0,0 +1,57 @@
|
||||
/* -*- 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,6 +1,8 @@
|
||||
# This makefile for a Kaleidoscope sketch pulls in all the targets
|
||||
# required to build the example
|
||||
|
||||
# Compile without deprecated code to save space
|
||||
LOCAL_CFLAGS ?= -DNDEPRECATED -DONESHOT_WITHOUT_METASTICKY
|
||||
|
||||
|
||||
|
@ -0,0 +1,59 @@
|
||||
/* -*- 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,36 @@
|
||||
# FirmwareVersion
|
||||
|
||||
Implements a new focus command - version - that simply prints the version set up
|
||||
at compile time.
|
||||
|
||||
## Using the plugin
|
||||
|
||||
To use the plugin, first define the version to be printed, then include the
|
||||
header, and activate the plugin.
|
||||
|
||||
```c++
|
||||
#define KALEIDOSCOPE_FIRMWARE_VERSION "0.1.2"
|
||||
|
||||
#include <Kaleidoscope.h>
|
||||
#include <Kaleidoscope-FirmwareVersion.h>
|
||||
#include <Kaleidoscope-FocusSerial.h>
|
||||
|
||||
KALEIDOSCOPE_INIT_PLUGINS(Focus,
|
||||
FirmwareVersion);
|
||||
|
||||
void setup () {
|
||||
Kaleidoscope.setup ();
|
||||
}
|
||||
```
|
||||
|
||||
## Focus commands
|
||||
|
||||
The plugin provides a single Focus command: `version`.
|
||||
|
||||
### `version`
|
||||
|
||||
> Prints the version configured at build time.
|
||||
|
||||
## Dependencies
|
||||
|
||||
* [Kaleidoscope-FocusSerial](Kaleidoscope-FocusSerial.md)
|
@ -0,0 +1,7 @@
|
||||
name=Kaleidoscope-FirmwareVersion
|
||||
version=0.0.0
|
||||
sentence=Provides a Focus command to print a preconfigured version
|
||||
maintainer=Kaleidoscope's Developers <jesse@keyboard.io>
|
||||
url=https://github.com/keyboardio/Kaleidoscope
|
||||
author=Keyboardio
|
||||
paragraph=
|
@ -0,0 +1,20 @@
|
||||
/* -*- mode: c++ -*-
|
||||
* Kaleidoscope-FirmwareVersion -- Provides a Focus command to print a version
|
||||
* Copyright (C) 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, 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "kaleidoscope/plugin/FirmwareVersion.h" // IWYU pragma: export
|
@ -0,0 +1,56 @@
|
||||
/* -*- mode: c++ -*-
|
||||
* Kaleidoscope-FirmwareVersion -- Provides a Focus command to print a version
|
||||
* Copyright (C) 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, 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef KALEIDOSCOPE_FIRMWARE_VERSION
|
||||
#define KALEIDOSCOPE_FIRMWARE_VERSION "0.0.0"
|
||||
#endif
|
||||
|
||||
#include <Arduino.h> // for PSTR, F, __FlashStringHelper
|
||||
#include "Kaleidoscope-FocusSerial.h" // for Focus, FocusSerial
|
||||
#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult
|
||||
#include "kaleidoscope/plugin.h" // for Plugin
|
||||
|
||||
namespace kaleidoscope {
|
||||
namespace plugin {
|
||||
|
||||
class FirmwareVersion : public Plugin {
|
||||
public:
|
||||
EventHandlerResult onFocusEvent(const char *input) {
|
||||
const char *cmd_version = PSTR("version");
|
||||
|
||||
if (::Focus.inputMatchesHelp(input))
|
||||
return ::Focus.printHelp(cmd_version);
|
||||
|
||||
if (!::Focus.inputMatchesCommand(input, cmd_version))
|
||||
return EventHandlerResult::OK;
|
||||
|
||||
#ifdef KALEIDOSCOPE_FIRMWARE_VERSION
|
||||
::Focus.send(F(KALEIDOSCOPE_FIRMWARE_VERSION));
|
||||
#else
|
||||
::Focus.send(F("0.0.0"));
|
||||
#endif
|
||||
|
||||
return EventHandlerResult::OK;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace plugin
|
||||
} // namespace kaleidoscope
|
||||
|
||||
kaleidoscope::plugin::FirmwareVersion FirmwareVersion;
|
@ -1,153 +0,0 @@
|
||||
/* -*- 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();
|
||||
}
|
@ -1,275 +0,0 @@
|
||||
/* -*- 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();
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
# LayerNames
|
||||
|
||||
This plugin provides a [Focus][plugin:focus]-based interface for storing custom
|
||||
layer names, to be used by software such as [Chrysalis][chrysalis]. The firmware
|
||||
itself does nothing with the layer names, it is purely for use by applications
|
||||
on the host side.
|
||||
|
||||
[chrysalis]: https://github.com/keyboardio/Chrysalis
|
||||
|
||||
## Using the plugin
|
||||
|
||||
To use the plugin, we need to include the header, initialize the plugin with
|
||||
`KALEIDOSCOPE_INIT_PLUGINS()`, and reserve storage space for the names. This is
|
||||
best illustrated with an example:
|
||||
|
||||
```c++
|
||||
#include <Kaleidoscope.h>
|
||||
#include <Kaleidoscope-EEPROMSettings.h>
|
||||
#include <Kaleidoscope-FocusSerial.h>
|
||||
#include <Kaleidoscope-LayerNames.h>
|
||||
|
||||
KALEIDOSCOPE_INIT_PLUGINS(
|
||||
EEPROMSettings,
|
||||
Focus,
|
||||
LayerNames
|
||||
);
|
||||
|
||||
void setup() {
|
||||
Kaleidoscope.setup();
|
||||
|
||||
LayerNames.reserve_storage(128);
|
||||
}
|
||||
```
|
||||
|
||||
## Plugin methods
|
||||
|
||||
The plugin provides a `LayerNames` object, with the following method available:
|
||||
|
||||
### `.reserve_storage(size)`
|
||||
|
||||
> Reserves `size` bytes of storage for layer names. This must be called from the
|
||||
> `setup()` method of your sketch.
|
||||
|
||||
## Focus commands
|
||||
|
||||
The plugin provides a single Focus command: `keymap.layerNames`.
|
||||
|
||||
### `keymap.layerNames [name_length name]...`
|
||||
|
||||
> Without arguments, displays all the stored layer names. Each layer is printed
|
||||
> on its own line, preceded by its length. At the end, the plugin will also
|
||||
> print an extra line with a name length of zero, followed by the string
|
||||
> "size=", and then the total size of the storage reserved for layer names.
|
||||
>
|
||||
> To set custom names, a list of length & name pairs must be given. The plugin
|
||||
> stops processing arguments when it encounters a name length of 0.
|
||||
|
||||
#### Example
|
||||
|
||||
```
|
||||
> keymap.layerNames
|
||||
< 6 Qwerty
|
||||
< 6 Numpad
|
||||
< 8 Function
|
||||
< 0 size=128
|
||||
< .
|
||||
|
||||
> keymap.layerNames 6 Dvorak 6 Numpad 8 Function 0
|
||||
< .
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
* [Kaleidoscope-EEPROM-Settings](Kaleidoscope-EEPROM-Settings.md)
|
||||
* [Kaleidoscope-FocusSerial](Kaleidoscope-FocusSerial.md)
|
@ -0,0 +1,7 @@
|
||||
name=Kaleidoscope-LayerNames
|
||||
version=0.0.0
|
||||
sentence=Kaleidoscope plugin that lets one set custom layer names
|
||||
maintainer=Kaleidoscope's Developers <jesse@keyboard.io>
|
||||
url=https://github.com/keyboardio/Kaleidoscope
|
||||
author=Keyboardio
|
||||
paragraph=
|
@ -0,0 +1,19 @@
|
||||
/* Kaleidoscope - Firmware for computer input devices
|
||||
* Copyright (C) 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, 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "kaleidoscope/plugin/LayerNames.h" // IWYU pragma: export
|
@ -0,0 +1,98 @@
|
||||
/* Kaleidoscope - Firmware for computer input devices
|
||||
* Copyright (C) 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, 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/>.
|
||||
*/
|
||||
|
||||
#include "kaleidoscope/plugin/LayerNames.h"
|
||||
|
||||
#include <Arduino.h> // for delay, PSTR, F, __FlashStri...
|
||||
#include <Kaleidoscope-FocusSerial.h> // for Focus, FocusSerial
|
||||
|
||||
#include "kaleidoscope/Runtime.h" // for Runtime, Runtime_
|
||||
#include "kaleidoscope/plugin/EEPROM-Settings.h" // for EEPROMSettings
|
||||
|
||||
namespace kaleidoscope {
|
||||
namespace plugin {
|
||||
|
||||
// =============================================================================
|
||||
|
||||
EventHandlerResult LayerNames::onNameQuery() {
|
||||
return ::Focus.sendName(F("LayerNames"));
|
||||
}
|
||||
|
||||
EventHandlerResult LayerNames::onFocusEvent(const char *input) {
|
||||
const char *cmd_layerNames = PSTR("keymap.layerNames");
|
||||
|
||||
if (::Focus.inputMatchesHelp(input))
|
||||
return ::Focus.printHelp(cmd_layerNames);
|
||||
|
||||
if (!::Focus.inputMatchesCommand(input, cmd_layerNames))
|
||||
return EventHandlerResult::OK;
|
||||
|
||||
if (::Focus.isEOL()) {
|
||||
uint16_t pos = 0;
|
||||
while (pos < storage_size_) {
|
||||
uint8_t name_size = Runtime.storage().read(storage_base_ + pos++);
|
||||
|
||||
if (name_size == 0 || name_size == 255) break;
|
||||
|
||||
::Focus.send(name_size);
|
||||
|
||||
for (uint8_t i = 0; i < name_size; i++) {
|
||||
uint8_t b = Runtime.storage().read(storage_base_ + pos++);
|
||||
::Focus.sendRaw(static_cast<char>(b));
|
||||
}
|
||||
::Focus.sendRaw(::Focus.NEWLINE);
|
||||
}
|
||||
::Focus.sendRaw(0, ::Focus.SEPARATOR, F("size="), storage_size_);
|
||||
} else {
|
||||
uint16_t pos = 0;
|
||||
|
||||
while (pos < storage_size_) {
|
||||
uint8_t name_size;
|
||||
::Focus.read(name_size);
|
||||
|
||||
// size is followed by a space, ignore that.
|
||||
char spc;
|
||||
::Focus.read(spc);
|
||||
|
||||
Runtime.storage().update(storage_base_ + pos++, name_size);
|
||||
|
||||
if (name_size == 0 ||
|
||||
name_size == ::EEPROMSettings.EEPROM_UNINITIALIZED_BYTE)
|
||||
break;
|
||||
|
||||
for (uint8_t i = 0; i < name_size; i++) {
|
||||
char c;
|
||||
::Focus.read(c);
|
||||
|
||||
Runtime.storage().update(storage_base_ + pos++, c);
|
||||
}
|
||||
}
|
||||
Runtime.storage().commit();
|
||||
}
|
||||
|
||||
return EventHandlerResult::EVENT_CONSUMED;
|
||||
}
|
||||
|
||||
// public
|
||||
void LayerNames::reserve_storage(uint16_t size) {
|
||||
storage_base_ = ::EEPROMSettings.requestSlice(size);
|
||||
storage_size_ = size;
|
||||
}
|
||||
|
||||
} // namespace plugin
|
||||
} // namespace kaleidoscope
|
||||
|
||||
kaleidoscope::plugin::LayerNames LayerNames;
|
@ -0,0 +1,42 @@
|
||||
/* Kaleidoscope - Firmware for computer input devices
|
||||
* Copyright (C) 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, 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h> // for uint16_t, uint8_t
|
||||
|
||||
#include "kaleidoscope/event_handler_result.h" // for EventHandlerResult
|
||||
#include "kaleidoscope/plugin.h" // for Plugin
|
||||
|
||||
namespace kaleidoscope {
|
||||
namespace plugin {
|
||||
|
||||
class LayerNames : public kaleidoscope::Plugin {
|
||||
public:
|
||||
EventHandlerResult onNameQuery();
|
||||
EventHandlerResult onFocusEvent(const char *input);
|
||||
|
||||
void reserve_storage(uint16_t size);
|
||||
|
||||
private:
|
||||
uint16_t storage_base_;
|
||||
uint16_t storage_size_;
|
||||
};
|
||||
|
||||
} // namespace plugin
|
||||
} // namespace kaleidoscope
|
||||
|
||||
extern kaleidoscope::plugin::LayerNames LayerNames;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue