commit
602b0b14d5
@ -1,14 +1,34 @@ |
||||
RGBLIGHT_ENABLE = yes
|
||||
RGBLIGHT_STARTUP_ANIMATION = yes
|
||||
AUDIO_ENABLE = yes
|
||||
HAPTIC_ENABLE = no
|
||||
COMMAND_ENABLE = no
|
||||
TAP_DANCE_ENABLE = yes
|
||||
UNICODE_ENABLE = yes
|
||||
OLED_ENABLE = yes
|
||||
WPM_ENABLE = yes
|
||||
ENCODER_ENABLE = yes
|
||||
ENCODER_MAP_ENABLE = yes
|
||||
# DEBOUNCE_TYPE = sym_eager_pk
|
||||
COMMAND_ENABLE = no
|
||||
RGBLIGHT_ENABLE = yes
|
||||
RGBLIGHT_STARTUP_ANIMATION = yes
|
||||
AUDIO_ENABLE = yes
|
||||
HAPTIC_ENABLE = no
|
||||
TAP_DANCE_ENABLE = yes
|
||||
OLED_ENABLE = yes
|
||||
WPM_ENABLE = yes
|
||||
ENCODER_ENABLE = yes
|
||||
ENCODER_MAP_ENABLE = yes
|
||||
AUTOCORRECTION_ENABLE = yes
|
||||
CAPS_WORD_ENABLE = yes
|
||||
|
||||
LTO_SUPPORTED = no
|
||||
ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/elite_c) |
||||
RGBLIGHT_ENABLE = no
|
||||
AUDIO_ENABLE = no
|
||||
HAPTIC_ENABLE = no
|
||||
TAP_DANCE_ENABLE = no
|
||||
OLED_ENABLE = no
|
||||
WPM_ENABLE = no
|
||||
ENCODER_ENABLE = no
|
||||
AUTOCORRECTION_ENABLE = no
|
||||
LTO_SUPPORTED = yes
|
||||
SWAP_HANDS_ENABLE = no
|
||||
CUSTOM_UNICODE_ENABLE = no
|
||||
CAPS_WORD_ENABLE = no
|
||||
BOOTLOADER = qmk-hid
|
||||
BOOTLOADER_SIZE = 512
|
||||
endif |
||||
ifeq ($(strip $(KEYBOARD)), handwired/tractyl_manuform/5x6_right/teensy2pp) |
||||
AUTOCORRECTION_ENABLE = no
|
||||
CAPS_WORD_ENABLE = yes
|
||||
endif |
||||
# DEBOUNCE_TYPE = sym_eager_pk
|
||||
|
@ -1,4 +1,6 @@ |
||||
TAP_DANCE_ENABLE = yes
|
||||
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
|
||||
UNICODE_ENABLE = yes
|
||||
UNICODEMAP_ENABLE = no
|
||||
TAP_DANCE_ENABLE = yes
|
||||
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
|
||||
UNICODE_ENABLE = yes
|
||||
UNICODEMAP_ENABLE = no
|
||||
AUTOCORRECTION_ENABLE = yes
|
||||
CAPS_WORD_ENABLE = yes
|
||||
|
@ -1,20 +1,27 @@ |
||||
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
MOUSEKEY_ENABLE = no # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = yes # Console for debug
|
||||
CONSOLE_ENABLE = no # Console for debug
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
UNICODE_ENABLE = yes # Unicode
|
||||
OLED_ENABLE = yes
|
||||
OLED_DRIVER = SSD1306 # Enables the use of OLED displays
|
||||
ENCODER_ENABLE = yes # Enables the use of one or more encoders
|
||||
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
RGBLIGHT_STARTUP_ANIMATION = yes
|
||||
RGB_MATRIX_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = yes
|
||||
KEY_LOCK_ENABLE = no
|
||||
WPM_ENABLE = yes
|
||||
SWAP_HANDS_ENABLE = yes
|
||||
LTO_ENABLE = no
|
||||
CTPC = yes
|
||||
|
||||
ifeq ($(strip $(KEYBOARD)), splitkb/kyria/rev1/proton_c) |
||||
RGB_MATRIX_ENABLE = yes
|
||||
CONSOLE_ENABLE = yes # Console for debug
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
TAP_DANCE_ENABLE = yes
|
||||
SWAP_HANDS_ENABLE = yes
|
||||
LTO_ENABLE = no
|
||||
CTPC = yes
|
||||
AUTOCORRECTION_ENABLE = yes
|
||||
CAPS_WORD_ENABLE = yes
|
||||
else |
||||
LTO_ENABLE = yes
|
||||
BOOTLOADER = qmk-hid
|
||||
BOOTLOADER_SIZE = 512
|
||||
endif |
||||
|
@ -1,6 +1,10 @@ |
||||
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
|
||||
EXTRAKEY_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = no
|
||||
NKRO_ENABLE = yes
|
||||
RGBLIGHT_STARTUP_ANIMATION = yes
|
||||
ENCODER_MAP_ENABLE = yes
|
||||
|
||||
AUTOCORRECTION_ENABLE = no
|
||||
CUSTOM_UNICODE_ENABLE = no
|
||||
|
@ -0,0 +1,215 @@ |
||||
// Copyright 2021 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "drashna.h" |
||||
|
||||
__attribute__((weak)) void keyboard_pre_init_keymap(void) {} |
||||
void keyboard_pre_init_user(void) { |
||||
userspace_config.raw = eeconfig_read_user(); |
||||
keyboard_pre_init_keymap(); |
||||
} |
||||
// Add reconfigurable functions here, for keymap customization
|
||||
// This allows for a global, userspace functions, and continued
|
||||
// customization of the keymap. Use _keymap instead of _user
|
||||
// functions in the keymaps
|
||||
// Call user matrix init, set default RGB colors and then
|
||||
// call the keymap's init function
|
||||
__attribute__((weak)) void matrix_init_keymap(void) {} |
||||
__attribute__((weak)) void matrix_init_secret(void) {} |
||||
void matrix_init_user(void) { |
||||
#if defined(BOOTLOADER_CATERINA) && defined(__AVR__) && defined(__AVR_ATmega32U4__) |
||||
DDRD &= ~(1 << 5); |
||||
PORTD &= ~(1 << 5); |
||||
|
||||
DDRB &= ~(1 << 0); |
||||
PORTB &= ~(1 << 0); |
||||
#endif |
||||
#ifdef CUSTOM_UNICODE_ENABLE |
||||
matrix_init_unicode(); |
||||
#endif |
||||
matrix_init_secret(); |
||||
matrix_init_keymap(); |
||||
} |
||||
|
||||
__attribute__((weak)) void keyboard_post_init_keymap(void) {} |
||||
void keyboard_post_init_user(void) { |
||||
#if defined(RGBLIGHT_ENABLE) |
||||
keyboard_post_init_rgb_light(); |
||||
#endif |
||||
#if defined(RGB_MATRIX_ENABLE) |
||||
keyboard_post_init_rgb_matrix(); |
||||
#endif |
||||
#if defined(SPLIT_KEYBOARD) && defined(SPLIT_TRANSACTION_IDS_USER) |
||||
keyboard_post_init_transport_sync(); |
||||
#endif |
||||
keyboard_post_init_keymap(); |
||||
} |
||||
|
||||
#ifdef RGB_MATRIX_ENABLE |
||||
void rgb_matrix_update_pwm_buffers(void); |
||||
#endif |
||||
|
||||
__attribute__((weak)) void shutdown_keymap(void) {} |
||||
void shutdown_user(void) { |
||||
#ifdef RGBLIGHT_ENABLE |
||||
rgblight_enable_noeeprom(); |
||||
rgblight_mode_noeeprom(1); |
||||
rgblight_setrgb_red(); |
||||
#endif // RGBLIGHT_ENABLE
|
||||
#ifdef RGB_MATRIX_ENABLE |
||||
rgb_matrix_set_color_all(0xFF, 0x00, 0x00); |
||||
rgb_matrix_update_pwm_buffers(); |
||||
#endif // RGB_MATRIX_ENABLE
|
||||
#ifdef OLED_ENABLE |
||||
oled_off(); |
||||
#endif |
||||
|
||||
shutdown_keymap(); |
||||
} |
||||
|
||||
__attribute__((weak)) void suspend_power_down_keymap(void) {} |
||||
|
||||
void suspend_power_down_user(void) { |
||||
#ifdef OLED_ENABLE |
||||
oled_off(); |
||||
#endif |
||||
suspend_power_down_keymap(); |
||||
} |
||||
|
||||
__attribute__((weak)) void suspend_wakeup_init_keymap(void) {} |
||||
void suspend_wakeup_init_user(void) { |
||||
if (layer_state_is(_GAMEPAD)) { |
||||
layer_off(_GAMEPAD); |
||||
} |
||||
if (layer_state_is(_DIABLO)) { |
||||
layer_off(_DIABLO); |
||||
} |
||||
suspend_wakeup_init_keymap(); |
||||
} |
||||
|
||||
// No global matrix scan code, so just run keymap's matrix
|
||||
// scan function
|
||||
__attribute__((weak)) void matrix_scan_keymap(void) {} |
||||
__attribute__((weak)) void matrix_scan_secret(void) {} |
||||
void matrix_scan_user(void) { |
||||
static bool has_ran_yet; |
||||
if (!has_ran_yet) { |
||||
has_ran_yet = true; |
||||
startup_user(); |
||||
} |
||||
|
||||
#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
|
||||
run_diablo_macro_check(); |
||||
#endif // TAP_DANCE_ENABLE
|
||||
|
||||
#if defined(RGBLIGHT_ENABLE) |
||||
matrix_scan_rgb_light(); |
||||
#endif // RGBLIGHT_ENABLE
|
||||
#if defined(RGB_MATRIX_ENABLE) |
||||
matrix_scan_rgb_matrix(); |
||||
#endif |
||||
#if defined(POINTING_DEVICE_ENABLE) |
||||
matrix_scan_pointing(); |
||||
#endif |
||||
|
||||
matrix_scan_secret(); |
||||
|
||||
matrix_scan_keymap(); |
||||
} |
||||
|
||||
#ifdef AUDIO_ENABLE |
||||
float doom_song[][2] = SONG(E1M1_DOOM); |
||||
#endif |
||||
|
||||
// on layer change, no matter where the change was initiated
|
||||
// Then runs keymap's layer change check
|
||||
__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; } |
||||
layer_state_t layer_state_set_user(layer_state_t state) { |
||||
if (!is_keyboard_master()) { |
||||
return state; |
||||
} |
||||
|
||||
state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); |
||||
#if defined(POINTING_DEVICE_ENABLE) |
||||
state = layer_state_set_pointing(state); |
||||
#endif |
||||
#if defined(RGBLIGHT_ENABLE) |
||||
state = layer_state_set_rgb_light(state); |
||||
#endif // RGBLIGHT_ENABLE
|
||||
#if defined(AUDIO_ENABLE) && !defined(__arm__) |
||||
static bool is_gamepad_on = false; |
||||
if (layer_state_cmp(state, _GAMEPAD) != is_gamepad_on) { |
||||
is_gamepad_on = layer_state_cmp(state, _GAMEPAD); |
||||
if (is_gamepad_on) { |
||||
PLAY_LOOP(doom_song); |
||||
} else { |
||||
stop_all_notes(); |
||||
} |
||||
} |
||||
#endif |
||||
state = layer_state_set_keymap(state); |
||||
return state; |
||||
} |
||||
|
||||
// Runs state check and changes underglow color and animation
|
||||
__attribute__((weak)) layer_state_t default_layer_state_set_keymap(layer_state_t state) { return state; } |
||||
layer_state_t default_layer_state_set_user(layer_state_t state) { |
||||
if (!is_keyboard_master()) { |
||||
return state; |
||||
} |
||||
|
||||
state = default_layer_state_set_keymap(state); |
||||
#if 0 |
||||
# if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE) |
||||
state = default_layer_state_set_rgb(state); |
||||
# endif // RGBLIGHT_ENABLE
|
||||
#endif |
||||
return state; |
||||
} |
||||
|
||||
__attribute__((weak)) void led_set_keymap(uint8_t usb_led) {} |
||||
void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); } |
||||
|
||||
__attribute__((weak)) void eeconfig_init_keymap(void) {} |
||||
void eeconfig_init_user(void) { |
||||
userspace_config.raw = 0; |
||||
userspace_config.rgb_layer_change = true; |
||||
eeconfig_update_user(userspace_config.raw); |
||||
eeconfig_init_keymap(); |
||||
} |
||||
|
||||
#ifdef SPLIT_KEYBOARD |
||||
__attribute__((weak)) void matrix_slave_scan_keymap(void) {} |
||||
void matrix_slave_scan_user(void) { |
||||
# if defined(AUDIO_ENABLE) |
||||
# if !defined(NO_MUSIC_MODE) |
||||
music_task(); |
||||
# endif |
||||
# ifdef AUDIO_INIT_DELAY |
||||
if (!is_keyboard_master()) { |
||||
static bool delayed_tasks_run = false; |
||||
static uint16_t delayed_task_timer = 0; |
||||
if (!delayed_tasks_run) { |
||||
if (!delayed_task_timer) { |
||||
delayed_task_timer = timer_read(); |
||||
} else if (timer_elapsed(delayed_task_timer) > 300) { |
||||
audio_startup(); |
||||
delayed_tasks_run = true; |
||||
} |
||||
} |
||||
} |
||||
# endif |
||||
# endif |
||||
# ifdef SEQUENCER_ENABLE |
||||
sequencer_task(); |
||||
# endif |
||||
# ifdef LED_MATRIX_ENABLE |
||||
led_matrix_task(); |
||||
# endif |
||||
# ifdef HAPTIC_ENABLE |
||||
haptic_task(); |
||||
# endif |
||||
|
||||
matrix_slave_scan_keymap(); |
||||
} |
||||
#endif |
@ -0,0 +1,25 @@ |
||||
// Copyright 2021 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once |
||||
|
||||
#include "quantum.h" |
||||
|
||||
void matrix_init_keymap(void); |
||||
void matrix_init_secret(void); |
||||
void shutdown_keymap(void); |
||||
void suspend_power_down_keymap(void); |
||||
void suspend_wakeup_init_keymap(void); |
||||
void matrix_scan_keymap(void); |
||||
void matrix_scan_secret(void); |
||||
layer_state_t layer_state_set_keymap(layer_state_t state); |
||||
layer_state_t default_layer_state_set_keymap(layer_state_t state); |
||||
void led_set_keymap(uint8_t usb_led); |
||||
void eeconfig_init_keymap(void); |
||||
|
||||
#ifdef CUSTOM_UNICODE_ENABLE |
||||
void matrix_init_unicode(void); |
||||
#endif |
||||
#ifdef SPLIT_KEYBOARD |
||||
void matrix_slave_scan_keymap(void); |
||||
#endif |
@ -0,0 +1,71 @@ |
||||
# Custom Userspace Callback Functions |
||||
|
||||
Specifically QMK works by using customized callback functions for everything. This allows for multiple levels of customization. |
||||
|
||||
`matrix_scan` calls `matrix_scan_quantum`, which calls `matrix_scan_kb`, which calls `matrix_scan_user`. |
||||
`process_record` calls a bunch of stuff, but eventually calls `process_record_kb` which calls `process_record_user` |
||||
The same goes for `matrix_init`, `layer_state_set`, `led_set`, and a few other functions. |
||||
|
||||
All (most) `_user` functions are handled here, in the userspace instead. To allow keyboard specific configuration, I've created `_keymap` functions that can be called by the keymap.c files instead. |
||||
|
||||
This allows for keyboard specific configuration while maintaining the ability to customize the board. |
||||
|
||||
My [Ergodox EZ Keymap](https://github.com/qmk/qmk_firmware/blob/master/layouts/community/ergodox/drashna/keymap.c) is a good example of this, as it uses the LEDs as modifier indicators. |
||||
|
||||
You can see a list of these files in [callbacks.c](callbacks.c), or a shortend list here |
||||
|
||||
```c |
||||
__attribute__((weak)) void matrix_init_keymap(void) {} |
||||
void matrix_init_user(void) { |
||||
matrix_init_keymap(); |
||||
} |
||||
|
||||
__attribute__((weak)) void keyboard_post_init_keymap(void) {} |
||||
void keyboard_post_init_user(void) { |
||||
keyboard_post_init_keymap(); |
||||
} |
||||
|
||||
__attribute__((weak)) void matrix_scan_keymap(void) {} |
||||
void matrix_scan_user(void) { |
||||
matrix_scan_keymap(); |
||||
} |
||||
|
||||
__attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } |
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
||||
if (!process_record_keymap(keycode, record)) { return false; } |
||||
return true; |
||||
} |
||||
|
||||
__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; } |
||||
layer_state_t layer_state_set_user(layer_state_t state) { |
||||
state = layer_state_set_keymap(state); |
||||
return state; |
||||
} |
||||
|
||||
__attribute__ ((weak)) void led_set_keymap(uint8_t usb_led) {} |
||||
void led_set_user(uint8_t usb_led) { |
||||
led_set_keymap(usb_led); |
||||
} |
||||
|
||||
__attribute__ ((weak)) void suspend_power_down_keymap(void) {} |
||||
void suspend_power_down_user(void) { |
||||
suspend_power_down_keymap(); |
||||
} |
||||
|
||||
__attribute__ ((weak)) void suspend_wakeup_init_keymap(void) {} |
||||
void suspend_wakeup_init_user(void) { |
||||
suspend_wakeup_init_keymap(); |
||||
} |
||||
|
||||
|
||||
__attribute__ ((weak)) void shutdown_keymap(void) {} |
||||
void shutdown_user (void) { |
||||
shutdown_keymap(); |
||||
} |
||||
|
||||
__attribute__ ((weak)) void eeconfig_init_keymap(void) {} |
||||
void eeconfig_init_user(void) { |
||||
eeconfig_update_user(0); |
||||
eeconfig_init_keymap(); |
||||
} |
||||
``` |
@ -0,0 +1,301 @@ |
||||
# Autocorrection |
||||
|
||||
This is taken from [Pascal Getreuer's implemenation](https://getreuer.info/posts/keyboards/autocorrection/index.html), with a number of modifications. |
||||
|
||||
To enabled Autocorrection, add `AUTOCORRECTION_ENABLE = yes` to your `rules.mk` file. |
||||
|
||||
This is mostly a reproduction of Pascal's docs: |
||||
|
||||
## Overview |
||||
Some words are more prone to typos than others. I have a habit of typo-ing *ouput* and *fitler*. This post describes a rudimentary autocorrection implementation that runs on your keyboard with QMK. |
||||
|
||||
The animation below shows the effect as I type *aparent*. As I press the final t, the autocorrection feature detects the typo and automatically sends keys to correct it: |
||||
|
||||
Example: Autocorrecting *aparent* → apparent. |
||||
|
||||
**Features**: |
||||
* It runs on your keyboard, so it is always active no matter what software. |
||||
* Low resource cost: for an autocorrection dictionary of 70 entries, firmware size cost is 1620 bytes and average CPU cost per key press is about 20 µs. |
||||
* It is case insensitive. It corrects Fitler to Filter and FITLER to FILTER. |
||||
* It works within words. It corrects fitlered, fitlering, and useful for programming, within longer identifiers like DesignButterworthFitle*r. |
||||
|
||||
**Limitations**: Running autocorrection on the keyboard comes with some constraints. It is rudimentary like I said: |
||||
* It is limited to alphabet characters a–z. No accented or Unicode letters; I’m sorry this probably isn’t useful for languages besides English. |
||||
* It does not follow mouse or hotkey driven cursor movement. |
||||
|
||||
## Taking autocorrection for a test drive |
||||
With the above flashed to your keyboard, try for instance typing the misspelled word ouput. The instant you type the final t, the word should be speedily autocorrected to output. As further tests, try becuase and invliad. |
||||
|
||||
Here is the full list of typos corrected using the provided autocorrection_data.h file. : is a special character denoting a word break. See below for how to change the autocorrection dictionary. |
||||
|
||||
``` |
||||
:guage -> gauge |
||||
:the:the: -> the |
||||
:thier -> their |
||||
:ture -> true |
||||
accomodate -> accommodate |
||||
acommodate -> accommodate |
||||
aparent -> apparent |
||||
aparrent -> apparent |
||||
apparant -> apparent |
||||
apparrent -> apparent |
||||
aquire -> acquire |
||||
becuase -> because |
||||
cauhgt -> caught |
||||
cheif -> chief |
||||
choosen -> chosen |
||||
cieling -> ceiling |
||||
collegue -> colleague |
||||
concensus -> consensus |
||||
contians -> contains |
||||
cosnt -> const |
||||
dervied -> derived |
||||
fales -> false |
||||
fasle -> false |
||||
fitler -> filter |
||||
flase -> false |
||||
foward -> forward |
||||
frequecy -> frequency |
||||
gaurantee -> guarantee |
||||
guaratee -> guarantee |
||||
heigth -> height |
||||
heirarchy -> hierarchy |
||||
inclued -> include |
||||
interator -> iterator |
||||
intput -> input |
||||
invliad -> invalid |
||||
lenght -> length |
||||
liasion -> liaison |
||||
libary -> library |
||||
listner -> listener |
||||
looses: -> loses |
||||
looup -> lookup |
||||
manefist -> manifest |
||||
namesapce -> namespace |
||||
namespcae -> namespace |
||||
occassion -> occasion |
||||
occured -> occurred |
||||
ouptut -> output |
||||
ouput -> output |
||||
overide -> override |
||||
postion -> position |
||||
priviledge -> privilege |
||||
psuedo -> pseudo |
||||
recieve -> receive |
||||
refered -> referred |
||||
relevent -> relevant |
||||
repitition -> repetition |
||||
reuslt -> result |
||||
retrun -> return |
||||
retun -> return |
||||
reutrn -> return |
||||
saftey -> safety |
||||
seperate -> separate |
||||
singed -> signed |
||||
stirng -> string |
||||
strign -> string |
||||
swithc -> switch |
||||
swtich -> switch |
||||
thresold -> threshold |
||||
udpate -> update |
||||
widht -> width |
||||
``` |
||||
|
||||
## Firmware size and CPU costs |
||||
I am anxiously aware that a keyboard microcontroller has limited resources. So I was sure to measure how much memory and CPU time autocorrection consumes during development. These measurements are for the example autocorrection dictionary as used above, which has 70 entries: |
||||
* **Firmware size**: Autocorrection increases my firmware size by a total of 1620 bytes. Breaking that down, 1104 bytes are for the autocorrection_data array and 516 bytes for the autocorrection code. |
||||
* **CPU time**: On my Elite-C microcontrollers, the average CPU time for process_autocorrection to process an alpha key press is around 20 µs. Consider this a rough order-of-magnitude cost. Processing cost increases (more trie nodes are visited) when recent input is close to a known typo, with the max being when a long typo is matched. |
||||
|
||||
The costs are not free but reasonable. For reference, the firmware size cost for mouse keys is 2124 bytes and the CPU time to process a layer switch is about 70 µs, so autocorrection is cheaper than those things. Of course, the cost scales with the size of the autocorrection dictionary, so keep that in mind if you add a lot more entries. |
||||
|
||||
## How does it work? |
||||
The function process_autocorrection maintains a small buffer of recent key presses. On each key press, it checks whether the buffer ends in a recognized typo, and if so, automatically sends keystrokes to correct it. |
||||
|
||||
The tricky part is how to efficiently check the buffer for typos. We don’t want to spend too much memory or time on storing or searching the typos. A good solution is to represent the typos with a trie data structure. A trie is a tree data structure where each node is a letter, and words are formed by following a path to one of the leaves. |
||||
|
||||
|
||||
An example trie. |
||||
Since we search whether the buffer ends in a typo, we store the trie writing in reverse. The trie is queried starting from the last letter, then second to last letter, and so on, until either a letter doesn’t match or we reach a leaf, meaning a typo was found. |
||||
|
||||
## 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: |
||||
|
||||
1. First, create an autocorrection dictionary autocorrection_dict.txt, like |
||||
|
||||
``` |
||||
:thier -> their |
||||
fitler -> filter |
||||
lenght -> length |
||||
ouput -> output |
||||
widht -> width |
||||
``` |
||||
For a practical 70-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 letters a–z, or the special character : representing a word break. The correction may have any characters. |
||||
|
||||
2. Use the make_autocorrection_data.py Python script to process the dictionary |
||||
|
||||
``` |
||||
$ python3 make_autocorrection_data.py |
||||
Processed 70 autocorrection entries to table with 1104 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. |
||||
|
||||
3. Finally, recompile and flash your keymap. |
||||
|
||||
The generated C header looks like this: |
||||
|
||||
autocorrection_data.h |
||||
```c |
||||
// Generated code. |
||||
|
||||
#define AUTOCORRECTION_MIN_LENGTH 5 // "cheif" |
||||
#define AUTOCORRECTION_MAX_LENGTH 10 // "accomodate" |
||||
|
||||
static const uint8_t autocorrection_data[1104] PROGMEM = {108, 43, 0, 6, |
||||
71, 0, 7, 81, 0, 8, 199, 0, 9, 240, 1, 10, 250, 1, 11, 26, 2, 17, 53, 2, |
||||
18, 190, 2, 19, 202, 2, 21, 212, 2, 22, 20, 3, 23, 67, 3, 28, 16, 4, 0, |
||||
72, 50, 0, 22, 60, 0, 0, 11, 23, 44, 8, 11, 23, 44, 0, 132, 0, 8, 22, 18, |
||||
18, 15, 0, 132, 115, 101, 115, 0, 11, 23, 12, 26, 22, 0, 129, 99, 104, 0, |
||||
68, 94, 0, 8, 106, 0, 15, 174, 0, 21, 187, 0, 0, 12, 15, 25, 17, 12, 0, |
||||
131, 97, 108, 105, 100, 0, 74, 119, 0, 12, 129, 0, 21, 140, 0, 24, 165, |
||||
0, 0, 17, 12, 22, 0, 131, 103, 110, 101, 100, 0, 25, 21, 8, 7, 0, 131, |
||||
105, 118, 101, 100, 0, 72, 147, 0, 24, 156, 0, 0, 9, 8, 21, 0, 129, 114, |
||||
101, 100, 0, 6, 6, 18, 0, 129, 114, 101, 100, 0, 15, 6, 17, 12, 0, 129, |
||||
100, 101, 0, 18, 22, 8, 21, 11, 23, 0, 130, 104, 111, 108, 100, 0, 4, 26, |
||||
18, 9, 0, 131, 114, 119, 97, 114, 100, 0, 68, 233, 0, 6, 246, 0, 7, 4, 1, |
||||
8, 16, 1, 10, 52, 1, 15, 81, 1, 21, 90, 1, 22, 117, 1, 23, 144, 1, 24, |
||||
215, 1, 25, 228, 1, 0, 6, 19, 22, 8, 16, 4, 17, 0, 130, 97, 99, 101, 0, |
||||
19, 4, 22, 8, 16, 4, 17, 0, 131, 112, 97, 99, 101, 0, 12, 21, 8, 25, 18, |
||||
0, 130, 114, 105, 100, 101, 0, 23, 0, 68, 25, 1, 17, 36, 1, 0, 21, 4, 24, |
||||
10, 0, 130, 110, 116, 101, 101, 0, 4, 21, 24, 4, 10, 0, 135, 117, 97, |
||||
114, 97, 110, 116, 101, 101, 0, 68, 59, 1, 7, 69, 1, 0, 24, 10, 44, 0, |
||||
131, 97, 117, 103, 101, 0, 8, 15, 12, 25, 12, 21, 19, 0, 130, 103, 101, |
||||
0, 22, 4, 9, 0, 130, 108, 115, 101, 0, 76, 97, 1, 24, 109, 1, 0, 24, 20, |
||||
4, 0, 132, 99, 113, 117, 105, 114, 101, 0, 23, 44, 0, 130, 114, 117, 101, |
||||
0, 4, 0, 79, 126, 1, 24, 134, 1, 0, 9, 0, 131, 97, 108, 115, 101, 0, 6, |
||||
8, 5, 0, 131, 97, 117, 115, 101, 0, 4, 0, 71, 156, 1, 19, 193, 1, 21, |
||||
203, 1, 0, 18, 16, 0, 80, 166, 1, 18, 181, 1, 0, 18, 6, 4, 0, 135, 99, |
||||
111, 109, 109, 111, 100, 97, 116, 101, 0, 6, 6, 4, 0, 132, 109, 111, 100, |
||||
97, 116, 101, 0, 7, 24, 0, 132, 112, 100, 97, 116, 101, 0, 8, 19, 8, 22, |
||||
0, 132, 97, 114, 97, 116, 101, 0, 10, 8, 15, 15, 18, 6, 0, 130, 97, 103, |
||||
117, 101, 0, 8, 12, 6, 8, 21, 0, 131, 101, 105, 118, 101, 0, 12, 8, 11, |
||||
6, 0, 130, 105, 101, 102, 0, 17, 0, 76, 3, 2, 21, 16, 2, 0, 15, 8, 12, 6, |
||||
0, 133, 101, 105, 108, 105, 110, 103, 0, 12, 23, 22, 0, 131, 114, 105, |
||||
110, 103, 0, 70, 33, 2, 23, 44, 2, 0, 12, 23, 26, 22, 0, 131, 105, 116, |
||||
99, 104, 0, 10, 12, 8, 11, 0, 129, 104, 116, 0, 72, 69, 2, 10, 80, 2, 18, |
||||
89, 2, 21, 156, 2, 24, 167, 2, 0, 22, 18, 18, 11, 6, 0, 131, 115, 101, |
||||
110, 0, 12, 21, 23, 22, 0, 129, 110, 103, 0, 12, 0, 86, 98, 2, 23, 124, |
||||
2, 0, 68, 105, 2, 22, 114, 2, 0, 12, 15, 0, 131, 105, 115, 111, 110, 0, |
||||
4, 6, 6, 18, 0, 131, 105, 111, 110, 0, 76, 131, 2, 22, 146, 2, 0, 23, 12, |
||||
19, 8, 21, 0, 134, 101, 116, 105, 116, 105, 111, 110, 0, 18, 19, 0, 131, |
||||
105, 116, 105, 111, 110, 0, 23, 24, 8, 21, 0, 131, 116, 117, 114, 110, 0, |
||||
85, 174, 2, 23, 183, 2, 0, 23, 8, 21, 0, 130, 117, 114, 110, 0, 8, 21, 0, |
||||
128, 114, 110, 0, 7, 8, 24, 22, 19, 0, 131, 101, 117, 100, 111, 0, 24, |
||||
18, 18, 15, 0, 129, 107, 117, 112, 0, 72, 219, 2, 18, 3, 3, 0, 76, 229, |
||||
2, 15, 238, 2, 17, 248, 2, 0, 11, 23, 44, 0, 130, 101, 105, 114, 0, 23, |
||||
12, 9, 0, 131, 108, 116, 101, 114, 0, 23, 22, 12, 15, 0, 130, 101, 110, |
||||
101, 114, 0, 23, 4, 21, 8, 23, 17, 12, 0, 135, 116, 101, 114, 97, 116, |
||||
111, 114, 0, 72, 30, 3, 17, 38, 3, 24, 51, 3, 0, 15, 4, 9, 0, 129, 115, |
||||
101, 0, 4, 12, 23, 17, 18, 6, 0, 131, 97, 105, 110, 115, 0, 22, 17, 8, 6, |
||||
17, 18, 6, 0, 133, 115, 101, 110, 115, 117, 115, 0, 74, 86, 3, 11, 96, 3, |
||||
15, 118, 3, 17, 129, 3, 22, 218, 3, 24, 232, 3, 0, 11, 24, 4, 6, 0, 130, |
||||
103, 104, 116, 0, 71, 103, 3, 10, 110, 3, 0, 12, 26, 0, 129, 116, 104, 0, |
||||
17, 8, 15, 0, 129, 116, 104, 0, 22, 24, 8, 21, 0, 131, 115, 117, 108, |
||||
116, 0, 68, 139, 3, 8, 150, 3, 22, 210, 3, 0, 21, 4, 19, 19, 4, 0, 130, |
||||
101, 110, 116, 0, 85, 157, 3, 25, 200, 3, 0, 68, 164, 3, 21, 175, 3, 0, |
||||
19, 4, 0, 132, 112, 97, 114, 101, 110, 116, 0, 4, 19, 0, 68, 185, 3, 19, |
||||
193, 3, 0, 133, 112, 97, 114, 101, 110, 116, 0, 4, 0, 131, 101, 110, 116, |
||||
0, 8, 15, 8, 21, 0, 130, 97, 110, 116, 0, 18, 6, 0, 130, 110, 115, 116, |
||||
0, 12, 9, 8, 17, 4, 16, 0, 132, 105, 102, 101, 115, 116, 0, 83, 239, 3, |
||||
23, 6, 4, 0, 87, 246, 3, 24, 254, 3, 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, 70, 29, 4, 8, 41, 4, 11, 51, 4, 21, 69, 4, 0, 8, 24, 20, 8, 21, |
||||
9, 0, 129, 110, 99, 121, 0, 23, 9, 4, 22, 0, 130, 101, 116, 121, 0, 6, |
||||
21, 4, 21, 12, 8, 11, 0, 135, 105, 101, 114, 97, 114, 99, 104, 121, 0, 4, |
||||
5, 12, 15, 0, 130, 114, 97, 114, 121, 0}; |
||||
``` |
||||
|
||||
## Troubleshooting |
||||
### Avoiding false triggers |
||||
By default, typos are searched within words, to find typos within longer identifiers like maxFitlerOuput. While this is useful, a consequence is that autocorrection will falsely trigger when a typo happens to be a substring of a correctly-spelled word. For instance, if we had thier -> their as an entry, it would falsely trigger on (correct, though relatively uncommon) words like “wealthier” and “filthier.” |
||||
|
||||
The solution is to set a word break : before and/or after the typo to constrain matching. : matches space, period, comma, underscore, digits, and most other non-alpha characters. |
||||
|
||||
| Text | thier | :thier | thier: | :thier: | |
||||
|------|-------|--------|--------|---------| |
||||
|see thier typo|matches|matches|matches|matches| |
||||
it’s thiers |matches|matches|no|no| |
||||
wealthier words|matches|no|matches|no| |
||||
|
||||
:thier: is most restrictive, matching only when thier is a whole word. |
||||
|
||||
The make_autocorrection_data.py script makes an effort to check for entries that would false trigger as substrings of correct words. It searches each typo against a dictionary of 25K English words from the english_words Python package, provided it’s installed. |
||||
|
||||
### Overriding autocorrection |
||||
Occasionally you might actually want to type a typo (for instance, while editing autocorrection_dict.txt) without being autocorrected. Here is a way to do that: |
||||
|
||||
1. Begin typing the typo. |
||||
2. Before typing the last letter, press and release the Ctrl or Alt key. |
||||
3. Type the remaining letters. |
||||
|
||||
This works because the autocorrection implementation doesn’t understand hotkeys, so it resets itself whenever a modifier other than shift is held. |
||||
|
||||
Alternatively, the `AUTO_CTN` keycode will toggle autocorrection on and off. |
||||
|
||||
## Closing thoughts |
||||
Based on my own use, an autocorrection dictionary of a few dozen entries is enough to help in day-to-day writing. On the other hand, it is of course far from comprehensively checking that every word is spelled correctly. Keyboard microcontrollers might not have the resources check against a full English dictionary any time soon, but a lot of editors and other software have good integrated spell check features. |
||||
|
||||
I suggest to enable and use spell check in combination with autocorrection: |
||||
* Sublime: Open the View menu and enable “Spell Check.” |
||||
* Eclipse: Open the Window menu, click Preferences, and search for “Spelling.” |
||||
* Vim: Type :set spell, and misspellings will be highlighted. Use ]s to jump to the next misspelled word and z= to get suggested corrections for the word under the cursor. See the :help spell documentation. Vim also has an abbreviations feature that can autocorrect misspellings (see :help abbreviations). |
||||
* Emacs: Use M-x flyspell-mode to enable Flyspell mode in the current buffer. Or for programming, use M-x flyspell-prog-mode to check comments and strings only. See the spelling documentation. There is also an abbreviations feature that can do autocorrection. |
||||
|
||||
Some useful resources: |
||||
|
||||
* Wikipedia has a [large list of common typos](https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines). |
||||
* EmacsWiki has another [list of typos](https://www.emacswiki.org/emacs/autocorrection_abbrev_defs). |
||||
* You can find data on English word frequencies at https://www.wordfrequency.info/samples.asp. |
||||
|
||||
# Appendix: Trie binary data format |
||||
This section details how the trie is serialized to byte data in autocorrection_data. You don’t need to care about this to use this autocorrection implementation. But I document it for the record in case anyone is interested in modifying the implementation, or just curious how it works. |
||||
|
||||
What I did here is fairly arbitrary, but it is simple to decode and gets the job done. |
||||
|
||||
## Encoding |
||||
All autocorrection data is stored in a single flat array autocorrection_data. Each trie node is associated with a byte offset into this array, where data for that node is encoded, beginning with root at offset 0. There are three kinds of nodes. The highest two bits of the first byte of the node indicate what kind: |
||||
|
||||
* 00 ⇒ chain node: a trie node with a single child. |
||||
* 01 ⇒ branching node: a trie node with multiple children. |
||||
* 10 ⇒ leaf node: a leaf, corresponding to a typo and storing its correction. |
||||
|
||||
An example trie. |
||||
Branching node. Each branch is encoded with one byte for the keycode (KC_A–KC_Z) followed by a link to the child node. Links between nodes are 16-bit byte offsets relative to the beginning of the array, serialized in little endian order. |
||||
|
||||
All branches are serialized this way, one after another, and terminated with a zero byte. As described above, the node is identified as a branch by setting the two high bits of the first byte to 01, done by bitwise ORing the first keycode with 64. keycode. The root node for the above figure would be serialized like: |
||||
|
||||
+-------+-------+-------+-------+-------+-------+-------+ |
||||
| R|64 | node 2 | T | node 3 | 0 | |
||||
+-------+-------+-------+-------+-------+-------+-------+ |
||||
|
||||
Chain node. Tries tend to have long chains of single-child nodes, as seen in the example above with f-i-t-l in fitler. So to save space, we use a different format to encode chains than branching nodes. A chain is encoded as a string of keycodes, beginning with the node closest to the root, and terminated with a zero byte. The child of the last node in the chain is encoded immediately after. That child could be either a branching node or a leaf. |
||||
|
||||
In the figure above, the f-i-t-l chain is encoded as |
||||
|
||||
+-------+-------+-------+-------+-------+ |
||||
| L | T | I | F | 0 | |
||||
+-------+-------+-------+-------+-------+ |
||||
If we were to encode this chain using the same format used for branching nodes, we would encode a 16-bit node link with every node, costing 8 more bytes in this example. Across the whole trie, this adds up. Conveniently, we can point to intermediate points in the chain and interpret the bytes in the same way as before. E.g. starting at the i instead of the l, and the subchain has the same format. |
||||
|
||||
Leaf node. A leaf node corresponds to a particular typo and stores data to correct the typo. The leaf begins with a byte for the number of backspaces to type, and is followed by a null-terminated ASCII string of the replacement text. The idea is, after tapping backspace the indicated number of times, we can simply pass this string to QMK’s send_string_P function. For fitler, we need to tap backspace 3 times (not 4, because we catch the typo as the final ‘r’ is pressed) and replace it with lter. To identify the node as a leaf, the two high bits are set to 10 by ORing the backspace count with 128: |
||||
|
||||
+-------+-------+-------+-------+-------+-------+ |
||||
| 3|128 | 'l' | 't' | 'e' | 'r' | 0 | |
||||
+-------+-------+-------+-------+-------+-------+ |
||||
## Decoding |
||||
This format is by design decodable with fairly simple logic. A 16-bit variable state represents our current position in the trie, initialized with 0 to start at the root node. Then, for each keycode, test the highest two bits in the byte at state to identify the kind of node. |
||||
|
||||
* 00 ⇒ chain node: If the node’s byte matches the keycode, increment state by one to go to the next byte. If the next byte is zero, increment again to go to the following node. |
||||
* 01 ⇒ branching node: Search the branches for one that matches the keycode, and follow its node link. |
||||
* 10 ⇒ leaf node: a typo has been found! We read its first byte for the number of backspaces to type, then pass its following bytes to send_string_P to type the correction. |
@ -0,0 +1,36 @@ |
||||
# Cap Words |
||||
|
||||
This is taken from [Pascal Getreuer's implemenation](https://getreuer.info/posts/keyboards/caps-word/index.html), with a number of modifications. |
||||
|
||||
To enable Caps Word, add `CAPS_WORD_ENABLE = yes` to your `rules.mk`. |
||||
|
||||
This is mostly a reproduction of Pascal's docs: |
||||
|
||||
## Overview |
||||
|
||||
All-caps identifiers like “MOD_MASK_ALT” are awkward to type. |
||||
|
||||
Caps Lock would be the standard solution to this problem, but it is awkward: it needs a dedicated key to toggle it (an imposition on smaller keyboards), and we need to remember to toggle it off after typing the word. Or with normal shifting, we either perform finger gymnastics or need to stop typing in the middle of the word to release shift with one hand to switch to holding shift with the other hand. In my experience, this is a nuisance especially if your shift keys are mod-taps, as in home row mods. |
||||
|
||||
Caps Word, implemented here, is a modern alternative to Caps Lock: |
||||
|
||||
* Caps Word is activated by pressing the left and right shift keys at the same time. This way you don’t need a dedicated key for using Caps Word. |
||||
* Caps Word automatically disables itself at the end of the word. |
||||
|
||||
**Compatibility**: I’ve tested that this implementation works with one-shot mods and Space Cadet Shift, and it predictably handles key repeating. |
||||
|
||||
Unlike some other QMK Caps Word implementations, this library does not use the Caps Lock (KC_CAPS) keycode. It works even if the OS remaps Caps Lock to Ctrl or something else, as Emacs and Vim users often do. |
||||
|
||||
## Using Caps Word |
||||
With the above flashed to your keyboard: |
||||
|
||||
1. **Activating**: Press and release both left and right shift keys at the same time. If your shift keys are mod-taps, activate Caps Word by holding both shift mod-tap keys until the tapping term, then release them. |
||||
2. Then begin typing to get capitalized letters. |
||||
3. **Disabling**: Caps Word disables itself when the next word breaking key is typed. |
||||
|
||||
If you want to explicitly stop Caps Word, press and release Ctrl or another non-shift modifier or layer key. This also disables Caps Word. |
||||
|
||||
## Explanation |
||||
The code checks the mod bits on each key event, enabling Caps Word when both left and right shifts are active. |
||||
|
||||
While enabled, Caps Word automatically presses and releases left shift (KC_LSFT) as needed so that letters are shifted and other keys are not. The word continues while typing a–z, 0–9, -, _, and backspace. Any other key is considered “word breaking” and disables Caps Word. You can edit the switch statement at the end of the process_caps_word() function to adjust which keys count as word breaking. |
@ -0,0 +1,18 @@ |
||||
|
||||
# Custom Keycodes |
||||
|
||||
Keycodes are defined in the `process_record.h` file and need to be included in the keymap.c files, so that they can be used there. |
||||
|
||||
A bunch of macros are present and are only included on boards that are not the Ergodox EZ or Orthodox, as they are not needed for those boards. |
||||
|
||||
* `KC_MAKE` - outputs `qmk compile -kb (keyboard) -km (keymap)` and enter, to start compiling the currenct keyboard. This uses generated variables to always use the current keyboard and keymap. Will work with any keyboard and any keymap. |
||||
* If you are holding shift, it will use `qmk flash` instead of `qmk compile`. |
||||
* If `MAKE_BOOTLOADER` is defined, it will always use `qmk flash` instead of `qmk compile`. |
||||
* `DEFAULT_LAYER_1` ... `DEFAULT_LAYER_4` - This sets layer 0-3 as the default layer, and writes that to eeprom, and plays a chime. |
||||
* `VRSN`, outputs the keyboard, keymap, commit and date info. Eg: |
||||
* `handwired/tractyl_manuform/5x6_right/f411/drashna @ 0.15.9-162-g087d08, Built on: 2021-12-19-21:10:26` |
||||
* `KC_DIABLO_CLEAR` - clears the diablo tapdance status. |
||||
* `KC_CCCV` - Copy on hold, paste on tap. |
||||
* `KEYLOCK` - This unloads the host driver, and prevents any data from being sent to the host. Hitting it again loads the driver, back. |
||||
* `REBOOT` - Uses watchdog timer on AVR, and `NVIC_SystemReset()` on ChibiOS to reset the board, without jumping to the bootloader. |
||||
* `EEP_RST` - Overrides the default behavior, disables EEPROM (which will trigger a reset on init), and reboots the keyboard as per `REBOOT` keycode. |
@ -0,0 +1,9 @@ |
||||
# Keycode handling and interception |
||||
|
||||
* [Autocorrection](autocorrection/readme.md) |
||||
* [Cap Words](capwords.md) |
||||
* [Diablo Tap Dancing](tap_dance.md) |
||||
* [Keymap Wrappers](wrappers.md) |
||||
* [Secret Macros](secrets.md) |
||||
* [Custom Keycodes](keycodes.md) |
||||
* [Unicode Input](unicode.md) |
@ -1,6 +1,8 @@ |
||||
# Diablo Tap Dances |
||||
|
||||
My [Tap Dance](https://github.com/qmk/qmk_firmware/blob/master/users/drashna/tap_dances.c) file includes the tap dance declarations, and everything needed for them. |
||||
My [Tap Dance](tap_dances.c) file includes the tap dance declarations, and everything needed for them. |
||||
|
||||
To disable, add `CUSTOM_TAP_DANCE = no` to your `rules.mk`. |
||||
|
||||
This is used for making Diablo 3 much easier to plan, especially at high rift levels. |
||||
|
@ -0,0 +1,64 @@ |
||||
// Copyright 2021 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "drashna.h" |
||||
|
||||
__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { |
||||
switch (keycode) { |
||||
case BK_LWER: |
||||
return TAPPING_TERM + 25; |
||||
default: |
||||
return TAPPING_TERM; |
||||
} |
||||
} |
||||
|
||||
__attribute__((weak)) bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) { |
||||
// Immediately select the hold action when another key is tapped:
|
||||
// return true;
|
||||
// Do not select the hold action when another key is tapped.
|
||||
// return false;
|
||||
switch (keycode) { |
||||
default: |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
__attribute__((weak)) bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) { |
||||
// Immediately select the hold action when another key is pressed.
|
||||
// return true;
|
||||
// Do not select the hold action when another key is pressed.
|
||||
// return false;
|
||||
switch (keycode) { |
||||
case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: |
||||
return true; |
||||
default: |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
__attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) { |
||||
// Do not force the mod-tap key press to be handled as a modifier
|
||||
// if any other key was pressed while the mod-tap key is held down.
|
||||
// return true;
|
||||
// Force the mod-tap key press to be handled as a modifier if any
|
||||
// other key was pressed while the mod-tap key is held down.
|
||||
// return false;
|
||||
switch (keycode) { |
||||
default: |
||||
return true; |
||||
} |
||||
} |
||||
|
||||
__attribute__((weak)) bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { |
||||
switch (keycode) { |
||||
default: |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
__attribute__((weak)) bool get_retro_tapping(uint16_t keycode, keyrecord_t *record) { |
||||
switch (keycode) { |
||||
default: |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,42 @@ |
||||
# OLED Display |
||||
|
||||
To disable the pre genrated oled display, add `CUSTOM_OLED_DRIVER = no` to your `rules.mk`. |
||||
|
||||
<!-- to do: add all the stuff --> |
||||
## OLED Font |
||||
|
||||
My font file has multiple fonts and multiple logs integrated into the one file. And it uses the full 255 possible characters. |
||||
|
||||
In addition to the default font and logos: |
||||
|
||||
```c |
||||
# define OLED_FONT_5X5 |
||||
# define OLED_FONT_AZTECH |
||||
# define OLED_FONT_BMPLAIN |
||||
# define OLED_FONT_CRACKERS |
||||
# define OLED_FONT_EIN |
||||
# define OLED_FONT_HISKYF21 |
||||
# define OLED_FONT_SQUASH |
||||
# define OLED_FONT_SUPER_DIGG |
||||
# define OLED_FONT_ZXPIX |
||||
``` |
||||
|
||||
```c |
||||
# define OLED_LOGO_CORNE |
||||
# define OLED_LOGO_GMK_BAD |
||||
# define OLED_LOGO_GOTHAM |
||||
# define OLED_LOGO_HUE_MANITEE |
||||
# define OLED_LOGO_LOOSE |
||||
# define OLED_LOGO_SETS3N |
||||
# define OLED_LOGO_SKEEB |
||||
``` |
||||
|
||||
Additionally, the font file allows for external oled font files, instead. This allows for additional files that cannot be hosted in the QMK Repo. |
||||
|
||||
## Display |
||||
|
||||
A picture is worth a thousand words. So here are two: |
||||
|
||||
 |
||||
|
||||
 |
@ -0,0 +1,19 @@ |
||||
# User Pointing Device customization |
||||
|
||||
To disable the customized pointing device code and implement it at the keymap, add `CUSTOM_POINTING_DEVICE = no` to your `rules.mk`. |
||||
|
||||
## Automatic Mouse Layer |
||||
|
||||
Movement on the optical sensor triggers a layer that has all of the mouse keys on that layer. After a set time, the layer will automatically turn itself off after 650ms. |
||||
|
||||
Also, using mousekeys will extend the amount of time that the layer will stay active. |
||||
|
||||
Additionally, layer keys for the mouse layer will lock the layer on. |
||||
|
||||
## Gaming |
||||
|
||||
When the gamepad or diablo layers are enabled, the mouse layer is locked on, as well. |
||||
|
||||
## Keycodes |
||||
|
||||
The only custom keycode for Pointing devices here is `KC_ACCEL`. This allow the mouse report to have an acceleration curve (exponential). |
@ -1,97 +0,0 @@ |
||||
# Custom Userspace Function handlers |
||||
|
||||
Specifically QMK works by using customized handlers for everything. This allows for multiple levels of customization. |
||||
|
||||
`matrix_scan` calls `matrix_scan_quantum`, which calls `matrix_scan_kb`, which calls `matrix_scan_user`. |
||||
`process_record` calls a bunch of stuff, but eventually calls `process_record_kb` which calls `process_record_user` |
||||
The same goes for `matrix_init`, `layer_state_set`, `led_set`, and a few other functions. |
||||
|
||||
All (most) `_user` functions are handled here, in the userspace instead. To allow keyboard specific configuration, I've created `_keymap` functions that can be called by the keymap.c files instead. |
||||
|
||||
This allows for keyboard specific configuration while maintaining the ability to customize the board. |
||||
|
||||
My [Ergodox EZ Keymap](https://github.com/qmk/qmk_firmware/blob/master/layouts/community/ergodox/drashna/keymap.c) is a good example of this, as it uses the LEDs as modifier indicators. |
||||
|
||||
But for a list: |
||||
|
||||
```c |
||||
__attribute__ ((weak)) |
||||
void matrix_init_keymap(void) {} |
||||
|
||||
void matrix_init_user(void) { |
||||
matrix_init_keymap(); |
||||
} |
||||
|
||||
__attribute__((weak)) |
||||
void keyboard_post_init_keymap(void){ } |
||||
|
||||
void keyboard_post_init_user(void){ |
||||
keyboard_post_init_keymap(); |
||||
} |
||||
|
||||
__attribute__ ((weak)) |
||||
void matrix_scan_keymap(void) {} |
||||
|
||||
void matrix_scan_user(void) { |
||||
matrix_scan_keymap(); |
||||
} |
||||
|
||||
|
||||
__attribute__ ((weak)) |
||||
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { |
||||
return true; |
||||
} |
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
||||
return process_record_keymap(keycode, record); |
||||
} |
||||
|
||||
|
||||
__attribute__ ((weak)) |
||||
layer_state_t layer_state_set_keymap (layer_state_t state) { |
||||
return state; |
||||
} |
||||
|
||||
layer_state_t layer_state_set_user (layer_state_t state) { |
||||
return layer_state_set_keymap (state); |
||||
} |
||||
|
||||
|
||||
__attribute__ ((weak)) |
||||
void led_set_keymap(uint8_t usb_led) {} |
||||
|
||||
void led_set_user(uint8_t usb_led) { |
||||
led_set_keymap(usb_led); |
||||
} |
||||
|
||||
|
||||
__attribute__ ((weak)) |
||||
void suspend_power_down_keymap(void) {} |
||||
|
||||
void suspend_power_down_user(void) { |
||||
suspend_power_down_keymap(); |
||||
} |
||||
|
||||
|
||||
__attribute__ ((weak)) |
||||
void suspend_wakeup_init_keymap(void) {} |
||||
|
||||
void suspend_wakeup_init_user(void) { |
||||
suspend_wakeup_init_keymap(); |
||||
} |
||||
|
||||
|
||||
__attribute__ ((weak)) |
||||
void shutdown_keymap(void) {} |
||||
|
||||
void shutdown_user (void) { |
||||
shutdown_keymap(); |
||||
} |
||||
|
||||
__attribute__ ((weak)) |
||||
void eeconfig_init_keymap(void) {} |
||||
|
||||
void eeconfig_init_user(void) { |
||||
eeconfig_init_keymap(); |
||||
} |
||||
``` |
@ -1,10 +0,0 @@ |
||||
|
||||
# Custom Keycodes |
||||
|
||||
Keycodes are defined in the drashna.h file and need to be included in the keymap.c files, so that they can be used there. |
||||
|
||||
A bunch of macros are present and are only included on boards that are not the Ergodox EZ or Orthodox, as they are not needed for those boards. |
||||
|
||||
Included is a custom macro for compiling my keyboards. This includes the bootloader target (`:teensy`, `:avrdude`, or `:dfu`), and keeps RGBLIGHT, AUDIO enabled, if it previously was (regardless of the rules file). |
||||
|
||||
This also includes a modified RESET keycode as well, that sets the underglow to red. |
@ -0,0 +1,29 @@ |
||||
# Custom Split Transport |
||||
|
||||
To disable the customized split transport, add `CUSTOM_SPLIT_TRANSPORT_SYNC = no` to your `rules.mk`. |
||||
|
||||
This syncs a number of additional settings, such as the keymap_config (magic settings), user eeprom configs, and misc firmware settings. |
||||
|
||||
Additionally, this supports a watchdog timer reset for the secondary split side. |
||||
|
||||
## User State Config |
||||
|
||||
The User states that it sync are: |
||||
|
||||
* Audio Enable status |
||||
* Audio Clicky states |
||||
* Unicode mode |
||||
* Pointing Device tap toggle status |
||||
* Swap Hands status |
||||
* Host Driver status |
||||
|
||||
## Userspace Config |
||||
|
||||
The userspace config states that are synced are: |
||||
|
||||
* RGB layer indication |
||||
* "is overwatch" status |
||||
* nuke switch |
||||
* Swapped numbers |
||||
* RGB Matrix idle animation |
||||
* Autocorrect enable status |
Loading…
Reference in new issue