Compare commits

...

70 Commits

Author SHA1 Message Date
3991994177 minor tweak 2025-05-27 08:49:27 -07:00
6bfd7c5f12 added game layout 2025-05-27 08:49:16 -07:00
fab75ada44 Voyager tweaks 2024-11-14 21:38:25 -08:00
a36926391a Minor edits 2024-08-23 09:43:24 -07:00
41b6c60810 Added basic russian map 2024-01-29 11:34:03 -08:00
2845481490 Minor changes 2024-01-22 12:25:50 -08:00
08f3cee0a7 Added horizon layout 2024-01-15 10:40:12 -08:00
e6318b045d Added a few macros 2024-01-12 10:54:16 -08:00
741d87e0a8 Minor edits 2024-01-12 10:54:05 -08:00
e0d54f8e79 Minor cleanup 2023-12-31 10:29:30 -08:00
0856908bec Added voyager code 2023-12-31 10:28:51 -08:00
1067fcc4b5 Updated to QMK 0.23.1 2023-12-19 12:04:38 -08:00
7cb29a6bba Cleanup 2023-12-19 09:03:31 -08:00
87029d00c1 Timing change 2023-12-19 09:03:08 -08:00
e3e82a1109 Added short-circuit leader key 2023-12-19 08:34:06 -08:00
ae7c2b9534 Minor edit 2023-12-17 17:03:28 -08:00
19b4ddfce9 Edited keymaps 2023-12-16 12:27:53 -08:00
80276758fd Build system cleanup 2023-12-16 11:21:51 -08:00
c0c1312a6b Added one-handed layers 2023-12-13 17:46:21 -08:00
7f1253abe7 Keybind ergonomics 2023-10-10 11:26:41 -07:00
1eac64a26f Added binds for tag navigation 2023-10-10 11:21:37 -07:00
46cf1032b9 Tweaked leader sequences 2023-10-10 11:06:39 -07:00
dd94895986 Whitespace 2023-10-10 11:06:26 -07:00
a98c750a27 Keymap cleanup 2023-10-10 11:05:32 -07:00
461050a2ca Fixed mapping 2023-03-06 21:58:47 -08:00
9fb112feb1 Updated README 2022-12-27 13:37:44 -08:00
18596b85e9 Bump to latest QMK, cleanup 2022-12-27 13:22:07 -08:00
5165e637e7 Meta files 2022-12-27 13:21:54 -08:00
2bf3317bf5 Meta files 2022-12-27 13:20:23 -08:00
0d99adf288 Added docker build environment 2022-12-27 13:15:52 -08:00
254c0f8de0 Moved desktop layer key 2022-12-03 23:31:26 -08:00
b20b5b1271 Cleanup 2022-12-03 23:05:46 -08:00
d132a5951a Added plain keymap 2022-12-03 23:05:33 -08:00
f4a7960eed Added autocorrect feature 2022-11-20 20:45:36 -08:00
afa07ce83c Cleanup 2022-11-20 20:45:13 -08:00
d795d84f41 Minor cleanup 2022-11-20 12:05:11 -08:00
6f60ddc9cf Updated README 2022-11-18 23:49:08 -08:00
1c213ed8da Comments 2022-11-18 23:34:12 -08:00
065ab5b166 Fixed weird characters 2022-11-18 23:33:26 -08:00
7082172bc4 Reworked build system 2022-11-18 23:33:15 -08:00
6e84592338 Added another email 2022-11-03 10:58:52 -07:00
b951674cd9 Added alternative email 2022-09-16 10:21:18 -07:00
779965ff33 Added special char cmd 2022-08-10 09:11:09 -07:00
2545f15b30 Cleaned up tapdance code 2022-08-03 07:41:21 -07:00
7fe192e4b3 Cleaned up tapdance code + added screenshot tapdance 2022-08-02 19:14:32 -07:00
7004285fd7 Added screenshot keybind 2022-08-01 15:02:38 -07:00
bf6faeb94f Improved spellcheck sending 2022-07-21 21:20:16 -07:00
c757a1686c Added keycode type checkers to spellcheck 2022-07-21 20:01:49 -07:00
7be80e97fd Fixed a typo 2022-07-21 19:44:13 -07:00
7835772425 Removed extra code 2022-07-21 18:16:23 -07:00
e6cc6bfa10 Minor cleanup 2022-07-21 17:49:35 -07:00
4cb3fe0ee9 Moved spellcheck and rawhid to kb folder 2022-07-21 17:21:40 -07:00
584b39f4c2 Fixed a keybind 2022-07-21 14:16:06 -07:00
9fef820caf Removed extra files 2022-07-21 14:11:10 -07:00
417abd2697 Removed extra code 2022-07-21 14:10:07 -07:00
c5003d5104 Added HID layer state and keymap.
Closes #3
2022-07-21 14:09:50 -07:00
2d7b6544fc Increased animation fps 2022-07-20 21:19:31 -07:00
ad63cbabc6 Whitespace 2022-07-20 21:19:20 -07:00
7a2ac34a23 Added basic spellcheck code 2022-07-20 21:19:13 -07:00
12e65bf02b Cleaned up README 2022-07-20 21:12:32 -07:00
86585658e3 Removed deprecated config options and disabled fft 2022-07-20 20:08:03 -07:00
900d9a5d1d Fixed layer order 2022-07-20 19:09:10 -07:00
a4759176b1 Removed keyboard ascii art 2022-07-19 08:45:42 -07:00
092fdc64ba Added editorconfig 2022-07-19 08:45:26 -07:00
fab3cef86d Defined layers with macros and rearranged code
Closes: #2
2022-07-19 08:45:18 -07:00
225f89c91f Keybinds 2022-07-18 11:34:16 -07:00
2ccfa47ce6 Keybinds... 2022-07-18 11:02:19 -07:00
99e8360c5f Changed a few binds 2022-07-18 10:57:57 -07:00
27bbf48cba Added leader key 2022-07-18 10:37:48 -07:00
eec4251201 Fixed a few binds 2022-07-18 10:16:03 -07:00
106 changed files with 6006 additions and 2451 deletions

14
.editorconfig Normal file
View File

@ -0,0 +1,14 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
indent_style = tab
indent_size = 4
tab_width = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false

10
.gitignore vendored
View File

@ -1,3 +1,7 @@
/venv
/build
qmk/qmk.conf
# The docker container places firmware
# in this directory
output
# Secret information that shouldn't be
# added to git.
secrets.h

12
.gitmodules vendored
View File

@ -1,10 +1,6 @@
[submodule "qmk/qmk_fw"]
path = qmk/qmk_fw
url = ssh://git@git.betalupi.com:33/mirrors-QMK/qmk_firmware.git
[submodule "qmk/qmk_cli"]
path = qmk/qmk_cli
url = ssh://git@git.betalupi.com:33/mirrors-QMK/qmk_cli.git
[submodule "qmk_cli"]
[submodule "docker/qmk_cli"]
path = docker/qmk_cli
url = ssh://git@git.betalupi.com:33/QMK/qmk_cli.git
[submodule "qmk_fw"]
[submodule "docker/qmk_firmware"]
path = docker/qmk_firmware
url = ssh://git@git.betalupi.com:33/QMK/qmk_firmware.git

26
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,26 @@
{
//"files.exclude": {
// "**/.build": true,
// "**/*.hex": true,
// "**/*.bin": true,
// "**/*.uf2": true
//},
"files.associations": {
"*.h": "c",
"*.c": "c",
"*.inc": "c",
"*.cpp": "cpp",
"*.hpp": "cpp",
"xstddef": "c",
"type_traits": "c",
"utility": "c",
"ranges": "c",
"compare": "c",
"cstdint": "c",
"chrono": "c",
"typeindex": "c",
"typeinfo": "c",
"unordered_map": "c"
},
"C_Cpp.errorSquiggles": "disabled",
}

101
Makefile Normal file → Executable file
View File

@ -1,85 +1,28 @@
QMK_REPO := ssh://git@git.betalupi.com:33/Mark/qmk_betalupi.git
all: voyager ergodox
# QMK command
QMK_CONF := $(shell pwd)/qmk/qmk.conf
QMK := qmk --config-file $(QMK_CONF)
voyager:
@mkdir -p "$$(pwd)/output"
docker run -it --rm \
--user $$(id -u):$$(id -g) \
-v "$$(pwd)/output:/build_output" \
-v "$$(pwd)/keyboards:/qmk_firmware/keyboards:ro" \
-e QMK_TARGET="betalupi_voyager:default" \
git.betalupi.com/mark/qmk
# Where to create venv
VENV := $(shell pwd)/venv
ergodox:
@mkdir -p "$$(pwd)/output"
docker run -it --rm \
--user $$(id -u):$$(id -g) \
-v "$$(pwd)/output:/build_output" \
-v "$$(pwd)/keyboards:/qmk_firmware/keyboards:ro" \
-e QMK_TARGET="betalupi_ergodox:default" \
git.betalupi.com/mark/qmk
# Where to build firmware
BUILD_DIR := $(shell pwd)/build
ergodox_upload:
wally-cli output/betalupi_ergodox_default.hex
# Path to submodules
QMK_CLI := $(shell pwd)/qmk/qmk_cli
QMK_DIR := $(shell pwd)/qmk/qmk_fw
docker:
docker build docker -t git.betalupi.com/mark/qmk
.PHONY: git-submodule
git-submodule:
@git submodule sync --recursive
@git submodule update --init --recursive --progress
@echo ""
# Link keyboards into qmk_fw
KEYBOARDS := $(notdir $(shell find keyboards -maxdepth 1 -mindepth 1 -type d))
.PHONY: $(KEYBOARDS)
$(KEYBOARDS):
@echo "Linking keyboards into $(QMK_DIR)/keyboards..."
@ln -sT \
$(shell pwd)/keyboards/$@ \
$(QMK_DIR)/keyboards/$@
@echo ""
# Clone all repos and configure qmk
.PHONY: setup
setup: git-submodule $(KEYBOARDS)
@echo "Preparing venv..."
@python -m venv $(VENV) --prompt=qmk_venv
@echo "Building and installing qmk_cli"
@source $(VENV)/bin/activate && \
cd $(QMK_CLI) && \
python3 -m pip install build --quiet && \
python3 -m build > /dev/null && \
python3 -m pip install $$(find dist -name 'qmk-*.tar.gz') --quiet
@echo ""
@echo ""
@source $(VENV)/bin/activate && \
$(QMK) config user.qmk_home=$(QMK_DIR) && \
$(QMK) doctor
# Undo all changes done in setup
.PHONY: unsetup
unsetup:
-rm -drf $(VENV) $(BUILD_DIR)
-rm $(QMK_CONF)
-rm -dr $(QMK_CLI)/dist $(QMK_CLI)/qmk.egg-info
-rm $(KEYBOARDS:%=$(QMK_DIR)/keyboards/%)
# Compile and flash a keyboard
.PHONY: flash
flash:
@source $(VENV)/bin/activate && \
$(QMK) flash \
-e AVR_CFLAGS="-Wno-array-bounds" \
-e BUILD_DIR=$(BUILD_DIR) \
-kb betalupi_ergodox \
-km default
# Compile and flash a keyboard
.PHONY: comp-db
comp-db:
@source $(VENV)/bin/activate && \
$(QMK) generate-compilation-database \
-kb betalupi_ergodox \
-km default
.PHONY: voyager ergodox ergodox_upload docker all

View File

@ -1,34 +1,15 @@
# Betalupi QMK environment
This repository contains everything required to build qmk firmware.
This repository contains my keyboards' firmware and everything you need to build it. It includes a docker container for building QMK firmware, since QMK installation modifies my computer a bit more than I'd like.
### TODO
- **Core:**
- Better build/flash command
- Warning when directory is moved
- **Keyboard:**
- Random FFT animation
- Clear leds on sleep (fft anim)
## Usage
-------------------------------------------------
You do not need a local install of QMK to build this firmware.
You'll need docker, but there's a good chance you have that installed anyway.
## Setup
To initialize the build environment, run `make setup`. This does a few things:
- Updates all submodules
- Symlinks all directories in `keyboards` into `qmk/qmk_fm/keyboards`
- Creates a python virtualenv in `venv`
- Builds and installs `qmk/qmk_cli` into that venv
- Creates a QMK config file in `qmk/qmk.conf`
- Runs `qmk doctor` to make sure everything worked.
Once `make setup` has been run, this directory (or its parents) CANNOT BE RENAMED OR MOVED!
If you want to move this directory, run `make unsetup`, then run `make setup` again. No data should be lost.
## Using QMK
Run `make flash` to build and flash firmware. If you want to execute qmk manually, activate the virtualenv and use `./qmk.sh`.
1. `make docker`
2. `make`
3. `make upload`
Read [`Makefile`](./Makefile) for details.

77
docker/Dockerfile Normal file
View File

@ -0,0 +1,77 @@
## Build qmk-cli
FROM python:3.8-slim-buster AS qmk_cli_builder
WORKDIR /app
COPY qmk_cli .
RUN pip3 install build
RUN python3 -m build
## Base container
FROM debian:11-slim
# Install dependencies
RUN apt-get update && \
apt-get install --no-install-recommends -y \
avrdude \
binutils-arm-none-eabi \
binutils-riscv64-unknown-elf \
build-essential \
ca-certificates \
clang-format-11 \
dfu-programmer \
dfu-util \
dos2unix \
ca-certificates \
gcc \
gcc-arm-none-eabi \
gcc-riscv64-unknown-elf \
git \
libfl2 \
libnewlib-arm-none-eabi \
picolibc-riscv64-unknown-elf \
python3 \
python3-pip \
software-properties-common \
tar \
teensy-loader-cli \
unzip \
tar \
wget \
zip \
&& rm -rf /var/lib/apt/lists/*
# Install python packages
RUN python3 -m pip install --upgrade \
pip \
setuptools \
wheel \
nose2 \
yapf
# upgrade avr-gcc... for reasons?
RUN /bin/bash -c "set -o pipefail && \
wget -q https://github.com/ZakKemble/avr-gcc-build/releases/download/v8.3.0-1/avr-gcc-8.3.0-x64-linux.tar.bz2 -O - | tee /tmp/asdf.tar.bz2 | md5sum -c <(echo '588D0BEA4C5D21A1A06AA17625684417 -') && \
tar xfj /tmp/asdf.tar.bz2 --strip-components=1 -C / && \
rm -rf /share/ /tmp/*"
# Install qmk-cli
COPY --from=qmk_cli_builder /app/dist /tmp/dist
RUN python3 -m pip install /tmp/dist/qmk-*.whl && \
rm -rf /tmp/dist
# Copy qmk repo.
# Make sure you've pulled submodules first!
COPY qmk_firmware /qmk_firmware
RUN chmod -R 777 /qmk_firmware
VOLUME /qmk_firmware/keyboards
VOLUME /build_output
WORKDIR /qmk_firmware
ENV SKIP_GIT true
COPY entrypoint.sh /entrypoint.sh
CMD ["/bin/bash", "/entrypoint.sh"]

25
docker/README.md Normal file
View File

@ -0,0 +1,25 @@
# QMK Build Container
This container contains everything you need to build QMK, including a pinned version of QMK itself. **Be careful, this container may not use the latest version of QMK.**
## Usage
This container takes two volumes:
- `/build_output`: QMK binaries are copied here.
- `/qmk_firmware/keyboards`: QMK keyboard dir. Link this to your code.
```bash
docker run -it \
--user $(id -u):$(id -g) \
-v "$(pwd)/output:/build_output" \
-v "$(pwd)/kb:/qmk_firmware/keyboards:ro" \
-e QMK_TARGET="betalupi_ergodox:default" \
git.betalupi.com/mark/qmk
```
## Building
1. Before building, run `git submodule update --init --recursive`.
- Note that the submodules in this repo are linked to my local mirrors for speed. You'll probably need to update `qmk_cli` and `qmk_firmware` with github links.
2. Checkout whatever version of `qmk_firmware` you need (optional).
3. Run `docker build . -t git.betalupi.com/mark/qmk`

14
docker/entrypoint.sh Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
if [[ -z "$QMK_TARGET" ]]; then
echo "You must provide a target to build!" 1>&2
exit 1
fi
make $QMK_TARGET
# Move output files to output directory.
# These are the only extensions qmk can produce,
# as far as I know.
mv *.{bin,hex,uf2} /build_output > /dev/null 2>&1
exit 0

1
docker/qmk_cli Submodule

Submodule docker/qmk_cli added at aecd02e850

1
docker/qmk_firmware Submodule

Submodule docker/qmk_firmware added at 0f341dfdd3

View File

@ -1,5 +1,8 @@
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
#ifndef DISABLE_RGB_MATRIX_FFT_ANIM
#ifndef RGB_MATRIX_FRAMEBUFFER_EFFECTS
#undef ENABLE_RGB_MATRIX_FFT_ANIM
#endif
#ifdef ENABLE_RGB_MATRIX_FFT_ANIM
RGB_MATRIX_EFFECT(FFT_ANIM)
#ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
@ -54,4 +57,3 @@ bool FFT_ANIM(effect_params_t* params) {
#endif
#endif
#endif

View File

@ -1,25 +1,5 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com>
Copyright 2015 ZSA Technology Labs Inc (@zsa)
Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna)
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, see <http://www.gnu.org/licenses/>.
*/
#include "betalupi_ergodox.h"
#include "rawhid.h"
#include "features/beta_rawhid.h"
extern inline void ergodox_board_led_on(void);
extern inline void ergodox_right_led_1_on(void);
@ -66,6 +46,7 @@ void matrix_init_kb(void) {
PORTE |= (1<<6);
keyboard_config.raw = eeconfig_read_kb();
#ifdef RGB_MATRIX_ENABLE
if (keyboard_config.rgb_matrix_enable) {
rgb_matrix_set_flags(LED_FLAG_ALL);
@ -75,7 +56,6 @@ void matrix_init_kb(void) {
#endif
ergodox_blink_all_leds();
matrix_init_user();
}
@ -144,139 +124,6 @@ out:
}
#ifdef SWAP_HANDS_ENABLE
__attribute__ ((weak))
// swap-hands action needs a matrix to define the swap
const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
/* Left hand, matrix positions */
{{0,13}, {1,13}, {2,13}, {3,13}, {4,13}, {5,13}},
{{0,12}, {1,12}, {2,12}, {3,12}, {4,12}, {5,12}},
{{0,11}, {1,11}, {2,11}, {3,11}, {4,11}, {5,11}},
{{0,10}, {1,10}, {2,10}, {3,10}, {4,10}, {5,10}},
{{0,9}, {1,9}, {2,9}, {3,9}, {4,9}, {5,9}},
{{0,8}, {1,8}, {2,8}, {3,8}, {4,8}, {5,8}},
{{0,7}, {1,7}, {2,7}, {3,7}, {4,7}, {5,7}},
/* Right hand, matrix positions */
{{0,6}, {1,6}, {2,6}, {3,6}, {4,6}, {5,6}},
{{0,5}, {1,5}, {2,5}, {3,5}, {4,5}, {5,5}},
{{0,4}, {1,4}, {2,4}, {3,4}, {4,4}, {5,4}},
{{0,3}, {1,3}, {2,3}, {3,3}, {4,3}, {5,3}},
{{0,2}, {1,2}, {2,2}, {3,2}, {4,2}, {5,2}},
{{0,1}, {1,1}, {2,1}, {3,1}, {4,1}, {5,1}},
{{0,0}, {1,0}, {2,0}, {3,0}, {4,0}, {5,0}},
};
#endif
#ifdef RGB_MATRIX_ENABLE
void suspend_power_down_kb(void) {
rgb_matrix_set_suspend_state(true);
suspend_power_down_user();
}
void suspend_wakeup_init_kb(void) {
rgb_matrix_set_suspend_state(false);
suspend_wakeup_init_user();
}
const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
//{driver, R location, G location, B location}
{0, C3_1, C2_1, C4_1}, // LED1 on right
{0, C6_1, C5_1, C7_1}, // LED2
{0, C4_2, C3_2, C5_2}, // LED3
{0, C7_2, C6_2, C8_2}, // LED4
{0, C2_3, C1_3, C3_3}, // LED5
{0, C5_3, C4_3, C6_3}, // LED6
{0, C8_3, C7_3, C9_3}, // LED7
{0, C2_4, C1_4, C3_4}, // LED8
{0, C6_4, C5_4, C7_4}, // LED9
{0, C2_5, C1_5, C3_5}, // LED10
{0, C7_5, C6_5, C8_5}, // LED11
{0, C2_6, C1_6, C3_6}, // LED12
{0, C5_6, C4_6, C6_6}, // LED13
{0, C8_6, C7_6, C9_6}, // LED14
{0, C2_7, C1_7, C3_7}, // LED15
{0, C5_7, C4_7, C6_7}, // LED16
{0, C2_8, C1_8, C3_8}, // LED17
{0, C5_8, C4_8, C6_8}, // LED18
{0, C3_9, C2_9, C4_9}, // LED19
{0, C6_9, C5_9, C7_9}, // LED20
{0, C4_10, C3_10, C5_10}, // LED21
{0, C7_10, C6_10, C8_10}, // LED22
{0, C2_11, C1_11, C3_11}, // LED23
{0, C5_11, C4_11, C6_11}, // LED24
{1, C3_1, C2_1, C4_1}, // LED1 on left
{1, C6_1, C5_1, C7_1}, // LED2
{1, C4_2, C3_2, C5_2}, // LED3
{1, C7_2, C6_2, C8_2}, // LED4
{1, C2_3, C1_3, C3_3}, // LED5
{1, C5_3, C4_3, C6_3}, // LED6
{1, C8_3, C7_3, C9_3}, // LED7
{1, C2_4, C1_4, C3_4}, // LED8
{1, C6_4, C5_4, C7_4}, // LED9
{1, C2_5, C1_5, C3_5}, // LED10
{1, C7_5, C6_5, C8_5}, // LED11
{1, C2_6, C1_6, C3_6}, // LED12
{1, C5_6, C4_6, C6_6}, // LED13
{1, C8_6, C7_6, C9_6}, // LED14
{1, C2_7, C1_7, C3_7}, // LED15
{1, C5_7, C4_7, C6_7}, // LED16
{1, C2_8, C1_8, C3_8}, // LED17
{1, C5_8, C4_8, C6_8}, // LED18
{1, C3_9, C2_9, C4_9}, // LED19
{1, C6_9, C5_9, C7_9}, // LED20
{1, C4_10, C3_10, C5_10}, // LED21
{1, C7_10, C6_10, C8_10}, // LED22
{1, C2_11, C1_11, C3_11}, // LED23
{1, C5_11, C4_11, C6_11} // LED24
};
led_config_t g_led_config = { {
// Key matrix to LED index
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ 28, 33, 38, 43, 47, NO_LED },
{ 27, 32, 37, 42, 46, NO_LED },
{ 26, 31, 36, 41, 45, NO_LED },
{ 25, 30, 35, 40, 44, NO_LED },
{ 24, 29, 34, 39, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ 0, 5, 10, 15, NO_LED, NO_LED },
{ 1, 6, 11, 16, 20, NO_LED },
{ 2, 7, 12, 17, 21, NO_LED },
{ 3, 8, 13, 18, 22, NO_LED },
{ 4, 9, 14, 19, 23, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }
}, {
// LED index to physical position
{ 137, 0 }, { 154, 0 }, { 172, 0 }, { 189, 0 }, { 206, 0 }, { 137, 12 },
{ 154, 12 }, { 172, 12 }, { 189, 12 }, { 206, 12 }, { 137, 25 }, { 154, 25 },
{ 172, 25 }, { 189, 25 }, { 206, 25 }, { 137, 38 }, { 154, 38 }, { 172, 38 },
{ 189, 38 }, { 206, 38 }, { 154, 51 }, { 172, 51 }, { 189, 51 }, { 206, 51 },
{ 86, 0 }, { 68, 0 }, { 51, 0 }, { 34, 0 }, { 17, 0 }, { 86, 12 },
{ 68, 12 }, { 51, 12 }, { 34, 12 }, { 17, 12 }, { 86, 25 }, { 68, 25 },
{ 51, 25 }, { 34, 25 }, { 17, 25 }, { 86, 38 }, { 68, 38 }, { 51, 38 },
{ 34, 38 }, { 17, 38 }, { 68, 51 }, { 51, 51 }, { 34, 51 }, { 17, 51 }
}, {
// LED index to flag
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 1, 1, 1, 1,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 1, 1, 1, 1
} };
#endif
void keyboard_post_init_kb(void) {
// Start with matrix enabled
@ -295,188 +142,6 @@ void keyboard_post_init_kb(void) {
keyboard_post_init_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case LED_LEVEL:
if (record->event.pressed) {
keyboard_config.led_level++;
if (keyboard_config.led_level > 4) {
keyboard_config.led_level = 0;
}
ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 );
eeconfig_update_kb(keyboard_config.raw);
layer_state_set_kb(layer_state);
}
break;
#ifdef RGB_MATRIX_ENABLE
case TOGGLE_LAYER_COLOR:
if (record->event.pressed) {
keyboard_config.disable_layer_led ^= 1;
if (keyboard_config.disable_layer_led) {
rgb_matrix_set_color_all(0, 0, 0);
}
eeconfig_update_kb(keyboard_config.raw);
}
break;
case RGB_TOG:
if (record->event.pressed) {
switch (rgb_matrix_get_flags()) {
case LED_FLAG_ALL: {
rgb_matrix_set_flags(LED_FLAG_NONE);
keyboard_config.rgb_matrix_enable = false;
rgb_matrix_set_color_all(0, 0, 0);
}
break;
default: {
rgb_matrix_set_flags(LED_FLAG_ALL);
keyboard_config.rgb_matrix_enable = true;
}
break;
}
eeconfig_update_kb(keyboard_config.raw);
}
hid_send_state();
return false;
case RGB_MOD:
// Tell the host whenever we change animation mode.
hid_send_state();
return true;
#endif
// Custom RGBLIGHT macros
#ifdef RGBLIGHT_ENABLE
#ifdef RGBLIGHT_NO_EEPROM
case LIGHT_TOG:
if (record->event.pressed) {
rgblight_toggle_noeeprom();
}
break;
case LIGHT_MOD:
if (record->event.pressed) {
rgblight_step_noeeprom();
}
break;
case LIGHT_HUI:
if (record->event.pressed) {
rgblight_increase_hue_noeeprom();
}
break;
case LIGHT_HUD:
if (record->event.pressed) {
rgblight_decrease_hue_noeeprom();
}
break;
case LIGHT_SAI:
if (record->event.pressed) {
rgblight_increase_sat_noeeprom();
}
break;
case LIGHT_SAD:
if (record->event.pressed) {
rgblight_decrease_sat_noeeprom();
}
break;
case LIGHT_VAI:
if (record->event.pressed) {
rgblight_increase_val_noeeprom();
}
break;
case LIGHT_VAD:
if (record->event.pressed) {
rgblight_decrease_val_noeeprom();
}
break;
case LIGHT_SPI:
if (record->event.pressed) {
rgblight_increase_speed_noeeprom();
}
break;
case LIGHT_SPD:
if (record->event.pressed) {
rgblight_decrease_speed_noeeprom();
}
break;
#else
case LIGHT_TOG:
if (record->event.pressed) {
rgblight_toggle();
}
break;
case LIGHT_MOD:
if (record->event.pressed) {
rgblight_step();
}
break;
case LIGHT_HUI:
if (record->event.pressed) {
rgblight_increase_hue();
}
break;
case LIGHT_HUD:
if (record->event.pressed) {
rgblight_decrease_hue();
}
break;
case LIGHT_SAI:
if (record->event.pressed) {
rgblight_increase_sat();
}
break;
case LIGHT_SAD:
if (record->event.pressed) {
rgblight_decrease_sat();
}
break;
case LIGHT_VAI:
if (record->event.pressed) {
rgblight_increase_val();
}
break;
case LIGHT_VAD:
if (record->event.pressed) {
rgblight_decrease_val();
}
break;
case LIGHT_SPI:
if (record->event.pressed) {
rgblight_increase_speed();
}
break;
case LIGHT_SPD:
if (record->event.pressed) {
rgblight_decrease_speed();
}
break;
#endif
#endif
}
return process_record_user(keycode, record);
}
// EEPROM is getting reset!
void eeconfig_init_kb(void) {
keyboard_config.raw = 0;
@ -487,38 +152,17 @@ void eeconfig_init_kb(void) {
}
layer_state_t layer_state_set_kb(layer_state_t state) {
//uint8_t layer = biton32(state);
#ifdef DYNAMIC_MACRO_ENABLE
static bool is_dynamic_recording = false;
static uint16_t dynamic_loop_timer;
void dynamic_macro_record_start_user(void) {
is_dynamic_recording = true;
dynamic_loop_timer = timer_read();
ergodox_right_led_1_on();
}
void dynamic_macro_record_end_user(int8_t direction) {
is_dynamic_recording = false;
layer_state_set_user(layer_state);
}
#endif
hid_send_state(
.state = state
);
return layer_state_set_user(state);
};
void matrix_scan_kb(void) {
#ifdef DYNAMIC_MACRO_ENABLE
if (is_dynamic_recording) {
ergodox_right_led_1_off();
// if (timer_elapsed(dynamic_loop_timer) > 5)
{
static uint8_t counter;
counter++;
if (counter > 100) ergodox_right_led_1_on();
dynamic_loop_timer = timer_read();
}
}
#endif
#ifdef CAPS_LOCK_STATUS
led_t led_state = host_keyboard_led_state();

View File

@ -1,29 +1,10 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com>
Copyright 2015 ZSA Technology Labs Inc (@zsa)
Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna)
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, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
#include <stdint.h>
#include <stdbool.h>
#include "i2c_master.h"
#include "hardware/macros.h"
// I2C aliases and register addresses (see "mcp23018.md")
#define I2C_ADDR 0b0100000
@ -95,7 +76,7 @@ inline void ergodox_led_all_set(uint8_t n) {
ergodox_right_led_3_set(n);
}
enum ergodox_ez_keycodes {
enum betalupi_keycodes {
LED_LEVEL = SAFE_RANGE,
TOGGLE_LAYER_COLOR,
// Custom RGBLIGHT macros
@ -122,186 +103,3 @@ typedef union {
} keyboard_config_t;
extern keyboard_config_t keyboard_config;
// Turns {h, s, v} triples into a macro, so that
// the LEDS_ergodox macro can take them as inputs.
#define LC_HSV(h, s, v) {h, s, v}
// Rearrange a human-readable LED layout into the correct Ergodox order.
// LEDS_ergodox ONLY WORKS WITH MACROS.
// Don't input a standalone triple {h, s, v};
// Use LC_HSV if you need a single-instance color.
#define LEDS_ergodox( \
l01,l02,l03,l04,l05, \
l06,l07,l08,l09,l10, \
l11,l12,l13,l14,l15, \
l16,l17,l18,l19,l20, \
l21,l22,l23,l24, \
\
l25,l26,l27,l28,l29, \
l30,l31,l32,l33,l34, \
l35,l36,l37,l38,l39, \
l40,l41,l42,l43,l44, \
l45,l46,l47,l48 \
) \
{ \
l25,l26,l27,l28,l29, \
l30,l31,l32,l33,l34, \
l35,l36,l37,l38,l39, \
l40,l41,l42,l43,l44, \
l45,l46,l47,l48, \
\
l05,l04,l03,l02,l01, \
l10,l09,l08,l07,l06, \
l15,l14,l13,l12,l11, \
l20,l19,l18,l17,l16, \
l24,l23,l22,l21 \
}
/*
LEFT HAND: LINES 115-122
RIGHT HAND: LINES 124-131
*/
#define LAYOUT_ergodox( \
\
k00,k01,k02,k03,k04,k05,k06, \
k10,k11,k12,k13,k14,k15,k16, \
k20,k21,k22,k23,k24,k25, \
k30,k31,k32,k33,k34,k35,k36, \
k40,k41,k42,k43,k44, \
k55,k56, \
k54, \
k53,k52,k51, \
\
k07,k08,k09,k0A,k0B,k0C,k0D, \
k17,k18,k19,k1A,k1B,k1C,k1D, \
k28,k29,k2A,k2B,k2C,k2D, \
k37,k38,k39,k3A,k3B,k3C,k3D, \
k49,k4A,k4B,k4C,k4D, \
k57,k58, \
k59, \
k5C,k5B,k5A ) \
\
/* matrix positions */ \
{ \
{ k00, k10, k20, k30, k40, KC_NO }, \
{ k01, k11, k21, k31, k41, k51 }, \
{ k02, k12, k22, k32, k42, k52 }, \
{ k03, k13, k23, k33, k43, k53 }, \
{ k04, k14, k24, k34, k44, k54 }, \
{ k05, k15, k25, k35, KC_NO, k55 }, \
{ k06, k16, KC_NO, k36, KC_NO, k56 }, \
\
{ k07, k17, KC_NO, k37,KC_NO, k57 }, \
{ k08, k18, k28, k38,KC_NO, k58 }, \
{ k09, k19, k29, k39, k49, k59 }, \
{ k0A, k1A, k2A, k3A, k4A, k5A }, \
{ k0B, k1B, k2B, k3B, k4B, k5B }, \
{ k0C, k1C, k2C, k3C, k4C, k5C }, \
{ k0D, k1D, k2D, k3D, k4D, KC_NO } \
}
/*
LEFT HAND: LINES 158-165
RIGHT HAND: LINES 167-174
*/
#define LAYOUT_ergodox_80( \
\
k00,k01,k02,k03,k04,k05,k06, \
k10,k11,k12,k13,k14,k15,k16, \
k20,k21,k22,k23,k24,k25, \
k30,k31,k32,k33,k34,k35,k36, \
k40,k41,k42,k43,k44, \
k55,k56, \
k45,k46,k54, \
k53,k52,k51, \
\
k07,k08,k09,k0A,k0B,k0C,k0D, \
k17,k18,k19,k1A,k1B,k1C,k1D, \
k28,k29,k2A,k2B,k2C,k2D, \
k37,k38,k39,k3A,k3B,k3C,k3D, \
k49,k4A,k4B,k4C,k4D, \
k57,k58, \
k59,k47,k48, \
k5C,k5B,k5A ) \
\
/* matrix positions */ \
{ \
{ k00, k10, k20, k30, k40, KC_NO }, \
{ k01, k11, k21, k31, k41, k51 }, \
{ k02, k12, k22, k32, k42, k52 }, \
{ k03, k13, k23, k33, k43, k53 }, \
{ k04, k14, k24, k34, k44, k54 }, \
{ k05, k15, k25, k35, k45, k55 }, \
{ k06, k16, KC_NO, k36, k46, k56 }, \
\
{ k07, k17, KC_NO, k37, k47, k57 }, \
{ k08, k18, k28, k38, k48, k58 }, \
{ k09, k19, k29, k39, k49, k59 }, \
{ k0A, k1A, k2A, k3A, k4A, k5A }, \
{ k0B, k1B, k2B, k3B, k4B, k5B }, \
{ k0C, k1C, k2C, k3C, k4C, k5C }, \
{ k0D, k1D, k2D, k3D, k4D, KC_NO } \
}
/* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */
#define LAYOUT_ergodox_pretty( \
L00,L01,L02,L03,L04,L05,L06, R00,R01,R02,R03,R04,R05,R06, \
L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16, \
L20,L21,L22,L23,L24,L25, R21,R22,R23,R24,R25,R26, \
L30,L31,L32,L33,L34,L35,L36, R30,R31,R32,R33,R34,R35,R36, \
L40,L41,L42,L43,L44, R42,R43,R44,R45,R46, \
L55,L56, R50,R51, \
L54, R52, \
L53,L52,L51, R55,R54,R53 ) \
\
/* matrix positions */ \
{ \
{ L00, L10, L20, L30, L40, KC_NO }, \
{ L01, L11, L21, L31, L41, L51 }, \
{ L02, L12, L22, L32, L42, L52 }, \
{ L03, L13, L23, L33, L43, L53 }, \
{ L04, L14, L24, L34, L44, L54 }, \
{ L05, L15, L25, L35, KC_NO, L55 }, \
{ L06, L16, KC_NO, L36, KC_NO, L56 }, \
\
{ R00, R10, KC_NO, R30,KC_NO, R50 }, \
{ R01, R11, R21, R31,KC_NO, R51 }, \
{ R02, R12, R22, R32, R42, R52 }, \
{ R03, R13, R23, R33, R43, R53 }, \
{ R04, R14, R24, R34, R44, R54 }, \
{ R05, R15, R25, R35, R45, R55 }, \
{ R06, R16, R26, R36, R46, KC_NO } \
}
/* ---------- LEFT HAND ----------- ---------- RIGHT HAND ---------- */
#define LAYOUT_ergodox_pretty_80( \
L00,L01,L02,L03,L04,L05,L06, R00,R01,R02,R03,R04,R05,R06, \
L10,L11,L12,L13,L14,L15,L16, R10,R11,R12,R13,R14,R15,R16, \
L20,L21,L22,L23,L24,L25, R21,R22,R23,R24,R25,R26, \
L30,L31,L32,L33,L34,L35,L36, R30,R31,R32,R33,R34,R35,R36, \
L40,L41,L42,L43,L44, R42,R43,R44,R45,R46, \
L55,L56, R50,R51, \
L45,L46,L54, R52,R40,R41, \
L53,L52,L51, R55,R54,R53 ) \
\
/* matrix positions */ \
{ \
{ L00, L10, L20, L30, L40, KC_NO }, \
{ L01, L11, L21, L31, L41, L51 }, \
{ L02, L12, L22, L32, L42, L52 }, \
{ L03, L13, L23, L33, L43, L53 }, \
{ L04, L14, L24, L34, L44, L54 }, \
{ L05, L15, L25, L35, L45, L55 }, \
{ L06, L16, KC_NO, L36, L46, L56 }, \
\
{ R00, R10, KC_NO, R30, R40, R50 }, \
{ R01, R11, R21, R31, R41, R51 }, \
{ R02, R12, R22, R32, R42, R52 }, \
{ R03, R13, R23, R33, R43, R53 }, \
{ R04, R14, R24, R34, R44, R54 }, \
{ R05, R15, R25, R35, R45, R55 }, \
{ R06, R16, R26, R36, R46, KC_NO } \
}

View File

@ -1,15 +1,7 @@
#pragma once
#include "config_common.h"
// USB parameters
#define VENDOR_ID 0x3297 // ZSA Labs
#define PRODUCT_ID 0x4976 // Ergodox glow variant
#define DEVICE_VER 0x0002
#define MANUFACTURER Betalupi
#define PRODUCT Betalupi ErgoDox
#define WEBUSB_LANDING_PAGE_URL u8"betalupi.com"
#define USB_MAX_POWER_CONSUMPTION 500
#define USB_SUSPEND_WAKEUP_DELAY 0
@ -56,7 +48,7 @@
// with keys that convert to other keys on hold
// (z becomes ctrl when you hold it, and when this option isn't
// enabled, z rapidly followed by x actually sends Ctrl-x)
#define IGNORE_MOD_TAP_INTERRUPT
//#define IGNORE_MOD_TAP_INTERRUPT
#define MOUSEKEY_INTERVAL 20
#define MOUSEKEY_DELAY 0
@ -75,10 +67,9 @@
#define LED_BRIGHTNESS_DEFAULT (LED_BRIGHTNESS_LO)
// RGBLight (Underglow) config
#define RGBLED_NUM 8
#define RGB_DI_PIN D7
#define WS2812_DI_PIN D7
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 16
@ -86,7 +77,7 @@
// Max brightness
#define RGBLIGHT_LIMIT_VAL 200
//#define RGBLIGHT_OFF_AT_START
#define RGBLIGHT_OFF_AT_START
//#define RGBLIGHT_NO_EEPROM
// Prevents RGB keycodes from affecting underglow.
@ -107,7 +98,7 @@
#define DRIVER_COUNT 2
#define DRIVER_1_LED_TOTAL 24
#define DRIVER_2_LED_TOTAL 24
#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
#define RGB_MATRIX_HUE_STEP 10
#define RGB_MATRIX_SAT_STEP 16
@ -121,20 +112,11 @@
// limits in milliseconds how frequently an animation will update the LEDs.
// 16 (16ms) is equivalent to limiting to 60fps
// (increases keyboard responsiveness)
#define RGB_MATRIX_LED_FLUSH_LIMIT 26
#define RGB_MATRIX_LED_FLUSH_LIMIT 16
// turn off effects when suspended
#define RGB_DISABLE_WHEN_USB_SUSPENDED true
// Misc
/* key combination for command */
#define IS_COMMAND() ( \
get_mods() == (MOD_BIT(KC_LCTL) | MOD_BIT(KC_RCTL)) || \
get_mods() == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) \
)
// Not sure what this does.
// ZSA says: "fixes space cadet rollover issue"
#define DISABLE_SPACE_CADET_ROLLOVER

View File

@ -4,3 +4,13 @@
extern const int8_t fft_array_to_col[4][14];
extern const int8_t fft_col_to_array[10][5];
extern uint8_t layer_layouts[];
// Language keymap ids for layers.
// See layers/definitions/symbols.h.
enum layer_layout_ids {
LAYOUT_NULL, // This layer doesn't care what keymap the OS is using
LAYOUT_EN, // This layer is designed for the standard keymapping
LAYOUT_RU,
};

View File

@ -0,0 +1,184 @@
#include "autocorrect.h"
#include <string.h>
#include "autocorrect_data.h"
#if AUTOCORRECTION_MIN_LENGTH < 4
// Odd output or hard locks on the board have been observed when the min typo
// length is 3 or lower (https://github.com/getreuer/qmk-keymap/issues/2).
// Additionally, autocorrection entries for short typos are more likely to false
// trigger, so it is suggested that typos be at least 5 characters.
#error "Min typo length is less than 4. Autocorrection may behave poorly."
#endif
bool process_autocorrection(uint16_t keycode, keyrecord_t* record) {
static uint8_t typo_buffer[AUTOCORRECTION_MAX_LENGTH] = {0};
static uint8_t typo_buffer_size = 0;
// Ignore key release; we only process key presses.
if (!record->event.pressed) {
return true;
}
#ifndef NO_ACTION_ONESHOT
const uint8_t mods = get_mods() | get_oneshot_mods();
#else
const uint8_t mods = get_mods();
#endif
// Disable autocorrection while a mod other than shift is active.
if ((mods & ~MOD_MASK_SHIFT) != 0) {
typo_buffer_size = 0;
return true;
}
// The following switch cases address various kinds of keycodes. This logic is
// split over two switches rather than merged into one. The first switch may
// extract a basic keycode which is then further handled by the second switch,
// e.g. a layer-tap key with Caps Lock `LT(layer, KC_CAPS)`.
switch (keycode) {
#ifndef NO_ACTION_TAPPING
case QK_MOD_TAP ... QK_MOD_TAP_MAX: // Tap-hold keys.
#ifndef NO_ACTION_LAYER
case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
#endif
if (record->tap.count == 0) {
return true;
}
// Otherwise when tapped, get the basic keycode.
// Fallthrough intended.
#endif
// Handle shifted keys, e.g. symbols like KC_EXLM = S(KC_1).
case QK_LSFT ... QK_LSFT + 255:
case QK_RSFT ... QK_RSFT + 255:
keycode &= 0xff; // Get the basic keycode.
break;
// NOTE: Space Cadet keys expose no info to check whether they are being
// tapped vs. held. This makes autocorrection ambiguous, e.g. KC_LCPO
// might be '(', which we would treat as a word break, or it might be
// shift, which we would treat as having no effect. To behave cautiously,
// we allow Space Cadet keycodes to fall to the logic below and clear
// autocorrection state.
}
switch (keycode) {
// Ignore shifts, Caps Lock, one-shot mods, and layer switch keys.
case KC_NO:
case KC_LSFT:
case KC_RSFT:
case KC_CAPS:
case QK_ONE_SHOT_MOD ... QK_ONE_SHOT_MOD_MAX:
case QK_TO ... QK_TO_MAX:
case QK_MOMENTARY ... QK_MOMENTARY_MAX:
case QK_DEF_LAYER ... QK_DEF_LAYER_MAX:
case QK_TOGGLE_LAYER ... QK_TOGGLE_LAYER_MAX:
case QK_ONE_SHOT_LAYER ... QK_ONE_SHOT_LAYER_MAX:
case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX:
case QK_LAYER_MOD ... QK_LAYER_MOD_MAX:
return true; // Ignore these keys.
}
if (keycode == KC_QUOT) {
// Treat " (shifted ') as a word boundary.
if ((mods & MOD_MASK_SHIFT) != 0) {
keycode = KC_SPC;
}
} else if (!(KC_A <= keycode && keycode <= KC_Z)) {
if (keycode == KC_BSPC) {
// Remove last character from the buffer.
if (typo_buffer_size > 0) {
--typo_buffer_size;
}
return true;
} else if (KC_1 <= keycode && keycode <= KC_SLSH && keycode != KC_ESC) {
// Set a word boundary if space, period, digit, etc. is pressed.
// Behave more conservatively for the enter key. Reset, so that enter
// can't be used on a word ending.
if (keycode == KC_ENT) {
typo_buffer_size = 0;
}
keycode = KC_SPC;
} else {
// Clear state if some other non-alpha key is pressed.
typo_buffer_size = 0;
return true;
}
}
// If the buffer is full, rotate it to discard the oldest character.
if (typo_buffer_size >= AUTOCORRECTION_MAX_LENGTH) {
memmove(typo_buffer, typo_buffer + 1, AUTOCORRECTION_MAX_LENGTH - 1);
typo_buffer_size = AUTOCORRECTION_MAX_LENGTH - 1;
}
// Append `keycode` to the buffer.
// NOTE: `keycode` must be a basic keycode (0-255) by this point.
typo_buffer[typo_buffer_size++] = (uint8_t)keycode;
// Early return if not many characters have been buffered so far.
if (typo_buffer_size < AUTOCORRECTION_MIN_LENGTH) {
return true;
}
// Check whether the buffer ends in a typo. This is done using a trie
// stored in `autocorrection_data`.
uint16_t state = 0;
uint8_t code = pgm_read_byte(autocorrection_data + state);
for (int i = typo_buffer_size - 1; i >= 0; --i) {
const uint8_t key_i = typo_buffer[i];
if (code & 64) { // Check for match in node with multiple children.
code &= 63;
for (; code != key_i; code = pgm_read_byte(autocorrection_data + (state += 3))) {
if (!code) {
return true;
}
}
// Follow link to child node.
state = (uint16_t)(
(uint_fast16_t) pgm_read_byte(
autocorrection_data + state + 1
) |
(uint_fast16_t) pgm_read_byte(
autocorrection_data + state + 2
) << 8
);
// Otherwise check for match in node with a single child.
} else if (code != key_i) {
return true;
} else if (!(code = pgm_read_byte(autocorrection_data + (++state)))) {
++state;
}
// Stop if `state` becomes an invalid index. This should not normally
// happen, it is a safeguard in case of a bug, data corruption, etc.
if (state >= sizeof(autocorrection_data)) {
return true;
}
// Read first byte of the next node.
code = pgm_read_byte(autocorrection_data + state);
if (code & 128) { // A typo was found! Apply autocorrection.
const int backspaces = code & 63;
for (int i = 0; i < backspaces; ++i) {
tap_code(KC_BSPC);
}
send_string_P((char const*)(autocorrection_data + state + 1));
if (keycode == KC_SPC) {
typo_buffer[0] = KC_SPC;
typo_buffer_size = 1;
return true;
} else {
typo_buffer_size = 0;
return false;
}
}
}
return true;
}

View File

@ -0,0 +1,111 @@
// Copyright 2021-2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @file autocorrection.h
* @brief Autocorrection on your keyboard.
*
* Overview
* --------
*
* Some words are more prone to typos than others. This userspace QMK library
* implements rudimentary autocorrection, automatically detecting and fixing
* some misspellings.
*
* Features:
*
* * It runs on your keyboard, so it is always active no matter what software.
* * Low resource cost.
* * It is case insensitive.
* * It works within words, useful for programming to catch typos within longer
* identifiers.
*
* Limitations:
*
* * It is limited to alphabet characters az, apostrophes ', and word breaks.
* I'm sorry this probably isn't useful for languages besides English.
* * It does not follow mouse or hotkey driven cursor movement.
*
* Changing the autocorrection dictionary
* --------------------------------------
*
* The file autocorrection_data.h encodes the typos to correct. While you could
* simply use the version of this file provided above for a practical
* configuration, you can make your own to personalize the autocorrection to
* your most troublesome typos:
*
* Step 1: First, create an autocorrection dictionary autocorrection_dict.txt,
* in a form like
*
* :thier -> their
* dosen't -> doesn't
* fitler -> filter
* ouput -> output
* widht -> width
*
* For a practical 71-entry example, see autocorrection_dict.txt. And for a yet
* larger 400-entry example, see autocorrection_dict_extra.txt.
*
* The syntax is `typo -> correction`. Typos and corrections are case
* insensitive, and any whitespace before or after the typo and correction is
* ignored. The typo must be only the characters a-z, ', or the special
* character : representing a word break. The correction may have just about any
* printable ASCII characters.
*
* Step 2: Use the make_autocorrection_data.py Python script to process the
* dictionary. Put autocorrection_dict.txt in the same directory as the Python
* script and run
*
* $ python3 make_autocorrection_data.py
* Processed 71 autocorrection entries to table with 1120 bytes.
*
* The script arranges the entries in autocorrection_dict.txt into a trie and
* generates autocorrection_data.h with the serialized trie embedded as an
* array. The .h file will be written in the same directory.
*
* Step 3: Finally, recompile and flash your keymap.
*
* For full documentation, see
* <https://getreuer.info/posts/keyboards/autocorrection>
*
* @author Pascal Getreuer
*/
#pragma once
#include "quantum.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* Handler function for autocorrection.
*
* Call this function in keymap.c from `process_record_user()` like
*
* #include "features/autocorrection.h"
*
* bool process_record_user(uint16_t keycode, keyrecord_t* record) {
* if (!process_autocorrection(keycode, record)) { return false; }
* // Your macros...
*
* return true;
* }
*/
bool process_autocorrection(uint16_t keycode, keyrecord_t* record);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,238 @@
// Generated code.
// Autocorrection dictionary (132 entries):
// :agian -> again
// :agred -> agreed
// :ajust -> adjust
// :alot: -> a lot
// :andteh -> and the
// :andthe -> and the
// :anual -> annual
// :asign -> assign
// :asthe -> as the
// :atthe -> at the
// :casue -> cause
// :eveyr -> every
// :foudn -> found
// :gaurd -> guard
// :goign -> going
// :gonig -> going
// :graet -> great
// :haev -> have
// :htere -> there
// :htikn -> think
// :htink -> think
// :hwihc -> which
// :hwile -> while
// :idaes -> ideas
// :jstu: -> just
// :jsut: -> just
// :knwo -> know
// :konw -> know
// :kwno -> know
// :moeny -> money
// :olther -> other
// :otehr -> other
// :owudl -> would
// :sicne -> since
// :the:the: -> the
// :theri -> their
// :thier -> their
// :thsoe -> those
// :tothe -> to the
// :yaers -> years
// :yeasr -> years
// abbout -> about
// abotu -> about
// abouta -> about a
// aboutit -> about it
// aboutthe -> about the
// almsot -> almost
// alomst -> almost
// alwasy -> always
// alwyas -> always
// anohter -> another
// aroud -> around
// arround -> around
// arund -> around
// baceause -> because
// baout -> about
// beacuse -> because
// becasue -> because
// beccause -> because
// becouse -> because
// becuase -> because
// bedore -> before
// beeing -> being
// befoer -> before
// beteen -> between
// beween -> between
// bewteen -> between
// chekc -> check
// childen -> children
// chnage -> change
// claer -> clear
// comapny -> company
// contian -> contain
// coudl -> could
// didnot -> did not
// elasped -> elapsed
// firend -> friend
// firts -> first
// fitler -> filter
// follwo -> follow
// freind -> friend
// frequecy -> frequency
// fromthe -> from the
// heigth -> height
// iamge -> image
// inital -> initial
// intput -> input
// laguage -> language
// lenght -> length
// levle -> level
// libary -> library
// littel -> little
// mysefl -> myself
// ouptut -> output
// ouput -> output
// peaple -> people
// peolpe -> people
// peopel -> people
// poeople -> people
// poeple -> people
// probaly -> probably
// probelm -> problem
// raelly -> really
// realy -> really
// recrod -> record
// relaly -> really
// reponse -> response
// reprot -> report
// shoudl -> should
// singel -> single
// stregth -> strength
// strengh -> strength
// theese -> these
// therfore -> therefore
// thign -> thing
// thigsn -> things
// thikn -> think
// thiunk -> think
// thnigs -> things
// throught -> thought
// tihkn -> think
// tkaes -> takes
// todya -> today
// toghether -> together
// unkown -> unknown
// unqiue -> unique
// whcih -> which
// whihc -> which
// whlch -> which
// widht -> width
// wihch -> which
// woudl -> would
#define AUTOCORRECTION_MIN_LENGTH 5 // "abotu"
#define AUTOCORRECTION_MAX_LENGTH 9 // "toghether"
static const uint8_t autocorrection_data[1881] PROGMEM = {108, 61, 0, 4, 117, 0,
6, 141, 0, 7, 181, 0, 8, 52, 1, 10, 237, 2, 11, 8, 3, 12, 105, 3, 14, 115, 3,
15, 143, 3, 16, 12, 4, 17, 24, 4, 18, 234, 4, 21, 16, 5, 22, 152, 5, 23, 233,
5, 24, 190, 6, 25, 199, 6, 26, 208, 6, 28, 218, 6, 0, 72, 71, 0, 23, 81, 0,
24, 107, 0, 0, 11, 23, 44, 8, 11, 23, 44, 0, 132, 0, 82, 88, 0, 24, 98, 0, 0,
15, 4, 44, 0, 131, 32, 108, 111, 116, 0, 22, 13, 44, 0, 131, 117, 115, 116, 0,
23, 22, 13, 44, 0, 131, 117, 115, 116, 0, 87, 124, 0, 28, 133, 0, 0, 24, 18,
5, 4, 0, 128, 32, 97, 0, 7, 18, 23, 0, 129, 97, 121, 0, 75, 148, 0, 14, 173,
0, 0, 12, 0, 75, 157, 0, 26, 163, 0, 0, 26, 0, 129, 99, 104, 0, 11, 44, 0,
132, 119, 104, 105, 99, 104, 0, 8, 11, 6, 0, 129, 99, 107, 0, 72, 197, 0, 17,
223, 0, 18, 23, 1, 21, 33, 1, 24, 44, 1, 0, 83, 204, 0, 21, 215, 0, 0, 22, 4,
15, 8, 0, 131, 112, 115, 101, 100, 0, 10, 4, 44, 0, 128, 101, 100, 0, 72, 233,
0, 12, 244, 0, 24, 254, 0, 0, 21, 12, 9, 0, 132, 114, 105, 101, 110, 100, 0,
8, 21, 9, 0, 131, 105, 101, 110, 100, 0, 82, 5, 1, 21, 15, 1, 0, 21, 21, 4, 0,
132, 111, 117, 110, 100, 0, 4, 0, 130, 111, 117, 110, 100, 0, 21, 6, 8, 21, 0,
130, 111, 114, 100, 0, 24, 4, 10, 44, 0, 131, 117, 97, 114, 100, 0, 18, 21, 4,
0, 128, 110, 100, 0, 74, 80, 1, 11, 124, 1, 15, 205, 1, 17, 17, 2, 18, 27, 2,
19, 37, 2, 21, 47, 2, 22, 93, 2, 24, 198, 2, 0, 68, 87, 1, 16, 115, 1, 0, 81,
94, 1, 24, 103, 1, 0, 11, 6, 0, 131, 97, 110, 103, 101, 0, 10, 4, 15, 0, 132,
110, 103, 117, 97, 103, 101, 0, 4, 12, 0, 131, 109, 97, 103, 101, 0, 23, 0,
71, 142, 1, 16, 152, 1, 18, 162, 1, 22, 171, 1, 23, 180, 1, 0, 17, 4, 44, 0,
130, 32, 116, 104, 101, 0, 18, 21, 9, 0, 130, 32, 116, 104, 101, 0, 23, 44, 0,
130, 32, 116, 104, 101, 0, 4, 44, 0, 130, 32, 116, 104, 101, 0, 68, 187, 1,
24, 195, 1, 0, 44, 0, 130, 32, 116, 104, 101, 0, 18, 5, 4, 0, 130, 32, 116,
104, 101, 0, 76, 215, 1, 19, 226, 1, 25, 10, 2, 0, 26, 11, 44, 0, 132, 119,
104, 105, 108, 101, 0, 68, 236, 1, 8, 245, 1, 18, 255, 1, 0, 8, 19, 0, 131,
111, 112, 108, 101, 0, 18, 19, 0, 132, 101, 111, 112, 108, 101, 0, 8, 18, 19,
0, 133, 101, 111, 112, 108, 101, 0, 8, 15, 0, 129, 101, 108, 0, 6, 12, 22, 44,
0, 130, 110, 99, 101, 0, 22, 11, 23, 44, 0, 130, 111, 115, 101, 0, 15, 18, 8,
19, 0, 130, 112, 108, 101, 0, 72, 54, 2, 18, 65, 2, 0, 23, 11, 44, 0, 132,
116, 104, 101, 114, 101, 0, 71, 72, 2, 9, 81, 2, 0, 8, 5, 0, 131, 102, 111,
114, 101, 0, 21, 8, 11, 23, 0, 131, 101, 102, 111, 114, 101, 0, 68, 106, 2, 8,
117, 2, 17, 125, 2, 24, 138, 2, 0, 24, 6, 8, 5, 0, 131, 97, 117, 115, 101, 0,
8, 11, 23, 0, 130, 115, 101, 0, 18, 19, 8, 21, 0, 132, 115, 112, 111, 110,
115, 101, 0, 68, 148, 2, 6, 177, 2, 18, 188, 2, 0, 70, 155, 2, 8, 165, 2, 0,
6, 8, 5, 0, 132, 97, 117, 115, 101, 0, 6, 4, 5, 0, 134, 101, 99, 97, 117, 115,
101, 0, 4, 8, 5, 0, 132, 99, 97, 117, 115, 101, 0, 6, 8, 5, 0, 131, 97, 117,
115, 101, 0, 76, 205, 2, 22, 215, 2, 0, 20, 17, 24, 0, 131, 105, 113, 117,
101, 0, 4, 6, 0, 108, 225, 2, 8, 230, 2, 0, 130, 117, 115, 101, 0, 5, 0, 130,
117, 115, 101, 0, 76, 244, 2, 17, 254, 2, 0, 17, 18, 10, 44, 0, 130, 105, 110,
103, 0, 12, 8, 8, 5, 0, 131, 105, 110, 103, 0, 70, 24, 3, 8, 48, 3, 10, 60, 3,
12, 70, 3, 23, 79, 3, 0, 75, 31, 3, 15, 40, 3, 0, 12, 26, 0, 131, 104, 105,
99, 104, 0, 11, 26, 0, 130, 105, 99, 104, 0, 23, 7, 17, 4, 44, 0, 130, 32,
116, 104, 101, 0, 17, 8, 21, 23, 22, 0, 128, 116, 104, 0, 6, 11, 26, 0, 130,
105, 99, 104, 0, 10, 0, 72, 88, 3, 12, 98, 3, 0, 21, 23, 22, 0, 130, 110, 103,
116, 104, 0, 8, 11, 0, 129, 104, 116, 0, 21, 8, 11, 23, 44, 0, 129, 105, 114,
0, 17, 0, 76, 124, 3, 24, 135, 3, 0, 23, 11, 44, 0, 132, 116, 104, 105, 110,
107, 0, 12, 11, 23, 0, 130, 110, 107, 0, 68, 156, 3, 7, 182, 3, 8, 225, 3, 9,
3, 4, 0, 87, 163, 3, 24, 172, 3, 0, 12, 17, 12, 0, 129, 105, 97, 108, 0, 17,
4, 44, 0, 130, 110, 117, 97, 108, 0, 24, 0, 82, 191, 3, 26, 215, 3, 0, 70,
201, 3, 11, 205, 3, 26, 211, 3, 0, 129, 108, 100, 0, 22, 0, 129, 108, 100, 0,
129, 108, 100, 0, 18, 44, 0, 132, 119, 111, 117, 108, 100, 0, 74, 235, 3, 19,
243, 3, 23, 251, 3, 0, 17, 12, 22, 0, 129, 108, 101, 0, 18, 8, 19, 0, 129,
108, 101, 0, 23, 12, 15, 0, 129, 108, 101, 0, 8, 22, 28, 16, 0, 129, 108, 102,
0, 15, 8, 5, 18, 21, 19, 0, 130, 108, 101, 109, 0, 68, 46, 4, 7, 72, 4, 8, 81,
4, 10, 140, 4, 14, 174, 4, 22, 213, 4, 26, 223, 4, 0, 12, 0, 74, 55, 4, 23,
63, 4, 0, 4, 44, 0, 130, 97, 105, 110, 0, 17, 18, 6, 0, 130, 97, 105, 110, 0,
24, 18, 9, 44, 0, 129, 110, 100, 0, 71, 88, 4, 8, 98, 4, 0, 15, 12, 11, 6, 0,
129, 114, 101, 110, 0, 87, 105, 4, 26, 130, 4, 0, 72, 112, 4, 26, 120, 4, 0,
5, 0, 130, 119, 101, 101, 110, 0, 8, 5, 0, 132, 116, 119, 101, 101, 110, 0, 8,
5, 0, 131, 116, 119, 101, 101, 110, 0, 12, 0, 75, 152, 4, 18, 158, 4, 22, 165,
4, 0, 23, 0, 129, 110, 103, 0, 10, 44, 0, 129, 110, 103, 0, 4, 44, 0, 130,
115, 105, 103, 110, 0, 75, 181, 4, 12, 190, 4, 0, 12, 23, 0, 131, 104, 105,
110, 107, 0, 75, 197, 4, 23, 203, 4, 0, 23, 0, 129, 110, 107, 0, 11, 44, 0,
132, 116, 104, 105, 110, 107, 0, 10, 12, 11, 23, 0, 130, 110, 103, 115, 0, 18,
14, 17, 24, 0, 130, 110, 111, 119, 110, 0, 81, 241, 4, 26, 250, 4, 0, 26, 14,
44, 0, 130, 110, 111, 119, 0, 79, 1, 5, 17, 9, 5, 0, 15, 18, 9, 0, 129, 111,
119, 0, 14, 44, 0, 129, 111, 119, 0, 72, 29, 5, 11, 124, 5, 22, 134, 5, 28,
143, 5, 0, 68, 48, 5, 11, 56, 5, 12, 86, 5, 15, 95, 5, 18, 105, 5, 23, 113, 5,
0, 15, 6, 0, 130, 101, 97, 114, 0, 23, 0, 72, 65, 5, 15, 77, 5, 0, 11, 10, 18,
23, 0, 133, 101, 116, 104, 101, 114, 0, 18, 44, 0, 132, 116, 104, 101, 114, 0,
11, 23, 44, 0, 130, 101, 105, 114, 0, 23, 12, 9, 0, 131, 108, 116, 101, 114,
0, 9, 8, 5, 0, 129, 114, 101, 0, 11, 18, 17, 4, 0, 131, 116, 104, 101, 114, 0,
8, 23, 18, 44, 0, 130, 104, 101, 114, 0, 4, 8, 28, 44, 0, 129, 114, 115, 0, 8,
25, 8, 44, 0, 129, 114, 121, 0, 68, 168, 5, 8, 178, 5, 10, 203, 5, 21, 214, 5,
23, 225, 5, 0, 28, 26, 15, 4, 0, 130, 97, 121, 115, 0, 4, 0, 71, 187, 5, 14,
195, 5, 0, 12, 44, 0, 130, 101, 97, 115, 0, 23, 0, 131, 97, 107, 101, 115, 0,
12, 17, 11, 23, 0, 131, 105, 110, 103, 115, 0, 8, 4, 28, 44, 0, 131, 101, 97,
114, 115, 0, 21, 12, 9, 0, 129, 115, 116, 0, 72, 252, 5, 11, 6, 6, 12, 46, 6,
18, 57, 6, 22, 95, 6, 24, 123, 6, 0, 4, 21, 10, 44, 0, 130, 101, 97, 116, 0,
71, 13, 6, 10, 20, 6, 0, 12, 26, 0, 129, 116, 104, 0, 81, 27, 6, 24, 34, 6, 0,
8, 15, 0, 129, 116, 104, 0, 18, 21, 11, 23, 0, 133, 111, 117, 103, 104, 116,
0, 23, 24, 18, 5, 4, 0, 129, 32, 105, 116, 0, 81, 67, 6, 21, 77, 6, 22, 86, 6,
0, 7, 12, 7, 0, 130, 32, 110, 111, 116, 0, 19, 8, 21, 0, 130, 111, 114, 116,
0, 16, 15, 4, 0, 130, 111, 115, 116, 0, 80, 102, 6, 24, 112, 6, 0, 18, 15, 4,
0, 131, 109, 111, 115, 116, 0, 13, 4, 44, 0, 131, 100, 106, 117, 115, 116, 0,
82, 133, 6, 19, 157, 6, 23, 180, 6, 0, 68, 140, 6, 5, 149, 6, 0, 5, 0, 132,
97, 98, 111, 117, 116, 0, 5, 4, 0, 131, 111, 117, 116, 0, 87, 164, 6, 24, 172,
6, 0, 17, 12, 0, 131, 112, 117, 116, 0, 18, 0, 130, 116, 112, 117, 116, 0, 19,
24, 18, 0, 131, 116, 112, 117, 116, 0, 23, 18, 5, 4, 0, 129, 117, 116, 0, 8,
4, 11, 44, 0, 129, 118, 101, 0, 17, 18, 14, 44, 0, 130, 110, 111, 119, 0, 70,
234, 6, 15, 246, 6, 17, 42, 7, 21, 69, 7, 22, 80, 7, 0, 8, 24, 20, 8, 21, 9,
0, 129, 110, 99, 121, 0, 68, 253, 6, 15, 31, 7, 0, 69, 7, 7, 8, 16, 7, 15, 22,
7, 0, 18, 21, 19, 0, 129, 98, 108, 121, 0, 21, 0, 128, 108, 121, 0, 8, 21, 0,
131, 97, 108, 108, 121, 0, 8, 4, 21, 0, 132, 101, 97, 108, 108, 121, 0, 72,
49, 7, 19, 58, 7, 0, 18, 16, 44, 0, 130, 110, 101, 121, 0, 4, 16, 18, 6, 0,
131, 112, 97, 110, 121, 0, 4, 5, 12, 15, 0, 130, 114, 97, 114, 121, 0, 4, 26,
15, 4, 0, 129, 121, 115, 0};

View File

@ -0,0 +1,148 @@
# Dictionary syntax:
# Each line of this file defines one typo correction entry with the syntax
# "typo -> correction". Typos and corrections are case insensitive, and any
# whitespace before or after the typo and correction is ignored. The typo must be
# only the letters a-z, or the special character : representing a word break.
:htere -> there
abbout -> about
abotu -> about
baout -> about
:theri -> their
:thier -> their
:owudl -> would
woudl -> would
peaple -> people
peolpe -> people
peopel -> people
poeple -> people
poeople -> people
:hwihc -> which
whcih -> which
whihc -> which
whlch -> which
wihch -> which
coudl -> could
:htikn -> think
:htink -> think
thikn -> think
thiunk -> think
tihkn -> think
:olther -> other
:otehr -> other
baceause -> because
beacuse -> because
becasue -> because
beccause -> because
becouse -> because
becuase -> because
theese -> these
:goign -> going
:gonig -> going
:yaers -> years
:yeasr -> years
:thsoe -> those
shoudl -> should
raelly -> really
realy -> really
relaly -> really
bedore -> before
befoer -> before
littel -> little
beeing -> being
:hwile -> while
aroud -> around
arround -> around
arund -> around
thign -> thing
thigsn -> things
thnigs -> things
anohter -> another
beteen -> between
beween -> between
bewteen -> between
:eveyr -> every
:graet -> great
:agian -> again
:sicne -> since
alwasy -> always
alwyas -> always
throught -> thought
almsot -> almost
alomst -> almost
chnage -> change
chekc -> check
childen -> children
claer -> clear
comapny -> company
contian -> contain
elasped -> elapsed
fitler -> filter
firts -> first
follwo -> follow
:foudn -> found
frequecy -> frequency
firend -> friend
freind -> friend
heigth -> height
iamge -> image
inital -> initial
intput -> input
laguage -> language
lenght -> length
levle -> level
libary -> library
:moeny -> money
mysefl -> myself
ouptut -> output
ouput -> output
probaly -> probably
probelm -> problem
recrod -> record
reponse -> response
reprot -> report
singel -> single
stregth -> strength
strengh -> strength
tkaes -> takes
therfore -> therefore
todya -> today
toghether -> together
unkown -> unknown
unqiue -> unique
widht -> width
## Catch skipped spaces between common words.
:alot: -> a lot
:andteh -> and the
:andthe -> and the
:asthe -> as the
:atthe -> at the
abouta -> about a
aboutit -> about it
aboutthe -> about the
:tothe -> to the
didnot -> did not
fromthe -> from the
:the:the: -> the
## Various additional entries.
:agred -> agreed
:ajust -> adjust
:anual -> annual
:asign -> assign
:casue -> cause
:gaurd -> guard
:haev -> have
:idaes -> ideas
:jsut: -> just
:jstu: -> just
:knwo -> know
:konw -> know
:kwno -> know

View File

@ -0,0 +1,352 @@
"""Python program to make autocorrection_data.h.
This program reads "autocorrection_dict.txt" from the current directory and
generates a C source file "autocorrection_data.h" with a serialized trie
embedded as an array. Run this program without arguments like
$ python3 make_autocorrection_data.py
Or specify a dict file as the first argument like
$ python3 make_autocorrection_data.py mykeymap/dict.txt
The output is written to "autocorrection_data.h" in the same directory as the
dictionary. Or optionally specify the output .h file as well like
$ python3 make_autocorrection_data.py dict.txt somewhere/out.h
Each line of the dict file defines one typo and its correction with the syntax
"typo -> correction". Blank lines or lines starting with '#' are ignored.
Example:
:thier -> their
dosen't -> doesn't
fitler -> filter
lenght -> length
ouput -> output
widht -> width
See autocorrection_dict_extra.txt for a larger example.
For full documentation, see
https://getreuer.info/posts/keyboards/autocorrection
"""
import os.path
import sys
import textwrap
from typing import Any, Dict, Iterator, List, Tuple
try:
from english_words import english_words_lower_alpha_set as CORRECT_WORDS
except ImportError:
print(
"Autocorrection will falsely trigger when a typo is a substring of a "
"correctly spelled word. To check for this, install the english_words "
"package and rerun this script:\n\n pip install english_words\n"
)
# Use a minimal word list as a fallback.
CORRECT_WORDS = (
"apparent",
"association",
"available",
"classification",
"effect",
"entertainment",
"fantastic",
"information",
"integrate",
"international",
"language",
"loosest",
"manual",
"nothing",
"provides",
"reference",
"statehood",
"technology",
"virtually",
"wealthier",
"wonderful",
)
KC_A = 4
KC_SPC = 0x2C
KC_QUOT = 0x34
TYPO_CHARS = dict(
[
("'", KC_QUOT),
(":", KC_SPC), # "Word break" character.
]
+
# Characters a-z.
[(chr(c), c + KC_A - ord("a")) for c in range(ord("a"), ord("z") + 1)]
)
def parse_file(file_name: str) -> List[Tuple[str, str]]:
"""Parses autocorrections dictionary file.
Each line of the file defines one typo and its correction with the syntax
"typo -> correction". Blank lines or lines starting with '#' are ignored. The
function validates that typos only have characters in TYPO_CHARS, that
typos are not substrings of other typos, and checking that typos don't trigger
on CORRECT_WORDS.
Args:
file_name: String, path of the autocorrections dictionary.
Returns:
List of (typo, correction) tuples.
"""
autocorrections = []
typos = set()
for line_number, typo, correction in parse_file_lines(file_name):
if typo in typos:
print(f'Warning:{line_number}: Ignoring duplicate typo: "{typo}"')
continue
# Check that `typo` is valid.
if not (all([c in TYPO_CHARS for c in typo])):
print(
f'Error:{line_number}: Typo "{typo}" has '
"characters other than " + "".join(TYPO_CHARS.keys())
)
sys.exit(1)
for other_typo in typos:
if typo in other_typo or other_typo in typo:
print(
f"Error:{line_number}: Typos may not be substrings of one "
f"another, otherwise the longer typo would never trigger: "
f'"{typo}" vs. "{other_typo}".'
)
sys.exit(1)
if len(typo) < 5:
print(
f"Warning:{line_number}: It is suggested that typos are at "
f'least 5 characters long to avoid false triggers: "{typo}"'
)
check_typo_against_dictionary(line_number, typo)
autocorrections.append((typo, correction))
typos.add(typo)
return autocorrections
def make_trie(autocorrections: List[Tuple[str, str]]) -> Dict[str, Any]:
"""Makes a trie from the the typos, writing in reverse.
Args:
autocorrections: List of (typo, correction) tuples.
Returns:
Dict of dict, representing the trie.
"""
trie = {}
for typo, correction in autocorrections:
node = trie
for letter in typo[::-1]:
node = node.setdefault(letter, {})
node["LEAF"] = (typo, correction)
return trie
def parse_file_lines(file_name: str) -> Iterator[Tuple[int, str, str]]:
"""Parses lines read from `file_name` into typo-correction pairs."""
line_number = 0
for line in open(file_name, "rt"):
line_number += 1
line = line.strip()
if line and line[0] != "#":
# Parse syntax "typo -> correction", using strip to ignore indenting.
tokens = [token.strip() for token in line.split("->", 1)]
if len(tokens) != 2 or not tokens[0]:
print(f'Error:{line_number}: Invalid syntax: "{line}"')
sys.exit(1)
typo, correction = tokens
typo = typo.lower() # Force typos to lowercase.
typo = typo.replace(" ", ":")
yield line_number, typo, correction
def check_typo_against_dictionary(line_number: int, typo: str) -> None:
"""Checks `typo` against English dictionary words."""
if typo.startswith(":") and typo.endswith(":"):
if typo[1:-1] in CORRECT_WORDS:
print(
f'Warning:{line_number}: Typo "{typo}" is a correctly spelled '
"dictionary word."
)
elif typo.startswith(":") and not typo.endswith(":"):
for word in CORRECT_WORDS:
if word.startswith(typo[1:]):
print(
f'Warning:{line_number}: Typo "{typo}" would falsely trigger '
f'on correctly spelled word "{word}".'
)
elif not typo.startswith(":") and typo.endswith(":"):
for word in CORRECT_WORDS:
if word.endswith(typo[:-1]):
print(
f'Warning:{line_number}: Typo "{typo}" would falsely trigger '
f'on correctly spelled word "{word}".'
)
elif not typo.startswith(":") and not typo.endswith(":"):
for word in CORRECT_WORDS:
if typo in word:
print(
f'Warning:{line_number}: Typo "{typo}" would falsely trigger '
f'on correctly spelled word "{word}".'
)
def serialize_trie(
autocorrections: List[Tuple[str, str]], trie: Dict[str, Any]
) -> List[int]:
"""Serializes trie and correction data in a form readable by the C code.
Args:
autocorrections: List of (typo, correction) tuples.
trie: Dict of dicts.
Returns:
List of ints in the range 0-255.
"""
table = []
# Traverse trie in depth first order.
def traverse(trie_node: Dict[str, Any]) -> Dict[str, Any]:
if "LEAF" in trie_node: # Handle a leaf trie node.
typo, correction = trie_node["LEAF"]
word_boundary_ending = typo[-1] == ":"
typo = typo.strip(":")
i = 0 # Make the autocorrection data for this entry and serialize it.
while i < min(len(typo), len(correction)) and typo[i] == correction[i]:
i += 1
backspaces = len(typo) - i - 1 + word_boundary_ending
assert 0 <= backspaces <= 63
correction = correction[i:]
data = [backspaces + 128] + list(bytes(correction, "ascii")) + [0]
entry = {"data": data, "links": [], "byte_offset": 0}
table.append(entry)
elif len(trie_node) == 1: # Handle trie node with a single child.
c, trie_node = next(iter(trie_node.items()))
entry = {"chars": c, "byte_offset": 0}
# It's common for a trie to have long chains of single-child nodes. We
# find the whole chain so that we can serialize it more efficiently.
while len(trie_node) == 1 and "LEAF" not in trie_node:
c, trie_node = next(iter(trie_node.items()))
entry["chars"] += c
table.append(entry)
entry["links"] = [traverse(trie_node)]
else: # Handle trie node with multiple children.
entry = {"chars": "".join(sorted(trie_node.keys())), "byte_offset": 0}
table.append(entry)
entry["links"] = [traverse(trie_node[c]) for c in entry["chars"]]
return entry
traverse(trie)
def serialize(e: Dict[str, Any]) -> List[int]:
if not e["links"]: # Handle a leaf table entry.
return e["data"]
elif len(e["links"]) == 1: # Handle a chain table entry.
return [TYPO_CHARS[c] for c in e["chars"]] + [0]
else: # Handle a branch table entry.
data = []
for c, link in zip(e["chars"], e["links"]):
data += [TYPO_CHARS[c] | (0 if data else 64)] + encode_link(link)
return data + [0]
byte_offset = 0
for e in table: # To encode links, first compute byte offset of each entry.
e["byte_offset"] = byte_offset
byte_offset += len(serialize(e))
return [b for e in table for b in serialize(e)] # Serialize final table.
def encode_link(link: Dict[str, Any]) -> List[int]:
"""Encodes a node link as two bytes."""
byte_offset = link["byte_offset"]
if not (0 <= byte_offset <= 0xFFFF):
print(
"Error: The autocorrection table is too large, a node link exceeds "
"64KB limit. Try reducing the autocorrection dict to fewer entries."
)
sys.exit(1)
return [byte_offset & 255, byte_offset >> 8]
def write_generated_code(
autocorrections: List[Tuple[str, str]], data: List[int], file_name: str
) -> None:
"""Writes autocorrection data as generated C code to `file_name`.
Args:
autocorrections: List of (typo, correction) tuples.
data: List of ints in 0-255, the serialized trie.
file_name: String, path of the output C file.
"""
assert all(0 <= b <= 255 for b in data)
def typo_len(e: Tuple[str, str]) -> int:
return len(e[0])
min_typo = min(autocorrections, key=typo_len)[0]
max_typo = max(autocorrections, key=typo_len)[0]
generated_code = "".join(
[
"// Generated code.\n\n",
f"// Autocorrection dictionary ({len(autocorrections)} entries):\n",
"".join(
sorted(
f"// {typo:<{len(max_typo)}} -> {correction}\n"
for typo, correction in autocorrections
)
),
f'\n#define AUTOCORRECTION_MIN_LENGTH {len(min_typo)} // "{min_typo}"\n',
f'#define AUTOCORRECTION_MAX_LENGTH {len(max_typo)} // "{max_typo}"\n\n',
textwrap.fill(
"static const uint8_t autocorrection_data[%d] PROGMEM = {%s};"
% (len(data), ", ".join(map(str, data))),
width=80,
subsequent_indent=" ",
),
"\n\n",
]
)
with open(file_name, "wt") as f:
f.write(generated_code)
def get_default_h_file(dict_file: str) -> str:
return os.path.join(os.path.dirname(dict_file), "autocorrect_data.h")
def main(argv):
dict_file = argv[1] if len(argv) > 1 else "dict.txt"
h_file = argv[2] if len(argv) > 2 else get_default_h_file(dict_file)
autocorrections = parse_file(dict_file)
trie = make_trie(autocorrections)
data = serialize_trie(autocorrections, trie)
print(
f"Processed %d autocorrection entries to table with %d bytes."
% (len(autocorrections), len(data))
)
write_generated_code(autocorrections, data, h_file)
if __name__ == "__main__":
main(sys.argv)

View File

@ -1,7 +1,17 @@
#include "rawhid.h"
#include "betalupi_ergodox.h"
#include "extra_mappings.h"
// See rawhid.h for prococol documentation
#include "features/beta_rawhid.h"
#include "features/rawhid_commands.h"
extern uint8_t layer_layouts[];
#ifdef ENABLE_HID_SPELLCHECK
#include "features/hid_spellcheck.h"
#endif
// See features/beta_rawhid.h for prococol documentation
void raw_hid_receive(uint8_t *data, uint8_t length) {
uint8_t cmd = data[0];
@ -14,36 +24,70 @@ void raw_hid_receive(uint8_t *data, uint8_t length) {
hid_send_state();
break;
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
#ifdef ENABLE_RGB_MATRIX_FFT_ANIM
case CMD_ANIM_DATA:
cmd_animation(data, length);
break;
#endif
#ifdef ENABLE_HID_SPELLCHECK
case CMD_SPELLCHECK_WORD:
if (data[1]) {
ergodox_right_led_1_on();
_delay_ms(50);
ergodox_right_led_1_off();
}
break;
#endif
default:
break;
}
}
uint8_t nth_byte(size_t n, uint32_t data) {
return (data >> (8 * n)) & 0xFF;
}
void hid_send_state() {
// state: layer state.
// If this is 0, we'll use global layer_state instead.
void _hid_send_state(_hid_send_state_args args) {
uint32_t state = args.state ? args.state : layer_state;
uint8_t packet[RAW_EPSIZE] = {
CMD_SEND_STATE
CMD_SEND_STATE,
// Animation state, set later
0x00,
// Layer state
nth_byte(0, state),
nth_byte(1, state),
nth_byte(2, state),
nth_byte(3, state),
// Keymap for active layer
layer_layouts[biton32(state)]
};
// Set second byte
if (rgb_matrix_get_flags() != LED_FLAG_ALL) {
// RGB matrix is disabled
packet[1] = 0x00;
} else {
uint8_t mode = rgb_matrix_get_mode();
switch (mode) {
#ifdef ENABLE_RGB_MATRIX_FFT_ANIM
case RGB_MATRIX_CUSTOM_FFT_ANIM:
// FFT Animation is active
packet[1] = 0x02;
break;
#endif
default:
// Normal animation is active
@ -58,10 +102,34 @@ void hid_send_state() {
}
void hid_send_special_char(uint16_t char_id) {
uint8_t packet[RAW_EPSIZE] = {
CMD_SPECIAL_CHAR,
(char_id >> 0) & 0xFF,
(char_id >> 8) & 0xFF
};
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
raw_hid_send(packet, RAW_EPSIZE);
}
#ifdef ENABLE_HID_SPELLCHECK
void hid_send_word() {
uint8_t packet[RAW_EPSIZE] = {
CMD_SPELLCHECK_WORD,
spellcheck_buffer_size
};
for (int i = 0; i < 2 + spellcheck_buffer_size; i++) {
packet[i + 2] = spellcheck_buffer[i];
}
raw_hid_send(packet, RAW_EPSIZE);
}
#endif
#ifdef ENABLE_RGB_MATRIX_FFT_ANIM
#define FFT_PER_KEY 50
void cmd_animation(uint8_t *data, uint8_t length) {
switch (data[1]) {

View File

@ -0,0 +1,34 @@
#pragma once
#include "raw_hid.h"
#define RAW_EPSIZE 32
void raw_hid_receive(uint8_t *data, uint8_t length);
// hid_send_state with advanced arguments
typedef struct {
uint32_t state;
} _hid_send_state_args;
void _hid_send_state(_hid_send_state_args args);
#define hid_send_state(...) _hid_send_state( \
(_hid_send_state_args) { \
.state = 0, \
__VA_ARGS__ \
} \
)
void hid_send_special_char(uint16_t char_utf_8);
#ifdef ENABLE_HID_SPELLCHECK
void hid_send_word(void);
#endif
#ifdef ENABLE_RGB_MATRIX_FFT_ANIM
void cmd_animation(uint8_t *data, uint8_t length);
extern uint8_t g_rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS];
#endif

View File

@ -0,0 +1,185 @@
#ifdef ENABLE_HID_SPELLCHECK
#include "keymap_russian.h"
#include "keymap_us_international.h"
#include "features/hid_spellcheck.h"
#include "features/beta_rawhid.h"
#include "extra_mappings.h"
uint8_t spellcheck_buffer[SPELLCHECK_BUFFER_MAX] = {0};
uint8_t spellcheck_buffer_size = 0;
// Return one of the following.
#define SPELLCHECK_WORD 2
#define SPELLCHECK_SPACE 1
#define SPELLCHECK_NEITHER 0
uint8_t keycode_type_en(uint8_t mods, uint16_t keycode) {
if (
KC_A <= keycode && keycode <= KC_Z // basic letters
) {
return SPELLCHECK_WORD;
} else if (
( // Include these
(KC_1 <= keycode && keycode <= KC_SLSH) || // Symbols
// Treat " (shifted ') as a word boundary.
((keycode == KC_QUOT) && ((mods & MOD_MASK_SHIFT) != 0))
) && !( // Don't include these
(keycode == KC_ESC) ||
(keycode == KC_ENTER)
)
) {
return SPELLCHECK_SPACE;
} else {
return SPELLCHECK_NEITHER;
}
}
uint8_t keycode_type_ru(uint8_t mods, uint16_t keycode) {
if (
KC_A <= keycode && keycode <= KC_Z // basic letters
) {
return SPELLCHECK_WORD;
} else if (
KC_1 <= keycode && keycode <= KC_0
) {
return SPELLCHECK_SPACE;
}
switch (keycode) {
case RU_YO:
case RU_HA:
case RU_HARD:
case RU_E:
case RU_BE:
case RU_YU:
return SPELLCHECK_WORD;
case RU_MINS:
case RU_EQL:
case RU_DOT:
case RU_BSLS:
return SPELLCHECK_SPACE;
}
return SPELLCHECK_NEITHER;
}
bool process_spellcheck(uint16_t keycode, keyrecord_t* record) {
// Ignore key release; we only process key presses.
if (!record->event.pressed) { return true; }
#ifndef NO_ACTION_ONESHOT
const uint8_t mods = get_mods() | get_oneshot_mods();
#else
const uint8_t mods = get_mods();
#endif
// Disable autocorrection while a mod other than shift is active.
if ((mods & ~MOD_MASK_SHIFT) != 0) {
spellcheck_buffer_size = 0;
return true;
}
// The following switch cases address various kinds of keycodes. This logic is
// split over two switches rather than merged into one. The first switch may
// extract a basic keycode which is then further handled by the second switch,
// e.g. a layer-tap key with Caps Lock `LT(layer, KC_CAPS)`.
switch (keycode) {
#ifndef NO_ACTION_TAPPING
case QK_MOD_TAP ... QK_MOD_TAP_MAX: // Tap-hold keys.
#ifndef NO_ACTION_LAYER
case QK_LAYER_TAP ... QK_LAYER_TAP_MAX:
#endif
// Ignore when tap-hold keys are held.
if (record->tap.count == 0) { return true; }
// Otherwise when tapped, get the basic keycode.
// Fallthrough intended.
#endif
// Handle shifted keys, e.g. symbols like KC_EXLM = S(KC_1).
case QK_LSFT ... QK_LSFT + 255:
case QK_RSFT ... QK_RSFT + 255:
keycode &= 0xff; // Get the basic keycode.
break;
// NOTE: Space Cadet keys expose no info to check whether they are being
// tapped vs. held. This makes autocorrection ambiguous, e.g. KC_LCPO might
// be '(', which we would treat as a word break, or it might be shift, which
// we would treat as having no effect. To behave cautiously, we allow Space
// Cadet keycodes to fall to the logic below and clear autocorrection state.
}
switch (keycode) {
// Ignore shifts, Caps Lock, one-shot mods, and layer switch keys.
case KC_NO:
case KC_LSFT:
case KC_RSFT:
case KC_CAPS:
case QK_ONE_SHOT_MOD ... QK_ONE_SHOT_MOD_MAX:
case QK_TO ... QK_TO_MAX:
case QK_MOMENTARY ... QK_MOMENTARY_MAX:
case QK_DEF_LAYER ... QK_DEF_LAYER_MAX:
case QK_TOGGLE_LAYER ... QK_TOGGLE_LAYER_MAX:
case QK_ONE_SHOT_LAYER ... QK_ONE_SHOT_LAYER_MAX:
case QK_LAYER_TAP_TOGGLE ... QK_LAYER_TAP_TOGGLE_MAX:
case QK_LAYER_MOD ... QK_LAYER_MOD_MAX:
return true; // Ignore these keys.
}
if (keycode == KC_BSPC) {
// Remove last character from buffer
if (spellcheck_buffer_size > 0) { --spellcheck_buffer_size; }
return true;
}
uint8_t keycode_type;
switch (layer_layouts[biton32(layer_state)]) {
case LAYOUT_EN:
keycode_type = keycode_type_en(mods, keycode);
break;
case LAYOUT_RU:
keycode_type = keycode_type_ru(mods, keycode);
break;
default:
keycode_type = SPELLCHECK_NEITHER;
break;
}
switch(keycode_type) {
// No modifications are needed if this is a regular word character
case SPELLCHECK_WORD:
// If the buffer is full, rotate it to discard the oldest character.
if (spellcheck_buffer_size >= SPELLCHECK_BUFFER_MAX) {
memmove(spellcheck_buffer, spellcheck_buffer + 1, SPELLCHECK_BUFFER_MAX - 1);
spellcheck_buffer_size = SPELLCHECK_BUFFER_MAX - 1;
}
spellcheck_buffer[spellcheck_buffer_size++] = (uint8_t) keycode;
return true;
case SPELLCHECK_SPACE:
// If this is a word break, send word and reset buffer
if (spellcheck_buffer_size > 0) {
hid_send_word();
spellcheck_buffer_size = 0;
}
return true;
case SPELLCHECK_NEITHER:
spellcheck_buffer_size = 0;
return true;
}
return true;
}
#endif

View File

@ -0,0 +1,20 @@
#pragma once
#ifdef ENABLE_HID_SPELLCHECK
#include "quantum.h"
// spellcheck_buffer holds keycode history.
// It can only contain values 0x00 - 0xFF, aka standard usb hid codes.
// Host software is responsible for turning this into a usable string.
//
// Note that SOME preprocessing is done,see spellcheck.c
#define SPELLCHECK_BUFFER_MAX 16
uint8_t spellcheck_buffer[SPELLCHECK_BUFFER_MAX];
uint8_t spellcheck_buffer_size;
bool process_spellcheck(uint16_t keycode, keyrecord_t* record);
#endif

View File

@ -0,0 +1,39 @@
#pragma once
#ifdef ENABLE_BETA_LEADER
#include "quantum.h"
bool beta_process_leader(uint16_t keycode, keyrecord_t *record);
void beta_leader_start(void);
void beta_leader_end(void);
bool beta_leader_check(void);
void beta_qk_leader_check(void);
void beta_qk_leader_start(void);
#define BETA_LEADER_EXTERNS() \
extern bool beta_leading; \
extern uint16_t beta_leader_time; \
extern uint16_t beta_leader_sequence[5]; \
extern uint8_t beta_leader_sequence_size
// Normal sequence
// These do the same thing as SEQ_X_KEYS from qmk.
#define BETA_SEQ_1_LONG(key) if (beta_leader_sequence[0] == (key) && beta_leader_sequence[1] == 0 && beta_leader_sequence[2] == 0 && beta_leader_sequence[3] == 0 && beta_leader_sequence[4] == 0 && timer_elapsed(beta_leader_time) > LEADER_TIMEOUT)
#define BETA_SEQ_2_LONG(key1, key2) if (beta_leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2) && beta_leader_sequence[2] == 0 && beta_leader_sequence[3] == 0 && beta_leader_sequence[4] == 0 && timer_elapsed(beta_leader_time) > LEADER_TIMEOUT)
#define BETA_SEQ_3_LONG(key1, key2, key3) if (beta_leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2) && beta_leader_sequence[2] == (key3) && beta_leader_sequence[3] == 0 && beta_leader_sequence[4] == 0 && timer_elapsed(beta_leader_time) > LEADER_TIMEOUT)
#define BETA_SEQ_4_LONG(key1, key2, key3, key4) if (beta_leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2) && beta_leader_sequence[2] == (key3) && beta_leader_sequence[3] == (key4) && beta_leader_sequence[4] == 0 && timer_elapsed(beta_leader_time) > LEADER_TIMEOUT)
#define BETA_SEQ_5_LONG(key1, key2, key3, key4, key5) if (leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2) && beta_leader_sequence[2] == (key3) && beta_leader_sequence[3] == (key4) && beta_leader_sequence[4] == (key5) && timer_elapsed(beta_leader_time) > LEADER_TIMEOUT)
// Short-circuit sequence
// These match as soon as a matching sequence is seen,
// not waiting for the leader timeout. They thus register
// immediately, but cannot be used in longer sequences.
#define BETA_SEQ_1_SHORT(key) if (beta_leader_sequence[0] == (key))
#define BETA_SEQ_2_SHORT(key1, key2) if (beta_leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2))
#define BETA_SEQ_3_SHORT(key1, key2, key3) if (beta_leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2))
#define BETA_SEQ_4_SHORT(key1, key2, key3, key4) if (beta_leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2))
#define BETA_SEQ_5_SHORT(key1, key2, key3, key4, key5) if (beta_leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2))
#endif

View File

@ -0,0 +1,103 @@
#ifdef ENABLE_BETA_LEADER
#include "beta_leader.h"
#include <string.h>
#ifndef LEADER_TIMEOUT
#define LEADER_TIMEOUT 300
#endif
__attribute__((weak)) void beta_leader_start(void) {}
__attribute__((weak)) void beta_leader_end(void) {}
__attribute__((weak)) bool beta_leader_check(void) { return true; }
// Leader key stuff
bool beta_leading = false;
uint16_t beta_leader_time = 0;
bool beta_leader_change = false;
uint16_t beta_leader_sequence[5] = {0, 0, 0, 0, 0};
uint8_t beta_leader_sequence_size = 0;
void beta_qk_leader_start(void) {
if (beta_leading) {
return;
}
beta_leader_start();
beta_leading = true;
beta_leader_time = timer_read();
beta_leader_sequence_size = 0;
beta_leader_change = false; // If true, run
memset(beta_leader_sequence, 0, sizeof(beta_leader_sequence));
}
void beta_qk_leader_check() {
#ifdef LEADER_NO_TIMEOUT
bool timeout = (beta_leading && beta_leader_sequence_size > 0 && timer_elapsed(beta_leader_time) > LEADER_TIMEOUT);
#else
bool timeout = (beta_leading && timer_elapsed(beta_leader_time) > LEADER_TIMEOUT);
#endif
if (beta_leader_change || timeout) {
beta_leader_change = false;
if (
beta_leader_sequence[beta_leader_sequence_size - 1] == (QK_LEAD)
) {
beta_leading = false;
beta_leader_end();
return;
}
if (timeout) {
beta_leading = false;
beta_leader_end();
}
if (!beta_leader_check()) {
beta_leading = false;
beta_leader_end();
};
}
}
bool beta_process_leader(uint16_t keycode, keyrecord_t *record) {
// Leader key set-up
if (record->event.pressed) {
if (beta_leading) {
# ifndef LEADER_NO_TIMEOUT
if (timer_elapsed(beta_leader_time) < LEADER_TIMEOUT)
# endif // LEADER_NO_TIMEOUT
{
# ifndef LEADER_KEY_STRICT_KEY_PROCESSING
if (IS_QK_MOD_TAP(keycode)) {
keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
} else if (IS_QK_LAYER_TAP(keycode)) {
keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode);
}
# endif // LEADER_KEY_STRICT_KEY_PROCESSING
if (beta_leader_sequence_size < ARRAY_SIZE(beta_leader_sequence)) {
beta_leader_sequence[beta_leader_sequence_size] = keycode;
beta_leader_sequence_size++;
beta_leader_change = true;
} else {
beta_leading = false;
beta_leader_end();
return true;
}
# ifdef LEADER_PER_KEY_TIMING
beta_leader_time = timer_read();
# endif
return false;
}
} else {
if (keycode == QK_LEADER) {
beta_qk_leader_start();
}
}
}
return true;
}
#endif

View File

@ -0,0 +1,106 @@
#pragma once
// Sent by host when connection is initiated.
//
// Packet structure:
// Data: | cmd |
// # of Bytes: | 1 |
#define CMD_HELLO 0x00
// Sent periodically by host to test connection.
// Keyboard should ignore this command.
//
// Packet structure:
// Data: | cmd |
// # of Bytes: | 1 |
#define CMD_RUTHERE 0x01
// Send keyboard state to host.
//
// Packet structure:
// Data: | cmd | anim state | layer state | layer layout |
// # of Bytes: | 1 | 1 | 4 | 1 |
//
// anim state:
// 0x00: RGBMatrix disabled
// 0x01: normal animation, no HID data.
// 0x02: FFT Animation
//
// layer state: layer state right now.
// This is a uint32_t, where each bit corresponds to a layer index.
// Lowest-order bit is base layer, highest bit is layer 31.
// Layer indices are defined by the LAYER_* enum in layer.h,
// host interface should have a matching enum.
// Make sure to update it when you change your layers!
//
// layer layout:
// The layout this layer was designed for.
// 0x00: en_us
// 0x01: russian
#define CMD_SEND_STATE 0x02
// Animation data. Sent by host.
//
// Packet structure:
// Data: | cmd | data type | data |
// # of Bytes: | 1 | 1 | ? |
//
// data type:
// Which animation this data is for. These are defined below.
//
// data:
// Animation data. Content depends on data type.
#define CMD_ANIM_DATA 0x03
// Data for FFT animation.
// Data segment consists of 10 bits, each representing the height of a column.
// Minimum height is 0, maximum is 250.
#define CMD_ANIM_DATA_fft 0x00
// Sent by keyboard to host when a complete word is typed.
// Host checks if this is a known word.
// If it is not, host responds with the same CMD (see below).
//
// Packet structure (sent by keyboard):
// Data: | cmd | word length | keycodes |
// # of Bytes: | 1 | 1 | ? |
//
// word length: number of bytes in `keycodes` block
//
//
// Packet structure (sent by host):
// Data: | cmd | typo? |
// # of Bytes: | 1 | 1 |
//
// typo: If this is 0x01, the word we got was a typo.
#define CMD_SPELLCHECK_WORD 0x04
// Sent by host when a "special char" key is pressed.
// Handled by host interface.
//
// Packet structure:
// Data: | cmd | character |
// # of Bytes: | 1 | 2 |
//
// character:
// uint16_t, character id
//
#define CMD_SPECIAL_CHAR 0x05

View File

@ -0,0 +1,34 @@
// Turns {h, s, v} triples into a macro, so that
// the LEDS_ergodox macro can take them as inputs.
#define LC_HSV(h, s, v) {h, s, v}
// Rearrange a human-readable LED layout into the correct Ergodox order.
// LEDS_ergodox ONLY WORKS WITH MACROS.
// Don't input a standalone triple {h, s, v};
// Use LC_HSV if you need a single-instance color.
#define LEDS_ergodox( \
l01,l02,l03,l04,l05, \
l06,l07,l08,l09,l10, \
l11,l12,l13,l14,l15, \
l16,l17,l18,l19,l20, \
l21,l22,l23,l24, \
\
l25,l26,l27,l28,l29, \
l30,l31,l32,l33,l34, \
l35,l36,l37,l38,l39, \
l40,l41,l42,l43,l44, \
l45,l46,l47,l48 \
) \
{ \
l25,l26,l27,l28,l29, \
l30,l31,l32,l33,l34, \
l35,l36,l37,l38,l39, \
l40,l41,l42,l43,l44, \
l45,l46,l47,l48, \
\
l05,l04,l03,l02,l01, \
l10,l09,l08,l07,l06, \
l15,l14,l13,l12,l11, \
l20,l19,l18,l17,l16, \
l24,l23,l22,l21 \
}

View File

@ -0,0 +1,133 @@
#include "betalupi_ergodox.h"
#ifdef SWAP_HANDS_ENABLE
__attribute__ ((weak))
// swap-hands action needs a matrix to define the swap
const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
/* Left hand, matrix positions */
{{0,13}, {1,13}, {2,13}, {3,13}, {4,13}, {5,13}},
{{0,12}, {1,12}, {2,12}, {3,12}, {4,12}, {5,12}},
{{0,11}, {1,11}, {2,11}, {3,11}, {4,11}, {5,11}},
{{0,10}, {1,10}, {2,10}, {3,10}, {4,10}, {5,10}},
{{0,9}, {1,9}, {2,9}, {3,9}, {4,9}, {5,9}},
{{0,8}, {1,8}, {2,8}, {3,8}, {4,8}, {5,8}},
{{0,7}, {1,7}, {2,7}, {3,7}, {4,7}, {5,7}},
/* Right hand, matrix positions */
{{0,6}, {1,6}, {2,6}, {3,6}, {4,6}, {5,6}},
{{0,5}, {1,5}, {2,5}, {3,5}, {4,5}, {5,5}},
{{0,4}, {1,4}, {2,4}, {3,4}, {4,4}, {5,4}},
{{0,3}, {1,3}, {2,3}, {3,3}, {4,3}, {5,3}},
{{0,2}, {1,2}, {2,2}, {3,2}, {4,2}, {5,2}},
{{0,1}, {1,1}, {2,1}, {3,1}, {4,1}, {5,1}},
{{0,0}, {1,0}, {2,0}, {3,0}, {4,0}, {5,0}},
};
#endif
#ifdef RGB_MATRIX_ENABLE
void suspend_power_down_kb(void) {
rgb_matrix_set_suspend_state(true);
suspend_power_down_user();
}
void suspend_wakeup_init_kb(void) {
rgb_matrix_set_suspend_state(false);
suspend_wakeup_init_user();
}
const is31_led g_is31_leds[RGB_MATRIX_LED_COUNT] = {
//{driver, R location, G location, B location}
{0, C3_1, C2_1, C4_1}, // LED1 on right
{0, C6_1, C5_1, C7_1}, // LED2
{0, C4_2, C3_2, C5_2}, // LED3
{0, C7_2, C6_2, C8_2}, // LED4
{0, C2_3, C1_3, C3_3}, // LED5
{0, C5_3, C4_3, C6_3}, // LED6
{0, C8_3, C7_3, C9_3}, // LED7
{0, C2_4, C1_4, C3_4}, // LED8
{0, C6_4, C5_4, C7_4}, // LED9
{0, C2_5, C1_5, C3_5}, // LED10
{0, C7_5, C6_5, C8_5}, // LED11
{0, C2_6, C1_6, C3_6}, // LED12
{0, C5_6, C4_6, C6_6}, // LED13
{0, C8_6, C7_6, C9_6}, // LED14
{0, C2_7, C1_7, C3_7}, // LED15
{0, C5_7, C4_7, C6_7}, // LED16
{0, C2_8, C1_8, C3_8}, // LED17
{0, C5_8, C4_8, C6_8}, // LED18
{0, C3_9, C2_9, C4_9}, // LED19
{0, C6_9, C5_9, C7_9}, // LED20
{0, C4_10, C3_10, C5_10}, // LED21
{0, C7_10, C6_10, C8_10}, // LED22
{0, C2_11, C1_11, C3_11}, // LED23
{0, C5_11, C4_11, C6_11}, // LED24
{1, C3_1, C2_1, C4_1}, // LED1 on left
{1, C6_1, C5_1, C7_1}, // LED2
{1, C4_2, C3_2, C5_2}, // LED3
{1, C7_2, C6_2, C8_2}, // LED4
{1, C2_3, C1_3, C3_3}, // LED5
{1, C5_3, C4_3, C6_3}, // LED6
{1, C8_3, C7_3, C9_3}, // LED7
{1, C2_4, C1_4, C3_4}, // LED8
{1, C6_4, C5_4, C7_4}, // LED9
{1, C2_5, C1_5, C3_5}, // LED10
{1, C7_5, C6_5, C8_5}, // LED11
{1, C2_6, C1_6, C3_6}, // LED12
{1, C5_6, C4_6, C6_6}, // LED13
{1, C8_6, C7_6, C9_6}, // LED14
{1, C2_7, C1_7, C3_7}, // LED15
{1, C5_7, C4_7, C6_7}, // LED16
{1, C2_8, C1_8, C3_8}, // LED17
{1, C5_8, C4_8, C6_8}, // LED18
{1, C3_9, C2_9, C4_9}, // LED19
{1, C6_9, C5_9, C7_9}, // LED20
{1, C4_10, C3_10, C5_10}, // LED21
{1, C7_10, C6_10, C8_10}, // LED22
{1, C2_11, C1_11, C3_11}, // LED23
{1, C5_11, C4_11, C6_11} // LED24
};
led_config_t g_led_config = { {
// Key matrix to LED index
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ 28, 33, 38, 43, 47, NO_LED },
{ 27, 32, 37, 42, 46, NO_LED },
{ 26, 31, 36, 41, 45, NO_LED },
{ 25, 30, 35, 40, 44, NO_LED },
{ 24, 29, 34, 39, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ 0, 5, 10, 15, NO_LED, NO_LED },
{ 1, 6, 11, 16, 20, NO_LED },
{ 2, 7, 12, 17, 21, NO_LED },
{ 3, 8, 13, 18, 22, NO_LED },
{ 4, 9, 14, 19, 23, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }
}, {
// LED index to physical position
{ 137, 0 }, { 154, 0 }, { 172, 0 }, { 189, 0 }, { 206, 0 }, { 137, 12 },
{ 154, 12 }, { 172, 12 }, { 189, 12 }, { 206, 12 }, { 137, 25 }, { 154, 25 },
{ 172, 25 }, { 189, 25 }, { 206, 25 }, { 137, 38 }, { 154, 38 }, { 172, 38 },
{ 189, 38 }, { 206, 38 }, { 154, 51 }, { 172, 51 }, { 189, 51 }, { 206, 51 },
{ 86, 0 }, { 68, 0 }, { 51, 0 }, { 34, 0 }, { 17, 0 }, { 86, 12 },
{ 68, 12 }, { 51, 12 }, { 34, 12 }, { 17, 12 }, { 86, 25 }, { 68, 25 },
{ 51, 25 }, { 34, 25 }, { 17, 25 }, { 86, 38 }, { 68, 38 }, { 51, 38 },
{ 34, 38 }, { 17, 38 }, { 68, 51 }, { 51, 51 }, { 34, 51 }, { 17, 51 }
}, {
// LED index to flag
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 1, 1, 1, 1,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 1, 1, 1, 1
} };
#endif

View File

@ -1,32 +1,3 @@
/*
Note for ErgoDox EZ customizers: Here be dragons!
This is not a file you want to be messing with.
All of the interesting stuff for you is under keymaps/ :)
Love, Erez
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com>
Copyright 2015 ZSA Technology Labs Inc (@zsa)
Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna)
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, see <http://www.gnu.org/licenses/>.
*/
/*
* scan matrix
*/
#include <stdint.h>
#include <stdbool.h>
#include <avr/io.h>

View File

@ -2,102 +2,401 @@
"keyboard_name": "Betalupi ErgoDox",
"url": "betalupi.com",
"maintainer": "mark@betalupi",
"manufacturer": "Betalupi",
"usb": {
// ZSA Labs
"vid": "0x3297",
// Ergodox glow variant
"pid": "0x4976",
"device_version": "1.0.0"
},
"width": 17,
"height": 8,
"layouts": {
"LAYOUT_ergodox": {
"layout": [
{"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25},
{"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5},
{"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25},
{"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5},
{"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x":4.5, "y":4.125},
{"matrix": [0, 0], "x": 0, "y": 0.375, "w": 1.5},
{"matrix": [1, 0], "x": 1.5, "y": 0.375},
{"matrix": [2, 0], "x": 2.5, "y": 0.125},
{"matrix": [3, 0], "x": 3.5, "y": 0},
{"matrix": [4, 0], "x": 4.5, "y": 0.125},
{"matrix": [5, 0], "x": 5.5, "y": 0.25},
{"matrix": [6, 0], "x": 6.5, "y": 0.25},
{"x":6, "y":5}, {"x":7, "y":5},
{"x":7, "y":6},
{"x":5, "y":6, "h":2}, {"x":6, "y":6, "h":2}, {"x":7, "y":7},
{"matrix": [0, 1], "x": 0, "y": 1.375, "w": 1.5},
{"matrix": [1, 1], "x": 1.5, "y": 1.375},
{"matrix": [2, 1], "x": 2.5, "y": 1.125},
{"matrix": [3, 1], "x": 3.5, "y": 1},
{"matrix": [4, 1], "x": 4.5, "y": 1.125},
{"matrix": [5, 1], "x": 5.5, "y": 1.25},
{"matrix": [6, 1], "x": 6.5, "y": 1.25, "h": 1.5},
{"matrix": [0, 2], "x": 0, "y": 2.375, "w": 1.5},
{"matrix": [1, 2], "x": 1.5, "y": 2.375},
{"matrix": [2, 2], "x": 2.5, "y": 2.125},
{"matrix": [3, 2], "x": 3.5, "y": 2},
{"matrix": [4, 2], "x": 4.5, "y": 2.125},
{"matrix": [5, 2], "x": 5.5, "y": 2.25},
{"x":9.5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.375, "w":1.5},
{"x":9.5, "y":1.25, "h":1.5}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.375, "w":1.5},
{"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.375, "w":1.5},
{"x":9.5, "y":2.75, "h":1.5}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.375, "w":1.5},
{"x":11.5, "y":4.125}, {"x":12.5, "y":4}, {"x":13.5, "y":4.125}, {"x":14.5, "y":4.375}, {"x":15.5, "y":4.375},
{"matrix": [0, 3], "x": 0, "y": 3.375, "w": 1.5},
{"matrix": [1, 3], "x": 1.5, "y": 3.375},
{"matrix": [2, 3], "x": 2.5, "y": 3.125},
{"matrix": [3, 3], "x": 3.5, "y": 3},
{"matrix": [4, 3], "x": 4.5, "y": 3.125},
{"matrix": [5, 3], "x": 5.5, "y": 3.25},
{"matrix": [6, 3], "x": 6.5, "y": 2.75, "h": 1.5},
{"matrix": [0, 4], "x": 0.5, "y": 4.375},
{"matrix": [1, 4], "x": 1.5, "y": 4.375},
{"matrix": [2, 4], "x": 2.5, "y": 4.125},
{"matrix": [3, 4], "x": 3.5, "y": 4},
{"matrix": [4, 4], "x": 4.5, "y": 4.125},
{"x":9, "y":5}, {"x":10, "y":5},
{"x":9, "y":6},
{"x":9, "y":7}, {"x":10, "y":6, "h":2}, {"x":11, "y":6, "h":2}
{"matrix": [5, 5], "x": 6, "y": 5},
{"matrix": [6, 5], "x": 7, "y": 5},
{"matrix": [4, 5], "x": 7, "y": 6},
{"matrix": [3, 5], "x": 5, "y": 6, "h": 2},
{"matrix": [2, 5], "x": 6, "y": 6, "h": 2},
{"matrix": [1, 5], "x": 7, "y": 7},
{"matrix": [7, 0], "x": 9.5, "y": 0.25},
{"matrix": [8, 0], "x": 10.5, "y": 0.25},
{"matrix": [9, 0], "x": 11.5, "y": 0.125},
{"matrix": [10, 0], "x": 12.5, "y": 0},
{"matrix": [11, 0], "x": 13.5, "y": 0.125},
{"matrix": [12, 0], "x": 14.5, "y": 0.375},
{"matrix": [13, 0], "x": 15.5, "y": 0.375, "w": 1.5},
{"matrix": [7, 1], "x": 9.5, "y": 1.25, "h": 1.5},
{"matrix": [8, 1], "x": 10.5, "y": 1.25},
{"matrix": [9, 1], "x": 11.5, "y": 1.125},
{"matrix": [10, 1], "x": 12.5, "y": 1},
{"matrix": [11, 1], "x": 13.5, "y": 1.125},
{"matrix": [12, 1], "x": 14.5, "y": 1.375},
{"matrix": [13, 1], "x": 15.5, "y": 1.375, "w": 1.5},
{"matrix": [8, 2], "x": 10.5, "y": 2.25},
{"matrix": [9, 2], "x": 11.5, "y": 2.125},
{"matrix": [10, 2], "x": 12.5, "y": 2},
{"matrix": [11, 2], "x": 13.5, "y": 2.125},
{"matrix": [12, 2], "x": 14.5, "y": 2.375},
{"matrix": [13, 2], "x": 15.5, "y": 2.375, "w": 1.5},
{"matrix": [7, 3], "x": 9.5, "y": 2.75, "h": 1.5},
{"matrix": [8, 3], "x": 10.5, "y": 3.25},
{"matrix": [9, 3], "x": 11.5, "y": 3.125},
{"matrix": [10, 3], "x": 12.5, "y": 3},
{"matrix": [11, 3], "x": 13.5, "y": 3.125},
{"matrix": [12, 3], "x": 14.5, "y": 3.375},
{"matrix": [13, 3], "x": 15.5, "y": 3.375, "w": 1.5},
{"matrix": [9, 4], "x": 11.5, "y": 4.125},
{"matrix": [10, 4], "x": 12.5, "y": 4},
{"matrix": [11, 4], "x": 13.5, "y": 4.125},
{"matrix": [12, 4], "x": 14.5, "y": 4.375},
{"matrix": [13, 4], "x": 15.5, "y": 4.375},
{"matrix": [7, 5], "x": 9, "y": 5},
{"matrix": [8, 5], "x": 10, "y": 5},
{"matrix": [9, 5], "x": 9, "y": 6},
{"matrix": [12, 5], "x": 9, "y": 7},
{"matrix": [11, 5], "x": 10, "y": 6, "h": 2},
{"matrix": [10, 5], "x": 11, "y": 6, "h": 2}
]
},
"LAYOUT_ergodox_pretty": {
"layout": [
{"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25},
{"x":9.5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.375, "w":1.5},
{"matrix": [0, 0], "x": 0, "y": 0.375, "w": 1.5},
{"matrix": [1, 0], "x": 1.5, "y": 0.375},
{"matrix": [2, 0], "x": 2.5, "y": 0.125},
{"matrix": [3, 0], "x": 3.5, "y": 0},
{"matrix": [4, 0], "x": 4.5, "y": 0.125},
{"matrix": [5, 0], "x": 5.5, "y": 0.25},
{"matrix": [6, 0], "x": 6.5, "y": 0.25},
{"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5},
{"x":9.5, "y":1.25, "h":1.5}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.375, "w":1.5},
{"matrix": [7, 0], "x": 9.5, "y": 0.25},
{"matrix": [8, 0], "x": 10.5, "y": 0.25},
{"matrix": [9, 0], "x": 11.5, "y": 0.125},
{"matrix": [10, 0], "x": 12.5, "y": 0},
{"matrix": [11, 0], "x": 13.5, "y": 0.125},
{"matrix": [12, 0], "x": 14.5, "y": 0.375},
{"matrix": [13, 0], "x": 15.5, "y": 0.375, "w": 1.5},
{"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25},
{"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.375, "w":1.5},
{"matrix": [0, 1], "x": 0, "y": 1.375, "w": 1.5},
{"matrix": [1, 1], "x": 1.5, "y": 1.375},
{"matrix": [2, 1], "x": 2.5, "y": 1.125},
{"matrix": [3, 1], "x": 3.5, "y": 1},
{"matrix": [4, 1], "x": 4.5, "y": 1.125},
{"matrix": [5, 1], "x": 5.5, "y": 1.25},
{"matrix": [6, 1], "x": 6.5, "y": 1.25, "h": 1.5},
{"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5},
{"x":9.5, "y":2.75, "h":1.5}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.375, "w":1.5},
{"matrix": [7, 1], "x": 9.5, "y": 1.25, "h": 1.5},
{"matrix": [8, 1], "x": 10.5, "y": 1.25},
{"matrix": [9, 1], "x": 11.5, "y": 1.125},
{"matrix": [10, 1], "x": 12.5, "y": 1},
{"matrix": [11, 1], "x": 13.5, "y": 1.125},
{"matrix": [12, 1], "x": 14.5, "y": 1.375},
{"matrix": [13, 1], "x": 15.5, "y": 1.375, "w": 1.5},
{"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x":4.5, "y":4.125},
{"x":11.5, "y":4.125}, {"x":12.5, "y":4}, {"x":13.5, "y":4.125}, {"x":14.5, "y":4.375}, {"x":15.5, "y":4.375},
{"matrix": [0, 2], "x": 0, "y": 2.375, "w": 1.5},
{"matrix": [1, 2], "x": 1.5, "y": 2.375},
{"matrix": [2, 2], "x": 2.5, "y": 2.125},
{"matrix": [3, 2], "x": 3.5, "y": 2},
{"matrix": [4, 2], "x": 4.5, "y": 2.125},
{"matrix": [5, 2], "x": 5.5, "y": 2.25},
{"x":6, "y":5}, {"x":7, "y":5}, {"x":9, "y":5}, {"x":10, "y":5},
{"x":7, "y":6}, {"x":9, "y":6},
{"x":5, "y":6, "h":2}, {"x":6, "y":6, "h":2}, {"x":7, "y":7}, {"x":9, "y":7}, {"x":10, "y":6, "h":2}, {"x":11, "y":6, "h":2}
{"matrix": [8, 2], "x": 10.5, "y": 2.25},
{"matrix": [9, 2], "x": 11.5, "y": 2.125},
{"matrix": [10, 2], "x": 12.5, "y": 2},
{"matrix": [11, 2], "x": 13.5, "y": 2.125},
{"matrix": [12, 2], "x": 14.5, "y": 2.375},
{"matrix": [13, 2], "x": 15.5, "y": 2.375, "w": 1.5},
{"matrix": [0, 3], "x": 0, "y": 3.375, "w": 1.5},
{"matrix": [1, 3], "x": 1.5, "y": 3.375},
{"matrix": [2, 3], "x": 2.5, "y": 3.125},
{"matrix": [3, 3], "x": 3.5, "y": 3},
{"matrix": [4, 3], "x": 4.5, "y": 3.125},
{"matrix": [5, 3], "x": 5.5, "y": 3.25},
{"matrix": [6, 3], "x": 6.5, "y": 2.75, "h": 1.5},
{"matrix": [7, 3], "x": 9.5, "y": 2.75, "h": 1.5},
{"matrix": [8, 3], "x": 10.5, "y": 3.25},
{"matrix": [9, 3], "x": 11.5, "y": 3.125},
{"matrix": [10, 3], "x": 12.5, "y": 3},
{"matrix": [11, 3], "x": 13.5, "y": 3.125},
{"matrix": [12, 3], "x": 14.5, "y": 3.375},
{"matrix": [13, 3], "x": 15.5, "y": 3.375, "w": 1.5},
{"matrix": [0, 4], "x": 0.5, "y": 4.375},
{"matrix": [1, 4], "x": 1.5, "y": 4.375},
{"matrix": [2, 4], "x": 2.5, "y": 4.125},
{"matrix": [3, 4], "x": 3.5, "y": 4},
{"matrix": [4, 4], "x": 4.5, "y": 4.125},
{"matrix": [9, 4], "x": 11.5, "y": 4.125},
{"matrix": [10, 4], "x": 12.5, "y": 4},
{"matrix": [11, 4], "x": 13.5, "y": 4.125},
{"matrix": [12, 4], "x": 14.5, "y": 4.375},
{"matrix": [13, 4], "x": 15.5, "y": 4.375},
{"matrix": [5, 5], "x": 6, "y": 5},
{"matrix": [6, 5], "x": 7, "y": 5},
{"matrix": [7, 5], "x": 9, "y": 5},
{"matrix": [8, 5], "x": 10, "y": 5},
{"matrix": [4, 5], "x": 7, "y": 6},
{"matrix": [9, 5], "x": 9, "y": 6},
{"matrix": [3, 5], "x": 5, "y": 6, "h": 2},
{"matrix": [2, 5], "x": 6, "y": 6, "h": 2},
{"matrix": [1, 5], "x": 7, "y": 7},
{"matrix": [12, 5], "x": 9, "y": 7},
{"matrix": [11, 5], "x": 10, "y": 6, "h": 2},
{"matrix": [10, 5], "x": 11, "y": 6, "h": 2}
]
},
"LAYOUT_ergodox_80": {
"layout": [
{"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25},
{"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5},
{"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25},
{"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5},
{"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x":4.5, "y":4.125},
{"matrix": [0, 0], "x": 0, "y": 0.375, "w": 1.5},
{"matrix": [1, 0], "x": 1.5, "y": 0.375},
{"matrix": [2, 0], "x": 2.5, "y": 0.125},
{"matrix": [3, 0], "x": 3.5, "y": 0},
{"matrix": [4, 0], "x": 4.5, "y": 0.125},
{"matrix": [5, 0], "x": 5.5, "y": 0.25},
{"matrix": [6, 0], "x": 6.5, "y": 0.25},
{"x":6, "y":5}, {"x":7, "y":5},
{"x":5, "y":6}, {"x":6, "y":6}, {"x":7, "y":6},
{"x":5, "y":7}, {"x":6, "y":7}, {"x":7, "y":7},
{"matrix": [0, 1], "x": 0, "y": 1.375, "w": 1.5},
{"matrix": [1, 1], "x": 1.5, "y": 1.375},
{"matrix": [2, 1], "x": 2.5, "y": 1.125},
{"matrix": [3, 1], "x": 3.5, "y": 1},
{"matrix": [4, 1], "x": 4.5, "y": 1.125},
{"matrix": [5, 1], "x": 5.5, "y": 1.25},
{"matrix": [6, 1], "x": 6.5, "y": 1.25, "h": 1.5},
{"matrix": [0, 2], "x": 0, "y": 2.375, "w": 1.5},
{"matrix": [1, 2], "x": 1.5, "y": 2.375},
{"matrix": [2, 2], "x": 2.5, "y": 2.125},
{"matrix": [3, 2], "x": 3.5, "y": 2},
{"matrix": [4, 2], "x": 4.5, "y": 2.125},
{"matrix": [5, 2], "x": 5.5, "y": 2.25},
{"x":9.5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.375, "w":1.5},
{"x":9.5, "y":1.25, "h":1.5}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.375, "w":1.5},
{"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.375, "w":1.5},
{"x":9.5, "y":2.75, "h":1.5}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.375, "w":1.5},
{"x":11.5, "y":4.125}, {"x":12.5, "y":4}, {"x":13.5, "y":4.125}, {"x":14.5, "y":4.375}, {"x":15.5, "y":4.375},
{"matrix": [0, 3], "x": 0, "y": 3.375, "w": 1.5},
{"matrix": [1, 3], "x": 1.5, "y": 3.375},
{"matrix": [2, 3], "x": 2.5, "y": 3.125},
{"matrix": [3, 3], "x": 3.5, "y": 3},
{"matrix": [4, 3], "x": 4.5, "y": 3.125},
{"matrix": [5, 3], "x": 5.5, "y": 3.25},
{"matrix": [6, 3], "x": 6.5, "y": 2.75, "h": 1.5},
{"matrix": [0, 4], "x": 0.5, "y": 4.375},
{"matrix": [1, 4], "x": 1.5, "y": 4.375},
{"matrix": [2, 4], "x": 2.5, "y": 4.125},
{"matrix": [3, 4], "x": 3.5, "y": 4},
{"matrix": [4, 4], "x": 4.5, "y": 4.125},
{"x":9, "y":5}, {"x":10, "y":5},
{"x":9, "y":6}, {"x":10, "y":6}, {"x":11, "y":6},
{"x":9, "y":7}, {"x":10, "y":7}, {"x":11, "y":7}
{"matrix": [5, 5], "x": 6, "y": 5},
{"matrix": [6, 5], "x": 7, "y": 5},
{"matrix": [5, 4], "x": 5, "y": 6},
{"matrix": [6, 4], "x": 6, "y": 6},
{"matrix": [4, 5], "x": 7, "y": 6},
{"matrix": [3, 5], "x": 5, "y": 7},
{"matrix": [2, 5], "x": 6, "y": 7},
{"matrix": [1, 5], "x": 7, "y": 7},
{"matrix": [7, 0], "x": 9.5, "y": 0.25},
{"matrix": [8, 0], "x": 10.5, "y": 0.25},
{"matrix": [9, 0], "x": 11.5, "y": 0.125},
{"matrix": [10, 0], "x": 12.5, "y": 0},
{"matrix": [11, 0], "x": 13.5, "y": 0.125},
{"matrix": [12, 0], "x": 14.5, "y": 0.375},
{"matrix": [13, 0], "x": 15.5, "y": 0.375, "w": 1.5},
{"matrix": [7, 1], "x": 9.5, "y": 1.25, "h": 1.5},
{"matrix": [8, 1], "x": 10.5, "y": 1.25},
{"matrix": [9, 1], "x": 11.5, "y": 1.125},
{"matrix": [10, 1], "x": 12.5, "y": 1},
{"matrix": [11, 1], "x": 13.5, "y": 1.125},
{"matrix": [12, 1], "x": 14.5, "y": 1.375},
{"matrix": [13, 1], "x": 15.5, "y": 1.375, "w": 1.5},
{"matrix": [8, 2], "x": 10.5, "y": 2.25},
{"matrix": [9, 2], "x": 11.5, "y": 2.125},
{"matrix": [10, 2], "x": 12.5, "y": 2},
{"matrix": [11, 2], "x": 13.5, "y": 2.125},
{"matrix": [12, 2], "x": 14.5, "y": 2.375},
{"matrix": [13, 2], "x": 15.5, "y": 2.375, "w": 1.5},
{"matrix": [7, 3], "x": 9.5, "y": 2.75, "h": 1.5},
{"matrix": [8, 3], "x": 10.5, "y": 3.25},
{"matrix": [9, 3], "x": 11.5, "y": 3.125},
{"matrix": [10, 3], "x": 12.5, "y": 3},
{"matrix": [11, 3], "x": 13.5, "y": 3.125},
{"matrix": [12, 3], "x": 14.5, "y": 3.375},
{"matrix": [13, 3], "x": 15.5, "y": 3.375, "w": 1.5},
{"matrix": [9, 4], "x": 11.5, "y": 4.125},
{"matrix": [10, 4], "x": 12.5, "y": 4},
{"matrix": [11, 4], "x": 13.5, "y": 4.125},
{"matrix": [12, 4], "x": 14.5, "y": 4.375},
{"matrix": [13, 4], "x": 15.5, "y": 4.375},
{"matrix": [7, 5], "x": 9, "y": 5},
{"matrix": [8, 5], "x": 10, "y": 5},
{"matrix": [9, 5], "x": 9, "y": 6},
{"matrix": [7, 4], "x": 10, "y": 6},
{"matrix": [8, 4], "x": 11, "y": 6},
{"matrix": [12, 5], "x": 9, "y": 7},
{"matrix": [11, 5], "x": 10, "y": 7},
{"matrix": [10, 5], "x": 11, "y": 7}
]
},
"LAYOUT_ergodox_pretty_80": {
"layout": [
{"x":0, "y":0.375, "w":1.5}, {"x":1.5, "y":0.375}, {"x":2.5, "y":0.125}, {"x":3.5, "y":0}, {"x":4.5, "y":0.125}, {"x":5.5, "y":0.25}, {"x":6.5, "y":0.25},
{"x":9.5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.375, "w":1.5},
{"matrix": [0, 0], "x": 0, "y": 0.375, "w": 1.5},
{"matrix": [1, 0], "x": 1.5, "y": 0.375},
{"matrix": [2, 0], "x": 2.5, "y": 0.125},
{"matrix": [3, 0], "x": 3.5, "y": 0},
{"matrix": [4, 0], "x": 4.5, "y": 0.125},
{"matrix": [5, 0], "x": 5.5, "y": 0.25},
{"matrix": [6, 0], "x": 6.5, "y": 0.25},
{"x":0, "y":1.375, "w":1.5}, {"x":1.5, "y":1.375}, {"x":2.5, "y":1.125}, {"x":3.5, "y":1}, {"x":4.5, "y":1.125}, {"x":5.5, "y":1.25}, {"x":6.5, "y":1.25, "h":1.5},
{"x":9.5, "y":1.25, "h":1.5}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.375, "w":1.5},
{"matrix": [7, 0], "x": 9.5, "y": 0.25},
{"matrix": [8, 0], "x": 10.5, "y": 0.25},
{"matrix": [9, 0], "x": 11.5, "y": 0.125},
{"matrix": [10, 0], "x": 12.5, "y": 0},
{"matrix": [11, 0], "x": 13.5, "y": 0.125},
{"matrix": [12, 0], "x": 14.5, "y": 0.375},
{"matrix": [13, 0], "x": 15.5, "y": 0.375, "w": 1.5},
{"x":0, "y":2.375, "w":1.5}, {"x":1.5, "y":2.375}, {"x":2.5, "y":2.125}, {"x":3.5, "y":2}, {"x":4.5, "y":2.125}, {"x":5.5, "y":2.25},
{"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.375, "w":1.5},
{"matrix": [0, 1], "x": 0, "y": 1.375, "w": 1.5},
{"matrix": [1, 1], "x": 1.5, "y": 1.375},
{"matrix": [2, 1], "x": 2.5, "y": 1.125},
{"matrix": [3, 1], "x": 3.5, "y": 1},
{"matrix": [4, 1], "x": 4.5, "y": 1.125},
{"matrix": [5, 1], "x": 5.5, "y": 1.25},
{"matrix": [6, 1], "x": 6.5, "y": 1.25, "h": 1.5},
{"x":0, "y":3.375, "w":1.5}, {"x":1.5, "y":3.375}, {"x":2.5, "y":3.125}, {"x":3.5, "y":3}, {"x":4.5, "y":3.125}, {"x":5.5, "y":3.25}, {"x":6.5, "y":2.75, "h":1.5},
{"x":9.5, "y":2.75, "h":1.5}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.375, "w":1.5},
{"matrix": [7, 1], "x": 9.5, "y": 1.25, "h": 1.5},
{"matrix": [8, 1], "x": 10.5, "y": 1.25},
{"matrix": [9, 1], "x": 11.5, "y": 1.125},
{"matrix": [10, 1], "x": 12.5, "y": 1},
{"matrix": [11, 1], "x": 13.5, "y": 1.125},
{"matrix": [12, 1], "x": 14.5, "y": 1.375},
{"matrix": [13, 1], "x": 15.5, "y": 1.375, "w": 1.5},
{"x":0.5, "y":4.375}, {"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4}, {"x":4.5, "y":4.125},
{"x":11.5, "y":4.125}, {"x":12.5, "y":4}, {"x":13.5, "y":4.125}, {"x":14.5, "y":4.375}, {"x":15.5, "y":4.375},
{"matrix": [0, 2], "x": 0, "y": 2.375, "w": 1.5},
{"matrix": [1, 2], "x": 1.5, "y": 2.375},
{"matrix": [2, 2], "x": 2.5, "y": 2.125},
{"matrix": [3, 2], "x": 3.5, "y": 2},
{"matrix": [4, 2], "x": 4.5, "y": 2.125},
{"matrix": [5, 2], "x": 5.5, "y": 2.25},
{"x":6, "y":5}, {"x":7, "y":5}, {"x":9, "y":5}, {"x":10, "y":5},
{"x":5, "y":6}, {"x":6, "y":6}, {"x":7, "y":6}, {"x":9, "y":6}, {"x":10, "y":6}, {"x":11, "y":6},
{"x":5, "y":7}, {"x":6, "y":7}, {"x":7, "y":7}, {"x":9, "y":7}, {"x":10, "y":7}, {"x":11, "y":7}
{"matrix": [8, 2], "x": 10.5, "y": 2.25},
{"matrix": [9, 2], "x": 11.5, "y": 2.125},
{"matrix": [10, 2], "x": 12.5, "y": 2},
{"matrix": [11, 2], "x": 13.5, "y": 2.125},
{"matrix": [12, 2], "x": 14.5, "y": 2.375},
{"matrix": [13, 2], "x": 15.5, "y": 2.375, "w": 1.5},
{"matrix": [0, 3], "x": 0, "y": 3.375, "w": 1.5},
{"matrix": [1, 3], "x": 1.5, "y": 3.375},
{"matrix": [2, 3], "x": 2.5, "y": 3.125},
{"matrix": [3, 3], "x": 3.5, "y": 3},
{"matrix": [4, 3], "x": 4.5, "y": 3.125},
{"matrix": [5, 3], "x": 5.5, "y": 3.25},
{"matrix": [6, 3], "x": 6.5, "y": 2.75, "h": 1.5},
{"matrix": [7, 3], "x": 9.5, "y": 2.75, "h": 1.5},
{"matrix": [8, 3], "x": 10.5, "y": 3.25},
{"matrix": [9, 3], "x": 11.5, "y": 3.125},
{"matrix": [10, 3], "x": 12.5, "y": 3},
{"matrix": [11, 3], "x": 13.5, "y": 3.125},
{"matrix": [12, 3], "x": 14.5, "y": 3.375},
{"matrix": [13, 3], "x": 15.5, "y": 3.375, "w": 1.5},
{"matrix": [0, 4], "x": 0.5, "y": 4.375},
{"matrix": [1, 4], "x": 1.5, "y": 4.375},
{"matrix": [2, 4], "x": 2.5, "y": 4.125},
{"matrix": [3, 4], "x": 3.5, "y": 4},
{"matrix": [4, 4], "x": 4.5, "y": 4.125},
{"matrix": [9, 4], "x": 11.5, "y": 4.125},
{"matrix": [10, 4], "x": 12.5, "y": 4},
{"matrix": [11, 4], "x": 13.5, "y": 4.125},
{"matrix": [12, 4], "x": 14.5, "y": 4.375},
{"matrix": [13, 4], "x": 15.5, "y": 4.375},
{"matrix": [5, 5], "x": 6, "y": 5},
{"matrix": [6, 5], "x": 7, "y": 5},
{"matrix": [7, 5], "x": 9, "y": 5},
{"matrix": [8, 5], "x": 10, "y": 5},
{"matrix": [5, 4], "x": 5, "y": 6},
{"matrix": [6, 4], "x": 6, "y": 6},
{"matrix": [4, 5], "x": 7, "y": 6},
{"matrix": [9, 5], "x": 9, "y": 6},
{"matrix": [7, 4], "x": 10, "y": 6},
{"matrix": [8, 4], "x": 11, "y": 6},
{"matrix": [3, 5], "x": 5, "y": 7},
{"matrix": [2, 5], "x": 6, "y": 7},
{"matrix": [1, 5], "x": 7, "y": 7},
{"matrix": [12, 5], "x": 9, "y": 7},
{"matrix": [11, 5], "x": 10, "y": 7},
{"matrix": [10, 5], "x": 11, "y": 7}
]
}
}

View File

@ -1,3 +1,18 @@
#define ENABLE_BETA_LEADER
// No timeout after initial leader key press
#define LEADER_NO_TIMEOUT
// Timeout resets after each keypress
#define LEADER_PER_KEY_TIMING
#define LEADER_TIMEOUT 500
// Enable spellcheck over HID
//#define ENABLE_HID_SPELLCHECK
#define ENABLE_AUTOCORRECT
// RGBLight effects
// Static color is always enabled.
//#define RGBLIGHT_EFFECT_ALTERNATING
@ -11,68 +26,7 @@
//#define RGBLIGHT_EFFECT_STATIC_GRADIENT
//#define RGBLIGHT_EFFECT_TWINKLE
// Special effects
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
//#define RGB_MATRIX_KEYPRESSES
// Custom effects
//#def DISABLE_RGB_MATRIX_FFT_ANIM // FFT Display (Requires framebuffer)
// #define RGB_MATRIX_FRAMEBUFFER_EFFECTS
// #define ENABLE_RGB_MATRIX_FFT_ANIM // Requires framebuffer
// Normal matrix effects
//#define DISABLE_RGB_MATRIX_SOLID_COLOR
#define DISABLE_RGB_MATRIX_ALPHAS_MODS // Static dual hue, speed is hue for secondary hue
//#define DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN // Static gradient top to bottom, speed controls how much gradient changes
#define DISABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT // Static gradient left to right, speed controls how much gradient changes
#define DISABLE_RGB_MATRIX_BREATHING // Single hue brightness cycling animation
#define DISABLE_RGB_MATRIX_BAND_SAT // Single hue band fading saturation scrolling left to right
#define DISABLE_RGB_MATRIX_BAND_VAL // Single hue band fading brightness scrolling left to right
#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_SAT // Single hue 3 blade spinning pinwheel fades saturation
#define DISABLE_RGB_MATRIX_BAND_PINWHEEL_VAL // Single hue 3 blade spinning pinwheel fades brightness
#define DISABLE_RGB_MATRIX_BAND_SPIRAL_SAT // Single hue spinning spiral fades saturation
#define DISABLE_RGB_MATRIX_BAND_SPIRAL_VAL // Single hue spinning spiral fades brightness
#define DISABLE_RGB_MATRIX_CYCLE_ALL // Full keyboard solid hue cycling through full gradient
#define DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT // Full gradient scrolling left to right
#define DISABLE_RGB_MATRIX_CYCLE_UP_DOWN // Full gradient scrolling top to bottom
#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN // Full gradient scrolling out to in
#define DISABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL // Full dual gradients scrolling out to in
#define DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON // Full gradent Chevron shapped scrolling left to right
#define DISABLE_RGB_MATRIX_CYCLE_PINWHEEL // Full gradient spinning pinwheel around center of keyboard
#define DISABLE_RGB_MATRIX_CYCLE_SPIRAL // Full gradient spinning spiral around center of keyboard
#define DISABLE_RGB_MATRIX_DUAL_BEACON // Full gradient spinning around center of keyboard
#define DISABLE_RGB_MATRIX_RAINBOW_BEACON // Full tighter gradient spinning around center of keyboard
#define DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS // Full dual gradients spinning two halfs of keyboard
#define DISABLE_RGB_MATRIX_RAINDROPS // Randomly changes a single key's hue
#define DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS // Randomly changes a single key's hue and saturation
#define DISABLE_RGB_MATRIX_HUE_BREATHING // Hue shifts up a slight ammount at the same time, then shifts back
#define DISABLE_RGB_MATRIX_HUE_PENDULUM // Hue shifts up a slight ammount in a wave to the right, then back to the left
#define DISABLE_RGB_MATRIX_HUE_WAVE // Hue shifts up a slight ammount and then back down in a wave to the right
#define DISABLE_RGB_MATRIX_PIXEL_FRACTAL // Single hue fractal filled keys pulsing horizontally out to edges
#define DISABLE_RGB_MATRIX_PIXEL_FLOW // Pulsing RGB flow along LED wiring with random hues
#define DISABLE_RGB_MATRIX_PIXEL_RAIN // Randomly light keys with random hues
// Framebuffer matrix effects
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define DISABLE_RGB_MATRIX_TYPING_HEATMAP
#define DISABLE_RGB_MATRIX_DIGITAL_RAIN
#endif
// Keypress matrix effects
#ifdef RGB_MATRIX_KEYPRESSES
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE // Pulses keys hit to hue & value then fades value out
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE // Static single hue, pulses keys hit to shifted hue then fades to current hue
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE // Hue & value pulse near a single key hit then fades value out
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE // Hue & value pulse near multiple key hits then fades value out
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS // Hue & value pulse the same column and row of a single key hit then fades value out
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS // Hue & value pulse the same column and row of multiple key hits then fades value out
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS // Hue & value pulse away on the same column and row of a single key hit then fades value out
#define DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS // Hue & value pulse away on the same column and row of multiple key hits then fades value out
#define DISABLE_RGB_MATRIX_SPLASH // Full gradient & value pulse away from a single key hit then fades value out
#define DISABLE_RGB_MATRIX_MULTISPLASH // Full gradient & value pulse away from multiple key hits then fades value out
#define DISABLE_RGB_MATRIX_SOLID_SPLASH // Hue & value pulse away from a single key hit then fades value out
#define DISABLE_RGB_MATRIX_SOLID_MULTISPLASH // Hue & value pulse away from multiple key hits then fades value out
#endif

View File

@ -1,178 +1,182 @@
#include "keymap.h"
#include QMK_KEYBOARD_H
#include "version.h"
#include "keymap_russian.h"
#include "keymap_us_international.h"
// Define custom keys
// (Must be done BEFORE keymaps)
// Values that should not be saved to git.
// There should be a`secrets.h` in this directory
// with the following contents:
//
// #define SECRET_EMAIL "value"
// #define SECRET_GMAIL "value"
// #define SECRET_SCHOOL_EMAIL "value"
#include "secrets.h"
// Macro keycodes
enum custom_keycodes {
M_SHUTDOWN = BETA_SAFE_RANGE,
// Macros
M_RESETWM,
M_RU_CTRL,
M_RU_ALT
M_RU_ALT,
M_GUI,
// Special characters.
// M_SPECIAL_TOP and M_SPECIAL_BOTTOM are
// bounds used to parse these. Only special
// characters should be between them.
//
// Сharacters here should be in the same
// order as they are in the host inteface.
M_SPECIAL_TOP,
M_SC_GRAVE,
M_SC_TILD,
M_SC_QUOT,
M_SC_LBR,
M_SC_RBR,
M_SC_LCBR,
M_SC_RCBR,
M_SC_LKVCH,
M_SC_RKVCH,
M_SPECIAL_BOTTOM
};
// Tapdance keycodes
enum tap_dance_codes {
TD_WMLAYOUT,
TD_SCREENSHOT,
TD_OCR
};
// LED colors
#define LC_OFF LC_HSV( 0, 0, 0)
#define LC_GREEN LC_HSV( 85, 203, 158)
#define LC_YELLOW LC_HSV( 32, 176, 255)
#define LC_PINK LC_HSV(243, 222, 234)
#define LC_CYAN LC_HSV(134, 255, 213)
#define LC_ORANGE LC_HSV( 14, 255, 255)
#define LC_WHITE LC_HSV( 0, 0, 150)
#define LC_RED LC_HSV( 0, 255, 145)
// Assemble key and LED maps
enum layer_indices {
LAYER_MAIN_IDX = 0,
LAYER_RUSSIAN_IDX,
LAYER_NUMPAD_IDX,
LAYER_SYMBOLS_IDX,
LAYER_ARROWS_IDX,
LAYER_FKEYS_IDX,
LAYER_DESKTOP_IDX,
LAYER_KEYBOARD_IDX,
LAYER_SYMBOLS_RU_IDX
};
enum led_indices {
// We have seperate indexes for LEDs because
// some layers may not need an led map.
// This saves memory by avoiding extra empty led maps.
LAYER_RUSSIAN_LEDS_IDX = 0,
LAYER_NUMPAD_LEDS_IDX,
LAYER_SYMBOLS_LEDS_IDX,
LAYER_ARROWS_LEDS_IDX,
LAYER_FKEYS_LEDS_IDX,
LAYER_DESKTOP_LEDS_IDX,
LAYER_SYMBOLS_RU_LEDS_IDX
};
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[LAYER_MAIN_IDX] = LAYER_MAIN,
[LAYER_RUSSIAN_IDX] = LAYER_RUSSIAN,
[LAYER_NUMPAD_IDX] = LAYER_NUMPAD,
[LAYER_SYMBOLS_IDX] = LAYER_SYMBOLS,
[LAYER_ARROWS_IDX] = LAYER_ARROWS,
[LAYER_FKEYS_IDX] = LAYER_FKEYS,
[LAYER_DESKTOP_IDX] = LAYER_DESKTOP,
[LAYER_KEYBOARD_IDX] = LAYER_KEYBOARD,
[LAYER_SYMBOLS_RU_IDX] = LAYER_SYMBOLS_RU
};
const uint8_t PROGMEM ledmap[][DRIVER_LED_TOTAL][3] = {
[LAYER_RUSSIAN_LEDS_IDX] = LAYER_RUSSIAN_LEDS,
[LAYER_NUMPAD_LEDS_IDX] = LAYER_NUMPAD_LEDS,
[LAYER_SYMBOLS_LEDS_IDX] = LAYER_SYMBOLS_LEDS,
[LAYER_ARROWS_LEDS_IDX] = LAYER_ARROWS_LEDS,
[LAYER_FKEYS_LEDS_IDX] = LAYER_FKEYS_LEDS,
[LAYER_DESKTOP_LEDS_IDX] = LAYER_DESKTOP_LEDS,
[LAYER_SYMBOLS_RU_LEDS_IDX] = LAYER_SYMBOLS_RU_LEDS
};
void keyboard_post_init_user(void) {}
#define LC_RU_B LC_HSV( 0, 0, 165)
#define LC_RU_G LC_HSV(153, 255, 153)
#define LC_RU_K LC_HSV( 0, 255, 145)
#ifdef ENABLE_HID_SPELLCHECK
#include "features/hid_spellcheck.h"
#endif
void set_layer_color(int layer) {
for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
HSV hsv = {
.h = pgm_read_byte(&ledmap[layer][i][0]),
.s = pgm_read_byte(&ledmap[layer][i][1]),
.v = pgm_read_byte(&ledmap[layer][i][2]),
};
if (!hsv.h && !hsv.s && !hsv.v) {
rgb_matrix_set_color( i, 0, 0, 0 );
} else {
RGB rgb = hsv_to_rgb( hsv );
float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
rgb_matrix_set_color( i, f * rgb.r, f * rgb.g, f * rgb.b );
}
}
}
#ifdef ENABLE_AUTOCORRECT
#include "features/autocorrect/autocorrect.h"
#endif
void rgb_matrix_indicators_user(void) {
if (keyboard_config.disable_layer_led) {
return;
}
#ifdef ENABLE_BETA_LEADER
#include "features/leader/beta_leader.h"
#endif
switch (biton32(layer_state)) {
case LAYER_RUSSIAN_IDX:
set_layer_color(LAYER_RUSSIAN_LEDS_IDX);
break;
case LAYER_SYMBOLS_RU_IDX:
set_layer_color(LAYER_SYMBOLS_RU_LEDS_IDX);
break;
case LAYER_NUMPAD_IDX:
set_layer_color(LAYER_NUMPAD_LEDS_IDX);
break;
case LAYER_SYMBOLS_IDX:
set_layer_color(LAYER_SYMBOLS_LEDS_IDX);
break;
case LAYER_ARROWS_IDX:
set_layer_color(LAYER_ARROWS_LEDS_IDX);
break;
case LAYER_FKEYS_IDX:
set_layer_color(LAYER_FKEYS_LEDS_IDX);
break;
case LAYER_DESKTOP_IDX:
set_layer_color(LAYER_DESKTOP_LEDS_IDX);
break;
default:
if (rgb_matrix_get_flags() == LED_FLAG_NONE) {
rgb_matrix_set_color_all(0, 0, 0);
}
break;
}
}
#include "features/beta_rawhid.h"
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case M_RESETWM:
if (record->event.pressed) {
SEND_STRING(SS_LCTL(SS_LGUI(SS_LSFT(SS_TAP(X_R)))));
}
break;
case M_SHUTDOWN:
if (record->event.pressed) {
SEND_STRING(SS_LGUI(SS_TAP(X_P)) SS_DELAY(100) SS_TAP(X_Y) SS_DELAY(100) SS_TAP(X_ENTER));
}
break;
case M_RU_CTRL:
if (record->event.pressed) {
layer_move(LAYER_MAIN_IDX);
register_code16(KC_LCTRL);
} else {
unregister_code16(KC_LCTRL);
layer_move(LAYER_RUSSIAN_IDX);
}
break;
// Send a special character.
// Returns false if character was caught, true otherwise.
bool send_special_character(uint16_t keycode) {
if ( (keycode > M_SPECIAL_TOP) && (keycode < M_SPECIAL_BOTTOM) ) {
hid_send_special_char(keycode - M_SPECIAL_TOP - 1);
return false;
}
return true;
}
uint32_t layer_state_set_user(uint32_t state) {
uint8_t layer = biton32(state);
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
switch (layer) {
case LAYER_NUMPAD_IDX:
ergodox_right_led_1_on();
break;
case LAYER_KEYBOARD_IDX:
ergodox_right_led_1_on();
ergodox_right_led_2_on();
ergodox_right_led_3_on();
break;
default:
break;
void matrix_scan_user(void) {
#ifdef ENABLE_BETA_LEADER
beta_qk_leader_check();
#endif
}
return state;
const uint16_t PROGMEM test_combo2[] = {KC_D, KC_F, COMBO_END};
combo_t key_combos[] = {
COMBO(test_combo2, KC_TAB),
};
qk_tap_dance_action_t tap_dance_actions[] = {
[TD_WMLAYOUT] = ACTION_TAP_DANCE_FN_ADVANCED(td_wmlayout_dance, td_wmlayout_finished, td_wmlayout_reset),
};
// Include all other parts of configuration
#include "layers/layers.c"
#include "parts/leader.c"
#include "parts/tapdance.c"
// Process macros.
// Return FALSE to halt key processing,
// Return TRUE to allow QMK to handle keypress.
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef ENABLE_BETA_LEADER
if (!beta_process_leader(keycode, record)) { return false; }
#endif
#ifdef ENABLE_HID_SPELLCHECK
if (!process_spellcheck(keycode, record)) { return false; }
#endif
#ifdef ENABLE_AUTOCORRECT
if (!process_autocorrection(keycode, record)) { return false; }
#endif
// Handle special chars
if (record->event.pressed) {
if (!send_special_character(keycode)) { return false; }
}
// Handle macros
switch (keycode) {
case M_RESETWM:
if (record->event.pressed) {
SEND_STRING(SS_LCTL(SS_LGUI(SS_LSFT(SS_TAP(X_R)))));
}
return false;
// Workaround for one-shot LGUI key.
// Using just LGUI with LAYER_DESKTOP as OSL
// does not allow you to hold lgui. This does.
case M_GUI:
if (record->event.pressed) {
register_code16(KC_LGUI);
} else {
unregister_code16(KC_LGUI);
}
return false;
case M_SHUTDOWN:
if (record->event.pressed) {
SEND_STRING(SS_LGUI(SS_TAP(X_P)) SS_DELAY(100) SS_TAP(X_Y) SS_DELAY(100) SS_TAP(X_ENTER));
}
return false;
case M_RU_CTRL:
if (record->event.pressed) {
layer_move(LAYER_MAIN);
register_code16(KC_LCTL);
} else {
unregister_code16(KC_LCTL);
layer_move(LAYER_RUSSIAN);
}
return false;
case M_RU_ALT:
if (record->event.pressed) {
layer_move(LAYER_MAIN);
register_code16(KC_LALT);
} else {
unregister_code16(KC_LALT);
layer_move(LAYER_RUSSIAN);
}
return false;
}
return true;
}

View File

@ -1,49 +0,0 @@
#pragma once
#include "betalupi_ergodox.h"
#include "version.h"
#include "keymap_russian.h"
#include "keymap_us_international.h"
#include "layers.h"
#include "tapdance.h"
extern rgb_config_t rgb_matrix_config;
/* Text keyboard
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | Del | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | BkSp | A | S | D | F | G |------| |------| H | J | K | L |; / L2|' / Cmd |
* |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
* | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | App | LGui | | Alt |Ctrl/Esc|
* ,------|------|------| |------+--------+------.
* | | | Home | | PgUp | | |
* | Space|Backsp|------| |------| Tab |Enter |
* | |ace | End | | PgDn | | |
* `--------------------' `----------------------'
*/
// LED colors, in HSV.
#define LC_OFF LC_HSV( 0, 0, 0)
#define LC_GREEN LC_HSV( 85, 203, 158)
#define LC_YELLOW LC_HSV( 32, 176, 255)
#define LC_PINK LC_HSV(243, 222, 234)
#define LC_CYAN LC_HSV(134, 255, 213)
#define LC_ORANGE LC_HSV( 14, 255, 255)
#define LC_RU_B LC_HSV( 0, 0, 165)
#define LC_RU_G LC_HSV(153, 255, 153)
#define LC_RU_K LC_HSV( 0, 255, 145)

View File

@ -1,11 +0,0 @@
#pragma once
#include "layers/main.h"
#include "layers/numpad.h"
#include "layers/symbols.h"
#include "layers/arrows.h"
#include "layers/fkeys.h"
#include "layers/desktop.h"
#include "layers/keyboard.h"
#include "layers/russian.h"
#include "layers/symbols_ru.h"

View File

@ -1,39 +0,0 @@
#pragma once
#include "keymap.h"
#define LAYER_ARROWS LAYOUT_ergodox(\
KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_TRANSPARENT, LGUI(LCTL(KC_ENTER)), KC_NO, KC_UP, KC_NO, KC_PGUP, KC_TRANSPARENT,\
KC_LGUI, LALT(KC_LCTRL), KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDN,\
KC_TRANSPARENT, LGUI(KC_LCTRL), KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT,\
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
\
KC_TRANSPARENT, KC_TRANSPARENT,\
KC_TRANSPARENT,\
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
\
\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT,\
KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT,\
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
\
KC_TRANSPARENT, KC_TRANSPARENT,\
KC_TRANSPARENT,\
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT\
)
#define LAYER_ARROWS_LEDS LEDS_ergodox(\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_YELLOW, LC_OFF, LC_GREEN, LC_OFF, LC_ORANGE, \
LC_ORANGE, LC_GREEN, LC_GREEN, LC_GREEN, LC_ORANGE, \
LC_ORANGE, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_PINK, \
\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)

View File

@ -0,0 +1,10 @@
# EditorConfig is awesome: https://EditorConfig.org
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false

View File

@ -0,0 +1,57 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(ARROWS)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_NULL
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_ergodox(\
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_TRNS, KC_NO, LGUI(KC_LEFT), KC_UP, LGUI(KC_RIGHT), KC_PGUP, KC_NO,\
KC_LGUI, LALT(KC_LCTL), KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDN,\
KC_TRNS, LGUI(KC_LCTL), KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO,\
\
\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_TRNS, KC_TRNS\
)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA LEDS_ergodox(\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_CYAN, LC_GREEN, LC_CYAN, LC_ORANGE, \
LC_ORANGE, LC_GREEN, LC_GREEN, LC_GREEN, LC_ORANGE, \
LC_ORANGE, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_RED, \
\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,57 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(DESKTOP)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_ergodox(\
KC_MEDIA_PLAY_PAUSE, LGUI(KC_1), LGUI(KC_2), LGUI(KC_3), LGUI(KC_4), LGUI(KC_5), KC_NO,\
LGUI(KC_TAB), KC_NO, LGUI(LCTL(KC_ENTER)), KC_NO, KC_NO, LGUI(KC_T), KC_NO,\
KC_NO, LGUI(KC_EQL), LGUI(KC_MINUS), KC_NO, LGUI(KC_F), LGUI(KC_G),\
KC_NO, KC_NO, KC_NO, LGUI(LSFT(KC_C)), LGUI(KC_N), LGUI(KC_M), KC_NO,\
M_GUI, KC_NO, KC_NO, KC_MEDIA_PREV_TRACK, KC_MEDIA_NEXT_TRACK,\
\
KC_NO, M_RESETWM,\
KC_NO,\
LGUI(KC_ENTER), LGUI(KC_BSLS), KC_NO,\
\
\
M_SHUTDOWN, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, LGUI(KC_P), KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO, \
KC_NO, KC_NO, KC_NO\
)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA LEDS_ergodox(\
LC_PINK, LC_PINK, LC_PINK, LC_PINK, LC_PINK, \
LC_OFF, LC_GREEN, LC_OFF, LC_OFF, LC_CYAN, \
LC_GREEN, LC_GREEN, LC_OFF, LC_CYAN, LC_CYAN, \
LC_OFF, LC_OFF, LC_ORANGE, LC_CYAN, LC_CYAN, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_ORANGE, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,58 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(FKEYS)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_NULL
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_ergodox(\
TO(LAYER_MAIN), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_NO,\
KC_NO, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_NO,\
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO,\
\
\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
\
KC_NO, KC_NO,\
KC_NO, \
KC_NO, KC_TRNS, KC_NO \
)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA LEDS_ergodox(\
LC_CYAN, LC_CYAN, LC_CYAN, LC_CYAN, LC_CYAN, \
LC_CYAN, LC_CYAN, LC_CYAN, LC_CYAN, LC_CYAN, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,118 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(FLIP)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_ergodox(\
KC_ESCAPE, KC_0, KC_9, KC_8, KC_7, KC_6, KC_NO,\
KC_NO, KC_NO, KC_O, KC_I, KC_U, KC_Y, KC_NO,\
KC_NO, KC_L, OSL(LAYER_FLIP_SYMBOLS_A), KC_K, KC_J, KC_H,\
KC_NO, KC_COMMA, KC_DOT, KC_P, KC_M, KC_N, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_ENTER, KC_RSFT, KC_NO,\
\
\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO\
)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA LEDS_ergodox(\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF,\
\
LC_RED, LC_RED, LC_RED, LC_RED, LC_RED, \
LC_RED, LC_RED, LC_RED, LC_RED, LC_RED, \
LC_RED, LC_RED, LC_RED, LC_RED, LC_RED, \
LC_RED, LC_RED, LC_RED, LC_RED, LC_RED, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(FLIP_SYMBOLS_A)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_ergodox(\
KC_NO, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_NO,\
KC_NO, KC_GRAVE, KC_LPRN, KC_RPRN, KC_QUES, KC_LCBR, KC_NO,\
KC_NO, KC_TILD, KC_QUOTE, KC_COMMA, KC_DOT, KC_DQUO,\
KC_NO, KC_NO, KC_LBRC, KC_RBRC, KC_EXLM, KC_RCBR, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO,\
\
\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO\
)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA LEDS_ergodox(\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_ORANGE, LC_CYAN, LC_CYAN, LC_PINK, LC_CYAN, \
LC_ORANGE, LC_PINK, LC_PINK, LC_PINK, LC_PINK, \
LC_OFF, LC_CYAN, LC_CYAN, LC_PINK, LC_CYAN, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
\
LC_RED, LC_RED, LC_RED, LC_RED, LC_RED, \
LC_RED, LC_RED, LC_RED, LC_RED, LC_RED, \
LC_RED, LC_RED, LC_RED, LC_RED, LC_RED, \
LC_RED, LC_RED, LC_RED, LC_RED, LC_RED, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,24 @@
// First layer will be "default" layer in QMK.
// Second will have index 1, etc. See layers.h
// These MUST be first.
// (For example, LAYER_ARROWS overlays on top of LAYER_MAIN.)
#include "main.h"
#include "russian.h"
#include "numbers.h" // Must be under symbols and arrows
// The order of the layers below doesn't matter,
// since they avoid transparent keys.
#include "symbols.h"
#include "symbols_ru.h"
#include "flip.h"
#include "arrows.h"
#include "desktop.h"
//#include "fkeys.h"
#include "keyboard.h"

View File

@ -0,0 +1,46 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(KEYBOARD)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_ergodox(\
TO(LAYER_MAIN), RGB_HUD, RGB_HUI, KC_NO, KC_NO, KC_NO, KC_NO,\
TOGGLE_LAYER_COLOR, RGB_SAD, RGB_SAI, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, RGB_VAD, RGB_VAI, KC_NO, KC_NO, KC_NO,\
KC_NO, RGB_SPD, RGB_SPI, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, RGB_MOD,\
\
RGB_TOG, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO,\
\
\
KC_NO, LIGHT_HUD, LIGHT_HUI, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, LIGHT_SAD, LIGHT_SAI, KC_NO, KC_NO, KC_NO, KC_NO,\
LIGHT_VAD, LIGHT_VAI, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, LIGHT_SPD, LIGHT_SPI, KC_NO, KC_NO, KC_NO, KC_NO,\
LIGHT_MOD, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, LIGHT_TOG,\
KC_NO,\
QK_BOOTLOADER, KC_NO, KC_NO\
)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_INDICATORS
case BETA_LAYER_MAGIC_MACRO:
ergodox_right_led_1_on();
ergodox_right_led_2_on();
ergodox_right_led_3_on();
break;
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,38 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(MAIN)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_ergodox(\
KC_ESCAPE, KC_1, KC_2, KC_3, KC_4, KC_5, TO(LAYER_NUMBERS),\
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, QK_LEAD, \
KC_DELETE, KC_A, KC_S, KC_D, KC_F, KC_G,\
KC_LCTL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_LALT,\
OSL(LAYER_DESKTOP), KC_NO, KC_NO, KC_LSFT, MO(LAYER_ARROWS),\
\
TD(TD_SCREENSHOT), TD(TD_OCR),\
TD(TD_WMLAYOUT),\
KC_SPACE, KC_BSPC, OSL(LAYER_FLIP),\
\
\
KC_NO, KC_6, KC_7, KC_8, KC_9, KC_0, LGUI(KC_TAB),\
KC_NO, KC_Y, KC_U, KC_I, KC_O, KC_NO, KC_NO,\
KC_H, KC_J, KC_K, MO(LAYER_SYMBOLS), KC_L, QK_LEAD,\
KC_NO, KC_N, KC_M, KC_P, KC_V, KC_NO, KC_NO,\
KC_RIGHT, KC_NO, KC_NO, KC_NO, LGUI(KC_SPACE),\
\
KC_NO, KC_NO,\
KC_NO, \
TO(LAYER_RUSSIAN), KC_RSFT, KC_ENTER\
)
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,58 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(NUMBERS)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_ergodox(\
KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5, TO(LAYER_MAIN),\
KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_NO,\
KC_TRNS, MO(LAYER_SYMBOLS), KC_NO, KC_NO, KC_DOT, KC_MINUS, \
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_TRNS, KC_TRNS, KC_NO,\
\
\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
\
KC_TRNS, KC_TRNS,\
KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS\
)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA LEDS_ergodox(\
LC_GREEN, LC_GREEN, LC_GREEN, LC_GREEN, LC_GREEN, \
LC_GREEN, LC_GREEN, LC_GREEN, LC_GREEN, LC_GREEN, \
LC_RED, LC_OFF, LC_OFF, LC_PINK, LC_CYAN, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,58 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(RUSSIAN)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_RU
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_ergodox(\
KC_TRANSPARENT, RU_1, RU_2, RU_3, RU_4, RU_5, KC_TRANSPARENT,\
KC_TRANSPARENT, RU_CHE, RU_SHA, RU_IE, RU_ER, RU_TE, RU_YO,\
KC_TRANSPARENT, RU_A, RU_ES, RU_DE, RU_EF, RU_GHE,\
M_RU_CTRL, RU_ZE, RU_YA, RU_TSE, RU_VE, RU_BE, RU_E,\
KC_TRANSPARENT, KC_TRANSPARENT, M_RU_ALT, KC_TRANSPARENT, MO(LAYER_ARROWS),\
\
KC_TRANSPARENT, KC_TRANSPARENT,\
KC_TRANSPARENT,\
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
\
\
KC_NO, RU_6, RU_7, RU_8, RU_9, RU_0, KC_TRANSPARENT,\
RU_SOFT, RU_U, RU_YU, RU_I, RU_O, RU_SHCH, KC_NO,\
RU_HA, RU_ZHE, RU_KA, MO(LAYER_SYMBOLS_RU), RU_EL, KC_NO,\
RU_HARD, RU_EN, RU_EM, RU_PE, RU_YERU, RU_SHTI, KC_TRANSPARENT,\
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
\
KC_TRANSPARENT, KC_TRANSPARENT,\
KC_TRANSPARENT,\
TO(LAYER_MAIN), KC_TRANSPARENT, KC_TRANSPARENT\
)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA LEDS_ergodox(\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_RU_B, LC_RU_B, LC_RU_B, LC_RU_B, LC_RU_B, \
LC_RU_G, LC_RU_G, LC_RU_G, LC_RU_G, LC_RU_G, \
LC_RU_K, LC_RU_K, LC_RU_K, LC_RU_K, LC_RU_K, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_RU_B, LC_RU_B, LC_RU_B, LC_RU_B, LC_RU_B, \
LC_RU_G, LC_RU_G, LC_RU_G, LC_RU_G, LC_RU_G, \
LC_RU_K, LC_RU_K, LC_RU_K, LC_RU_K, LC_RU_K, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,119 @@
// Layers are defined in macros,
// so that all supporting code can be
// auto-generated by the preprocessor.
//
// When making a new layer, make sure you update EVERY
// reference to BETA_LAYER() with your layer's name!
// This macro isn't used anywhere else.
// It's here for convenience, so we only have to write
// the layer name in one place.
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(SYMBOLS)
// What OS keyboard layout this layer is designed for.
// See extra_mappings.h for possible values.
//
// Every layer must have this section.
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
// If BETA_LAYER_NAME is defined, the preprocessor is making
// enums for this layer. See keymap.h.
//
// IMPORTANT:
// Things will break if BETA_LAYER_MAGIC_MACRO is written outside #ifdef/#endif guards.
// If BETA_LAYER_KEYS is defined, the preprocessor is either...
// - making LAYER_* enums (see keymap.h)
// - filling the keymap array (see keymap.c)
//
// Every layer must have this section.
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_ergodox(\
KC_NO, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_NO,\
KC_NO, KC_GRAVE, KC_LPRN, KC_RPRN, KC_QUES, KC_LCBR, KC_NO,\
KC_NO, KC_TILD, KC_QUOT, KC_COMMA, KC_DOT, KC_DQUO,\
KC_NO, KC_NO, KC_LBRC, KC_RBRC, KC_EXLM, KC_RCBR, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO,\
\
\
KC_NO, KC_CIRC, KC_AMPR, KC_ASTR, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_LABK, KC_RABK, KC_SLASH, KC_NO, KC_BSLS, KC_NO,\
KC_UNDS, KC_MINUS, KC_COLN, KC_TRANSPARENT, KC_PIPE, KC_NO,\
KC_NO, KC_EQUAL, KC_PLUS, KC_SCLN, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO\
)
// This is important.d
// The magic macro MUST be here, AFTER the keymap data.
BETA_LAYER_MAGIC_MACRO
#endif
// If BETA_LAYER_KEYS is defined, the preprocessor is either...
// - making LAYER_*_LEDS enums (see keymap.h)
// - filling the ledmap array (see keymap.c)
// - building the layer color switch statement (see keymap.c)
//
// This section is optional. If it is missing, this layer will not have
// an RGBMatrix color.
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA LEDS_ergodox(\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_ORANGE, LC_CYAN, LC_CYAN, LC_PINK, LC_CYAN, \
LC_ORANGE, LC_PINK, LC_PINK, LC_PINK, LC_PINK, \
LC_OFF, LC_CYAN, LC_CYAN, LC_PINK, LC_CYAN, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_GREEN, LC_GREEN, LC_CYAN, LC_OFF, LC_CYAN, \
LC_CYAN, LC_GREEN, LC_PINK, LC_RED, LC_CYAN, \
LC_GREEN, LC_GREEN, LC_PINK, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)
// This is important.
// The magic macro MUST be here, AFTER the RGBMatrix data.
BETA_LAYER_MAGIC_MACRO
#endif
// If BETA_LAYER_INDICATORS is defined, the preprocessor is
// building the indicator led switch statement (see keymap.c)
//
// This should be a `case` statement that looks exactly like the following example.
//
// This section is optional. If it is missing, this layer will
// not set indicator leds.
/*
#ifdef BETA_LAYER_INDICATORS
case LAYER_MAGIC_MACRO:
ergodox_right_led_1_on();
//ergodox_right_led_2_on();
//ergodox_right_led_3_on();
break;
#endif
*/
// Cleanup.
// This is not optional,
// we MUST undef these here so the next layer
// we load can re-define them.
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,58 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(SYMBOLS_RU)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_RU
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_ergodox(\
KC_NO, RU_EXLM, RU_DQUO, RU_NUM, RU_SCLN, RU_PERC, KC_NO,\
KC_NO, M_SC_GRAVE, RU_LPRN, RU_RPRN, RU_QUES, M_SC_LCBR, KC_NO,\
KC_NO, M_SC_TILD, M_SC_QUOT, RU_COMM, RU_DOT, RU_DQUO,\
KC_NO, KC_NO, M_SC_LBR, M_SC_RBR, RU_EXLM, M_SC_RCBR, KC_NO,\
KC_NO, KC_NO, KC_NO, M_SC_LKVCH, M_SC_RKVCH,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO,\
\
\
KC_NO, RU_COLN, RU_QUES, RU_ASTR, RU_LPRN, RU_RPRN, KC_NO,\
KC_NO, KC_NO, KC_NO, RU_SLSH, KC_NO, RU_BSLS, KC_NO,\
RU_UNDS, RU_MINS, RU_COLN, KC_TRANSPARENT, KC_NO, KC_NO,\
KC_NO, RU_EQL, RU_PLUS, RU_SCLN, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO\
)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA LEDS_ergodox(\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_WHITE, LC_CYAN, LC_CYAN, LC_PINK, LC_WHITE, \
LC_WHITE, LC_WHITE, LC_PINK, LC_PINK, LC_PINK, \
LC_OFF, LC_WHITE, LC_WHITE, LC_PINK, LC_WHITE, \
LC_OFF, LC_OFF, LC_WHITE, LC_WHITE, \
\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_CYAN, LC_OFF, LC_CYAN, \
LC_CYAN, LC_GREEN, LC_PINK, LC_ORANGE, LC_OFF, \
LC_GREEN, LC_GREEN, LC_PINK, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -1,39 +0,0 @@
#pragma once
#include "keymap.h"
#define LAYER_DESKTOP LAYOUT_ergodox(\
KC_TRANSPARENT, LGUI(KC_1), LGUI(KC_2), LGUI(KC_3), LGUI(KC_4), LGUI(KC_5), M_RESETWM,\
KC_NO, KC_NO, LGUI(LCTL(KC_ENTER)), KC_NO, KC_NO, LGUI(KC_T), KC_NO,\
KC_NO, LGUI(KC_PLUS), LGUI(KC_MINUS), KC_NO, LGUI(KC_F), LGUI(KC_G),\
KC_NO, KC_NO, KC_NO, LGUI(LSFT(KC_C)), LGUI(KC_N), LGUI(KC_M), KC_NO,\
TO(LAYER_MAIN_IDX), KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
LGUI(KC_ENTER), LGUI(KC_BSLASH), KC_NO,\
\
\
M_SHUTDOWN, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, LGUI(KC_P), KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, LGUI(KC_H), LGUI(KC_J), KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_MEDIA_PREV_TRACK, KC_MEDIA_NEXT_TRACK,\
KC_AUDIO_VOL_UP,\
KC_AUDIO_VOL_DOWN, KC_MEDIA_STOP, KC_MEDIA_PLAY_PAUSE\
)
#define LAYER_DESKTOP_LEDS LEDS_ergodox(\
LC_PINK, LC_PINK, LC_PINK, LC_PINK, LC_PINK, \
LC_OFF, LC_GREEN, LC_OFF, LC_OFF, LC_CYAN, \
LC_GREEN, LC_GREEN, LC_OFF, LC_CYAN, LC_CYAN, \
LC_OFF, LC_OFF, LC_ORANGE, LC_CYAN, LC_CYAN, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_ORANGE, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)

View File

@ -1,39 +0,0 @@
#pragma once
#include "keymap.h"
#define LAYER_FKEYS LAYOUT_ergodox(\
KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_NO,\
KC_NO, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO,\
\
\
KC_NO, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_NO, \
KC_NO, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
\
KC_NO, KC_NO,\
KC_NO, \
KC_NO, KC_NO, KC_NO \
)
#define LAYER_FKEYS_LEDS LEDS_ergodox(\
LC_CYAN, LC_CYAN, LC_CYAN, LC_CYAN, LC_CYAN, \
LC_CYAN, LC_CYAN, LC_CYAN, LC_CYAN, LC_CYAN, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
\
LC_CYAN, LC_CYAN, LC_CYAN, LC_CYAN, LC_CYAN, \
LC_CYAN, LC_CYAN, LC_CYAN, LC_CYAN, LC_CYAN, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)

View File

@ -1,25 +0,0 @@
#pragma once
#include "keymap.h"
#define LAYER_KEYBOARD LAYOUT_ergodox(\
RGB_TOG, RGB_HUD, RGB_HUI, KC_NO, KC_NO, KC_NO, KC_NO,\
TOGGLE_LAYER_COLOR, RGB_SAD, RGB_SAI, KC_NO, KC_NO, KC_NO, RGB_HUI,\
KC_NO, RGB_VAD, RGB_VAI, KC_NO, KC_NO, KC_NO,\
KC_NO, RGB_SPD, RGB_SPI, KC_NO, KC_NO, KC_NO, RGB_HUD,\
KC_NO, KC_NO, KC_NO, KC_NO, RGB_MOD,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO,\
\
\
KC_NO, LIGHT_HUD, LIGHT_HUI, KC_NO, KC_NO, KC_NO, LIGHT_TOG,\
KC_NO, LIGHT_SAD, LIGHT_SAI, KC_NO, KC_NO, KC_NO, KC_NO,\
LIGHT_VAD, LIGHT_VAI, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_NO, LIGHT_SPD, LIGHT_SPI, KC_NO, KC_NO, KC_NO, KC_NO,\
LIGHT_MOD, KC_NO, KC_NO, TO(LAYER_MAIN_IDX), KC_NO,\
\
KC_NO, RGB_TOG,\
KC_NO,\
RESET, KC_NO, KC_NO\
)

View File

@ -0,0 +1,140 @@
#include "extra_mappings.h"
#define LAYER_INCLUDE_FILE "definitions/include.c"
/*
Setup
*/
// Generate layer ids
#define BETA_LAYER_KEYS
#define BETA_LAYER(name) LAYER_##name,
enum layer_indices {
#include LAYER_INCLUDE_FILE
X_LAYER_MAX
};
#undef BETA_LAYER
#undef BETA_LAYER_KEYS
// Generate RGBMatrix ids
// We don't use the same id for layers and layer colors
// to save memory. Not every layer has colors!
#define BETA_LAYER_LEDS
#define BETA_LAYER(name) LAYER_##name##_LEDS,
enum led_indices {
#include LAYER_INCLUDE_FILE
X_LAYER_LEDS_MAX
};
#undef BETA_LAYER
#undef BETA_LAYER_LEDS
/*
Load layers
*/
// Create keymap array
#define BETA_LAYER_KEYS
#define BETA_LAYER(name) [LAYER_##name] = BETA_LAYER_CONTEXT_DATA,
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#include LAYER_INCLUDE_FILE
};
#undef BETA_LAYER
#undef BETA_LAYER_KEYS
// Create led map array
#define BETA_LAYER_LEDS
#define BETA_LAYER(name) [LAYER_##name##_LEDS] = BETA_LAYER_CONTEXT_DATA,
const uint8_t PROGMEM ledmaps[][RGB_MATRIX_LED_COUNT][3] = {
#include LAYER_INCLUDE_FILE
};
#undef BETA_LAYER
#undef BETA_LAYER_LEDS
// Create os layout array
#define BETA_LAYER_LAYOUTS
#define BETA_LAYER(name) [LAYER_##name] = BETA_LAYER_CONTEXT_DATA,
uint8_t layer_layouts[] = {
#include LAYER_INCLUDE_FILE
};
#undef BETA_LAYER
#undef BETA_LAYER_LAYOUTS
void set_layer_color(int layer) {
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
HSV hsv = {
.h = pgm_read_byte(&ledmaps[layer][i][0]),
.s = pgm_read_byte(&ledmaps[layer][i][1]),
.v = pgm_read_byte(&ledmaps[layer][i][2]),
};
if (!hsv.h && !hsv.s && !hsv.v) {
rgb_matrix_set_color( i, 0, 0, 0 );
} else {
RGB rgb = hsv_to_rgb( hsv );
float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
rgb_matrix_set_color( i, f * rgb.r, f * rgb.g, f * rgb.b );
}
}
}
bool rgb_matrix_indicators_user(void) {
if (keyboard_config.disable_layer_led) {
return true;
}
switch (biton32(layer_state)) {
// Load layer RGBMatrix colors
#define BETA_LAYER_LEDS
#define BETA_LAYER(name)\
case LAYER_##name:\
set_layer_color(LAYER_##name##_LEDS);\
break;
#include LAYER_INCLUDE_FILE
#undef BETA_LAYER
#undef BETA_LAYER_LEDS
default:
if (rgb_matrix_get_flags() == LED_FLAG_NONE) {
rgb_matrix_set_color_all(0, 0, 0);
}
break;
}
return true;
}
layer_state_t layer_state_set_user(layer_state_t state) {
uint8_t layer = biton32(state);
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
switch (layer) {
// Load indicator LED cases
#define BETA_LAYER_INDICATORS
#define BETA_LAYER(name) LAYER_##name
#include LAYER_INCLUDE_FILE
#undef BETA_LAYER
#undef BETA_LAYER_INDICATORS
default:
break;
}
return state;
};

View File

@ -1,25 +0,0 @@
#pragma once
#include "keymap.h"
#define LAYER_MAIN LAYOUT_ergodox(\
KC_ESCAPE, KC_1, KC_2, KC_3, KC_4, KC_5, TG(LAYER_NUMPAD_IDX),\
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LGUI,\
KC_DELETE, KC_A, KC_S, KC_D, KC_F, KC_G,\
M_RU_CTRL, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_NO,\
MO(LAYER_DESKTOP_IDX), MO(LAYER_FKEYS_IDX), KC_LALT, KC_LSHIFT, MO(LAYER_ARROWS_IDX),\
\
KC_PSCREEN, KC_NO,\
TD(TD_WMLAYOUT),\
KC_SPACE, KC_BSPACE, LCTL(KC_BSPACE),\
\
\
LCTL(KC_LALT), KC_6, KC_7, KC_8, KC_9, KC_0, LGUI(KC_TAB),\
KC_NO, KC_Y, KC_U, KC_I, KC_O, KC_NO, KC_NO,\
KC_H, KC_J, KC_K, MO(LAYER_SYMBOLS_IDX), KC_L, KC_NO,\
KC_NO, KC_N, KC_M, KC_P, KC_DOT, KC_COMMA, KC_NO,\
KC_RIGHT, KC_NO, KC_NO, TO(LAYER_KEYBOARD_IDX), KC_NO,\
\
LGUI(KC_SPACE), TO(LAYER_RUSSIAN_IDX),\
KC_NO,\
KC_DELETE, KC_RSHIFT, KC_ENTER\
)

View File

@ -1,39 +0,0 @@
#pragma once
#include "keymap.h"
#define LAYER_NUMPAD LAYOUT_ergodox(\
KC_TRANSPARENT, KC_CIRC, KC_NO, KC_HASH, KC_DLR, KC_PERC, KC_TRANSPARENT,\
KC_TRANSPARENT, KC_NO, KC_7, KC_8, KC_9, KC_ASTR, KC_SLASH,\
KC_TRANSPARENT, KC_PLUS, KC_4, KC_5, KC_6, KC_0,\
KC_TRANSPARENT, KC_MINUS, KC_1, KC_2, KC_3, KC_DOT, KC_TRANSPARENT,\
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_NO, KC_NO,\
\
KC_TRANSPARENT, KC_TRANSPARENT,\
KC_TRANSPARENT,\
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
\
\
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT,\
KC_TRANSPARENT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRANSPARENT,\
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
\
KC_TRANSPARENT, KC_TRANSPARENT,\
KC_TRANSPARENT,\
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT\
)
#define LAYER_NUMPAD_LEDS LEDS_ergodox(\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_GREEN, LC_GREEN, LC_GREEN, LC_YELLOW, \
LC_YELLOW, LC_GREEN, LC_GREEN, LC_GREEN, LC_GREEN, \
LC_YELLOW, LC_GREEN, LC_GREEN, LC_GREEN, LC_YELLOW, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)

View File

@ -1,39 +0,0 @@
#pragma once
#include "keymap.h"
#define LAYER_RUSSIAN LAYOUT_ergodox(\
KC_TRANSPARENT, RU_1, RU_2, RU_3, RU_4, RU_5, KC_TRANSPARENT,\
KC_TRANSPARENT, RU_CHE, RU_SHA, RU_IE, RU_ER, RU_TE, RU_YO,\
KC_TRANSPARENT, RU_A, RU_ES, RU_DE, RU_EF, RU_GHE,\
M_RU_CTRL, RU_ZE, RU_YA, RU_TSE, RU_VE, RU_BE, RU_E,\
KC_TRANSPARENT, KC_TRANSPARENT, KC_LALT, KC_TRANSPARENT, KC_TRANSPARENT,\
\
KC_TRANSPARENT, KC_TRANSPARENT,\
KC_TRANSPARENT,\
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
\
\
KC_TRANSPARENT, RU_6, RU_7, RU_8, RU_9, RU_0, KC_TRANSPARENT,\
RU_SOFT, RU_U, RU_YU, RU_I, RU_O, RU_SHCH, KC_TRANSPARENT,\
RU_HA, RU_ZHE, RU_KA, MO(LAYER_SYMBOLS_RU_IDX), RU_EL, KC_NO,\
RU_HARD, RU_EN, RU_EM, RU_PE, RU_YERU, RU_SHTI, KC_TRANSPARENT,\
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT,\
\
KC_TRANSPARENT, TO(LAYER_MAIN_IDX),\
KC_TRANSPARENT,\
KC_TRANSPARENT, KC_TRANSPARENT, KC_TRANSPARENT\
)
#define LAYER_RUSSIAN_LEDS LEDS_ergodox(\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_RU_B, LC_RU_B, LC_RU_B, LC_RU_B, LC_RU_B, \
LC_RU_G, LC_RU_G, LC_RU_G, LC_RU_G, LC_RU_G, \
LC_RU_K, LC_RU_K, LC_RU_K, LC_RU_K, LC_RU_K, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_RU_B, LC_RU_B, LC_RU_B, LC_RU_B, LC_RU_B, \
LC_RU_G, LC_RU_G, LC_RU_G, LC_RU_G, LC_RU_G, \
LC_RU_K, LC_RU_K, LC_RU_K, LC_RU_K, LC_RU_K, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)

View File

@ -1,39 +0,0 @@
#pragma once
#include "keymap.h"
#define LAYER_SYMBOLS LAYOUT_ergodox(\
KC_NO, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_NO,\
KC_NO, KC_GRAVE, KC_LPRN, KC_RPRN, KC_QUES, KC_LCBR, KC_NO,\
KC_NO, KC_TILD, KC_QUOTE, KC_COMMA, KC_DOT, KC_DQUO,\
KC_NO, KC_NO, KC_LBRACKET, KC_RBRACKET, KC_EXLM, KC_RCBR, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO,\
\
\
KC_NO, KC_CIRC, KC_AMPR, KC_ASTR, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_LABK, KC_RABK, KC_SLASH, KC_NO, KC_BSLASH, KC_NO,\
KC_UNDS, KC_MINUS, KC_COLN, KC_TRANSPARENT, KC_PIPE, KC_NO,\
KC_NO, KC_EQUAL, KC_PLUS, KC_SCOLON, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO\
)
#define LAYER_SYMBOLS_LEDS LEDS_ergodox(\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_ORANGE, LC_CYAN, LC_CYAN, LC_PINK, LC_CYAN, \
LC_ORANGE, LC_PINK, LC_PINK, LC_PINK, LC_PINK, \
LC_OFF, LC_CYAN, LC_CYAN, LC_PINK, LC_CYAN, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_GREEN, LC_GREEN, LC_CYAN, LC_OFF, LC_CYAN, \
LC_CYAN, LC_GREEN, LC_PINK, LC_ORANGE, LC_CYAN, \
LC_GREEN, LC_GREEN, LC_PINK, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)

View File

@ -1,39 +0,0 @@
#pragma once
#include "keymap.h"
#define LAYER_SYMBOLS_RU LAYOUT_ergodox(\
KC_NO, RU_EXLM, RU_DQUO, RU_NUM, RU_SCLN, RU_PERC, KC_NO,\
KC_NO, KC_NO, RU_LPRN, RU_RPRN, RU_QUES, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, RU_COMM, RU_DOT, RU_DQUO,\
KC_NO, KC_NO, KC_NO, KC_NO, RU_EXLM, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO,\
\
\
KC_NO, RU_COLN, RU_QUES, RU_ASTR, RU_LPRN, RU_RPRN, KC_NO,\
KC_NO, KC_NO, KC_NO, RU_SLSH, KC_NO, RU_BSLS, KC_NO,\
RU_UNDS, RU_MINS, RU_COLN, KC_TRANSPARENT, KC_NO, KC_NO,\
KC_NO, RU_EQL, RU_PLUS, RU_SCLN, KC_NO, KC_NO, KC_NO,\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO,\
KC_NO,\
KC_NO, KC_NO, KC_NO\
)
#define LAYER_SYMBOLS_RU_LEDS LEDS_ergodox(\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_CYAN, LC_CYAN, LC_PINK, LC_OFF, \
LC_OFF, LC_OFF, LC_PINK, LC_PINK, LC_PINK, \
LC_OFF, LC_OFF, LC_OFF, LC_PINK, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_CYAN, LC_OFF, LC_CYAN, \
LC_CYAN, LC_GREEN, LC_PINK, LC_ORANGE, LC_OFF, \
LC_GREEN, LC_GREEN, LC_PINK, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF \
)

View File

@ -0,0 +1,56 @@
#include "features/leader/beta_leader.h"
BETA_LEADER_EXTERNS();
void beta_leader_start(void) {
ergodox_right_led_3_on();
}
void beta_leader_end(void) {
ergodox_right_led_3_off();
}
bool beta_leader_check(void) {
BETA_SEQ_2_SHORT(KC_E, KC_M) {
SEND_STRING(SECRET_EMAIL);
return false;
}
BETA_SEQ_2_SHORT(KC_G, KC_M) {
SEND_STRING(SECRET_GMAIL);
return false;
}
BETA_SEQ_2_SHORT(KC_L, KC_I) {
SEND_STRING(SECRET_SCHOOL_EMAIL);
return false;
}
BETA_SEQ_2_LONG(KC_K, KC_B) {
layer_move(LAYER_KEYBOARD);
return false;
}
/*
BETA_SEQ_1_SHORT(KC_F) {
// doesn't work, no deactivate
// also, this is slow since laeder key uses dumb logic
set_oneshot_layer(LAYER_FKEYS, ONESHOT_START);
return false;
}
*/
BETA_SEQ_2_SHORT(KC_F, KC_1) { tap_code(KC_F1); return false; }
BETA_SEQ_2_SHORT(KC_F, KC_2) { tap_code(KC_F2); return false; }
BETA_SEQ_2_SHORT(KC_F, KC_3) { tap_code(KC_F3); return false; }
BETA_SEQ_2_SHORT(KC_F, KC_4) { tap_code(KC_F4); return false; }
BETA_SEQ_2_SHORT(KC_F, KC_5) { tap_code(KC_F5); return false; }
BETA_SEQ_2_SHORT(KC_F, KC_Q) { tap_code(KC_F6); return false; }
BETA_SEQ_2_SHORT(KC_F, KC_W) { tap_code(KC_F7); return false; }
BETA_SEQ_2_SHORT(KC_F, KC_E) { tap_code(KC_F8); return false; }
BETA_SEQ_2_SHORT(KC_F, KC_R) { tap_code(KC_F9); return false; }
BETA_SEQ_2_SHORT(KC_F, KC_T) { tap_code(KC_F10); return false; }
return true;
}

View File

@ -0,0 +1,37 @@
void td_screenshot(tap_dance_state_t *state, void *user_data) {
if (state->count == 1) {
tap_code16(KC_PSCR);
} else if (state->count == 2) {
tap_code16(LSFT(KC_PSCR));
} else if (state->count == 3) {
tap_code16(LALT(KC_PSCR));
} else {
reset_tap_dance(state);
}
}
void td_ocr(tap_dance_state_t *state, void *user_data) {
if (state->count == 1) {
tap_code16(LCTL(KC_PSCR));
} else if (state->count == 2) {
tap_code16(LCTL(LSFT(KC_PSCR)));
} else {
reset_tap_dance(state);
}
}
void td_wmlayout(tap_dance_state_t *state, void *user_data) {
if (state->count == 1) {
tap_code16(LGUI(KC_COMMA));
} else if (state->count == 2) {
tap_code16(LGUI(KC_DOT));
} else {
reset_tap_dance(state);
}
}
tap_dance_action_t tap_dance_actions[] = {
[TD_WMLAYOUT] = ACTION_TAP_DANCE_FN(td_wmlayout),
[TD_SCREENSHOT] = ACTION_TAP_DANCE_FN(td_screenshot),
[TD_OCR] = ACTION_TAP_DANCE_FN(td_ocr),
};

View File

@ -1,7 +1,4 @@
# rules.mk overrides
TAP_DANCE_ENABLE = yes
SRC += \
tapdance/wmlayout.c \
tapdance/tapdance.c
COMBO_ENABLE = yes

View File

@ -1,18 +0,0 @@
#pragma once
#include "keymap.h"
enum {
SINGLE_TAP = 1,
SINGLE_HOLD,
DOUBLE_TAP,
DOUBLE_HOLD,
DOUBLE_SINGLE_TAP,
MORE_TAPS
};
uint8_t dance_step(qk_tap_dance_state_t *state);
void td_wmlayout_dance(qk_tap_dance_state_t *state, void *user_data);
void td_wmlayout_finished(qk_tap_dance_state_t *state, void *user_data);
void td_wmlayout_reset(qk_tap_dance_state_t *state, void *user_data);

View File

@ -1,21 +0,0 @@
#include "keymap.h"
#include "tapdance.h"
uint8_t dance_step(qk_tap_dance_state_t *state) {
if (state->count == 1) {
if (state->interrupted || !state->pressed) {
return SINGLE_TAP;
} else {
return SINGLE_HOLD;
}
} else if (state->count == 2) {
if (state->interrupted) {
return DOUBLE_SINGLE_TAP;
} else if (state->pressed) {
return DOUBLE_HOLD;
} else {
return DOUBLE_TAP;
}
}
return MORE_TAPS;
}

View File

@ -1,55 +0,0 @@
#include "keymap.h"
#include "tapdance.h"
typedef struct {
bool is_press_action;
uint8_t step;
} tap;
static tap dance_state[1];
// Called on every tap
void td_wmlayout_dance(qk_tap_dance_state_t *state, void *user_data) {
if(state->count == 3) {
tap_code16(LGUI(KC_COMMA));
tap_code16(LGUI(KC_COMMA));
tap_code16(LGUI(KC_COMMA));
}
if(state->count > 3) {
tap_code16(LGUI(KC_COMMA));
}
}
// Called when action finishes
void td_wmlayout_finished(qk_tap_dance_state_t *state, void *user_data) {
dance_state[0].step = dance_step(state);
switch (dance_state[0].step) {
case SINGLE_TAP:
register_code16(LGUI(KC_COMMA));
break;
case DOUBLE_TAP:
register_code16(LGUI(KC_DOT));
break;
case DOUBLE_SINGLE_TAP:
tap_code16(LGUI(KC_COMMA));
register_code16(LGUI(KC_COMMA));
break;
}
}
// Called when action resets
void td_wmlayout_reset(qk_tap_dance_state_t *state, void *user_data) {
wait_ms(10);
switch (dance_state[0].step) {
case SINGLE_TAP:
unregister_code16(LGUI(KC_COMMA));
break;
case DOUBLE_TAP:
unregister_code16(LGUI(KC_DOT));
break;
case DOUBLE_SINGLE_TAP:
unregister_code16(LGUI(KC_COMMA));
break;
}
dance_state[0].step = 0;
}

View File

@ -1,23 +1,3 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2013 Oleg Kostyuk <cub.uanic@gmail.com>
Copyright 2015 ZSA Technology Labs Inc (@zsa)
Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna)
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, see <http://www.gnu.org/licenses/>.
*/
#pragma once
/*

View File

@ -0,0 +1,187 @@
#include "betalupi_ergodox.h"
#include "features/beta_rawhid.h"
// Handle a keypress.
// Returns true if we should keep looking for keypresses,
// returns false if we should stop.
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case LED_LEVEL:
if (record->event.pressed) {
keyboard_config.led_level++;
if (keyboard_config.led_level > 4) {
keyboard_config.led_level = 0;
}
ergodox_led_all_set((uint8_t)keyboard_config.led_level * 255 / 4 );
eeconfig_update_kb(keyboard_config.raw);
layer_state_set_kb(layer_state);
}
break;
#ifdef RGB_MATRIX_ENABLE
case TOGGLE_LAYER_COLOR:
if (record->event.pressed) {
keyboard_config.disable_layer_led ^= 1;
if (keyboard_config.disable_layer_led) {
rgb_matrix_set_color_all(0, 0, 0);
}
eeconfig_update_kb(keyboard_config.raw);
}
break;
case RGB_TOG:
if (record->event.pressed) {
switch (rgb_matrix_get_flags()) {
case LED_FLAG_ALL: {
rgb_matrix_set_flags(LED_FLAG_NONE);
keyboard_config.rgb_matrix_enable = false;
rgb_matrix_set_color_all(0, 0, 0);
}
break;
default: {
rgb_matrix_set_flags(LED_FLAG_ALL);
keyboard_config.rgb_matrix_enable = true;
}
break;
}
eeconfig_update_kb(keyboard_config.raw);
}
hid_send_state();
return false;
case RGB_MOD:
// Tell the host whenever we change animation mode.
hid_send_state();
return true;
#endif
// Custom RGBLIGHT macros
#ifdef RGBLIGHT_ENABLE
#ifdef RGBLIGHT_NO_EEPROM
case LIGHT_TOG:
if (record->event.pressed) {
rgblight_toggle_noeeprom();
}
break;
case LIGHT_MOD:
if (record->event.pressed) {
rgblight_step_noeeprom();
}
break;
case LIGHT_HUI:
if (record->event.pressed) {
rgblight_increase_hue_noeeprom();
}
break;
case LIGHT_HUD:
if (record->event.pressed) {
rgblight_decrease_hue_noeeprom();
}
break;
case LIGHT_SAI:
if (record->event.pressed) {
rgblight_increase_sat_noeeprom();
}
break;
case LIGHT_SAD:
if (record->event.pressed) {
rgblight_decrease_sat_noeeprom();
}
break;
case LIGHT_VAI:
if (record->event.pressed) {
rgblight_increase_val_noeeprom();
}
break;
case LIGHT_VAD:
if (record->event.pressed) {
rgblight_decrease_val_noeeprom();
}
break;
case LIGHT_SPI:
if (record->event.pressed) {
rgblight_increase_speed_noeeprom();
}
break;
case LIGHT_SPD:
if (record->event.pressed) {
rgblight_decrease_speed_noeeprom();
}
break;
#else
case LIGHT_TOG:
if (record->event.pressed) {
rgblight_toggle();
}
break;
case LIGHT_MOD:
if (record->event.pressed) {
rgblight_step();
}
break;
case LIGHT_HUI:
if (record->event.pressed) {
rgblight_increase_hue();
}
break;
case LIGHT_HUD:
if (record->event.pressed) {
rgblight_decrease_hue();
}
break;
case LIGHT_SAI:
if (record->event.pressed) {
rgblight_increase_sat();
}
break;
case LIGHT_SAD:
if (record->event.pressed) {
rgblight_decrease_sat();
}
break;
case LIGHT_VAI:
if (record->event.pressed) {
rgblight_increase_val();
}
break;
case LIGHT_VAD:
if (record->event.pressed) {
rgblight_decrease_val();
}
break;
case LIGHT_SPI:
if (record->event.pressed) {
rgblight_increase_speed();
}
break;
case LIGHT_SPD:
if (record->event.pressed) {
rgblight_decrease_speed();
}
break;
#endif
#endif
}
return process_record_user(keycode, record);
}

View File

@ -1,64 +0,0 @@
#pragma once
#include "betalupi_ergodox.h"
#include "raw_hid.h"
void raw_hid_receive(uint8_t *data, uint8_t length);
void hid_send_state(void);
void cmd_animation(uint8_t *data, uint8_t length);
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
extern uint8_t g_rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS];
#endif
// Sent by host when connection is initiated.
//
// Packet structure:
// Data: | cmd |
// # of Bytes: | 1 |
#define CMD_HELLO 0x00
// Sent periodically by host to test connection.
// Keyboard should ignore this command.
//
// Packet structure:
// Data: | cmd |
// # of Bytes: | 1 |
#define CMD_RUTHERE 0x01
// Send keyboard state to host.
//
// Packet structure:
// Data: | cmd | anim state |
// # of Bytes: | 1 | 1 |
//
// anim state:
// 0x00: RGBMatrix disabled
// 0x01: normal animation, no HID data.
// 0x02: FFT Animation
#define CMD_SEND_STATE 0x02
// Animation data. Sent by host.
//
// Packet structure:
// Data: | cmd | data type | data |
// # of Bytes: | 1 | 1 | ? |
//
// data type:
// Which animation this data is for. These are defined below.
//
// data:
// Animation data. Content depends on data type.
#define CMD_ANIM_DATA 0x03
// Data for FFT animation.
// Data segment consists of 10 bits, each representing the height of a column.
// Minimum height is 0, maximum is 250.
#define CMD_ANIM_DATA_fft 0x00

View File

@ -1,77 +0,0 @@
# Betalupi Ergodox
This is a modified version of the [ZSA ErgoDox firmware](https://git.betalupi.com/mirrors-QMK/zsa_firmware), based on the `ergodox_ex/glow` keyboard.
## TODO
- Layer switch cleanup
- Define indicator in keymap
- Define language in keymap
- Auto-switch all
--------------------------------------------------------------------------------
# Setup
Clone this repo into `keyboards/betalupi_ergodox` in your qmk directory.
Make example for this keyboard (after setting up your build environment):
make betalupi_ergodox:default:flash
If you get array-bounds errors on build, you may have a bad avr-gcc version. Read [this issue](https://github.com/qmk/qmk_firmware/issues/17064), and try
AVR_CFLAGS="-Wno-array-bounds"
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information.
--------------------------------------------------------------------------------
# Notes
Custom keycodes (betalupi_keyboard.c)
```
// Custom RGBLIGHT macros
LIGHT_TOG, // Toggle backlight
LIGHT_HUI, // Increase backlight hue
LIGHT_HUD, // Decrease backlight hue
LIGHT_SAI, // Increase backlight sat
LIGHT_SAD, // Decrease backlight sat
LIGHT_VAI, // Increase backlight val
LIGHT_VAD, // Decrease backlight val
LIGHT_SPI, // Increase backlight speed
LIGHT_SPD, // Decrease backlight speed
LIGHT_MOD, // Change backlight animation mode
```
--------------------------------------------------------------------------------
# Notes from ZSA
### Indicator LEDs
You can use the `LED_LEVEL` keycode to cycle through the brightness levels for the LEDs on the top right of the keyboard. These settings are saved in eeprom (persistant memory).
Alternatively, you can set the brightness by calling the following functions:
```c
void ergodox_led_all_set(uint8_t level);
void ergodox_right_led_1_set(uint8_t level);
void ergodox_right_led_2_set(uint8_t level);
void ergodox_right_led_3_set(uint8_t level);
```
These settings are not persistent, so you'd need to reset it every time the board starts.
These are on a 0-255 scale
### RGB Matrix Features
If you're using the Smart LED (layer indication) feature from the Oryx Configurator, you want to make sure that you enable these options by adding `#define ORYX_CONFIGURATOR` to your keymap's `config.h`.
This changes the `RGB_TOG` keycode so that it will toggle the lights on and off, in a way that will allow the Smart LEDs to continue to work, even with the rest of the LEDs turned off.
Additionally, a new keycode has been added to toggle the Smart LEDs. Use `TOGGLE_LAYER_COLOR`, if you aren't already.

View File

@ -1,45 +1,39 @@
# MCU name
MCU = atmega32u4
BOOTLOADER = halfkay
# Enable raw HID for bi-directional communication
RAW_ENABLE = yes
# Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
BOOTLOADER = halfkay
# Build Options
# comment out to disable the options.
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
CUSTOM_MATRIX = lite # Custom matrix file for the ErgoDox EZ
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
UNICODE_ENABLE = no # Unicode
SWAP_HANDS_ENABLE= no # Allow swapping hands of keyboard
BOOTMAGIC_ENABLE = no
MOUSEKEY_ENABLE = no
EXTRAKEY_ENABLE = yes
CONSOLE_ENABLE = no
COMMAND_ENABLE = no
CUSTOM_MATRIX = lite
NKRO_ENABLE = yes
UNICODE_ENABLE = no
SWAP_HANDS_ENABLE = no
SLEEP_LED_ENABLE = no
API_SYSEX_ENABLE = no
# Disable some unused qmk features
# to save space
MOUSE_SHARED_EP = no
MAGIC_ENABLE = no
LEADER_ENABLE = no
TAP_DANCE_ENABLE = yes
AUDIO_SUPPORTED = no
BACKLIGHT_SUPPORTED = no
DEBOUNCE_TYPE = sym_eager_pr
SRC += \
matrix.c \
led_i2c.c \
rawhid.c \
extra_mappings.c
extra_mappings.c \
process_record.c \
hardware/matrix.c \
hardware/led_i2c.c \
hardware/maps.c \
features/beta_rawhid.c \
features/hid_spellcheck.c \
features/autocorrect/autocorrect.c \
features/leader/leader.c
QUANTUM_LIB_SRC += i2c_master.c
@ -52,10 +46,8 @@ LTO_ENABLE = yes
# Enable keyboard-specific effects
RGB_MATRIX_CUSTOM_KB = yes
MOUSE_SHARED_EP = no
# FROM glow dir
# From glow dir
RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = IS31FL3731
RGB_MATRIX_DRIVER = is31fl3731
RGBLIGHT_ENABLE = yes
RGBLIGHT_DRIVER = WS2812
RGBLIGHT_DRIVER = ws2812

View File

@ -1,707 +0,0 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Compiler for keymap.c files
This script will generate a keymap.c file from a simple
markdown file with a specific layout.
Usage:
python compile_keymap.py INPUT_PATH [OUTPUT_PATH]
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import io
import re
import sys
import json
import unicodedata
import collections
import itertools as it
PY2 = sys.version_info.major == 2
if PY2:
chr = unichr
KEYBOARD_LAYOUTS = {
# These map positions in the parsed layout to
# positions in the KEYMAP MATRIX
'ergodox_ez': [
[ 0, 1, 2, 3, 4, 5, 6], [38, 39, 40, 41, 42, 43, 44],
[ 7, 8, 9, 10, 11, 12, 13], [45, 46, 47, 48, 49, 50, 51],
[14, 15, 16, 17, 18, 19 ], [ 52, 53, 54, 55, 56, 57],
[20, 21, 22, 23, 24, 25, 26], [58, 59, 60, 61, 62, 63, 64],
[27, 28, 29, 30, 31 ], [ 65, 66, 67, 68, 69],
[ 32, 33], [70, 71 ],
[ 34], [72 ],
[ 35, 36, 37], [73, 74, 75 ],
]
}
ROW_INDENTS = {
'ergodox_ez': [0, 0, 0, 0, 0, 1, 0, 0, 0, 2, 5, 0, 6, 0, 4, 0]
}
BLANK_LAYOUTS = [
# Compact Layout
"""
.------------------------------------.------------------------------------.
| | | | | | | | | | | | | | |
!-----+----+----+----+----+----------!-----+----+----+----+----+----+-----!
| | | | | | | | | | | | | | |
!-----+----+----+----x----x----! ! !----x----x----+----+----+-----!
| | | | | | |-----!-----! | | | | | |
!-----+----+----+----x----x----! ! !----x----x----+----+----+-----!
| | | | | | | | | | | | | | |
'-----+----+----+----+----+----------'----------+----+----+----+----+-----'
| | | | | | ! | | | | |
'------------------------' '------------------------'
.-----------. .-----------.
| | | ! | |
.-----+-----+-----! !-----+-----+-----.
! ! | | ! | ! !
! ! !-----! !-----! ! !
| | | | ! | | |
'-----------------' '-----------------'
""",
# Wide Layout
"""
.---------------------------------------------. .---------------------------------------------.
| | | | | | | | ! | | | | | | |
!-------+-----+-----+-----+-----+-------------! !-------+-----+-----+-----+-----+-----+-------!
| | | | | | | | ! | | | | | | |
!-------+-----+-----+-----x-----x-----! ! ! !-----x-----x-----+-----+-----+-------!
| | | | | | |-------! !-------! | | | | | |
!-------+-----+-----+-----x-----x-----! ! ! !-----x-----x-----+-----+-----+-------!
| | | | | | | | ! | | | | | | |
'-------+-----+-----+-----+-----+-------------' '-------------+-----+-----+-----+-----+-------'
| | | | | | ! | | | | |
'------------------------------' '------------------------------'
.---------------. .---------------.
| | | ! | |
.-------+-------+-------! !-------+-------+-------.
! ! | | ! | ! !
! ! !-------! !-------! ! !
| | | | ! | | |
'-----------------------' '-----------------------'
""",
]
DEFAULT_CONFIG = {
"keymaps_includes": [
"keymap_common.h",
],
'filler': "-+.'!:x",
'separator': "|",
'default_key_prefix': ["KC_"],
}
SECTIONS = [
'layout_config',
'layers',
]
# Markdown Parsing
ONELINE_COMMENT_RE = re.compile(r"""
^ # comment must be at the start of the line
\s* # arbitrary whitespace
// # start of the comment
(.*) # the comment
$ # until the end of line
""", re.MULTILINE | re.VERBOSE
)
INLINE_COMMENT_RE = re.compile(r"""
([\,\"\[\]\{\}\d]) # anythig that might end a expression
\s+ # comment must be preceded by whitespace
// # start of the comment
\s # and succeded by whitespace
(?:[^\"\]\}\{\[]*) # the comment (except things which might be json)
$ # until the end of line
""", re.MULTILINE | re.VERBOSE)
TRAILING_COMMA_RE = re.compile(r"""
, # the comma
(?:\s*) # arbitrary whitespace
$ # only works if the trailing comma is followed by newline
(\s*) # arbitrary whitespace
([\]\}]) # end of an array or object
""", re.MULTILINE | re.VERBOSE)
def loads(raw_data):
if isinstance(raw_data, bytes):
raw_data = raw_data.decode('utf-8')
raw_data = ONELINE_COMMENT_RE.sub(r"", raw_data)
raw_data = INLINE_COMMENT_RE.sub(r"\1", raw_data)
raw_data = TRAILING_COMMA_RE.sub(r"\1\2", raw_data)
return json.loads(raw_data)
def parse_config(path):
def reset_section():
section.update({
'name': section.get('name', ""),
'sub_name': "",
'start_line': -1,
'end_line': -1,
'code_lines': [],
})
def start_section(line_index, line):
end_section()
if line.startswith("# "):
name = line[2:]
elif line.startswith("## "):
name = line[3:]
else:
name = ""
name = name.strip().replace(" ", "_").lower()
if name in SECTIONS:
section['name'] = name
else:
section['sub_name'] = name
section['start_line'] = line_index
def end_section():
if section['start_line'] >= 0:
if section['name'] == 'layout_config':
config.update(loads("\n".join(
section['code_lines']
)))
elif section['sub_name'].startswith('layer'):
layer_name = section['sub_name']
config['layer_lines'][layer_name] = section['code_lines']
reset_section()
def amend_section(line_index, line):
section['end_line'] = line_index
section['code_lines'].append(line)
config = DEFAULT_CONFIG.copy()
config.update({
'layer_lines': collections.OrderedDict(),
'macro_ids': {'UM'},
'unicode_macros': {},
})
section = {}
reset_section()
with io.open(path, encoding="utf-8") as fh:
for i, line in enumerate(fh):
if line.startswith("#"):
start_section(i, line)
elif line.startswith(" "):
amend_section(i, line[4:])
else:
# TODO: maybe parse description
pass
end_section()
assert 'layout' in config
return config
# header file parsing
IF0_RE = re.compile(r"""
^
#if 0
$.*?
#endif
""", re.MULTILINE | re.DOTALL | re.VERBOSE)
COMMENT_RE = re.compile(r"""
/\*
.*?
\*/"
""", re.MULTILINE | re.DOTALL | re.VERBOSE)
def read_header_file(path):
with io.open(path, encoding="utf-8") as fh:
data = fh.read()
data, _ = COMMENT_RE.subn("", data)
data, _ = IF0_RE.subn("", data)
return data
def regex_partial(re_str_fmt, flags):
def partial(*args, **kwargs):
re_str = re_str_fmt.format(*args, **kwargs)
return re.compile(re_str, flags)
return partial
KEYDEF_REP = regex_partial(r"""
#define
\s
(
(?:{}) # the prefixes
(?:\w+) # the key name
) # capture group end
""", re.MULTILINE | re.DOTALL | re.VERBOSE)
ENUM_RE = re.compile(r"""
(
enum
\s\w+\s
\{
.*? # the enum content
\}
;
) # capture group end
""", re.MULTILINE | re.DOTALL | re.VERBOSE)
ENUM_KEY_REP = regex_partial(r"""
(
{} # the prefixes
\w+ # the key name
) # capture group end
""", re.MULTILINE | re.DOTALL | re.VERBOSE)
def parse_keydefs(config, data):
prefix_options = "|".join(config['key_prefixes'])
keydef_re = KEYDEF_REP(prefix_options)
enum_key_re = ENUM_KEY_REP(prefix_options)
for match in keydef_re.finditer(data):
yield match.groups()[0]
for enum_match in ENUM_RE.finditer(data):
enum = enum_match.groups()[0]
for key_match in enum_key_re.finditer(enum):
yield key_match.groups()[0]
def parse_valid_keys(config, out_path):
basepath = os.path.abspath(os.path.join(os.path.dirname(out_path)))
dirpaths = []
subpaths = []
while len(subpaths) < 6:
path = os.path.join(basepath, *subpaths)
dirpaths.append(path)
dirpaths.append(os.path.join(path, "tmk_core", "common"))
dirpaths.append(os.path.join(path, "quantum"))
subpaths.append('..')
includes = set(config['keymaps_includes'])
includes.add("keycode.h")
valid_keycodes = set()
for dirpath, include in it.product(dirpaths, includes):
include_path = os.path.join(dirpath, include)
if os.path.exists(include_path):
header_data = read_header_file(include_path)
valid_keycodes.update(
parse_keydefs(config, header_data)
)
return valid_keycodes
# Keymap Parsing
def iter_raw_codes(layer_lines, filler, separator):
filler_re = re.compile("[" + filler + " ]")
for line in layer_lines:
line, _ = filler_re.subn("", line.strip())
if not line:
continue
codes = line.split(separator)
for code in codes[1:-1]:
yield code
def iter_indexed_codes(raw_codes, key_indexes):
key_rows = {}
key_indexes_flat = []
for row_index, key_indexes in enumerate(key_indexes):
for key_index in key_indexes:
key_rows[key_index] = row_index
key_indexes_flat.extend(key_indexes)
assert len(raw_codes) == len(key_indexes_flat)
for raw_code, key_index in zip(raw_codes, key_indexes_flat):
# we keep track of the row mostly for layout purposes
yield raw_code, key_index, key_rows[key_index]
LAYER_CHANGE_RE = re.compile(r"""
(DF|TG|MO)\(\d+\)
""", re.VERBOSE)
MACRO_RE = re.compile(r"""
M\(\w+\)
""", re.VERBOSE)
UNICODE_RE = re.compile(r"""
U[0-9A-F]{4}
""", re.VERBOSE)
NON_CODE = re.compile(r"""
^[^A-Z0-9_]$
""", re.VERBOSE)
def parse_uni_code(raw_code):
macro_id = "UC_" + (
unicodedata.name(raw_code)
.replace(" ", "_")
.replace("-", "_")
)
code = "M({})".format(macro_id)
uc_hex = "{:04X}".format(ord(raw_code))
return code, macro_id, uc_hex
def parse_key_code(raw_code, key_prefixes, valid_keycodes):
if raw_code in valid_keycodes:
return raw_code
for prefix in key_prefixes:
code = prefix + raw_code
if code in valid_keycodes:
return code
def parse_code(raw_code, key_prefixes, valid_keycodes):
if not raw_code:
return 'KC_TRNS', None, None
if LAYER_CHANGE_RE.match(raw_code):
return raw_code, None, None
if MACRO_RE.match(raw_code):
macro_id = raw_code[2:-1]
return raw_code, macro_id, None
if UNICODE_RE.match(raw_code):
hex_code = raw_code[1:]
return parse_uni_code(chr(int(hex_code, 16)))
if NON_CODE.match(raw_code):
return parse_uni_code(raw_code)
code = parse_key_code(raw_code, key_prefixes, valid_keycodes)
return code, None, None
def parse_keymap(config, key_indexes, layer_lines, valid_keycodes):
keymap = {}
raw_codes = list(iter_raw_codes(
layer_lines, config['filler'], config['separator']
))
indexed_codes = iter_indexed_codes(raw_codes, key_indexes)
key_prefixes = config['key_prefixes']
for raw_code, key_index, row_index in indexed_codes:
code, macro_id, uc_hex = parse_code(
raw_code, key_prefixes, valid_keycodes
)
# TODO: line numbers for invalid codes
err_msg = "Could not parse key '{}' on row {}".format(
raw_code, row_index
)
assert code is not None, err_msg
# print(repr(raw_code), repr(code), macro_id, uc_hex)
if macro_id:
config['macro_ids'].add(macro_id)
if uc_hex:
config['unicode_macros'][macro_id] = uc_hex
keymap[key_index] = (code, row_index)
return keymap
def parse_keymaps(config, valid_keycodes):
keymaps = collections.OrderedDict()
key_indexes = config.get(
'key_indexes', KEYBOARD_LAYOUTS[config['layout']]
)
# TODO: maybe validate key_indexes
for layer_name, layer_lines, in config['layer_lines'].items():
keymaps[layer_name] = parse_keymap(
config, key_indexes, layer_lines, valid_keycodes
)
return keymaps
# keymap.c output
USERCODE = """
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
};
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state);
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
switch (layer) {
case L1:
ergodox_right_led_1_on();
break;
case L2:
ergodox_right_led_2_on();
break;
case L3:
ergodox_right_led_3_on();
break;
case L4:
ergodox_right_led_1_on();
ergodox_right_led_2_on();
break;
case L5:
ergodox_right_led_1_on();
ergodox_right_led_3_on();
break;
// case L6:
// ergodox_right_led_2_on();
// ergodox_right_led_3_on();
// break;
// case L7:
// ergodox_right_led_1_on();
// ergodox_right_led_2_on();
// ergodox_right_led_3_on();
// break;
default:
ergodox_board_led_off();
break;
}
};
"""
MACROCODE = """
#define UC_MODE_WIN 0
#define UC_MODE_LINUX 1
#define UC_MODE_OSX 2
// TODO: allow default mode to be configured
static uint16_t unicode_mode = UC_MODE_WIN;
uint16_t hextokeycode(uint8_t hex) {{
if (hex == 0x0) {{
return KC_P0;
}}
if (hex < 0xA) {{
return KC_P1 + (hex - 0x1);
}}
return KC_A + (hex - 0xA);
}}
void unicode_action_function(uint16_t hi, uint16_t lo) {{
switch (unicode_mode) {{
case UC_MODE_WIN:
register_code(KC_LALT);
register_code(KC_PPLS);
unregister_code(KC_PPLS);
register_code(hextokeycode((hi & 0xF0) >> 4));
unregister_code(hextokeycode((hi & 0xF0) >> 4));
register_code(hextokeycode((hi & 0x0F)));
unregister_code(hextokeycode((hi & 0x0F)));
register_code(hextokeycode((lo & 0xF0) >> 4));
unregister_code(hextokeycode((lo & 0xF0) >> 4));
register_code(hextokeycode((lo & 0x0F)));
unregister_code(hextokeycode((lo & 0x0F)));
unregister_code(KC_LALT);
break;
case UC_MODE_LINUX:
register_code(KC_LCTL);
register_code(KC_LSFT);
register_code(KC_U);
unregister_code(KC_U);
register_code(hextokeycode((hi & 0xF0) >> 4));
unregister_code(hextokeycode((hi & 0xF0) >> 4));
register_code(hextokeycode((hi & 0x0F)));
unregister_code(hextokeycode((hi & 0x0F)));
register_code(hextokeycode((lo & 0xF0) >> 4));
unregister_code(hextokeycode((lo & 0xF0) >> 4));
register_code(hextokeycode((lo & 0x0F)));
unregister_code(hextokeycode((lo & 0x0F)));
unregister_code(KC_LCTL);
unregister_code(KC_LSFT);
break;
case UC_MODE_OSX:
break;
}}
}}
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {{
if (!record->event.pressed) {{
return MACRO_NONE;
}}
// MACRODOWN only works in this function
switch(id) {{
case UM:
unicode_mode = (unicode_mode + 1) % 2;
break;
{macro_cases}
{unicode_macro_cases}
default:
break;
}}
return MACRO_NONE;
}};
"""
UNICODE_MACRO_TEMPLATE = """
case {macro_id}:
unicode_action_function(0x{hi:02x}, 0x{lo:02x});
break;
""".strip()
def unicode_macro_cases(config):
for macro_id, uc_hex in config['unicode_macros'].items():
hi = int(uc_hex, 16) >> 8
lo = int(uc_hex, 16) & 0xFF
unimacro_keys = ", ".join(
"T({})".format(
"KP_" + digit if digit.isdigit() else digit
) for digit in uc_hex
)
yield UNICODE_MACRO_TEMPLATE.format(
macro_id=macro_id, hi=hi, lo=lo
)
def iter_keymap_lines(keymap, row_indents=None):
col_widths = {}
col = 0
# first pass, figure out the column widths
prev_row_index = None
for code, row_index in keymap.values():
if row_index != prev_row_index:
col = 0
if row_indents:
col = row_indents[row_index]
col_widths[col] = max(len(code), col_widths.get(col, 0))
prev_row_index = row_index
col += 1
# second pass, yield the cell values
col = 0
prev_row_index = None
for key_index in sorted(keymap):
code, row_index = keymap[key_index]
if row_index != prev_row_index:
col = 0
yield "\n"
if row_indents:
for indent_col in range(row_indents[row_index]):
pad = " " * (col_widths[indent_col] - 4)
yield (" /*-*/" + pad)
col = row_indents[row_index]
else:
yield pad
yield " {}".format(code)
if key_index < len(keymap) - 1:
yield ","
# This will be yielded on the next iteration when
# we know that we're not at the end of a line.
pad = " " * (col_widths[col] - len(code))
prev_row_index = row_index
col += 1
def iter_keymap_parts(config, keymaps):
# includes
for include_path in config['keymaps_includes']:
yield '#include "{}"\n'.format(include_path)
yield "\n"
# definitions
for i, macro_id in enumerate(sorted(config['macro_ids'])):
yield "#define {} {}\n".format(macro_id, i)
yield "\n"
for i, layer_name in enumerate(config['layer_lines']):
yield '#define L{0:<3} {0:<5} // {1}\n'.format(i, layer_name)
yield "\n"
# keymaps
yield "const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {\n"
for i, layer_name in enumerate(config['layer_lines']):
# comment
layer_lines = config['layer_lines'][layer_name]
prefixed_lines = " * " + " * ".join(layer_lines)
yield "/*\n{} */\n".format(prefixed_lines)
# keymap codes
keymap = keymaps[layer_name]
row_indents = ROW_INDENTS.get(config['layout'])
keymap_lines = "".join(iter_keymap_lines(keymap, row_indents))
yield "[L{0}] = KEYMAP({1}\n),\n".format(i, keymap_lines)
yield "};\n\n"
# macros
yield MACROCODE.format(
macro_cases="",
unicode_macro_cases="\n".join(unicode_macro_cases(config)),
)
# TODO: dynamically create blinking lights
yield USERCODE
def main(argv=sys.argv[1:]):
if not argv or '-h' in argv or '--help' in argv:
print(__doc__)
return 0
in_path = os.path.abspath(argv[0])
if not os.path.exists(in_path):
print("No such file '{}'".format(in_path))
return 1
if len(argv) > 1:
out_path = os.path.abspath(argv[1])
else:
dirname = os.path.dirname(in_path)
out_path = os.path.join(dirname, "keymap.c")
config = parse_config(in_path)
valid_keys = parse_valid_keys(config, out_path)
keymaps = parse_keymaps(config, valid_keys)
with io.open(out_path, mode="w", encoding="utf-8") as fh:
for part in iter_keymap_parts(config, keymaps):
fh.write(part)
if __name__ == '__main__':
sys.exit(main())

View File

@ -1,3 +0,0 @@
# ErgoDox EZ Utilities
The Python script in this directory, by [mbarkhau](https://github.com/mbarkhau) allows you to write out a basic ErgoDox EZ keymap using Markdown notation, and then transpile it to C, which you can then compile. It's experimental, but if you're not comfortable using C, it's a nice option.

View File

@ -0,0 +1,221 @@
#include "betalupi_voyager.h"
#include "raw_hid.h"
keyboard_config_t keyboard_config;
bool mcp23018_leds[2] = {0, 0};
bool is_launching = false;
void voyager_led_task(void) {
if (is_launching) {
STATUS_LED_1(false);
STATUS_LED_2(false);
STATUS_LED_3(false);
STATUS_LED_4(false);
wait_ms(250);
STATUS_LED_1(true);
STATUS_LED_2(true);
wait_ms(250);
STATUS_LED_3(true);
STATUS_LED_4(true);
wait_ms(250);
STATUS_LED_1(false);
STATUS_LED_2(false);
wait_ms(250);
STATUS_LED_3(false);
STATUS_LED_4(false);
wait_ms(250);
is_launching = false;
layer_state_set_kb(layer_state);
}
}
static THD_WORKING_AREA(waLEDThread, 128);
static THD_FUNCTION(LEDThread, arg) {
(void)arg;
chRegSetThreadName("LEDThread");
while (true) {
voyager_led_task();
}
}
void keyboard_pre_init_kb(void) {
// Initialize Reset pins
setPinInput(A8);
setPinOutput(A9);
writePinLow(A9);
setPinOutput(B5);
setPinOutput(B4);
setPinOutput(B3);
writePinLow(B5);
writePinLow(B4);
writePinLow(B3);
chThdCreateStatic(waLEDThread, sizeof(waLEDThread), NORMALPRIO - 16, LEDThread, NULL);
keyboard_pre_init_user();
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_set_color_all(0, 0, 0);
}
layer_state_t layer_state_set_kb(layer_state_t state) {
state = layer_state_set_user(state);
return state;
}
#ifdef RGB_MATRIX_ENABLE
// clang-format off
const is31_led PROGMEM g_is31_leds[RGB_MATRIX_LED_COUNT] = {
/* Refer to IS31 manual for these locations
* driver
* | R location
* | | G location
* | | | B location
* | | | | */
{0, C2_2, C1_2, C4_3},
{0, C2_3, C1_3, C3_3},
{0, C2_4, C1_4, C3_4},
{0, C2_5, C1_5, C3_5},
{0, C2_6, C1_6, C3_6},
{0, C2_7, C1_7, C3_7},
{0, C2_8, C1_8, C3_8},
{0, C8_1, C7_1, C9_1},
{0, C8_2, C7_2, C9_2},
{0, C8_3, C7_3, C9_3},
{0, C8_4, C7_4, C9_4},
{0, C8_5, C7_5, C9_5},
{0, C8_6, C7_6, C9_6},
{0, C2_10, C1_10, C4_11},
{0, C2_11, C1_11, C3_11},
{0, C2_12, C1_12, C3_12},
{0, C2_13, C1_13, C3_13},
{0, C2_14, C1_14, C3_14},
{0, C2_15, C1_15, C3_15},
{0, C2_16, C1_16, C3_16},
{0, C8_9, C7_9, C9_9},
{0, C8_10, C7_10, C9_10},
{0, C8_11, C7_11, C9_11},
{0, C8_12, C7_12, C9_12},
{0, C8_13, C7_13, C9_13},
{0, C8_14, C7_14, C9_14},
{1, C2_7, C1_7, C3_7},
{1, C2_6, C1_6, C3_6},
{1, C2_5, C1_5, C3_5},
{1, C2_4, C1_4, C3_4},
{1, C2_3, C1_3, C3_3},
{1, C2_2, C1_2, C4_3},
{1, C8_5, C7_5, C9_5},
{1, C8_4, C7_4, C9_4},
{1, C8_3, C7_3, C9_3},
{1, C8_2, C7_2, C9_2},
{1, C8_1, C7_1, C9_1},
{1, C2_8, C1_8, C3_8},
{1, C2_14, C1_14, C3_14},
{1, C2_13, C1_13, C3_13},
{1, C2_12, C1_12, C3_12},
{1, C2_11, C1_11, C3_11},
{1, C2_10, C1_10, C4_11},
{1, C8_6, C7_6, C9_6},
{1, C8_12, C7_12, C9_12},
{1, C8_11, C7_11, C9_11},
{1, C8_10, C7_10, C9_10},
{1, C8_9, C7_9, C9_9},
{1, C2_16, C1_16, C3_16},
{1, C2_15, C1_15, C3_15},
{1, C8_14, C7_14, C9_14},
{1, C8_13, C7_13, C9_13},
};
led_config_t g_led_config = { {
{ NO_LED, 0, 1, 2, 3, 4, 5 },
{ NO_LED, 6, 7, 8, 9, 10, 11 },
{ NO_LED, 12, 13, 14, 15, 16, 17 },
{ NO_LED, 18, 19, 20, 21, 22, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, 23, NO_LED, NO_LED },
{ 24, 25, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED },
{ 26, 27, 28, 29, 30, 31, NO_LED },
{ 32, 33, 34, 35, 36, 37, NO_LED },
{ 38, 39, 40, 41, 42, 43, NO_LED },
{ NO_LED, 45, 46, 47, 48, 49, NO_LED },
{ NO_LED, NO_LED, 44, NO_LED, NO_LED, NO_LED, NO_LED },
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, 50, 51 },
}, {
{0, 10}, {17, 10}, {34,8}, {52, 5}, {69, 8}, {86, 10},
{0, 21}, {17, 21}, {34, 19}, {52, 17}, {69, 19}, {86, 21},
{0, 32}, {17, 32}, {34, 30}, {52, 28}, {69, 30}, {86, 32},
{0, 43}, {17, 43}, {34, 41}, {52, 39}, {69, 41}, {86, 43},
{86, 53}, {96, 58},
{138, 10}, {155, 10}, {172, 8}, {190, 5}, {207, 8}, {224, 10},
{138, 21}, {155, 21}, {172, 19}, {190, 17}, {207, 19}, {224, 21},
{138, 32}, {155, 32}, {172, 30}, {190, 28}, {207, 30}, {224, 32},
{138, 43}, {155,43}, {172, 41}, {190, 39}, {207, 41}, {224, 43},
{128, 58}, {138, 53}
}, {
1, 4, 4, 4, 4, 4,
1, 4, 4, 4, 4, 4,
1, 4, 4, 4, 4, 4,
1, 4, 4, 4, 4, 4,
1, 1, 4, 4, 4, 4,
4, 1, 4, 4, 4, 4,
4, 1, 4, 4, 4, 4,
4, 1, 4, 4, 4, 4,
4, 1, 1, 1
} };
// clang-format on
#endif
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
if (!process_record_user(keycode, record)) {
return false;
}
switch (keycode) {
#ifdef RGB_MATRIX_ENABLE
case RGB_TOG:
if (record->event.pressed) {
switch (rgb_matrix_get_flags()) {
case LED_FLAG_ALL: {
rgb_matrix_set_flags(LED_FLAG_NONE);
rgb_matrix_set_color_all(0, 0, 0);
} break;
default: {
rgb_matrix_set_flags(LED_FLAG_ALL);
} break;
}
}
return false;
#endif
}
return true;
}
void matrix_init_kb(void) {
keyboard_config.raw = eeconfig_read_kb();
if (!keyboard_config.led_level && !keyboard_config.led_level_res) {
keyboard_config.led_level = true;
keyboard_config.led_level_res = 0b11;
eeconfig_update_kb(keyboard_config.raw);
}
matrix_init_user();
}
void eeconfig_init_kb(void) { // EEPROM is getting reset!
keyboard_config.raw = 0;
keyboard_config.led_level = true;
keyboard_config.led_level_res = 0b11;
keyboard_config.disable_layer_led = false;
eeconfig_update_kb(keyboard_config.raw);
eeconfig_init_user();
}

View File

@ -0,0 +1,87 @@
#pragma once
#include "quantum.h"
extern bool mcp23018_leds[];
#define MCP23018_DEFAULT_ADDRESS 0b0100000
#define STATUS_LED_1(status) writePin(B5, (bool)status)
#define STATUS_LED_2(status) writePin(B4, (bool)status)
#define STATUS_LED_3(status) mcp23018_leds[0] = (bool)status
#define STATUS_LED_4(status) mcp23018_leds[1] = (bool)status
/*
// clang-format off
#define LAYOUT( \
k00, k01, k02, k03, k04, k05, k26, k27, k28, k29, k30, k31, \
k06, k07, k08, k09, k10, k11, k32, k33, k34, k35, k36, k37, \
k12, k13, k14, k15, k16, k17, k38, k39, k40, k41, k42, k43, \
k18, k19, k20, k21, k22, k23, k44, k45, k46, k47, k48, k49, \
k24, k25, k50, k51 \
)\
{ \
{ KC_NO, k00, k01, k02, k03, k04, k05 }, \
{ KC_NO, k06, k07, k08, k09, k10, k11 }, \
{ KC_NO, k12, k13, k14, k15, k16, k17 }, \
{ KC_NO, k18, k19, k20, k21, k22, KC_NO }, \
{ KC_NO, KC_NO, KC_NO, KC_NO, k23, KC_NO, KC_NO }, \
{ k24, k25, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
\
{ k26, k27, k28, k29, k30, k31, KC_NO }, \
{ k32, k33, k34, k35, k36, k37, KC_NO }, \
{ k38, k39, k40, k41, k42, k43, KC_NO }, \
{ KC_NO, k45, k46, k47, k48, k49, KC_NO }, \
{ KC_NO, KC_NO, k44, KC_NO, KC_NO, KC_NO, KC_NO }, \
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, k50, k51 }, \
}
// clang-format on
*/
// clang-format off
#define LAYOUT( \
k00, k01, k02, k03, k04, k05, \
k06, k07, k08, k09, k10, k11, \
k12, k13, k14, k15, k16, k17, \
k18, k19, k20, k21, k22, k23, \
k24, k25, \
k26, k27, k28, k29, k30, k31, \
k32, k33, k34, k35, k36, k37, \
k38, k39, k40, k41, k42, k43, \
k44, k45, k46, k47, k48, k49, \
k50, k51 \
)\
{ \
{ KC_NO, k00, k01, k02, k03, k04, k05 }, \
{ KC_NO, k06, k07, k08, k09, k10, k11 }, \
{ KC_NO, k12, k13, k14, k15, k16, k17 }, \
{ KC_NO, k18, k19, k20, k21, k22, KC_NO }, \
{ KC_NO, KC_NO, KC_NO, KC_NO, k23, KC_NO, KC_NO }, \
{ k24, k25, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
\
{ k26, k27, k28, k29, k30, k31, KC_NO }, \
{ k32, k33, k34, k35, k36, k37, KC_NO }, \
{ k38, k39, k40, k41, k42, k43, KC_NO }, \
{ KC_NO, k45, k46, k47, k48, k49, KC_NO }, \
{ KC_NO, KC_NO, k44, KC_NO, KC_NO, KC_NO, KC_NO }, \
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, k50, k51 }, \
}
// clang-format on
enum voyager_keycodes {
LED_LEVEL = SAFE_RANGE,
BETA_SAFE_RANGE,
};
typedef union {
uint32_t raw;
struct {
bool disable_layer_led : 1;
bool placeholder : 1;
bool led_level : 1;
uint8_t led_level_res : 2; // DO NOT REMOVE
};
} keyboard_config_t;
extern keyboard_config_t keyboard_config;
bool is_transport_connected(void);

View File

@ -0,0 +1,63 @@
#pragma once
/* key matrix size */
#define MATRIX_ROWS 12
#define MATRIX_COLS 7
/* PCB default pin-out */
// #define MATRIX_ROW_PINS { B10, B11, B12, B13, B14, B15 }
// #define MATRIX_COL_PINS { A0, A1, A2, A3, A6, A7, B0 }
// #define MCP23_ROW_PINS { GPB5, GBP4, GBP3, GBP2, GBP1, GBP0 }
// #define MCP23_COL_PINS { GPA0, GBA1, GBA2, GBA3, GBA4, GBA5, GBA6 }
// #define MCP23_LED_R GPB7
// #define MCP23_LED_G GPB6
// #define MCP23_LED_B GPA7
// Not needed, is default address:
// #define EXTERNAL_EEPROM_I2C_BASE_ADDRESS 0b10100000
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION ROW2COL
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
#define LED_BRIGHTNESS_LO 5
#define LED_BRIGHTNESS_HI 100
#define LED_BRIGHTNESS_DEFAULT (LED_BRIGHTNESS_LO)
#define DRIVER_ADDR_1 0b1110100
#define DRIVER_ADDR_2 0b1110111
#define DRIVER_COUNT 2
#define DRIVER_1_LED_TOTAL 36
#define DRIVER_2_LED_TOTAL 36
#define RGB_MATRIX_LED_COUNT (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
#define RGB_MATRIX_CENTER { 125, 26 }
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 175
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES
#define RGB_DISABLE_WHEN_USB_SUSPENDED
#ifndef ISSI_TIMEOUT
#define ISSI_TIMEOUT 5
#endif
#define MOUSEKEY_INTERVAL 20
#define MOUSEKEY_DELAY 0
#define MOUSEKEY_TIME_TO_MAX 60
#define MOUSEKEY_MAX_SPEED 7
#define MOUSEKEY_WHEEL_DELAY 400
#define MOUSEKEY_WHEEL_INTERVAL MOUSEKEY_INTERVAL
#define MOUSEKEY_WHEEL_MAX_SPEED MOUSEKEY_MAX_SPEED
#define MOUSEKEY_WHEEL_TIME_TO_MAX MOUSEKEY_TIME_TO_MAX
#define TAPPING_TOGGLE 1
// Delay between each i2c io expander ops (in MCU cycles)
#define IO_EXPANDER_OP_DELAY 500

View File

@ -0,0 +1,39 @@
#pragma once
#ifdef ENABLE_BETA_LEADER
#include "quantum.h"
bool beta_process_leader(uint16_t keycode, keyrecord_t *record);
void beta_leader_start(void);
void beta_leader_end(void);
bool beta_leader_check(void);
void beta_qk_leader_check(void);
void beta_qk_leader_start(void);
#define BETA_LEADER_EXTERNS() \
extern bool beta_leading; \
extern uint16_t beta_leader_time; \
extern uint16_t beta_leader_sequence[5]; \
extern uint8_t beta_leader_sequence_size
// Normal sequence
// These do the same thing as SEQ_X_KEYS from qmk.
#define BETA_SEQ_1_LONG(key) if (beta_leader_sequence[0] == (key) && beta_leader_sequence[1] == 0 && beta_leader_sequence[2] == 0 && beta_leader_sequence[3] == 0 && beta_leader_sequence[4] == 0 && timer_elapsed(beta_leader_time) > LEADER_TIMEOUT)
#define BETA_SEQ_2_LONG(key1, key2) if (beta_leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2) && beta_leader_sequence[2] == 0 && beta_leader_sequence[3] == 0 && beta_leader_sequence[4] == 0 && timer_elapsed(beta_leader_time) > LEADER_TIMEOUT)
#define BETA_SEQ_3_LONG(key1, key2, key3) if (beta_leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2) && beta_leader_sequence[2] == (key3) && beta_leader_sequence[3] == 0 && beta_leader_sequence[4] == 0 && timer_elapsed(beta_leader_time) > LEADER_TIMEOUT)
#define BETA_SEQ_4_LONG(key1, key2, key3, key4) if (beta_leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2) && beta_leader_sequence[2] == (key3) && beta_leader_sequence[3] == (key4) && beta_leader_sequence[4] == 0 && timer_elapsed(beta_leader_time) > LEADER_TIMEOUT)
#define BETA_SEQ_5_LONG(key1, key2, key3, key4, key5) if (leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2) && beta_leader_sequence[2] == (key3) && beta_leader_sequence[3] == (key4) && beta_leader_sequence[4] == (key5) && timer_elapsed(beta_leader_time) > LEADER_TIMEOUT)
// Short-circuit sequence
// These match as soon as a matching sequence is seen,
// not waiting for the leader timeout. They thus register
// immediately, but cannot be used in longer sequences.
#define BETA_SEQ_1_SHORT(key) if (beta_leader_sequence[0] == (key))
#define BETA_SEQ_2_SHORT(key1, key2) if (beta_leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2))
#define BETA_SEQ_3_SHORT(key1, key2, key3) if (beta_leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2))
#define BETA_SEQ_4_SHORT(key1, key2, key3, key4) if (beta_leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2))
#define BETA_SEQ_5_SHORT(key1, key2, key3, key4, key5) if (beta_leader_sequence[0] == (key1) && beta_leader_sequence[1] == (key2))
#endif

View File

@ -0,0 +1,103 @@
#ifdef ENABLE_BETA_LEADER
#include "beta_leader.h"
#include <string.h>
#ifndef LEADER_TIMEOUT
#define LEADER_TIMEOUT 300
#endif
__attribute__((weak)) void beta_leader_start(void) {}
__attribute__((weak)) void beta_leader_end(void) {}
__attribute__((weak)) bool beta_leader_check(void) { return true; }
// Leader key stuff
bool beta_leading = false;
uint16_t beta_leader_time = 0;
bool beta_leader_change = false;
uint16_t beta_leader_sequence[5] = {0, 0, 0, 0, 0};
uint8_t beta_leader_sequence_size = 0;
void beta_qk_leader_start(void) {
if (beta_leading) {
return;
}
beta_leader_start();
beta_leading = true;
beta_leader_time = timer_read();
beta_leader_sequence_size = 0;
beta_leader_change = false; // If true, run
memset(beta_leader_sequence, 0, sizeof(beta_leader_sequence));
}
void beta_qk_leader_check() {
#ifdef LEADER_NO_TIMEOUT
bool timeout = (beta_leading && beta_leader_sequence_size > 0 && timer_elapsed(beta_leader_time) > LEADER_TIMEOUT);
#else
bool timeout = (beta_leading && timer_elapsed(beta_leader_time) > LEADER_TIMEOUT);
#endif
if (beta_leader_change || timeout) {
beta_leader_change = false;
if (
beta_leader_sequence[beta_leader_sequence_size - 1] == (QK_LEAD)
) {
beta_leading = false;
beta_leader_end();
return;
}
if (timeout) {
beta_leading = false;
beta_leader_end();
}
if (!beta_leader_check()) {
beta_leading = false;
beta_leader_end();
};
}
}
bool beta_process_leader(uint16_t keycode, keyrecord_t *record) {
// Leader key set-up
if (record->event.pressed) {
if (beta_leading) {
# ifndef LEADER_NO_TIMEOUT
if (timer_elapsed(beta_leader_time) < LEADER_TIMEOUT)
# endif // LEADER_NO_TIMEOUT
{
# ifndef LEADER_KEY_STRICT_KEY_PROCESSING
if (IS_QK_MOD_TAP(keycode)) {
keycode = QK_MOD_TAP_GET_TAP_KEYCODE(keycode);
} else if (IS_QK_LAYER_TAP(keycode)) {
keycode = QK_LAYER_TAP_GET_TAP_KEYCODE(keycode);
}
# endif // LEADER_KEY_STRICT_KEY_PROCESSING
if (beta_leader_sequence_size < ARRAY_SIZE(beta_leader_sequence)) {
beta_leader_sequence[beta_leader_sequence_size] = keycode;
beta_leader_sequence_size++;
beta_leader_change = true;
} else {
beta_leading = false;
beta_leader_end();
return true;
}
# ifdef LEADER_PER_KEY_TIMING
beta_leader_time = timer_read();
# endif
return false;
}
} else {
if (keycode == QK_LEADER) {
beta_qk_leader_start();
}
}
}
return true;
}
#endif

View File

@ -0,0 +1,22 @@
/* Copyright 2021 QMK
*
* 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 <https://www.gnu.org/licenses/>.
*/
#pragma once
#define HAL_USE_I2C TRUE
#define HAL_USE_GPT TRUE
#define HAL_USE_DAC TRUE
#include_next <halconf.h>

View File

@ -0,0 +1,230 @@
{
"keyboard_name": "Betalupi Voyager",
"manufacturer": "ZSA Technology Labs",
"url": "zsa.io/voyager",
"maintainer": "ZSA Technology Labs",
"usb": {
"vid": "0x3297",
"pid": "0x1977",
"device_version": "0.0.1"
},
"layout_aliases": {
"LAYOUT_voyager": "LAYOUT"
},
"layouts": {
"LAYOUT": {
"layout": [
{
"x": 3,
"y": 0
},
{
"x": 12,
"y": 0
},
{
"x": 2,
"y": 0.25
},
{
"x": 4,
"y": 0.25
},
{
"x": 11,
"y": 0.25
},
{
"x": 13,
"y": 0.25
},
{
"x": 0,
"y": 0.5
},
{
"x": 1,
"y": 0.5
},
{
"x": 5,
"y": 0.5
},
{
"x": 10,
"y": 0.5
},
{
"x": 14,
"y": 0.5
},
{
"x": 15,
"y": 0.5
},
{
"x": 3,
"y": 1
},
{
"x": 12,
"y": 1
},
{
"x": 2,
"y": 1.25
},
{
"x": 4,
"y": 1.25
},
{
"x": 11,
"y": 1.25
},
{
"x": 13,
"y": 1.25
},
{
"x": 0,
"y": 1.5
},
{
"x": 1,
"y": 1.5
},
{
"x": 5,
"y": 1.5
},
{
"x": 10,
"y": 1.5
},
{
"x": 14,
"y": 1.5
},
{
"x": 15,
"y": 1.5
},
{
"x": 3,
"y": 2
},
{
"x": 12,
"y": 2
},
{
"x": 2,
"y": 2.25
},
{
"x": 4,
"y": 2.25
},
{
"x": 11,
"y": 2.25
},
{
"x": 13,
"y": 2.25
},
{
"x": 0,
"y": 2.5
},
{
"x": 1,
"y": 2.5
},
{
"x": 5,
"y": 2.5
},
{
"x": 10,
"y": 2.5
},
{
"x": 14,
"y": 2.5
},
{
"x": 15,
"y": 2.5
},
{
"x": 3,
"y": 3
},
{
"x": 12,
"y": 3
},
{
"x": 2,
"y": 3.25
},
{
"x": 4,
"y": 3.25
},
{
"x": 11,
"y": 3.25
},
{
"x": 13,
"y": 3.25
},
{
"x": 0,
"y": 3.5
},
{
"x": 1,
"y": 3.5
},
{
"x": 5,
"y": 3.5
},
{
"x": 10,
"y": 3.5
},
{
"x": 14,
"y": 3.5
},
{
"x": 15,
"y": 3.5
},
{
"x": 0,
"y": 4.5
},
{
"x": 1,
"y": 4.5,
"h": 1.75
},
{
"x": -0.75,
"y": 4.75,
"h": 1.75
},
{
"x": 0.25,
"y": 4.75
}
]
}
}
}

Binary file not shown.

View File

@ -0,0 +1,40 @@
#define ENABLE_BETA_LEADER
// No timeout after initial leader key press
#define LEADER_NO_TIMEOUT
#define COMBO_SHOULD_TRIGGER
// Timeout resets after each keypress
#define LEADER_PER_KEY_TIMING
#define LEADER_TIMEOUT 500
// Enable spellcheck over HID
//#define ENABLE_HID_SPELLCHECK
//#define ENABLE_AUTOCORRECT
// RGBLight effects
// Static color is always enabled.
//#define RGBLIGHT_EFFECT_ALTERNATING
//#define RGBLIGHT_EFFECT_BREATHING
//#define RGBLIGHT_EFFECT_CHRISTMAS
//#define RGBLIGHT_EFFECT_KNIGHT
//#define RGBLIGHT_EFFECT_RAINBOW_MOOD
//#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
//#define RGBLIGHT_EFFECT_RGB_TEST
//#define RGBLIGHT_EFFECT_SNAKE
//#define RGBLIGHT_EFFECT_STATIC_GRADIENT
//#define RGBLIGHT_EFFECT_TWINKLE
// Custom effects
// #define RGB_MATRIX_FRAMEBUFFER_EFFECTS
// #define ENABLE_RGB_MATRIX_FFT_ANIM // Requires framebuffer
#define USB_SUSPEND_WAKEUP_DELAY 200
#define RAW_USAGE_PAGE 0xFF60
#define RAW_USAGE_ID 0x61
#define LAYER_STATE_32BIT
#define RGB_MATRIX_STARTUP_SPD 60

View File

@ -0,0 +1,238 @@
#include QMK_KEYBOARD_H
#include "version.h"
#include "keymap_russian.h"
#include "keymap_us_international.h"
// Values that should not be saved to git.
// There should be a`secrets.h` in this directory
// with the following contents:
//
// #define SECRET_EMAIL "value"
// #define SECRET_GMAIL "value"
// #define SECRET_SCHOOL_EMAIL "value"
#include "secrets.h"
// Macro keycodes
enum custom_keycodes
{
M_SHUTDOWN = BETA_SAFE_RANGE,
// Macros
M_RESETWM,
M_RU_CTRL,
M_RU_ALT,
M_GUI,
// Special characters.
// M_SPECIAL_TOP and M_SPECIAL_BOTTOM are
// bounds used to parse these. Only special
// characters should be between them.
//
// Сharacters here should be in the same
// order as they are in the host inteface.
M_SPECIAL_TOP,
M_SC_GRAVE,
M_SC_TILD,
M_SC_QUOT,
M_SC_LBR,
M_SC_RBR,
M_SC_LCBR,
M_SC_RCBR,
M_SC_LKVCH,
M_SC_RKVCH,
M_SPECIAL_BOTTOM
};
// LED colors
#define LC_OFF {0, 0, 0}
#define LC_GRN {85, 203, 158}
#define LC_YLW {32, 176, 255}
#define LC_PNK {243, 222, 234}
#define LC_CYN {134, 255, 213}
#define LC_ORN {14, 255, 255}
#define LC_WHT {0, 0, 150}
#define LC_RED {0, 255, 145}
#define LC_BLU {153, 255, 153}
#define LC_RUB {0, 0, 165}
#define LC_RUG {153, 255, 153}
#define LC_RUK {0, 255, 145}
#ifdef ENABLE_HID_SPELLCHECK
#include "features/hid_spellcheck.h"
#endif
#ifdef ENABLE_AUTOCORRECT
#include "features/autocorrect/autocorrect.h"
#endif
#ifdef ENABLE_BETA_LEADER
#include "features/leader/beta_leader.h"
#endif
// #include "features/beta_rawhid.h"
/*
// Send a special character.
// Returns false if character was caught, true otherwise.
bool send_special_character(uint16_t keycode) {
if ( (keycode > M_SPECIAL_TOP) && (keycode < M_SPECIAL_BOTTOM) ) {
hid_send_special_char(keycode - M_SPECIAL_TOP - 1);
return false;
}
return true;
}*/
const uint16_t PROGMEM combo2[] = {KC_D, KC_F, COMBO_END};
const uint16_t PROGMEM combo3[] = {KC_M, KC_P, COMBO_END};
const uint16_t PROGMEM combo4[] = {RU_ER, RU_TE, COMBO_END};
const uint16_t PROGMEM combo5[] = {RU_EF, RU_GHE, COMBO_END};
const uint16_t PROGMEM combo6[] = {KC_DELETE, KC_A, COMBO_END};
combo_t key_combos[] = {
COMBO(combo2, KC_TAB),
COMBO(combo3, KC_RIGHT),
COMBO(combo4, RU_YO),
COMBO(combo5, RU_E),
COMBO(combo6, LCTL(KC_DELETE)),
};
void matrix_scan_user(void)
{
#ifdef ENABLE_BETA_LEADER
beta_qk_leader_check();
#endif
}
// Must be done early, layers need this enum
enum tap_dance_codes
{
TD_WMLAYOUT,
TD_SCREENSHOT,
TD_ESCAPE,
TD_NOGAME
};
// Include all other parts of configuration
#include "layers/layers.c"
#include "parts/leader.c"
#include "parts/tapdance.c"
bool combo_should_trigger(uint16_t combo_index, combo_t *combo, uint16_t keycode, keyrecord_t *record)
{
if (
false
//|| layer_state_is(LAYER_SIMPLEARROWS)
)
{
return false;
}
/* Disable combo `SOME_COMBO` on layer `_LAYER_A` */
if (
combo_index == 0 ||
combo_index == 1)
{
if (layer_state_is(LAYER_RUSSIAN))
{
return false;
}
}
else if (
combo_index == 2 ||
combo_index == 3)
{
if (!layer_state_is(LAYER_RUSSIAN))
{
return false;
}
}
return true;
}
// Process macros.
// Return FALSE to halt key processing,
// Return TRUE to allow QMK to handle keypress.
bool process_record_user(uint16_t keycode, keyrecord_t *record)
{
#ifdef ENABLE_BETA_LEADER
if (!beta_process_leader(keycode, record))
{
return false;
}
#endif
#ifdef ENABLE_HID_SPELLCHECK
if (!process_spellcheck(keycode, record))
{
return false;
}
#endif
#ifdef ENABLE_AUTOCORRECT
if (!process_autocorrection(keycode, record))
{
return false;
}
#endif
// Handle special chars
// if (record->event.pressed) {
// if (!send_special_character(keycode)) { return false; }
//}
// Handle macros
switch (keycode)
{
case M_RESETWM:
if (record->event.pressed)
{
SEND_STRING(SS_LCTL(SS_LGUI(SS_LSFT(SS_TAP(X_R)))));
}
return false;
// Workaround for one-shot LGUI key.
// Using just LGUI with LAYER_DESKTOP as OSL
// does not allow you to hold lgui. This does.
case M_GUI:
if (record->event.pressed)
{
register_code16(KC_LGUI);
}
else
{
unregister_code16(KC_LGUI);
}
return false;
case M_SHUTDOWN:
if (record->event.pressed)
{
SEND_STRING(SS_LGUI(SS_TAP(X_P)) SS_DELAY(100) SS_TAP(X_Y) SS_DELAY(100) SS_TAP(X_ENTER));
}
return false;
/*
case M_RU_CTRL:
if (record->event.pressed) {
layer_move(LAYER_MAIN);
register_code16(KC_LCTL);
} else {
unregister_code16(KC_LCTL);
layer_move(LAYER_RUSSIAN);
}
return false;
case M_RU_ALT:
if (record->event.pressed) {
layer_move(LAYER_MAIN);
register_code16(KC_LALT);
} else {
unregister_code16(KC_LALT);
layer_move(LAYER_RUSSIAN);
}
return false;*/
}
return true;
}

View File

@ -0,0 +1,10 @@
# EditorConfig is awesome: https://EditorConfig.org
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false

View File

@ -0,0 +1,47 @@
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(ARROWS)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_NULL
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_voyager(\
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_TRNS, KC_NO, KC_NO, KC_UP, KC_NO, KC_PGUP, \
KC_TRNS, KC_LCTL, KC_LEFT, KC_DOWN, KC_RIGHT, KC_PGDN, \
KC_LCTL, LGUI(KC_LCTL), KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, \
\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_PGUP, KC_NO, KC_NO, KC_NO, \
KC_NO, LCTL(KC_LEFT), KC_PGDN, LCTL(KC_RIGHT), KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_TRNS, KC_TRNS \
)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA {\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_GRN, LC_OFF, LC_ORN, \
LC_OFF, LC_ORN, LC_GRN, LC_GRN, LC_GRN, LC_ORN, \
LC_OFF, LC_ORN, LC_OFF, LC_OFF, LC_RED, LC_OFF, \
LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_ORN, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_GRN, LC_ORN, LC_GRN, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF \
}
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,49 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(CTRL)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_voyager(\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, LGUI(KC_A), LGUI(KC_S), LGUI(KC_D), KC_TRNS, KC_TRNS,\
KC_NO, LGUI(KC_Z), LGUI(KC_X), LGUI(KC_C), LGUI(KC_V), KC_TRNS,\
KC_TRNS, KC_TRNS, \
\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS \
)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA {\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_RED, LC_ORN, LC_GRN, LC_GRN, LC_CYN, LC_OFF, \
LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF \
}
// This is important.
// The magic macro MUST be here, AFTER the RGBMatrix data.
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,48 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(FKEYS)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_NULL
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_voyager(\
TO(LAYER_MAIN), KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, \
KC_NO, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, \
\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
\
KC_NO, KC_NO \
)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA {\
LC_RED, LC_BLU, LC_BLU, LC_BLU, LC_BLU, LC_BLU, \
LC_OFF, LC_BLU, LC_BLU, LC_BLU, LC_BLU, LC_BLU, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF \
}
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,47 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(GAME)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_voyager( \
KC_ESCAPE, KC_1, KC_2, KC_3, KC_4, KC_5, \
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, \
KC_DELETE, KC_A, KC_S, KC_D, KC_F, KC_G, \
KC_LCTL, KC_Z, KC_X, KC_C, MO(LAYER_ARROWS), TD(TD_NOGAME), \
\
KC_SPACE, KC_BSPC, \
\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA { \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_RED, \
LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF}
// This is important.
// The magic macro MUST be here, AFTER the RGBMatrix data.
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,25 @@
// ORDER MATTERS!
// Don't forget how QMK layers work...
//
// Learned that the hard way.
// First layer will be "default" layer in QMK.
// Second will have index 1, etc. See layers.h
// These MUST be first.
// (For example, LAYER_ARROWS overlays on top of LAYER_MAIN)
#include "main.h"
#include "game.h"
#include "ctrl.h"
#include "russian.h"
#include "numbers.h" // Must be under symbols and arrows
// The order of the layers below doesn't matter,
// since they avoid transparent keys.
#include "symbols.h"
#include "arrows.h"
#include "macros.h"
#include "fkeys.h"
#include "keyboard.h"

View File

@ -0,0 +1,29 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(KEYBOARD)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_voyager(\
TO(LAYER_MAIN), RGB_HUD, RGB_HUI, KC_NO, KC_NO, KC_NO, \
KC_NO, RGB_SAD, RGB_SAI, KC_NO, KC_NO, KC_NO, \
KC_NO, RGB_VAD, RGB_VAI, KC_NO, KC_NO, KC_NO, \
RGB_MOD, RGB_TOG, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, \
\
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO \
)
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,44 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(MACROS)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_voyager( \
TO(LAYER_MAIN), LGUI(KC_1), LGUI(KC_2), LGUI(KC_3), LGUI(KC_4), LGUI(KC_5), \
KC_LGUI, KC_NO, TD(TD_SCREENSHOT), KC_NO, KC_NO, LGUI(KC_T), \
KC_MEDIA_PLAY_PAUSE, KC_MEDIA_NEXT_TRACK, KC_NO, KC_NO, OSL(LAYER_FKEYS), KC_NO, \
KC_NO, KC_MEDIA_PREV_TRACK, KC_NO, LGUI(KC_W), KC_NO, TO(LAYER_GAME), \
LGUI(KC_ENTER), LGUI(KC_BSLS), \
\
M_SHUTDOWN, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO, KC_NO, KC_NO, LGUI(KC_SPACE), TD(TD_WMLAYOUT), \
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, TT(LAYER_RUSSIAN), \
LCTL(LGUI(LSFT(KC_R))), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_NO, KC_NO)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA { \
LC_RED, LC_PNK, LC_PNK, LC_PNK, LC_PNK, LC_PNK, \
LC_CYN, LC_OFF, LC_CYN, LC_OFF, LC_OFF, LC_OFF, \
LC_GRN, LC_GRN, LC_OFF, LC_OFF, LC_BLU, LC_OFF, \
LC_OFF, LC_GRN, LC_OFF, LC_ORN, LC_OFF, LC_RED, \
LC_PNK, LC_PNK, \
LC_RED, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_RED, LC_RED, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_BLU, \
LC_ORN, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF}
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,37 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(MAIN)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
// TODO:
// russian
// spellcheck
// shared features
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_voyager(\
KC_ESCAPE, KC_1, KC_2, KC_3, KC_4, KC_5, \
OSL(LAYER_MACROS), KC_Q, KC_W, KC_E, KC_R, KC_T, \
KC_DELETE, MT(MOD_LALT, KC_A), KC_S, KC_D, KC_F, KC_G, \
MO(LAYER_CTRL), KC_Z, MT(MOD_LSFT, KC_X), KC_C, MO(LAYER_ARROWS), KC_B, \
\
KC_SPACE, KC_BSPC, \
\
\
KC_6, KC_7, KC_8, KC_9, KC_0, LGUI(KC_SPACE), \
KC_Y, KC_U, KC_I, KC_O, KC_NO, KC_NO, \
KC_H, KC_J, KC_K, MO(LAYER_SYMBOLS), KC_L, QK_LEAD, \
KC_N, KC_M, KC_P, KC_V, KC_NO, KC_NO, \
\
KC_RSFT, KC_ENTER \
)
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,49 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(NUMBERS)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_voyager(\
TO(LAYER_MAIN), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\
KC_TRNS, KC_1, KC_2, KC_3, KC_4, KC_5, \
KC_TRNS, KC_6, KC_7, KC_8, KC_9, KC_0, \
KC_TRNS, KC_NO, KC_NO, KC_DOT, KC_COMMA, KC_NO,\
KC_TRNS, KC_TRNS, \
\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
KC_TRNS, KC_TRNS \
)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA {\
LC_RED, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_GRN, LC_GRN, LC_GRN, LC_GRN, LC_GRN, \
LC_OFF, LC_GRN, LC_GRN, LC_GRN, LC_GRN, LC_GRN, \
LC_OFF, LC_OFF, LC_OFF, LC_PNK, LC_PNK, LC_OFF, \
LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF \
}
// This is important.
// The magic macro MUST be here, AFTER the RGBMatrix data.
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,47 @@
// See symbols.h for docs
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(RUSSIAN)
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_voyager(\
KC_ESCAPE, RU_1, RU_2, RU_3, RU_4, RU_5, \
OSL(LAYER_MACROS), RU_CHE, RU_SHA, RU_IE, RU_ER, RU_TE, \
KC_DELETE, MT(MOD_LALT, RU_A), RU_ES, RU_DE, RU_EF, RU_GHE, \
LM(MOD_LCTL, LAYER_CTRL), RU_ZE, MT(MOD_LSFT, RU_YA), RU_TSE, MO(LAYER_ARROWS), RU_BE, \
KC_SPACE, KC_BSPC, \
\
RU_6, RU_7, RU_8, RU_9, RU_0, LGUI(KC_TAB), \
RU_U, RU_YU, RU_I, RU_O, RU_SHCH, RU_HARD, \
RU_HA, RU_ZHE, RU_KA, MO(LAYER_SYMBOLS), RU_EL, RU_SOFT, \
RU_EN, RU_EM, RU_PE, RU_VE, RU_YERU, RU_SHTI, \
KC_RSFT, KC_ENTER \
)
BETA_LAYER_MAGIC_MACRO
#endif
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA {\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_RUB, LC_RUB, LC_RUB, LC_RUB, LC_RUB, LC_RUB, \
LC_RUG, LC_RUG, LC_RUG, LC_RUG, LC_RUG, LC_RUG, \
LC_RUK, LC_RUK, LC_RUK, LC_RUK, LC_RUK, LC_RUK, \
LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_RUB, LC_RUB, LC_RUB, LC_RUB, LC_RUB, LC_RUB, \
LC_RUG, LC_RUG, LC_RUG, LC_RUG, LC_RUG, LC_RUG, \
LC_RUK, LC_RUK, LC_RUK, LC_RUK, LC_RUK, LC_RUK, \
LC_OFF, LC_OFF \
}
BETA_LAYER_MAGIC_MACRO
#endif
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,112 @@
// Layers are defined in macros,
// so that all supporting code can be
// auto-generated by the preprocessor.
//
// When making a new layer, make sure you update EVERY
// reference to BETA_LAYER() with your layer's name!
// This macro isn't used anywhere else.
// It's here for convenience, so we only have to write
// the layer name in one place.
#define BETA_LAYER_MAGIC_MACRO BETA_LAYER(SYMBOLS)
// What OS keyboard layout this layer is designed for.
// See extra_mappings.h for possible values.
//
// Every layer must have this section.
#ifdef BETA_LAYER_LAYOUTS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_EN
BETA_LAYER_MAGIC_MACRO
#endif
// If BETA_LAYER_NAME is defined, the preprocessor is making
// enums for this layer. See keymap.h.
//
// IMPORTANT:
// Things will break if BETA_LAYER_MAGIC_MACRO is written outside #ifdef/#endif guards.
// If BETA_LAYER_KEYS is defined, the preprocessor is either...
// - making LAYER_* enums (see keymap.h)
// - filling the keymap array (see keymap.c)
//
// Every layer must have this section.
#ifdef BETA_LAYER_KEYS
#define BETA_LAYER_CONTEXT_DATA LAYOUT_voyager(\
KC_NO, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC,\
KC_NO, KC_GRAVE, KC_LPRN, KC_RPRN, KC_QUES, KC_LCBR,\
KC_NO, KC_TILD, KC_QUOT, KC_COMMA, KC_DOT, KC_DQUO,\
KC_NO, KC_NO, KC_LBRC, KC_RBRC, KC_EXLM, KC_RCBR,\
\
KC_NO, KC_NO,\
\
\
KC_CIRC, KC_AMPR, KC_ASTR, KC_NO, KC_NO, KC_NO,\
KC_LABK, KC_RABK, KC_SLASH, KC_NO, KC_BSLS, KC_NO,\
KC_UNDS, KC_MINUS, KC_COLN, KC_TRANSPARENT, KC_PIPE, KC_NO,\
KC_EQUAL, KC_PLUS, KC_SCLN, KC_NO, KC_NO, KC_NO,\
\
KC_NO, KC_NO\
)
// This is important.d
// The magic macro MUST be here, AFTER the keymap data.
BETA_LAYER_MAGIC_MACRO
#endif
// If BETA_LAYER_KEYS is defined, the preprocessor is either...
// - making LAYER_*_LEDS enums (see keymap.h)
// - filling the ledmap array (see keymap.c)
// - building the layer color switch statement (see keymap.c)
//
// This section is optional. If it is missing, this layer will not have
// an RGBMatrix color.
#ifdef BETA_LAYER_LEDS
#define BETA_LAYER_CONTEXT_DATA {\
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_ORN, LC_CYN, LC_CYN, LC_PNK, LC_CYN, \
LC_OFF, LC_ORN, LC_PNK, LC_PNK, LC_PNK, LC_PNK, \
LC_OFF, LC_OFF, LC_CYN, LC_CYN, LC_PNK, LC_CYN, \
LC_OFF, LC_OFF, \
LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, LC_OFF, \
LC_GRN, LC_GRN, LC_CYN, LC_OFF, LC_CYN, LC_OFF, \
LC_CYN, LC_GRN, LC_PNK, LC_RED, LC_CYN, LC_OFF, \
LC_GRN, LC_GRN, LC_PNK, LC_OFF, LC_OFF, LC_OFF, \
LC_OFF, LC_OFF \
}
// This is important.
// The magic macro MUST be here, AFTER the RGBMatrix data.
BETA_LAYER_MAGIC_MACRO
#endif
// If BETA_LAYER_INDICATORS is defined, the preprocessor is
// building the indicator led switch statement (see keymap.c)
//
// This should be a `case` statement that looks exactly like the following example.
//
// This section is optional. If it is missing, this layer will
// not set indicator leds.
/*
#ifdef BETA_LAYER_INDICATORS
case LAYER_MAGIC_MACRO:
ergodox_right_led_1_on();
//ergodox_right_led_2_on();
//ergodox_right_led_3_on();
break;
#endif
*/
// Cleanup.
// This is not optional,
// we MUST undef these here so the next layer
// we load can re-define them.
#undef BETA_LAYER_CONTEXT_DATA
#undef BETA_LAYER_MAGIC_MACRO

View File

@ -0,0 +1,160 @@
//#include "extra_mappings.h"
#define LAYER_INCLUDE_FILE "definitions/include.c"
/*
Setup
*/
// Generate layer ids
#define BETA_LAYER_KEYS
#define BETA_LAYER(name) LAYER_##name,
enum layer_indices {
#include LAYER_INCLUDE_FILE
X_LAYER_MAX
};
#undef BETA_LAYER
#undef BETA_LAYER_KEYS
// Generate RGBMatrix ids
// We don't use the same id for layers and layer colors
// to save memory. Not every layer has colors!
#define BETA_LAYER_LEDS
#define BETA_LAYER(name) LAYER_##name##_LEDS,
enum led_indices {
#include LAYER_INCLUDE_FILE
X_LAYER_LEDS_MAX
};
#undef BETA_LAYER
#undef BETA_LAYER_LEDS
/*
Load layers
*/
// Create keymap array
#define BETA_LAYER_KEYS
#define BETA_LAYER(name) [LAYER_##name] = BETA_LAYER_CONTEXT_DATA,
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#include LAYER_INCLUDE_FILE
};
#undef BETA_LAYER
#undef BETA_LAYER_KEYS
// Create led map array
#define BETA_LAYER_LEDS
#define BETA_LAYER(name) [LAYER_##name##_LEDS] = BETA_LAYER_CONTEXT_DATA,
const uint8_t PROGMEM ledmaps[][RGB_MATRIX_LED_COUNT][3] = {
#include LAYER_INCLUDE_FILE
};
#undef BETA_LAYER
#undef BETA_LAYER_LEDS
/*
// Create os layout array
#define BETA_LAYER_LAYOUTS
#define BETA_LAYER(name) [LAYER_##name] = BETA_LAYER_CONTEXT_DATA,
uint8_t layer_layouts[] = {
#include LAYER_INCLUDE_FILE
};
#undef BETA_LAYER
#undef BETA_LAYER_LAYOUTS
*/
void set_layer_color(int layer) {
for (int i = 0; i < RGB_MATRIX_LED_COUNT; i++) {
HSV hsv = {
.h = pgm_read_byte(&ledmaps[layer][i][0]),
.s = pgm_read_byte(&ledmaps[layer][i][1]),
.v = pgm_read_byte(&ledmaps[layer][i][2]),
};
if (!hsv.h && !hsv.s && !hsv.v) {
rgb_matrix_set_color( i, 0, 0, 0 );
} else {
RGB rgb = hsv_to_rgb( hsv );
float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
rgb_matrix_set_color( i, f * rgb.r, f * rgb.g, f * rgb.b );
}
}
}
extern bool beta_leading;
bool rgb_matrix_indicators_user(void) {
if (keyboard_config.disable_layer_led) {
return true;
}
switch (biton32(layer_state)) {
// Load layer RGBMatrix colors
#define BETA_LAYER_LEDS
#define BETA_LAYER(name)\
case LAYER_##name:\
set_layer_color(LAYER_##name##_LEDS);\
break;
#include LAYER_INCLUDE_FILE
#undef BETA_LAYER
#undef BETA_LAYER_LEDS
default:
if (rgb_matrix_get_flags() == LED_FLAG_NONE) {
rgb_matrix_set_color_all(0, 0, 0);
}
break;
}
if (beta_leading) {
rgb_matrix_set_color(43, 0x00, 0x00, 0xFF);
}
if (biton32(layer_state) == LAYER_KEYBOARD) {
rgb_matrix_set_color(0, 0xFF, 0x00, 0x00);
rgb_matrix_set_color(18, 0x95, 0xFF, 0x00);
rgb_matrix_set_color(19, 0x95, 0xFF, 0x00);
rgb_matrix_set_color(14, 0x00, 0xFF, 0x8C);
rgb_matrix_set_color(13, 0x00, 0xFF, 0x8C);
rgb_matrix_set_color(8, 0x00, 0xFF, 0x8C);
rgb_matrix_set_color(7, 0x00, 0xFF, 0x8C);
rgb_matrix_set_color(2, 0x00, 0xFF, 0x8C);
rgb_matrix_set_color(1, 0x00, 0xFF, 0x8C);
}
return true;
}
layer_state_t layer_state_set_user(layer_state_t state) {
uint8_t layer = biton32(state);
STATUS_LED_1(false);
STATUS_LED_2(false);
STATUS_LED_3(false);
STATUS_LED_4(false);
switch (layer) {
// Load indicator LED cases
#define BETA_LAYER_INDICATORS
#define BETA_LAYER(name) LAYER_##name
#include LAYER_INCLUDE_FILE
#undef BETA_LAYER
#undef BETA_LAYER_INDICATORS
default:
break;
}
return state;
};

View File

@ -0,0 +1,37 @@
#include "features/leader/beta_leader.h"
BETA_LEADER_EXTERNS();
void beta_leader_start(void) {}
void beta_leader_end(void) {}
bool beta_leader_check(void) {
BETA_SEQ_2_SHORT(KC_E, KC_M) {
SEND_STRING(SECRET_EMAIL);
return false;
}
BETA_SEQ_2_SHORT(KC_G, KC_M) {
SEND_STRING(SECRET_GMAIL);
return false;
}
BETA_SEQ_2_SHORT(KC_L, KC_I) {
SEND_STRING(SECRET_SCHOOL_EMAIL);
return false;
}
BETA_SEQ_2_SHORT(KC_K, KC_B) {
layer_move(LAYER_KEYBOARD);
return false;
}
BETA_SEQ_1_SHORT(KC_N) {
layer_move(LAYER_NUMBERS);
return false;
}
return true;
}

View File

@ -0,0 +1,57 @@
void td_screenshot(tap_dance_state_t *state, void *user_data)
{
if (state->count == 1)
{
tap_code16(KC_PSCR);
}
else if (state->count == 2)
{
tap_code16(LSFT(KC_PSCR));
}
else if (state->count == 3)
{
tap_code16(LALT(KC_PSCR));
}
else
{
reset_tap_dance(state);
}
}
void td_wmlayout(tap_dance_state_t *state, void *user_data)
{
if (state->count == 1)
{
tap_code16(LGUI(KC_COMMA));
}
else if (state->count == 2)
{
tap_code16(LGUI(KC_DOT));
}
else
{
reset_tap_dance(state);
}
}
void td_nogame(tap_dance_state_t *state, void *user_data)
{
if (state->count == 1)
{
tap_code16(KC_B);
}
else if (state->count == 2)
{
layer_move(LAYER_MAIN);
}
else
{
reset_tap_dance(state);
}
}
tap_dance_action_t tap_dance_actions[] = {
[TD_WMLAYOUT] = ACTION_TAP_DANCE_FN(td_wmlayout),
[TD_SCREENSHOT] = ACTION_TAP_DANCE_FN(td_screenshot),
[TD_NOGAME] = ACTION_TAP_DANCE_FN(td_nogame),
};

View File

@ -0,0 +1,3 @@
# rules.mk overrides
TAP_DANCE_ENABLE = yes

View File

@ -0,0 +1,85 @@
/*
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
* STM32F303xC memory setup.
*/
MEMORY
{
flash0 (rx) : org = 0x08002000, len = 256k - 0x2000
flash1 (rx) : org = 0x00000000, len = 0
flash2 (rx) : org = 0x00000000, len = 0
flash3 (rx) : org = 0x00000000, len = 0
flash4 (rx) : org = 0x00000000, len = 0
flash5 (rx) : org = 0x00000000, len = 0
flash6 (rx) : org = 0x00000000, len = 0
flash7 (rx) : org = 0x00000000, len = 0
ram0 (wx) : org = 0x20000000, len = 40k
ram1 (wx) : org = 0x00000000, len = 0
ram2 (wx) : org = 0x00000000, len = 0
ram3 (wx) : org = 0x00000000, len = 0
ram4 (wx) : org = 0x10000000, len = 8k
ram5 (wx) : org = 0x00000000, len = 0
ram6 (wx) : org = 0x00000000, len = 0
ram7 (wx) : org = 0x00000000, len = 0
}
/* For each data/text section two region are defined, a virtual region
and a load region (_LMA suffix).*/
/* Flash region to be used for exception vectors.*/
REGION_ALIAS("VECTORS_FLASH", flash0);
REGION_ALIAS("VECTORS_FLASH_LMA", flash0);
/* Flash region to be used for constructors and destructors.*/
REGION_ALIAS("XTORS_FLASH", flash0);
REGION_ALIAS("XTORS_FLASH_LMA", flash0);
/* Flash region to be used for code text.*/
REGION_ALIAS("TEXT_FLASH", flash0);
REGION_ALIAS("TEXT_FLASH_LMA", flash0);
/* Flash region to be used for read only data.*/
REGION_ALIAS("RODATA_FLASH", flash0);
REGION_ALIAS("RODATA_FLASH_LMA", flash0);
/* Flash region to be used for various.*/
REGION_ALIAS("VARIOUS_FLASH", flash0);
REGION_ALIAS("VARIOUS_FLASH_LMA", flash0);
/* Flash region to be used for RAM(n) initialization data.*/
REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0);
/* RAM region to be used for Main stack. This stack accommodates the processing
of all exceptions and interrupts.*/
REGION_ALIAS("MAIN_STACK_RAM", ram0);
/* RAM region to be used for the process stack. This is the stack used by
the main() function.*/
REGION_ALIAS("PROCESS_STACK_RAM", ram0);
/* RAM region to be used for data segment.*/
REGION_ALIAS("DATA_RAM", ram0);
REGION_ALIAS("DATA_RAM_LMA", flash0);
/* RAM region to be used for BSS segment.*/
REGION_ALIAS("BSS_RAM", ram0);
/* RAM region to be used for the default heap.*/
REGION_ALIAS("HEAP_RAM", ram0);
/* Generic rules inclusion.*/
INCLUDE rules.ld

View File

@ -0,0 +1,241 @@
/* Copyright 2020 ZSA Technology Labs, Inc <@zsa>
* Copyright 2020 Jack Humbert <jack.humb@gmail.com>
* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#include "betalupi_voyager.h"
#include "is31fl3731.h"
#include "i2c_master.h"
extern matrix_row_t matrix[MATRIX_ROWS]; // debounced values
extern matrix_row_t raw_matrix[MATRIX_ROWS]; // raw values
static matrix_row_t raw_matrix_right[MATRIX_COLS];
#define ROWS_PER_HAND (MATRIX_ROWS / 2)
#ifndef VOYAGER_I2C_TIMEOUT
# define VOYAGER_I2C_TIMEOUT 100
#endif
extern bool mcp23018_leds[2];
extern bool is_launching;
bool mcp23018_initd = false;
// extern bool IS31FL3731_initd;
static uint8_t mcp23018_reset_loop;
// static uint8_t is31fl3731_reset_loop;
uint8_t mcp23018_tx[3];
uint8_t mcp23018_rx[1];
void mcp23018_init(void) {
i2c_init();
mcp23018_tx[0] = 0x00; // IODIRA
mcp23018_tx[1] = 0b00000000; // A is output
mcp23018_tx[2] = 0b00111111; // B is inputs
if (MSG_OK == i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, VOYAGER_I2C_TIMEOUT)) {
mcp23018_tx[0] = 0x0C; // GPPUA
mcp23018_tx[1] = 0b10000000; // A is not pulled-up
mcp23018_tx[2] = 0b11111111; // B is pulled-up
wait_ms(5);
if (MSG_OK == i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, VOYAGER_I2C_TIMEOUT)) {
wait_ms(5);
mcp23018_initd = is_launching = true;
}
}
}
bool io_expander_ready(void) {
uint8_t tx[1] = {0x13};
if (MSG_OK == i2c_readReg(MCP23018_DEFAULT_ADDRESS << 1, tx[0], &tx[0], 1, VOYAGER_I2C_TIMEOUT)) {
return true;
}
return false;
}
void matrix_init_custom(void) {
// outputs
setPinOutput(B10);
setPinOutput(B11);
setPinOutput(B12);
setPinOutput(B13);
setPinOutput(B14);
setPinOutput(B15);
// inputs
setPinInputLow(A0);
setPinInputLow(A1);
setPinInputLow(A2);
setPinInputLow(A3);
setPinInputLow(A6);
setPinInputLow(A7);
setPinInputLow(B0);
mcp23018_init();
}
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
bool changed = false;
// Attempt to reset the mcp23018 if it's not initialized
if (!mcp23018_initd) {
if (++mcp23018_reset_loop == 0) {
// Since mcp23018_reset_loop is 8 bit - we'll try to reset once in 255 matrix scans. This will be approx bit more frequent than once per second.
if (io_expander_ready()) {
// If we managed to initialize the mcp23018 - we need to reinitialize the matrix / layer state. During an electric discharge the i2c peripherals might be in a weird state. Giving a delay and resetting the MCU allows to recover from this.
wait_ms(200);
mcu_reset();
}
}
}
// Scanning left and right side of the keyboard for key presses.
// Left side is scanned by reading the gpio pins directly, right side is scanned by reading the mcp23018 registers.
matrix_row_t data = 0;
for (uint8_t row = 0; row <= ROWS_PER_HAND; row++) {
// strobe row
switch (row) {
case 0:
writePinHigh(B10);
break;
case 1:
writePinHigh(B11);
break;
case 2:
writePinHigh(B12);
break;
case 3:
writePinHigh(B13);
break;
case 4:
writePinHigh(B14);
break;
case 5:
writePinHigh(B15);
break;
case 6:
break; // Left hand has 6 rows
}
// Selecting the row on the right side of the keyboard.
if (mcp23018_initd) {
// select row
mcp23018_tx[0] = 0x12; // GPIOA
mcp23018_tx[1] = (0b01111111 & ~(1 << (row))) | ((uint8_t)!mcp23018_leds[2] << 7); // activate row
mcp23018_tx[2] = ((uint8_t)!mcp23018_leds[1] << 6) | ((uint8_t)!mcp23018_leds[0] << 7); // activate row
if (MSG_OK != i2c_transmit(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx, 3, VOYAGER_I2C_TIMEOUT)) {
mcp23018_initd = false;
}
}
// Reading the left side of the keyboard.
if (row < ROWS_PER_HAND) {
// i2c comm incur enough wait time
if (!mcp23018_initd) {
// need wait to settle pin state
matrix_io_delay();
}
// read col data
data = ((readPin(A0) << 0) | (readPin(A1) << 1) | (readPin(A2) << 2) | (readPin(A3) << 3) | (readPin(A6) << 4) | (readPin(A7) << 5) | (readPin(B0) << 6));
// unstrobe row
switch (row) {
case 0:
writePinLow(B10);
break;
case 1:
writePinLow(B11);
break;
case 2:
writePinLow(B12);
break;
case 3:
writePinLow(B13);
break;
case 4:
writePinLow(B14);
break;
case 5:
writePinLow(B15);
break;
case 6:
break;
}
if (current_matrix[row] != data) {
current_matrix[row] = data;
changed = true;
}
}
// Reading the right side of the keyboard.
if (mcp23018_initd) {
for (uint16_t i = 0; i < IO_EXPANDER_OP_DELAY; i++) {
__asm__("nop");
}
mcp23018_tx[0] = 0x13; // GPIOB
if (MSG_OK != i2c_readReg(MCP23018_DEFAULT_ADDRESS << 1, mcp23018_tx[0], &mcp23018_rx[0], 1, VOYAGER_I2C_TIMEOUT)) {
mcp23018_initd = false;
}
data = ~(mcp23018_rx[0] & 0b00111111);
for (uint16_t i = 0; i < IO_EXPANDER_OP_DELAY; i++) {
__asm__("nop");
}
} else {
data = 0;
}
if (raw_matrix_right[row] != data) {
raw_matrix_right[row] = data;
changed = true;
}
}
for (uint8_t row = 0; row < ROWS_PER_HAND; row++) {
current_matrix[11 - row] = 0;
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
current_matrix[11 - row] |= ((raw_matrix_right[6 - col] & (1 << row) ? 1 : 0) << col);
}
}
return changed;
}
// DO NOT REMOVE
// Needed for proper wake/sleep
void matrix_power_up(void) {
bool temp_launching = is_launching;
matrix_init_custom();
is_launching = temp_launching;
if (!temp_launching) {
STATUS_LED_1(false);
STATUS_LED_2(false);
STATUS_LED_3(false);
STATUS_LED_4(false);
}
// initialize matrix state: all keys off
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
matrix[i] = 0;
}
}
bool is_transport_connected(void) {
return mcp23018_initd;
}

Some files were not shown because too many files have changed in this diff Show More