diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2022-09-25 16:02:54 +0200 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2022-09-25 16:02:54 +0200 |
commit | 6afdd9d74da250e47ac64d6690bd19d037045e99 (patch) | |
tree | 661f6cfb244c02bcd1fbfe8fb9b2bd9242a91394 /users | |
parent | 93a55e61b59d20f7cd842cce02e5b18a63a23612 (diff) | |
parent | 1bdf4cdc22ae57d111efb2f7d71e405e5c7b3f11 (diff) | |
download | qmk_firmware-6afdd9d74da250e47ac64d6690bd19d037045e99.tar.gz qmk_firmware-6afdd9d74da250e47ac64d6690bd19d037045e99.zip |
Merge branch 'master' into taamas
Diffstat (limited to 'users')
185 files changed, 11692 insertions, 4519 deletions
diff --git a/users/333fred/333fred.c b/users/333fred/333fred.c index 99f4e01685..ea7b904403 100644 --- a/users/333fred/333fred.c +++ b/users/333fred/333fred.c @@ -115,7 +115,7 @@ void tap_dance_process_keycode(uint16_t keycode) { } __attribute__ ((weak)) -void layer_state_set_rgb(uint32_t state) {} +void layer_state_set_rgb(layer_state_t state) {} layer_state_t layer_state_set_user(layer_state_t state) { layer_state_set_rgb(state); diff --git a/users/333fred/rgb.c b/users/333fred/rgb.c index d287143302..ae21702030 100644 --- a/users/333fred/rgb.c +++ b/users/333fred/rgb.c @@ -23,8 +23,8 @@ #include "quantum.h" #include "333fred.h" -void layer_state_set_rgb(uint32_t state) { - switch (biton32(state)) { +void layer_state_set_rgb(layer_state_t state) { + switch (get_highest_layer(state)) { case BASE: // purple rgblight_sethsv_noeeprom(210, 255, 20); diff --git a/users/bbaserdem/.gitignore b/users/bbaserdem/.gitignore new file mode 100644 index 0000000000..57bd0e43b4 --- /dev/null +++ b/users/bbaserdem/.gitignore @@ -0,0 +1,2 @@ +/secrets.h +/secrets.c diff --git a/users/bbaserdem/README.md b/users/bbaserdem/README.md deleted file mode 100644 index eb8f33d422..0000000000 --- a/users/bbaserdem/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# Overview - -I have mostly ortholinear keyboards, which share a lot of functions. -For this purpose, I collected them here. - -I have the following keymaps: - -* Gherkin (Does not use the user space) -* XD75RE (Uses different keymap) -* Let's Split -* Let's Split It Up -* Planck - -# Layout - -I use DVORAK with an unorthodox Turkish layout. -If you wanna grab my code, and you used a layout with a persistent base -layer change, change it to layer 0 before proceeding. - -# Layers - -* **Dvorak**: Base layer,with dvorak layout. -* **Alternative**: Has alternate characters. -* **Game**: Toggled from *Function*, comfortable for gaming use. -* **Numeric**: Has numericals and symbols. Can be locked. -* **Function**: Layer has media and function keys. -* **Mouse**: Manipulates mouse. Can be locked. -* **Music** Allows playing sounds. - -# Functionality - -* **RGB Backlight**: With layer indication, and ability to change base layer lighting mode. -* **Secrets**: By placing a secrets.h, and not tracking it, passwords can be stored. -* **Mouse**: Mouse emulation, complete with diagonal keys. -* **Turkish**: An AltGr-like overlay that allows some non-common letters, in unicode. - -I suggest checking out how I enabled Turkish keys, -how I planned out RGB lighting, -and my mouse implementation; -they might offer some insight into fringe user cases. - -# Issues - -All features are too big for the 32kB bootloader. -Offenders are audio and rgb lights; it comes down to one or the other. - -~The Proton board, and rev 6 might fix that.~ - -# Credits - -I have previously written my keymap by myself before, but I rewrote it here, diff --git a/users/bbaserdem/bb-audio.c b/users/bbaserdem/bb-audio.c new file mode 100644 index 0000000000..eef0cdf2f6 --- /dev/null +++ b/users/bbaserdem/bb-audio.c @@ -0,0 +1,82 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bb-audio.h" +/* AUDIO + * This contains some audio related stuff. + * There is no need to wrap this up with preprocessor commands; + * This is only called if audio is enabled + */ + +float tone_game_intro[][2] = GAME_ON_SONG; +float tone_game_outro[][2] = GAME_OFF_SONG; + +// Audio playing when layer changes +layer_state_t layer_state_set_audio(layer_state_t state) { + // Get this layer + static bool prev_game = false; + + // If entering the game layer; play the intro sound + if (layer_state_cmp(state, _GAME) && (!prev_game)) { + stop_all_notes(); + PLAY_SONG(tone_game_intro); + prev_game = true; + } + // If exiting the game layer; play the outro sound + if ((!layer_state_cmp(state, _GAME)) && prev_game) { + stop_all_notes(); + PLAY_SONG(tone_game_outro); + prev_game = false; + } + return state; +} + +// Audio layer switch; add the music layer on top of this +bool process_record_audio(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case MU_TOG: + if (!record->event.pressed) { + // On release, exit music mode if enabled + if (layer_state_is(_MUSI)) { + layer_off(_MUSI); + // If not enabled; turn off all layers and load music layer + } else { + layer_clear(); + layer_on(_MUSI); + } + } + return true; + break; + case MU_ON: + if (!record->event.pressed) { + // On release, enter music mode + layer_clear(); + layer_on(_MUSI); + } + return true; + break; + case MU_OFF: + if (!record->event.pressed) { + // On release, exit music mode + layer_off(_MUSI); + } + return true; + break; + } + return true; +} diff --git a/users/bbaserdem/bb-audio.h b/users/bbaserdem/bb-audio.h new file mode 100644 index 0000000000..351061ab9a --- /dev/null +++ b/users/bbaserdem/bb-audio.h @@ -0,0 +1,28 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bbaserdem.h" + +/* AUDIO + * Some functions to hook to some modes + */ + +// Hook to layer change effects +layer_state_t layer_state_set_audio(layer_state_t state); + +// Hook to audio keycodes +bool process_record_audio(uint16_t keycode, keyrecord_t *record); diff --git a/users/bbaserdem/bb-backlight.c b/users/bbaserdem/bb-backlight.c new file mode 100644 index 0000000000..5eca1f2c11 --- /dev/null +++ b/users/bbaserdem/bb-backlight.c @@ -0,0 +1,30 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bb-backlight.h" +/* Replaced functions with noeeprom varieties; I don't need retention across + * booting. + */ + +// Backlight LEDs +void keyboard_post_init_backlight(void) { + backlight_enable(); + backlight_level(2); +# ifdef BACKLIGHT_BREATHING + breathing_enable(); +# endif // BACKLIGHT_BREATHING +} diff --git a/users/bbaserdem/bb-backlight.h b/users/bbaserdem/bb-backlight.h new file mode 100644 index 0000000000..3af3137d9a --- /dev/null +++ b/users/bbaserdem/bb-backlight.h @@ -0,0 +1,23 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bbaserdem.h" + +/* Hooks for backlight definitions + */ + +void keyboard_post_init_backlight(void); diff --git a/users/bbaserdem/bb-encoder.c b/users/bbaserdem/bb-encoder.c new file mode 100644 index 0000000000..eea9751051 --- /dev/null +++ b/users/bbaserdem/bb-encoder.c @@ -0,0 +1,514 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bb-encoder.h" + +// Need this to call velocikey activation +#ifdef VELOCIKEY_ENABLE +# include "velocikey.h" +#endif // VELOCIKEY_ENABLE +// Need memcpy and memcmp from string.h along with transfer stuff +#ifdef OLED_ENABLE +# include <string.h> +#endif // OLED_ENABLE + +/* ROTARY ENCODER + * This contains my general rotary encoder code + * Encoders each have a list of different modes they can be in. + * Each mode also have an on click action as well. + * Modes can be cycled using either shift-click or ctrl-click + * Modes can be reset using OS click + * Some modes are only accessible through some keymap layers + */ + +// Default state for the encoders +void reset_encoder_state(void) { + userspace_config.e0base = 0; + userspace_config.e0point = 0; + userspace_config.e0rgb = 0; + userspace_config.e1base = 1; + userspace_config.e1point = 1; + userspace_config.e1rgb = 1; +} + +// Encoder scroll functionality +bool encoder_update_user(uint8_t index, bool clockwise) { + uint8_t this_number; + // Differentiate layer roles + switch (get_highest_layer(layer_state)) { +# ifdef RGB_MATRIX_ENABLE + case _MEDI: + // Get correct index + if (index == 0) { + this_number = userspace_config.e0rgb; + } else if (index == 1) { + this_number = userspace_config.e1rgb; + } else { + this_number = 128; + } + switch(this_number) { + case 0: // Effect the RGB mode + if (clockwise) { + rgb_matrix_step_noeeprom(); + } else { + rgb_matrix_step_reverse_noeeprom(); + } + break; + case 1: // Effect the RGB hue + if (clockwise) { + rgb_matrix_increase_hue_noeeprom(); + } else { + rgb_matrix_decrease_hue_noeeprom(); + } + break; + case 2: // Effect the RGB saturation + if (clockwise) { + rgb_matrix_increase_sat_noeeprom(); + } else { + rgb_matrix_decrease_sat_noeeprom(); + } + break; + case 3: // Effect the RGB brightness + if (clockwise) { + rgb_matrix_increase_val_noeeprom(); + } else { + rgb_matrix_decrease_val_noeeprom(); + } + break; + case 4: // Effect the RGB effect speed + if (clockwise) { + rgb_matrix_increase_speed_noeeprom(); + } else { + rgb_matrix_decrease_speed_noeeprom(); + } + break; + } + break; +# endif // RGB_MATRIX_ENABLE +# ifdef MOUSEKEY_ENABLE + case _MOUS: + // Get correct index + if (index == 0) { + this_number = userspace_config.e0point; + } else if (index == 1) { + this_number = userspace_config.e1point; + } else { + this_number = 128; + } + switch(this_number) { + case 0: // Move mouse on horizontal axis + if (clockwise) { + tap_code(KC_MS_R); + } else { + tap_code(KC_MS_L); + } + break; + case 1: // Move mouse on vertical axis + if (clockwise) { + tap_code(KC_MS_D); + } else { + tap_code(KC_MS_U); + } + break; + case 2: // Move mouse wheel on vertical axis + if (clockwise) { + tap_code(KC_WH_D); + } else { + tap_code(KC_WH_U); + } + break; + case 3: // Move mouse on horizontal axis + if (clockwise) { + tap_code(KC_WH_R); + } else { + tap_code(KC_WH_L); + } + break; + } + break; +# endif // MOUSEKEY_ENABLE + default: + // Get correct index + if (index == 0) { + this_number = userspace_config.e0base; + } else if (index == 1) { + this_number = userspace_config.e1base; + } else { + this_number = 128; + } + switch(this_number) { + case 0: // Volume + if (clockwise) { + tap_code16(KC_VOLU); + } else { + tap_code16(KC_VOLD); + } + break; + case 1: // Song change + if (clockwise) { + tap_code16(KC_MNXT); + } else { + tap_code16(KC_MPRV); + } + break; + case 2: // Move to audio sink + if (clockwise) { + tap_code16(KC_F13); + } else { + tap_code16(S(KC_F13)); + } + break; + case 3: // Volume of source + if (clockwise) { + tap_code16(S(KC_VOLU)); + } else { + tap_code16(C(KC_VOLD)); + } + break; + case 4: // Move to audio source + if (clockwise) { + tap_code16(C(KC_F13)); + } else { + tap_code16(C(S(KC_F13))); + } + break; + case 5: // Left-right + if (clockwise) { + tap_code16(KC_RGHT); + } else { + tap_code16(KC_LEFT); + } + break; + case 6: // Up-down + if (clockwise) { + tap_code16(KC_DOWN); + } else { + tap_code16(KC_UP); + } + break; + case 7: // Page Up-down + if (clockwise) { + tap_code16(KC_PGDN); + } else { + tap_code16(KC_PGUP); + } + break; + case 8: // Delete + if (clockwise) { + tap_code16(KC_DEL); + } else { + tap_code16(KC_BSPC); + } + break; + } + break; + } + return false; +} + +void encoder_click_action(uint8_t index) { + uint8_t this_number; + // Differentiate layer roles + switch (get_highest_layer(layer_state)) { +# ifdef RGB_MATRIX_ENABLE + case _MEDI: + // Get correct index + if (index == 0) { + this_number = userspace_config.e0rgb; + } else if (index == 1) { + this_number = userspace_config.e1rgb; + } else { + this_number = 128; + } + switch(this_number) { + case 0: // Return to no animation + rgb_matrix_mode_noeeprom(RGB_MATRIX_SOLID_COLOR); + break; + case 1: + case 2: + case 3: // Toggle + rgb_matrix_increase_val_noeeprom(); + break; + case 4: // Toggle velocikey +# ifdef VELOCIKEY_ENABLE + velocikey_toggle(); +# endif // VELOCIKEY_ENABLE + break; + } + break; +# endif // RGB_MATRIX_ENABLE +# ifdef MOUSEKEY_ENABLE + case _MOUS: + // Get correct index + if (index == 0) { + this_number = userspace_config.e0point; + } else if (index == 1) { + this_number = userspace_config.e1point; + } else { + this_number = 128; + } + switch(this_number) { + case 0: // Left click + tap_code16(KC_BTN1); + break; + case 1: // Right click + tap_code16(KC_BTN2); + break; + case 2: + case 3: // Middle click + tap_code16(KC_BTN2); + break; + } + break; +# endif // MOUSEKEY_ENABLE + default: + // Get correct index + if (index == 0) { + this_number = userspace_config.e0base; + } else if (index == 1) { + this_number = userspace_config.e1base; + } else { + this_number = 128; + } + switch(this_number) { + case 0: // Toggle mute + case 2: + tap_code16(KC_MUTE); + break; + case 1: // Pause + tap_code16(KC_MPLY); + break; + case 3: // Mute source + case 4: + tap_code16(A(KC_MUTE)); + break; + case 5: // Insert + tap_code16(KC_INS); + break; + case 6: // Capslock + tap_code16(KC_CAPS); + break; + case 7: // Redo + tap_code16(BB_REDO); + break; + case 8: // Undo + tap_code16(BB_UNDO); + break; + } + break; + } +} + +bool process_record_encoder(uint16_t keycode, keyrecord_t *record) { + // Check if and which encoder + int encoder_index = -1; + + // Get the pressed encoder + switch (keycode) { + case BB_ENC0: + encoder_index = 0; + break; + case BB_ENC1: + encoder_index = 1; + break; + } + + // Activate encoder function of button + if ((encoder_index >= 0) & (!record->event.pressed)) { + // If shifted, move mode one point forward + if (get_mods() & MOD_MASK_SHIFT) { + switch (get_highest_layer(layer_state)) { +# ifdef RGB_MATRIX_ENABLE + case _MEDI: + if (encoder_index == 0) { + userspace_config.e0rgb = (userspace_config.e0rgb + 1) % 5; + } else { + userspace_config.e1rgb = (userspace_config.e1rgb + 1) % 5; + } + break; +# endif // RGB_MATRIX_ENABLE +# ifdef MOUSEKEY_ENABLE + case _MOUS: + if (encoder_index == 0) { + userspace_config.e0point = (userspace_config.e0point + 1) % 4; + } else { + userspace_config.e1point = (userspace_config.e1point + 1) % 4; + } + break; +# endif // MOUSEKEY_ENABLE + default: + if (encoder_index == 0) { + userspace_config.e0base = (userspace_config.e0base + 1) % 9; + } else { + userspace_config.e1base = (userspace_config.e1base + 1) % 9; + } + break; + } + // If ctrl is active, move mode one point backwards + } else if (get_mods() & MOD_MASK_CTRL) { + switch (get_highest_layer(layer_state)) { +# ifdef RGB_MATRIX_ENABLE + case _MEDI: + if (encoder_index == 0) { + userspace_config.e0rgb = (userspace_config.e0rgb + 5 - 1) % 5; + } else { + userspace_config.e1rgb = (userspace_config.e1rgb + 5 - 1) % 5; + } + break; +# endif // RGB_MATRIX_ENABLE +# ifdef MOUSEKEY_ENABLE + case _MOUS: + if (encoder_index == 0) { + userspace_config.e0point = (userspace_config.e0point + 4 - 1) % 4; + } else { + userspace_config.e1point = (userspace_config.e1point + 4 - 1) % 4; + } + break; +# endif // MOUSEKEY_ENABLE + default: + if (encoder_index == 0) { + userspace_config.e0base = (userspace_config.e0base + 9 - 1) % 9; + } else { + userspace_config.e1base = (userspace_config.e1base + 9 - 1) % 9; + } + break; + } + // If meta is active, reset the encoder states + } else if (get_mods() & MOD_MASK_GUI) { + reset_encoder_state(); + eeconfig_update_user(userspace_config.raw); + // If nothing else; just perform the click action + } else { + encoder_click_action(encoder_index); + } + } + return true; +} + +// For printing status to OLED +#ifdef OLED_ENABLE +void encoder_state_string(uint8_t index, uint8_t layer, char* buffer) { + uint8_t this_number; + // Get the layer straight from the main function + switch (layer) { + // If RGB control mode is enabled +# ifdef RGB_MATRIX_ENABLE + case _MEDI: + // Get correct index + if (index == 0) { + this_number = userspace_config.e0rgb; + } else if (index == 1) { + this_number = userspace_config.e1rgb; + } else { + this_number = 128; + } + switch (this_number) { + case 0: + strcpy(buffer, "ani mode"); + break; + case 1: + strcpy(buffer, "hue "); + break; + case 2: + strcpy(buffer, "saturat."); + break; + case 3: + strcpy(buffer, "bright. "); + break; + case 4: + strcpy(buffer, "ani. spd"); + break; + default: + strcpy(buffer, " -N/A- "); + break; + } + break; +# endif // RGB_MATRIX_ENABLE + // If pointer control is enabled +# ifdef MOUSEKEY_ENABLE + case _MOUS: + // Get correct index + if (index == 0) { + this_number = userspace_config.e0point; + } else if (index == 1) { + this_number = userspace_config.e1point; + } else { + this_number = 128; + } + switch (this_number) { + case 0: + strcpy(buffer, "Lateral "); + break; + case 1: + strcpy(buffer, "Vertical"); + break; + case 2: + strcpy(buffer, "Scr. Ver"); + break; + case 3: + strcpy(buffer, "Scr. Lat"); + break; + default: + strcpy(buffer, " -N/A- "); + break; + } + break; +# endif // MOUSEKEY_ENABLE + default: + // Get correct index + if (index == 0) { + this_number = userspace_config.e0base; + } else if (index == 1) { + this_number = userspace_config.e1base; + } else { + this_number = 128; + } + switch (this_number) { + case 0: + strcpy(buffer, "Volume "); + break; + case 1: + strcpy(buffer, "Song "); + break; + case 2: + strcpy(buffer, "Sink "); + break; + case 3: + strcpy(buffer, "Src. Vol"); + break; + case 4: + strcpy(buffer, "Source "); + break; + case 5: + strcpy(buffer, "Arrow LR"); + break; + case 6: + strcpy(buffer, "Arrow UD"); + break; + case 7: + strcpy(buffer, "Page U/D"); + break; + case 8: + strcpy(buffer, "Erase "); + break; + default: + strcpy(buffer, " -N/A- "); + break; + } + break; + } +} +#endif // OLED_ENABLE diff --git a/users/bbaserdem/bb-encoder.h b/users/bbaserdem/bb-encoder.h new file mode 100644 index 0000000000..dce08cd3d5 --- /dev/null +++ b/users/bbaserdem/bb-encoder.h @@ -0,0 +1,29 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bbaserdem.h" + +// Hook to encoder stuff +bool encoder_update_user(uint8_t index, bool clockwise); +// Complicated code for what the encoder keys do when pressed +bool process_record_encoder(uint16_t keycode, keyrecord_t *record); +// Clear the encoder settings +void reset_encoder_state(void); +// This is so that encoder state is synched between two halves +void housekeeping_task_encoder(void); +// This is purely for oled; should it want to use it +void encoder_state_string(uint8_t index, uint8_t layer, char* buffer); diff --git a/users/bbaserdem/bb-macro.c b/users/bbaserdem/bb-macro.c new file mode 100644 index 0000000000..a84a7bbc21 --- /dev/null +++ b/users/bbaserdem/bb-macro.c @@ -0,0 +1,156 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bb-macro.h" + +/* MACRO Definitions + * This file has my macros/unicodes + * Hooks for other functionality to inject itself into the process_record + */ + +// Tap dance definitons +#ifdef AUDIO_ENABLE +#ifdef TAP_DANCE_ENABLE +qk_tap_dance_action_t tap_dance_actions[] = { + // Music playback speed modulator + [TD_AUDIO_TEMPO] = ACTION_TAP_DANCE_DOUBLE(MU_SLOW, MU_FAST), +}; +#endif // AUDIO_ENABLE +#endif // TAP_DANCE_ENABLE + +// Unicode definitions; for single character keys +// We mask their definitions if unicode is not enabled +#ifdef UNICODEMAP_ENABLE +const uint32_t PROGMEM unicode_map[] = { + [UPC_A_CIRC] = 0x00C2, [LOW_A_CIRC] = 0x00E2, //  â + [UPC_C_CEDI] = 0x00C7, [LOW_C_CEDI] = 0x00E7, // Ç ç + [UPC_G_BREV] = 0x011E, [LOW_G_BREV] = 0x001F, // Ğ ğ + [UPC_I_CIRC] = 0x00CE, [LOW_I_CIRC] = 0x00EE, // Î î + [UPC_I_DOTL] = 0x0049, [LOW_I_DOTL] = 0x0131, // I ı + [UPC_I_DOTT] = 0x0130, [LOW_I_DOTT] = 0x0069, // İ i + [UPC_O_DIAE] = 0x00D6, [LOW_O_DIAE] = 0x00F6, // Ö ö + [UPC_S_CEDI] = 0x015E, [LOW_S_CEDI] = 0x015F, // Ş ş + [UPC_U_CIRC] = 0x00DB, [LOW_U_CIRC] = 0x00FB, // Û û + [UPC_U_DIAE] = 0x00DC, [LOW_U_DIAE] = 0x00FC, // Ü ü + [UPC_ALPHA] = 0x0391, [LOW_ALPHA] = 0x03B1, // Α α + [UPC_BETA] = 0x0392, [LOW_BETA] = 0x03B2, // Β β + [UPC_GAMMA] = 0x0393, [LOW_GAMMA] = 0x03B3, // Γ γ + [UPC_DELTA] = 0x0394, [LOW_DELTA] = 0x03B4, // Δ δ + [UPC_EPSILON] = 0x0395, [LOW_EPSILON] = 0x03B5, // Ε ε + [UPC_ZETA] = 0x0396, [LOW_ZETA] = 0x03B6, // Ζ ζ + [UPC_ETA] = 0x0397, [LOW_ETA] = 0x03B7, // Η η + [UPC_THETA] = 0x0398, [LOW_THETA] = 0x03B8, // Θ θ + [UPC_IOTA] = 0x0399, [LOW_IOTA] = 0x03B9, // Ι ι + [UPC_KAPPA] = 0x039A, [LOW_KAPPA] = 0x03BA, // Κ κ + [UPC_LAMBDA] = 0x039B, [LOW_LAMBDA] = 0x03BB, // Λ λ + [UPC_MU] = 0x039C, [LOW_MU] = 0x03BC, // Μ μ + [UPC_NU] = 0x039D, [LOW_NU] = 0x03BD, // Ν ν + [UPC_XI] = 0x039E, [LOW_XI] = 0x03BE, // Ξ ξ + [UPC_OMICRON] = 0x039F, [LOW_OMICRON] = 0x03BF, // Ο ο + [UPC_PI] = 0x03A0, [LOW_PI] = 0x03C0, // Π π + [UPC_RHO] = 0x03A1, [LOW_RHO] = 0x03C1, // Ρ ρ + [UPC_SIGMA] = 0x03A3, [LOW_SIGMA] = 0x03C3, // Σ σ + [UPC_TAU] = 0x03A4, [LOW_TAU] = 0x03C4, // Τ τ + [UPC_UPSILON] = 0x03A5, [LOW_UPSILON] = 0x03C5, // Υ υ + [UPC_PHI] = 0x03A6, [LOW_PHI] = 0x03C6, // Φ φ + [UPC_CHI] = 0x03A7, [LOW_CHI] = 0x03C7, // Χ χ + [UPC_PSI] = 0x03A8, [LOW_PSI] = 0x03C8, // Ψ ψ + [UPC_OMEGA] = 0x03A9, [LOW_OMEGA] = 0x03C9, // Ω ω + [ELLIPSIS] = 0x2026, // … + [PLANCK_CON] = 0x210F, // ℏ + [ANGSTROM] = 0x212B, // Å + [BITCOIN] = 0x20BF // ₿ +}; +#endif // UNICODEMAP_ENABLE + +// Keycodes +bool process_record_macro(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + // AltGr + Caps should change the oled layout variable + case KC_CAPSLOCK: + if (record->event.pressed) { + if (get_mods() & MOD_BIT(KC_RALT)) { + userspace_config.layout = (userspace_config.layout + 1) % 3; + } + } + return true; + break; + case BB_OLED: + if (record->event.pressed) { + if (get_mods() & MOD_MASK_SHIFT) { + // Scroll in opposite direction + userspace_config.layout = (userspace_config.layout + 4) % 3; + } else { + userspace_config.layout = (userspace_config.layout + 1) % 3; + } + } + return false; + break; + // Plain macros + case BB_PGPK: + // My public PGP key + if (record->event.pressed) { + SEND_STRING("0B7151C823559DD8A7A04CE36426139E2F4C6CCE"); + } + return false; break; + case DBL_ANG: + // Double angular bracket + if (record->event.pressed) { + SEND_STRING("<>"SS_TAP(X_LEFT)); + } + return false; break; + case DBL_PAR: + // Double paranthesis + if (record->event.pressed) { + SEND_STRING("()"SS_TAP(X_LEFT)); + } + return false; break; + case DBL_BRC: + // Double square brackets + if (record->event.pressed) { + SEND_STRING("[]"SS_TAP(X_LEFT)); + } + return false; break; + case DBL_CBR: + // Double curly brackets + if (record->event.pressed) { + SEND_STRING("{}"SS_TAP(X_LEFT)); + } + return false; break; + // Unicode macros +# ifdef UNICODEMAP_ENABLE + case TR_FLAG: + // Turkish flag + if (record->event.pressed) { + send_unicode_string("🇹🇷"); + } + return false; break; + case BB_LENY: + // Lenny face: ( ͡° ͜ʖ ͡°) + if (record->event.pressed) { + send_unicode_string("( ͡° ͜ʖ ͡°)"); + } + return false; break; + case BB_TABL: + // Table flip: ┻━┻︵ \(°□°)/ ︵ ┻━┻ + if (record->event.pressed) { + send_unicode_string("┻━┻︵ \\(°□°)/ ︵ ┻━┻"); + } + return false; break; +# endif // UNICODEMAP_ENABLE + } + return true; +} diff --git a/users/bbaserdem/bb-macro.h b/users/bbaserdem/bb-macro.h new file mode 100644 index 0000000000..3dc14e7a8a --- /dev/null +++ b/users/bbaserdem/bb-macro.h @@ -0,0 +1,113 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bbaserdem.h" + +/* This header file contains definitons regarding custom keycodes. + * - Both regular and unicode macros are dealt with in this file + */ + +// These will be delegated to keymap specific stuff (weak definition) +bool process_record_macro(uint16_t keycode, keyrecord_t *record); + +// Unicodemap implementation +#ifdef UNICODEMAP_ENABLE +enum userspace_unicodemap { + UPC_A_CIRC, + UPC_C_CEDI, + UPC_G_BREV, + UPC_I_CIRC, + UPC_I_DOTL, + UPC_I_DOTT, + UPC_O_DIAE, + UPC_S_CEDI, + UPC_U_CIRC, + UPC_U_DIAE, + LOW_A_CIRC, + LOW_C_CEDI, + LOW_G_BREV, + LOW_I_CIRC, + LOW_I_DOTL, + LOW_I_DOTT, + LOW_O_DIAE, + LOW_S_CEDI, + LOW_U_CIRC, + LOW_U_DIAE, + ELLIPSIS, + PLANCK_CON, + ANGSTROM, + MATHPI, + BITCOIN, + UPC_ALPHA, + UPC_BETA, + UPC_GAMMA, + UPC_DELTA, + UPC_EPSILON, + UPC_ZETA, + UPC_ETA, + UPC_THETA, + UPC_IOTA, + UPC_KAPPA, + UPC_LAMBDA, + UPC_MU, + UPC_NU, + UPC_XI, + UPC_OMICRON, + UPC_PI, + UPC_RHO, + UPC_SIGMA, + UPC_TAU, + UPC_UPSILON, + UPC_PHI, + UPC_CHI, + UPC_PSI, + UPC_OMEGA, + LOW_ALPHA, + LOW_BETA, + LOW_GAMMA, + LOW_DELTA, + LOW_EPSILON, + LOW_ZETA, + LOW_ETA, + LOW_THETA, + LOW_IOTA, + LOW_KAPPA, + LOW_LAMBDA, + LOW_MU, + LOW_NU, + LOW_XI, + LOW_OMICRON, + LOW_PI, + LOW_RHO, + LOW_SIGMA, + LOW_TAU, + LOW_UPSILON, + LOW_PHI, + LOW_CHI, + LOW_PSI, + LOW_OMEGA, +}; +#endif // UNICODEMAP_ENABLE + +// Tap dance stuff +#ifdef AUDIO_ENABLE +#ifdef TAP_DANCE_ENABLE +enum { + TD_AUDIO_TEMPO, +}; +#endif // AUDIO_ENABLE +#endif // TAP_DANCE_ENABLE diff --git a/users/bbaserdem/bb-oled-extra.c b/users/bbaserdem/bb-oled-extra.c new file mode 100644 index 0000000000..b52c4b335a --- /dev/null +++ b/users/bbaserdem/bb-oled-extra.c @@ -0,0 +1,796 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bb-oled.h" +#include "bb-oled-extra.h" + +// Helper function that draws images +void draw_image(uint8_t row, uint8_t col, const char image[4][42]) { + // Draw this image iteratively + for (int i = 0; i < 4; i++) { + oled_set_cursor(col, row + i); + oled_write_raw_P(image[i], 42); + } +} + +// Write modifiers to the screen +void render_modifiers(uint8_t row, uint8_t col, uint8_t mods) { + static const char PROGMEM mod_meta[12] = {0x00,0x01,0x01,0x01,0x01,0x06,0x18,0x60,0x81,0x81,0x81,0x81}; + static const char PROGMEM mod_altL[12] = {0x00,0x80,0x80,0x80,0x40,0x20,0x10,0x08,0x84,0x95,0x8e,0x84}; + static const char PROGMEM mod_altR[12] = {0x00,0x86,0x8f,0x8f,0x46,0x20,0x10,0x08,0x84,0x95,0x8e,0x84}; + static const char PROGMEM mod_ctrl[12] = {0x00,0x00,0xbd,0x42,0xa5,0x99,0x99,0xa5,0x42,0xbd,0x00,0x00}; + static const char PROGMEM mod_shft[12] = {0x00,0x20,0x30,0x28,0xe4,0x02,0x01,0x02,0xe4,0x28,0x30,0x20}; + // Looks like Mods: <OS> <Alt/Gr> <Ctrl> <Shift> + oled_set_cursor(col, row); + oled_write("Mods: ", false); + // Meta + if (mods & MOD_MASK_GUI) { + oled_write_raw_P(mod_meta, 12); + oled_set_cursor(col + 8, row); + } else { + oled_write(" ", false); + } + // Alt(Gr) + if (mods & MOD_BIT(KC_RALT)) { + oled_write_raw_P(mod_altR, 12); + oled_set_cursor(col + 10, row); + } else if (mods & MOD_MASK_ALT) { + oled_write_raw_P(mod_altL, 12); + oled_set_cursor(col + 10, row); + } else { + oled_write(" ", false); + } + // Ctrl + if (mods & MOD_MASK_CTRL) { + oled_write_raw_P(mod_ctrl, 12); + oled_set_cursor(col + 12, row); + } else { + oled_write(" ", false); + } + // Shift + if (mods & MOD_MASK_SHIFT) { + oled_write_raw_P(mod_shft, 12); + oled_set_cursor(col + 14, row); + } else { + oled_write(" ", false); + } +} + +// Draws the image of the currently used layout +void render_layout(uint8_t row, uint8_t col, uint8_t mods, bool isLeft) { + // DVORAK + static const char PROGMEM base0_L_dvor_nomod[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x00,0x04,0x08,0x10,0x00,0x00,0x00, + 0x00,0x0e,0x00,0x00,0x00,0x00,0x60,0xe0,0x00,0x00,0x00,0x00,0xc0,0xc0, + 0x00,0x00,0x00,0xf8,0x90,0x88,0x88,0x70,0x00,0x78,0x80,0x80,0x40,0xf8 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x00,0x00, + 0x40,0x40,0x40,0x80,0x00,0x80,0x41,0x40,0x40,0x80,0x00,0x80,0x40,0x40, + 0x40,0x80,0x00,0xc3,0x00,0x00,0x00,0xc0,0x00,0x00,0x42,0xd2,0x02,0x01 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0xd8,0x06,0x01,0x00,0x00,0x00,0x02, + 0x05,0x05,0x05,0x07,0x00,0x03,0x04,0x04,0x04,0x03,0x00,0x03,0x05,0x05, + 0x85,0x05,0x00,0xc3,0x04,0x04,0x02,0x07,0x00,0x00,0x00,0x07,0x04,0x00 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x00,0x03,0x0c,0x30,0xc0,0x00,0x00, + 0xb6,0x76,0x00,0x00,0x00,0x1c,0x22,0x22,0x12,0xfe,0x00,0x00,0x80,0x82, + 0x7e,0x00,0x00,0x3f,0x08,0x0c,0x12,0x20,0x00,0x22,0x14,0x08,0x14,0x22}}; + static const char PROGMEM base0_L_dvor_shift[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x20,0x10,0x20,0x40,0x20,0x00,0x00, + 0x07,0x00,0x07,0x00,0x00,0x10,0x28,0x44,0x82,0x00,0x00,0x82,0x44,0x28, + 0x10,0x00,0x00,0xfe,0x12,0x12,0x12,0x0c,0x00,0x06,0x08,0xf0,0x08,0x06 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x00,0x00,0xf0,0x00,0x00,0x00,0xe0, + 0x90,0x90,0x90,0xe0,0x00,0xe0,0x10,0x10,0x10,0xe0,0x00,0xf0,0x90,0x90, + 0x90,0x10,0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0x00,0x10,0xf0,0x10,0x00 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x00,0x80,0x87,0x80,0x00,0x00,0x07, + 0x00,0x00,0x00,0x07,0x00,0x03,0x84,0x84,0x84,0x03,0x00,0x07,0x04,0x04, + 0x04,0x84,0x00,0x83,0x04,0x04,0x04,0x83,0x00,0x80,0x04,0x07,0x04,0x80 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x01,0x00,0x28,0x04,0x03,0x00,0x00, + 0x36,0x36,0x00,0x00,0x00,0x1f,0x20,0x28,0x10,0x6f,0x00,0x18,0x20,0x20, + 0x20,0x1f,0x00,0x3f,0x04,0x0a,0x11,0x20,0x00,0x31,0x0a,0x04,0x0a,0x31}}; + static const char PROGMEM base0_R_dvor_nomod[4][42] = { + { 0x00,0xfc,0x12,0x12,0x00,0x00,0x70,0x88,0x88,0x48,0xf8,0x00,0x70,0x88, + 0x88,0x88,0x88,0x00,0xf8,0x10,0x08,0x08,0x10,0x00,0x00,0x02,0x7e,0x80, + 0x80,0x00,0x10,0x28,0x44,0x82,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0x00,0x80,0x80,0x80,0xf0,0x00,0xf0,0x02,0x82,0x82,0x01,0x00,0x00,0x80, + 0xf0,0x80,0x80,0x00,0xc0,0x40,0x40,0x40,0x80,0x00,0x80,0x40,0x40,0x40, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x83,0x04,0x04,0x02,0x07,0x00,0x07,0x01,0x00,0x00,0x07,0x00,0x00,0x00, + 0x03,0x04,0x04,0x00,0x07,0x00,0x00,0x00,0x07,0x00,0x04,0x05,0x05,0x05, + 0x02,0x00,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x73,0x39,0x00,0x00 + },{ 0x3f,0x24,0x22,0x22,0x1c,0x00,0x3e,0x02,0x3e,0x02,0x3c,0x00,0x1e,0x20, + 0x1c,0x20,0x1e,0x00,0x06,0x18,0x20,0x18,0x06,0x00,0x22,0x32,0x2a,0x26, + 0x22,0x00,0x14,0x14,0x14,0x14,0x14,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM base0_R_dvor_shift[4][42] = { + { 0xfe,0x12,0x12,0x12,0x02,0x00,0xfc,0x02,0x12,0x12,0xf4,0x00,0xfc,0x02, + 0x02,0x02,0x84,0x00,0xfe,0x12,0x12,0x32,0xcc,0x00,0xfe,0x00,0x00,0x00, + 0x00,0x00,0x04,0x88,0x50,0x20,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0xf1,0x10,0x10,0x10,0xe0,0x00,0xf0,0x81,0x81,0x81,0xf0,0x00,0x10,0x11, + 0xf1,0x11,0x10,0x00,0xf1,0x60,0x80,0x00,0xf1,0x00,0x61,0x91,0x91,0x91, + 0x21,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x8f,0x88,0x88,0x88,0x07,0x00,0x8f,0x00,0x00,0x00,0x8f,0x00,0x80,0x00, + 0x0f,0x00,0x80,0x00,0x8f,0x00,0x01,0x06,0x8f,0x00,0x84,0x88,0x88,0x88, + 0x87,0x00,0x08,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x73,0x39,0x00,0x00 + },{ 0x7f,0x44,0x44,0x44,0x3b,0x00,0x7f,0x01,0x06,0x01,0x7f,0x00,0x1f,0x60, + 0x1c,0x60,0x1f,0x00,0x07,0x18,0x60,0x18,0x07,0x00,0x70,0x48,0x44,0x42, + 0x41,0x00,0x08,0x08,0x3e,0x08,0x08,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM symb5_R_dvor[4][42] = { + { 0x00,0x02,0x04,0x08,0x00,0x00,0x20,0x20,0xdc,0x02,0x02,0x00,0x02,0x02, + 0xdc,0x20,0x20,0x00,0x00,0xc0,0x30,0x0c,0x03,0x00,0x50,0x50,0x50,0x50, + 0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0x00,0x80,0x00,0x00,0x00,0x00,0x00,0xf0,0x11,0x12,0x02,0x00,0x02,0x12, + 0x11,0xf0,0x00,0x00,0x43,0x20,0x20,0x20,0xc0,0x00,0x00,0x00,0xc0,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x01,0x80,0x41,0x82,0x01,0x00,0x00,0x1f,0x10,0x90,0x00,0x00,0x00,0x90, + 0x10,0x1f,0x00,0x00,0xc0,0x00,0x14,0x03,0x00,0x00,0x01,0x01,0x87,0x01, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x39,0x00,0x00 + },{ 0x22,0xf3,0x0a,0xf3,0x22,0x00,0x00,0x1c,0x63,0x80,0x00,0x00,0x00,0x80, + 0x63,0x1c,0x00,0x00,0x00,0x03,0x0c,0x30,0xc0,0x00,0x00,0x00,0x7f,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM numb6_L_dvor_nomod[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20, + 0x50,0x88,0x04,0x00,0x00,0x04,0x04,0xc4,0x34,0x0c,0x00,0xd8,0x24,0x24, + 0x24,0xd8,0x00,0x18,0x24,0x24,0x24,0xf8,0x00,0xf8,0x44,0x24,0x14,0xf8 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x00,0x00,0x00,0x80,0x41,0xe0,0x00,0x00,0xe0,0xa1,0xa1, + 0xa1,0x20,0x00,0xc0,0xa1,0xa1,0xa1,0x00,0x00,0x00,0x01,0x01,0x01,0x00 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08, + 0x08,0x08,0x08,0x08,0x00,0x03,0x02,0x02,0x0f,0x02,0x00,0x04,0x08,0x08, + 0x08,0x07,0x00,0x07,0x08,0x08,0x08,0x07,0x00,0x01,0x01,0x01,0x01,0x00 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41, + 0x22,0x14,0x08,0x00,0x00,0x00,0x04,0x02,0x7f,0x00,0x00,0x42,0x61,0x51, + 0x49,0x46,0x00,0x22,0x41,0x49,0x49,0x36,0x00,0x5e,0x61,0x01,0x61,0x5e}}; + static const char PROGMEM numb6_L_dvor_shift[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xd8,0x24,0x54,0x88,0x40,0x00,0x50,0x20,0xf8, + 0x20,0x50,0x00,0x00,0x38,0xc6,0x01,0x00,0x00,0x00,0x01,0xc6,0x38,0x00 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x60,0x91,0xf9,0x90,0x21,0x00,0x20,0x50,0x20, + 0x80,0x60,0x00,0x40,0x20,0x10,0x21,0x40,0x00,0x00,0x01,0x00,0x00,0x00 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x02,0x04,0x8f,0x04,0x03,0x00,0x0c,0x02,0x09, + 0x14,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0x00,0x00,0x00,0x3e,0x41,0x5d, + 0x55,0x5e,0x00,0x14,0x7f,0x14,0x7f,0x14,0x00,0x00,0x00,0x00,0x00,0x00}}; + // Turkish F + static const char PROGMEM base0_L_turf_nomod[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x10,0x10,0x7c,0x10,0x10,0x00,0x00, + 0xfe,0x09,0x09,0x00,0x00,0x70,0x88,0x88,0x48,0xf8,0x00,0x51,0xaa,0xaa, + 0x92,0x09,0x00,0x00,0x88,0xf8,0x80,0x00,0x00,0x70,0x88,0x88,0x88,0x70 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x40,0x80,0x00,0x80,0x40,0x00,0xc0, + 0x00,0x00,0x00,0xc0,0x00,0x00,0x42,0xd2,0x02,0x01,0x00,0x81,0x42,0x42, + 0x42,0x81,0x00,0x00,0x40,0x40,0x40,0x80,0x00,0xc0,0x10,0x00,0x10,0xc0 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x04,0x02,0x01,0x02,0x04,0x00,0x03, + 0x04,0x04,0x82,0x07,0x00,0x00,0x80,0x07,0x84,0x00,0x00,0x03,0x05,0x05, + 0x05,0x05,0x00,0x02,0x05,0x05,0x05,0x07,0x00,0x03,0x04,0x04,0x02,0x07 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x1c,0x22,0x22,0x12,0xfe,0x00,0x00, + 0x80,0x82,0x7e,0x00,0x00,0x1c,0x22,0x22,0x22,0x1c,0x00,0x06,0x18,0x20, + 0x18,0x06,0x00,0x1c,0x22,0x22,0x22,0x22,0x00,0x1c,0xa2,0x62,0x22,0x22}}; + static const char PROGMEM base0_L_turf_shift[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x28,0x10,0x7c,0x10,0x28,0x00,0xfe, + 0x12,0x12,0x12,0x02,0x00,0xfc,0x02,0x12,0x12,0xf4,0x00,0xf1,0x0a,0x4a, + 0x4a,0xd1,0x00,0x00,0x02,0xfe,0x02,0x00,0x00,0xfc,0x02,0x02,0x02,0xfc + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x30,0x40,0x80,0x40,0x30,0x00,0xf1, + 0x00,0x00,0x00,0xf0,0x00,0x00,0x21,0xe9,0x21,0x00,0x00,0xf1,0x92,0x92, + 0x92,0x11,0x00,0xe0,0x91,0x91,0x91,0xe0,0x00,0xe0,0x09,0x01,0x09,0xe0 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x0e,0x81,0x80,0x81,0x0e,0x00,0x07, + 0x08,0x08,0x08,0x87,0x00,0x00,0x50,0x1f,0x50,0x00,0x00,0x8f,0x08,0x08, + 0x08,0x88,0x00,0x0f,0x80,0x80,0x80,0x0f,0x00,0x8f,0x50,0x50,0x50,0x8f + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x3f,0x40,0x50,0x20,0xdf,0x00,0x30, + 0x40,0x40,0x40,0x3f,0x00,0x7e,0x81,0x81,0x81,0x7e,0x00,0x07,0x18,0x60, + 0x18,0x07,0x00,0x3f,0x40,0x40,0x40,0x21,0x00,0x1f,0xa0,0x60,0x20,0x10}}; + static const char PROGMEM base0_L_turf_altgr[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x10,0x10,0x10,0x30,0x00,0x00,0xf0, + 0x08,0xe8,0xa8,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x0c,0x1e,0xfe,0x02,0xfe,0x00,0x70,0x8a,0x89,0x8a,0x70 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x00,0x10,0x20,0x40,0x00,0x00,0xc1, + 0x12,0x0a,0x12,0xc2,0x00,0x00,0x10,0xc8,0x10,0x00,0x00,0x40,0xe0,0x50, + 0x10,0x20,0x00,0x00,0x50,0x48,0x50,0x80,0x00,0xc0,0x10,0x08,0x10,0xc0 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x00,0x03, + 0x04,0x04,0x02,0x07,0x00,0x00,0x00,0x07,0x00,0x00,0x00,0x01,0x83,0x05, + 0x04,0x82,0x00,0x02,0x05,0x05,0x05,0x07,0x00,0x83,0x84,0x04,0x82,0x87 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x00,0x3e,0x3e,0x3e,0x00,0x08,0x14, + 0x22,0x08,0x14,0x22,0x00,0x22,0x14,0x08,0x22,0x14,0x08,0x03,0x02,0x00, + 0x03,0x02,0x00,0x1c,0x22,0x7f,0x22,0x22,0x00,0x02,0x01,0x00,0x02,0x01}}; + static const char PROGMEM base0_L_turf_shfgr[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x90,0x90,0xfc,0x90,0x90,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x0a,0x09,0x0a,0xf0 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x00,0x88,0x90,0xa0,0x00,0x00,0xc0, + 0x10,0x08,0x10,0xc0,0x00,0x00,0x50,0xc8,0x50,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x80,0x50,0x48,0x50,0x80,0x00,0xc1,0x12,0x0a,0x12,0xc1 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x00,0x8f,0x4f,0x8f,0x00,0x00,0x0f, + 0x10,0x10,0x90,0x0f,0x00,0x80,0x10,0x1f,0x10,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x1f,0x82,0x82,0x82,0x1f,0x00,0x0f,0x10,0x10,0x10,0x0f + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x00,0x7c,0x7d,0x7c,0x00,0x00,0x04, + 0x0a,0x11,0x20,0x00,0x00,0x20,0x11,0x0a,0x04,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x1f,0x24,0x2a,0x20,0x1f,0x00,0x00,0x00,0x00,0x00,0x00}}; + static const char PROGMEM base0_R_turf_nomod[4][42] = { + { 0x70,0x88,0x88,0x48,0xff,0x00,0xf8,0x10,0x08,0x08,0x10,0x00,0xf8,0x08, + 0x08,0x08,0xf0,0x00,0xff,0x10,0x08,0x08,0xf0,0x00,0xf8,0x90,0x88,0x88, + 0x70,0x00,0x10,0x28,0x44,0x82,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0x40,0xf8,0x40,0x40,0x00,0x00,0xf8,0x00,0x80,0x40,0x00,0x00,0xc0,0x40, + 0xc0,0x40,0x80,0x00,0x08,0xf8,0x00,0x00,0x00,0x00,0xc3,0x00,0x00,0x00, + 0xc0,0x00,0x80,0x40,0x40,0x40,0x00,0x00,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x00,0x03,0x04,0x04,0x00,0x00,0x07,0x01,0x01,0x02,0x04,0x00,0xc7,0x00, + 0x07,0x00,0x07,0x00,0x00,0x03,0x04,0x04,0x00,0x00,0x03,0x14,0x14,0x12, + 0x0f,0x00,0x04,0x15,0x0d,0x05,0x02,0x00,0x00,0x00,0x73,0x39,0x00,0x00 + },{ 0x22,0x32,0x2a,0x26,0x22,0x00,0x24,0x2a,0x2a,0x2a,0x10,0x00,0x3f,0x24, + 0x22,0x22,0x1c,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0xb0,0x70,0x00, + 0x00,0x00,0x1e,0x20,0x1c,0x20,0x1e,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM base0_R_turf_shift[4][42] = { + { 0xfe,0x02,0x02,0x02,0xfc,0x00,0xfe,0x12,0x12,0x32,0xcc,0x00,0xfe,0x0c, + 0x30,0xc0,0xfe,0x00,0xfe,0x10,0x10,0x10,0xfe,0x00,0xfe,0x12,0x12,0x12, + 0x0c,0x00,0x82,0x44,0x28,0x10,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0x11,0x11,0xf1,0x11,0x10,0x00,0xf1,0x80,0x40,0x20,0x11,0x00,0xf1,0x20, + 0xc0,0x20,0xf1,0x00,0xf1,0x00,0x00,0x00,0x01,0x00,0x31,0x40,0x80,0x40, + 0x30,0x00,0x30,0x48,0x48,0x48,0x90,0x00,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x80,0x80,0x8f,0x80,0x80,0x00,0x0f,0x80,0x81,0x82,0x0c,0x00,0x8f,0x80, + 0x80,0x80,0x0f,0x00,0x0f,0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x0f,0x00, + 0x00,0x00,0x82,0x14,0x0c,0x04,0x83,0x00,0x00,0x00,0x73,0x39,0x00,0x00 + },{ 0x70,0x48,0x44,0x42,0x41,0x00,0x23,0x44,0x44,0x44,0x39,0x00,0x7f,0x44, + 0x44,0x44,0x3b,0x00,0x00,0x36,0x36,0x00,0x00,0x00,0x00,0xb6,0x76,0x00, + 0x00,0x00,0x1f,0x60,0x1c,0x60,0x1f,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM base0_R_turf_altgr[4][42] = { + { 0x53,0x54,0xf8,0x54,0x53,0x00,0x7c,0xba,0x8a,0x8a,0x7c,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x0c,0x12,0x12,0x0c,0x00,0x00,0x20,0xfc,0x22,0x02, + 0x84,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0x80,0x80,0xf1,0xa0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00, + 0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x20,0x11,0x01, + 0x00,0x00,0x40,0xf0,0x41,0xf0,0x40,0x00,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x02,0x01,0x0f,0x08,0x08,0x06,0x83,0x40,0x40,0x40,0x00,0x00,0x0f,0x02, + 0x04,0x04,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x07,0x01,0x07,0x01,0x00,0x00,0x00,0x73,0x39,0x00,0x00 + },{ 0x00,0x00,0x00,0x00,0x00,0x00,0x47,0x4a,0x4a,0x3c,0x00,0x00,0x11,0x0a, + 0x04,0x0a,0x11,0x00,0x04,0x04,0x15,0x04,0x04,0x00,0x00,0x00,0x04,0x00, + 0x00,0x00,0x04,0x02,0x04,0x08,0x04,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM base0_R_turf_shfgr[4][42] = { + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0xef,0x00,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xa0,0x90,0x88, + 0x00,0x00,0x00,0x90,0xa1,0x90,0x00,0x00,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x0f,0x0f, + 0x00,0x00,0x00,0x0f,0x0f,0x0f,0x00,0x00,0x00,0x00,0x73,0x39,0x00,0x00 + },{ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c,0x7d,0x7c, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM symb5_R_turf_nomod[4][42] = { + { 0x20,0x20,0xf8,0x20,0x20,0x00,0x00,0xc0,0x30,0x0c,0x03,0x00,0x20,0x20, + 0x20,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0x80,0x00,0xc0,0x00,0x80,0x00,0x43,0x20,0x20,0x20,0xc0,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x02,0x81,0x47,0x81,0x02,0x00,0x00,0x00,0x0a,0x01,0x00,0x00,0x04,0x04, + 0x04,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x39,0x00,0x00 + },{ 0x22,0xf3,0x0a,0xf3,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM symb5_R_turf_altgr[4][42] = { + { 0x10,0x10,0x10,0x30,0x00,0x00,0x03,0x0c,0x30,0xc0,0x00,0x00,0x00,0x00, + 0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0x80,0x80,0xe0,0x80,0x80,0x00,0x00,0x00,0xa0,0x00,0x03,0x00,0x00,0x00, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x04,0x84,0x47,0x84,0x04,0x00,0x06,0x09,0x08,0x08,0x04,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x39,0x00,0x00 + },{ 0x22,0xf3,0x0a,0xf3,0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM numb6_L_turf_nomod[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20, + 0x50,0x88,0x04,0x00,0x00,0x04,0x04,0xc4,0x34,0x0c,0x00,0xd8,0x24,0x24, + 0x24,0xd8,0x00,0x18,0x24,0x24,0x24,0xf8,0x00,0xf8,0x44,0x24,0x14,0xf8 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x01,0x00,0x00,0x00,0x80,0x41,0xe0,0x00,0x00,0xe0,0xa1,0xa1, + 0xa1,0x20,0x00,0xc0,0xa1,0xa1,0xa1,0x00,0x00,0x00,0x01,0x01,0x01,0x00 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x03,0x02,0x02,0x0f,0x02,0x00,0x04,0x08,0x08, + 0x08,0x07,0x00,0x07,0x08,0x08,0x08,0x07,0x00,0x00,0x00,0x00,0x00,0x00 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41, + 0x22,0x14,0x08,0x00,0x00,0x00,0x04,0x02,0x7f,0x00,0x00,0x42,0x61,0x51, + 0x49,0x46,0x00,0x22,0x41,0x49,0x49,0x36,0x00,0x5e,0x61,0x01,0x61,0x5e}}; + static const char PROGMEM numb6_L_turf_shift[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04, + 0x88,0x50,0x20,0x00,0x00,0x00,0x00,0x0e,0x00,0x00,0x00,0x00,0x38,0xc6, + 0x01,0x00,0x00,0x00,0x01,0xc6,0x38,0x00,0x00,0x50,0x50,0x50,0x50,0x50 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x00,0x00,0x00,0x00,0x00,0x60,0x90,0xf8,0x90,0x20,0x00,0x20,0x50,0x20, + 0x81,0x60,0x00,0x70,0x89,0x48,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x02,0x04,0x8f,0x04,0x03,0x00,0x0c,0x82,0x09, + 0x94,0x08,0x00,0x07,0x08,0x89,0x06,0x09,0x00,0x00,0x00,0x00,0x00,0x00 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41, + 0x22,0x14,0x08,0x00,0x00,0x00,0x00,0x5f,0x00,0x00,0x00,0x00,0x03,0x00, + 0x03,0x00,0x00,0x02,0x01,0x00,0x01,0x02,0x00,0x5e,0x61,0x01,0x61,0x5e}}; + static const char PROGMEM numb6_L_turf_altgr[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xff,0x00,0x00,0x00,0x10,0x10,0xee,0x01,0x01,0x00,0x00,0xff,0x01, + 0x01,0x00,0x00,0x00,0x01,0x01,0xff,0x00,0x00,0x01,0x01,0xee,0x10,0x10 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x00,0x00,0x00,0x10,0xf8,0x00,0x01,0x01,0x00,0x10,0xf9,0x01, + 0x01,0x00,0x00,0x88,0xa9,0x51,0x01,0x00,0x00,0x01,0x01,0x00,0x00,0x00 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x08,0x8c,0x0a,0x1f,0x00,0x00,0x00,0x90, + 0x90,0x10,0x00,0x00,0x08,0x0c,0x0a,0x1f,0x00,0x00,0x00,0x00,0x00,0x00 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x7b,0x00,0x00,0x00,0x00,0x09,0x0f,0x08,0x00,0x00,0x00,0x09,0x0c, + 0x0a,0x09,0x00,0x14,0x7f,0x14,0x7f,0x14,0x00,0x5e,0x61,0x01,0x61,0x5e}}; + static const char PROGMEM numb6_L_turf_shfgr[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xef,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x90,0xfc, + 0x90,0x90,0x00,0x06,0x09,0x09,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x88,0xa8,0x50, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x0a, + 0x15,0x0a,0x00,0x40,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x7b,0x00,0x00,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x04,0x05,0x05,0x02,0x00,0x00,0x5e,0x61,0x01,0x61,0x5e}}; + // QWERTY + static const char PROGMEM base0_L_qwer_nomod[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x00,0x04,0x08,0x10,0x00,0x00,0x70, + 0x88,0x88,0x48,0xf8,0x00,0x78,0x80,0x70,0x80,0x78,0x00,0x70,0xa8,0xa8, + 0xa8,0xb0,0x00,0xf8,0x10,0x08,0x08,0x10,0x00,0x08,0x7f,0x88,0x88,0x00 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x18,0x60,0x80,0x00,0x00,0x00,0x00, + 0x40,0x40,0x40,0x83,0x00,0x80,0x40,0x40,0x40,0x00,0x00,0x80,0x40,0x40, + 0x40,0xf8,0x00,0x00,0xf0,0x48,0x48,0x00,0x00,0x80,0x40,0x40,0x40,0xc0 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x00,0xc0,0x41,0x46,0x18,0x00,0x02, + 0x05,0x05,0x05,0x07,0x00,0x04,0x05,0x05,0x05,0x02,0x00,0x03,0x04,0x04, + 0x02,0x07,0x00,0x00,0x07,0x00,0x00,0x00,0x00,0xc3,0x14,0x14,0x12,0x0f + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x00,0xff,0x80,0x80,0x00,0x00,0x22, + 0x32,0x2a,0x26,0x22,0x00,0x22,0x14,0x08,0x14,0x22,0x00,0x1c,0x22,0x22, + 0x22,0x22,0x00,0x06,0x18,0x20,0x18,0x06,0x00,0x3f,0x24,0x22,0x22,0x1c}}; + static const char PROGMEM base0_L_qwer_shift[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x20,0x10,0x20,0x40,0x20,0x00,0xfc, + 0x02,0x42,0x82,0x7c,0x00,0x7e,0x80,0x70,0x80,0x7e,0x00,0xfe,0x12,0x12, + 0x12,0x02,0x00,0xfe,0x12,0x12,0x32,0xcc,0x00,0x02,0x02,0xfe,0x02,0x02 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x00,0x00,0xe0, + 0x91,0x91,0x90,0xe3,0x00,0x60,0x91,0x90,0x91,0x20,0x00,0xf1,0x11,0x11, + 0x11,0xe1,0x00,0xf1,0x90,0x90,0x90,0x11,0x00,0xe0,0x10,0x91,0x90,0xa0 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x00,0x00,0x9f,0x40,0x40,0x00,0x8f, + 0x80,0x80,0x80,0x8f,0x00,0x84,0x08,0x08,0x08,0x87,0x00,0x0f,0x88,0x88, + 0x88,0x07,0x00,0x8f,0x00,0x00,0x00,0x80,0x00,0x87,0x88,0x88,0x88,0x07 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x04,0x04,0x7b,0x80,0x80,0x00,0x70, + 0x48,0x44,0x42,0x41,0x00,0x71,0x0a,0x04,0x0a,0x71,0x00,0x3f,0x40,0x40, + 0x40,0x21,0x00,0x07,0x18,0x60,0x18,0x07,0x00,0x7f,0x44,0x44,0x44,0x3b}}; + static const char PROGMEM base0_R_qwer_nomod[4][42] = { + { 0x78,0x80,0x80,0x40,0xf8,0x00,0x78,0x80,0x80,0x40,0xf8,0x00,0x00,0x08, + 0xfa,0x80,0x00,0x00,0x70,0x88,0x88,0x88,0x70,0x00,0xf8,0x90,0x88,0x88, + 0x70,0x00,0x10,0x28,0x44,0x82,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0xf8,0x82,0x42,0x42,0x81,0x00,0x00,0x00,0x40,0xd0,0x00,0x00,0xf8,0x00, + 0x80,0x40,0x00,0x00,0x08,0xf8,0x00,0x00,0x00,0x00,0x03,0xc0,0xc0,0x00, + 0x00,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x07,0x00,0x00,0x00,0x07,0x00,0x00,0x10,0x10,0x0f,0x00,0x00,0x07,0x01, + 0x01,0x02,0x04,0x00,0x00,0x03,0x04,0x04,0x00,0x00,0x00,0x16,0x0e,0x00, + 0xc0,0x00,0x00,0x40,0x40,0xc0,0x00,0x00,0x00,0x00,0x73,0x39,0x00,0x00 + },{ 0x3e,0x02,0x02,0x02,0x3c,0x00,0x3e,0x02,0x3e,0x02,0x3c,0x00,0x00,0xb0, + 0x70,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0xc0,0x30,0x0c,0x03, + 0x00,0x00,0x00,0x80,0x80,0xff,0x00,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM base0_R_qwer_shift[4][42] = { + { 0x06,0x08,0xf0,0x08,0x06,0x00,0xfe,0x00,0x00,0x00,0xfe,0x00,0x00,0x02, + 0xfe,0x02,0x00,0x00,0xfc,0x02,0x02,0x02,0xfc,0x00,0xfe,0x12,0x12,0x12, + 0x0c,0x00,0x82,0x44,0x28,0x10,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0xf0,0x80,0x81,0x80,0xf0,0x00,0x00,0x01,0x01,0x01,0xf0,0x00,0xf0,0x81, + 0x41,0x21,0x10,0x00,0xf0,0x01,0x01,0x01,0x00,0x00,0x01,0xc0,0xc0,0x00, + 0x00,0x00,0x00,0x70,0x00,0x70,0x00,0x00,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x8f,0x00,0x00,0x00,0x8f,0x00,0x86,0x08,0x08,0x08,0x87,0x00,0x0f,0x00, + 0x01,0x82,0x0c,0x00,0x8f,0x08,0x08,0x08,0x08,0x00,0x00,0x86,0x86,0x80, + 0x00,0x00,0x00,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x73,0x39,0x00,0x00 + },{ 0x7f,0x03,0x0c,0x30,0x7f,0x00,0x7f,0x01,0x06,0x01,0x7f,0x00,0x04,0x0a, + 0x11,0x20,0x00,0x00,0x20,0x11,0x0a,0x04,0x00,0x00,0x01,0x00,0x28,0x04, + 0x03,0x00,0x00,0x80,0x80,0x7b,0x04,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM symb5_R_qwer[4][42] = { + { 0x00,0x04,0x08,0x10,0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x00,0x50,0x50, + 0x50,0x50,0x50,0x00,0x10,0x10,0xee,0x01,0x01,0x00,0x01,0x01,0xee,0x10, + 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xc0,0x00,0x00,0x00,0x00,0xf8,0x09,0x0a,0x02,0x00,0x02,0x0a,0x09,0xf8, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x01,0x80,0x41,0x82,0x01,0x00,0x04,0x04,0x84,0x44,0x04,0x00,0x01,0x41, + 0x87,0x01,0x01,0x00,0xc0,0x1f,0x10,0x10,0x00,0x00,0x00,0x10,0xd0,0x1f, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x39,0x00,0x00 + },{ 0x22,0xf3,0x0a,0xf3,0x22,0x00,0x00,0x1e,0x61,0x80,0x00,0x00,0x00,0x80, + 0x61,0x1e,0x00,0x00,0x00,0x03,0x0c,0x30,0xc0,0x00,0x00,0x00,0xff,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM numb6_L_qwer_nomod[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20, + 0x50,0x88,0x04,0x00,0x00,0x04,0x04,0xc4,0x34,0x0c,0x00,0xd8,0x24,0x24, + 0x24,0xd8,0x00,0x18,0x24,0x24,0x24,0xf8,0x00,0xf8,0x44,0x24,0x14,0xf8 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x70,0x00,0x71,0x00,0x00,0x00,0x80,0x41,0xe0,0x00,0x00,0xe0,0xa1,0xa1, + 0xa1,0x20,0x00,0xc0,0xa1,0xa1,0xa1,0x00,0x00,0x00,0x01,0x71,0x01,0x00 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x03,0x02,0x02,0x0f,0x02,0x00,0x04,0x08,0x08, + 0x08,0x07,0x00,0x07,0x08,0x08,0x08,0x07,0x00,0x00,0x00,0x00,0x00,0x00 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41, + 0x22,0x14,0x08,0x00,0x00,0x00,0x04,0x02,0x7f,0x00,0x00,0x42,0x61,0x51, + 0x49,0x46,0x00,0x22,0x41,0x49,0x49,0x36,0x00,0x5e,0x61,0x01,0x61,0x5e}}; + static const char PROGMEM numb6_L_qwer_shift[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xd8,0x24,0x54,0x88,0x40,0x00,0x50,0x20,0xf8, + 0x20,0x50,0x00,0x00,0x38,0xc6,0x01,0x00,0x00,0x00,0x01,0xc6,0x38,0x00 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x70,0x00,0x70,0x00,0x00,0x60,0x91,0xf9,0x90,0x21,0x00,0x20,0x50,0x20, + 0x80,0x60,0x00,0x40,0x20,0x10,0x21,0x40,0x00,0x00,0x71,0x00,0x70,0x00 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x02,0x04,0x8f,0x04,0x03,0x00,0x0c,0x02,0x09, + 0x14,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x5f,0x00,0x00,0x00,0x3e,0x41,0x5d, + 0x55,0x5e,0x00,0x14,0x7f,0x14,0x7f,0x14,0x00,0x00,0x00,0x00,0x00,0x00}}; + + // UNIVERSAL + static const char PROGMEM char1_L[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xe2,0xae,0x42,0x00,0x00,0x20,0x44,0x40,0x4c,0x20,0x00,0x12,0xa4,0x88, + 0xa4,0x12,0x00,0x08,0xf8,0x08,0xf8,0x08,0x00,0x78,0x80,0x80,0x80,0x78 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80, + 0x41,0x40,0x41,0x80,0x00,0x80,0x40,0x40,0x40,0x80,0x00,0x81,0x40,0x40, + 0x40,0x81,0x00,0xc0,0x00,0xc0,0x00,0xc0,0x00,0x00,0xc0,0x00,0x00,0x00 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x83, + 0xc4,0x84,0xc2,0x07,0x00,0x03,0x04,0x04,0x04,0x03,0x00,0x02,0x85,0x05, + 0x04,0x82,0x00,0x03,0x04,0x1f,0x04,0x03,0x00,0x80,0x83,0x84,0x82,0x80 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7f, + 0xc4,0x44,0xef,0x3b,0x00,0x3e,0x49,0x49,0x49,0x3e,0x00,0x02,0x7f,0x09, + 0x09,0x78,0x00,0x3e,0x08,0x08,0x14,0x22,0x00,0x20,0x24,0x24,0x24,0x20}}; + static const char PROGMEM char1_R[4][42] = { + { 0x70,0x88,0xf0,0x88,0x70,0x00,0xfe,0x02,0x02,0x02,0x06,0x00,0x88,0x48, + 0x70,0x90,0x88,0x00,0xf0,0x88,0x88,0x88,0x70,0x00,0xc0,0x30,0x0c,0x30, + 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0xa0,0x50,0x53,0x90,0x20,0x00,0xc0,0x80,0x40,0x40,0x80,0x00,0x40,0x40, + 0xc0,0x40,0x40,0x00,0xc3,0x00,0x00,0x00,0xc0,0x00,0x80,0x40,0xc0,0x40, + 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x03,0x84,0x84,0x04,0x03,0x00,0x07,0x00,0x00,0x00,0x1f,0x00,0x00,0x80, + 0x83,0x84,0x00,0x00,0x00,0x83,0x54,0x8b,0x00,0x00,0x83,0x84,0x84,0x83, + 0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x39,0x00,0x00 + },{ 0xff,0x24,0x24,0x27,0x18,0x00,0x7e,0x10,0x20,0x20,0x1e,0x00,0x2f,0x30, + 0x00,0x30,0x2f,0x00,0xe0,0x38,0x25,0x38,0xe0,0x00,0x18,0x26,0xa1,0xa0, + 0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM game2_L[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7c, + 0x82,0xa2,0x42,0xbc,0x00,0x3e,0xc0,0x30,0xc0,0x3e,0x00,0xfe,0x92,0x92, + 0x92,0x82,0x00,0xfe,0x12,0x12,0x32,0xcc,0x00,0x02,0x02,0xfe,0x02,0x02 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0x00,0x40,0x40,0x40,0x40,0xe0,0x00,0xe0, + 0x90,0x90,0x90,0xe1,0x00,0x60,0x90,0x90,0x90,0x20,0x00,0xf0,0x10,0x10, + 0x10,0xe0,0x00,0xf0,0x90,0x90,0x90,0x10,0x00,0xe0,0x10,0x90,0x90,0xa0 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x00,0x07,0x02,0x02,0x02,0x02,0x00,0x87, + 0x80,0x80,0x80,0x87,0x00,0x82,0x04,0x04,0x04,0x83,0x00,0x07,0x84,0x84, + 0x84,0x03,0x00,0x87,0x00,0x00,0x00,0x80,0x00,0x83,0x84,0x84,0x84,0x03 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x08,0x3c,0x02,0x3c,0x08,0x00,0x30, + 0x28,0x24,0x22,0x21,0x00,0x31,0x0a,0x04,0x0a,0x31,0x00,0x1f,0x20,0x20, + 0x20,0x11,0x00,0x03,0x0c,0x30,0x0c,0x03,0x00,0x3f,0x24,0x24,0x24,0x1b}}; + static const char PROGMEM medi3_R_nomod[4][42] = { + { 0x03,0x0c,0xb0,0x0c,0x03,0x00,0x3f,0x02,0x9c,0x02,0x3f,0x00,0x3f,0x04, + 0x84,0x04,0x3f,0x00,0x22,0x25,0xa5,0x25,0x18,0x00,0x3f,0x25,0xa5,0x25, + 0x1a,0x00,0x00,0xe0,0x8f,0x02,0x31,0x49,0xfa,0x00,0xe7,0x73,0x00,0x00 + },{ 0xc0,0x01,0x73,0x01,0xc0,0x00,0xf0,0x81,0xc3,0xe1,0xf0,0x00,0x00,0x71, + 0x03,0x71,0x00,0x00,0x00,0xc1,0xc3,0xc1,0x00,0x00,0xf0,0xe1,0xc3,0x81, + 0xf0,0x00,0x00,0x03,0xe2,0x21,0xe0,0x21,0xc0,0x00,0x9c,0xce,0x00,0x00 + },{ 0x01,0x02,0x02,0x02,0x01,0x00,0x07,0x00,0x01,0x03,0x87,0x00,0x00,0x1f, + 0x0e,0x04,0x80,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x07,0x03,0x01,0x00, + 0x87,0x00,0x00,0x40,0xa6,0xa8,0x08,0x04,0x8e,0x00,0x73,0x39,0x00,0x00 + },{ 0x3e,0x31,0x01,0x31,0x3e,0x00,0x00,0x46,0x46,0x4f,0x1f,0x00,0x00,0xa6, + 0x46,0xaf,0x1f,0x00,0x28,0x2c,0x2e,0x2c,0x28,0x00,0x00,0x46,0xe6,0x4f, + 0x1f,0x00,0x00,0x02,0x72,0x8a,0x89,0x00,0x1e,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM medi3_R_shift[4][42] = { + { 0x03,0x0c,0x30,0x0c,0x03,0x00,0x3f,0x02,0x1c,0x02,0x3f,0x00,0x3f,0x04, + 0x04,0x04,0x3f,0x00,0x22,0x25,0x25,0x25,0x18,0x00,0x3f,0x25,0x25,0x25, + 0x1a,0x00,0x00,0xe0,0x8f,0x02,0x31,0x49,0xfa,0x00,0xe7,0x73,0x00,0x00 + },{ 0xc0,0x01,0x71,0x01,0xc0,0x00,0xf0,0x81,0xc1,0xe1,0xf0,0x00,0x00,0x71, + 0x01,0x71,0x00,0x00,0x00,0xc1,0xc1,0xc1,0x00,0x00,0xf0,0xe1,0xc1,0x81, + 0xf0,0x00,0x00,0x03,0xe2,0x21,0xe0,0x21,0xc0,0x00,0x9c,0xce,0x00,0x00 + },{ 0x01,0x02,0x02,0x02,0x01,0x00,0x07,0x00,0x01,0x03,0x87,0x00,0x00,0x1f, + 0x0e,0x04,0x80,0x00,0x00,0x03,0x03,0x03,0x00,0x00,0x07,0x03,0x01,0x00, + 0x87,0x00,0x00,0x40,0xa6,0xa8,0x08,0x04,0x8e,0x00,0x73,0x39,0x00,0x00 + },{ 0x3e,0x31,0x01,0x31,0x3e,0x00,0x00,0x46,0x46,0x4f,0x1f,0x00,0x00,0xa6, + 0x46,0xaf,0x1f,0x00,0x28,0x2c,0x2e,0x2c,0x28,0x00,0x00,0x46,0xe6,0x4f, + 0x1f,0x00,0x00,0x02,0x72,0x8a,0x89,0x00,0x1e,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM navi4_R[4][42] = { + { 0xe0,0x10,0x54,0x38,0x10,0x00,0xfc,0x24,0x24,0x24,0x18,0x00,0x0c,0x10, + 0xe0,0x10,0x0c,0x00,0x8c,0x50,0x20,0x50,0x8c,0x00,0xc0,0xbe,0xa2,0xbe, + 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0x80,0xc1,0xa1,0x81,0x00,0x00,0x01,0x80,0x40,0x20,0x00,0x00,0x00,0x00, + 0xf1,0x00,0x00,0x00,0x41,0x20,0xd0,0x20,0x41,0x00,0x01,0x21,0x41,0x81, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x00,0x49,0x4a,0x48,0x87,0x00,0x81,0x82,0x85,0x89,0x01,0x00,0x01,0x02, + 0x85,0x02,0x01,0x00,0x40,0x40,0x47,0x40,0x40,0x00,0x81,0x09,0x05,0x02, + 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x73,0x39,0x00,0x00 + },{ 0x12,0x65,0x85,0x65,0x17,0x00,0x07,0x01,0x06,0x18,0x60,0x00,0x88,0x90, + 0xaf,0x90,0x88,0x00,0x04,0x02,0x7d,0x02,0x04,0x00,0x01,0x46,0x58,0x60, + 0x78,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + static const char PROGMEM func7_L[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0xff,0x09,0xe9,0xc9,0x01,0x00,0xe0,0x00, + 0x10,0x08,0xfc,0x00,0x00,0x08,0x84,0x44,0x24,0x18,0x00,0x88,0x04,0x24, + 0x24,0xd8,0x00,0x60,0x50,0x48,0xfc,0x40,0x00,0x70,0x80,0x9c,0x80,0x70 + },{ 0x00,0x00,0xce,0x9c,0x00,0xf0,0x00,0x00,0x9f,0x00,0x03,0x0c,0x1f,0x00, + 0xe0,0xa0,0xa1,0x20,0x00,0xc1,0xa1,0xa1,0xa1,0x01,0x00,0x20,0x21,0x21, + 0xa1,0x60,0x00,0xc0,0x20,0x20,0x21,0xc0,0x00,0x40,0xe0,0x50,0x40,0x80 + },{ 0x00,0x00,0x39,0x73,0x00,0xef,0x02,0x83,0xe4,0x00,0x0e,0x15,0x16,0x00, + 0x04,0x08,0x08,0x07,0x00,0x07,0x48,0xc8,0x08,0x07,0x00,0x00,0x40,0xce, + 0x01,0x00,0x00,0x06,0x49,0xc9,0x09,0x06,0x00,0x06,0x08,0x49,0x08,0x07 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x05,0x04,0x03,0x90,0xa8,0xa8,0x40,0x06, + 0x49,0x49,0x49,0x3e,0x00,0x7c,0xa2,0x93,0x8a,0x7c,0x00,0x00,0x08,0x07, + 0xfe,0x00,0x00,0x84,0xc2,0xa3,0x92,0x8c,0x00,0x70,0x38,0x0d,0x38,0x70}}; + static const char PROGMEM mous8_L[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x3c,0x84,0xbc,0x84,0x38,0x00,0x00,0x00,0x10, + 0x28,0x92,0xc5,0x82,0x00,0xfe,0x1f,0x1f,0x01,0xfe,0x00,0xfe,0x01,0x19, + 0x01,0xfe,0x00,0xfe,0x01,0x1f,0x1f,0xfe,0x00,0x10,0x38,0x92,0xc7,0x82 + },{ 0x00,0x00,0xce,0x9c,0x00,0xe7,0x08,0x08,0x08,0xe7,0x00,0x00,0x00,0x00, + 0x00,0x80,0x01,0x00,0x00,0x01,0x01,0x81,0x01,0x01,0x00,0x01,0x01,0x81, + 0x01,0x01,0x00,0x01,0x01,0x81,0x01,0x01,0x00,0x60,0x50,0xf8,0x41,0x00 + },{ 0x00,0x00,0x39,0x73,0x00,0x91,0xaa,0xaa,0xa9,0x43,0x00,0x00,0x00,0x02, + 0x07,0xca,0x02,0x02,0x00,0x02,0x01,0xcf,0x01,0x02,0x00,0x02,0x04,0x0f, + 0x04,0x02,0x00,0x02,0x02,0xca,0x07,0x02,0x00,0xdc,0x58,0x5c,0x18,0x1f + },{ 0x00,0x00,0xe7,0xce,0x00,0x1c,0x2a,0x2a,0x2a,0x2c,0x00,0x00,0x00,0x0c, + 0x33,0xc0,0x00,0x00,0x00,0x0c,0x03,0x00,0x03,0x0c,0x00,0x0c,0x30,0xc0, + 0x30,0x0c,0x00,0x00,0x00,0xc0,0x33,0x0c,0x00,0xe5,0xc9,0xe6,0xc0,0xf8}}; + static const char PROGMEM musi9_L[4][42] = { + { 0x00,0x00,0x73,0xe7,0x00,0x00,0x00,0x00,0x00,0xfe,0x04,0x18,0x04,0xfe, + 0x00,0x00,0xfe,0x00,0x00,0x00,0xfe,0x00,0x8c,0x12,0x12,0x12,0xe4,0x00, + 0x00,0x02,0xfe,0x02,0x00,0x00,0xfc,0x02,0x02,0x02,0x84,0x00,0x00,0x00 + },{ 0x00,0x00,0xce,0x9c,0x00,0x00,0xc0,0xe0,0xf0,0xf9,0xf8,0xf8,0xf8,0xf9, + 0xf0,0xe0,0xc0,0x01,0x01,0x01,0x00,0xf0,0xf0,0x01,0x01,0xf1,0xf0,0x00, + 0x00,0x01,0x01,0x01,0x00,0x00,0xf8,0xf1,0xe1,0xc1,0x80,0x00,0x00,0x00 + },{ 0x00,0x00,0x39,0x73,0x00,0x00,0x07,0x0f,0x1f,0x3f,0x3f,0x3f,0x3f,0x3f, + 0x1f,0x0f,0x07,0x00,0x00,0x00,0x00,0x1f,0x1f,0x00,0x00,0x1f,0x1f,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00,0x00 + },{ 0x00,0x00,0xe7,0xce,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x08, + 0xf8,0x08,0xf0,0x00,0x70,0x88,0x88,0x88,0x70,0x00,0x70,0x88,0x88,0x48, + 0xff,0x00,0x70,0xa8,0xa8,0xa8,0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}; + static const char PROGMEM musi9_R[4][42] = { + { 0x00,0x00,0x00,0xfe,0x04,0x18,0x04,0xfe,0x00,0x00,0xfe,0x00,0x00,0x00, + 0xfe,0x00,0x8c,0x12,0x12,0x12,0xe4,0x00,0x00,0x02,0xfe,0x02,0x00,0x00, + 0xfc,0x02,0x02,0x02,0x84,0x00,0x00,0x00,0x00,0x00,0xe7,0x73,0x00,0x00 + },{ 0x00,0x00,0x00,0x81,0x60,0x10,0x60,0x81,0x60,0x10,0x00,0x01,0x01,0x01, + 0xe0,0xe0,0x60,0x61,0x61,0x61,0x60,0xf8,0x70,0x21,0x01,0x01,0xc0,0xe0, + 0x60,0x01,0xf9,0xf9,0x00,0x60,0xe0,0xc0,0x00,0x00,0x9c,0xce,0x00,0x00 + },{ 0x18,0x24,0x4b,0x48,0x48,0x4c,0x4b,0x48,0x4b,0x2c,0x18,0x00,0x00,0x00, + 0x4f,0xe7,0xf0,0x60,0x60,0x60,0x60,0x60,0x7e,0x7f,0x00,0x0f,0x3f,0x70, + 0x60,0xc0,0xc1,0xc1,0xc0,0x60,0x70,0x3f,0x0f,0x00,0x73,0x39,0x00,0x00 + },{ 0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x08,0xf8,0x08,0xf0,0x00,0x70,0x88, + 0x88,0x88,0x71,0x00,0x70,0x88,0x88,0x48,0xff,0x00,0x70,0xa8,0xa8,0xa8, + 0xb0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xce,0xe7,0x00,0x00}}; + uint8_t this_layout = userspace_config.layout % 3; + + // Render the requested image on the given column and row + // Don't grab highest layer; instead compare from top to bottom. + // Highest layer might be on the other side + if (isLeft) { + if (layer_state_cmp(layer_state, _MUSI)) { + draw_image(row, col, musi9_L); + } else if (layer_state_cmp(layer_state, _MOUS)) { + draw_image(row, col, mous8_L); + } else if (layer_state_cmp(layer_state, _FUNC)) { + draw_image(row, col, func7_L); + } else if (layer_state_cmp(layer_state, _NUMB)) { + switch (this_layout) { + case 0: // Dvorak + if (mods & MOD_MASK_SHIFT) { + draw_image(row, col, numb6_L_dvor_shift); + } else { + draw_image(row, col, numb6_L_dvor_nomod); + } + break; + case 1: // Turkish F + if ((mods & MOD_MASK_SHIFT) && (mods & MOD_BIT(KC_RALT))) { + // Shift + AltGr + draw_image(row, col, numb6_L_turf_shfgr); + } else if (mods & MOD_MASK_SHIFT) { + // Shift + draw_image(row, col, numb6_L_turf_shift); + } else if (mods & MOD_BIT(KC_RALT)) { + // AltGr + draw_image(row, col, numb6_L_turf_altgr); + } else { + // Normal + draw_image(row, col, numb6_L_turf_nomod); + } + break; + case 2: // Qwerty + if (mods & MOD_MASK_SHIFT) { + draw_image(row, col, numb6_L_qwer_shift); + } else { + draw_image(row, col, numb6_L_qwer_nomod); + } + break; + } + } else if (layer_state_cmp(layer_state, _GAME)) { + draw_image(row, col, game2_L); + } else if (layer_state_cmp(layer_state, _CHAR)) { + draw_image(row, col, char1_L); + } else { + switch (this_layout) { + case 0: // Dvorak + if (mods & MOD_MASK_SHIFT) { + draw_image(row, col, base0_L_dvor_shift); + } else { + draw_image(row, col, base0_L_dvor_nomod); + } + break; + case 1: // Turkish F + if ((mods & MOD_MASK_SHIFT) && (mods & MOD_BIT(KC_RALT))) { + // Shift + AltGr + draw_image(row, col, base0_L_turf_shfgr); + } else if (mods & MOD_MASK_SHIFT) { + // Shift + draw_image(row, col, base0_L_turf_shift); + } else if (mods & MOD_BIT(KC_RALT)) { + // AltGr + draw_image(row, col, base0_L_turf_altgr); + } else { + // Normal + draw_image(row, col, base0_L_turf_nomod); + } + break; + case 2: // Qwerty + if (mods & MOD_MASK_SHIFT) { + draw_image(row, col, base0_L_qwer_shift); + } else { + draw_image(row, col, base0_L_qwer_nomod); + } + break; + } + } + } else { + if (layer_state_cmp(layer_state, _MUSI)) { + draw_image(row, col, musi9_R); + } else if (layer_state_cmp(layer_state, _SYMB)) { + switch (this_layout) { + case 0: // Dvorak + draw_image(row, col, symb5_R_dvor); + break; + case 1: // Turkish f + if (mods & MOD_BIT(KC_RALT)) { + // AltGr + draw_image(row, col, symb5_R_turf_altgr); + } else { + // Normal + draw_image(row, col, symb5_R_turf_nomod); + } + break; + case 2: // Qwerty + draw_image(row, col, symb5_R_qwer); + break; + } + } else if (layer_state_cmp(layer_state, _NAVI)) { + draw_image(row, col, navi4_R); + } else if (layer_state_cmp(layer_state, _MEDI)) { + if (mods & MOD_MASK_SHIFT) { + draw_image(row, col, medi3_R_shift); + } else { + draw_image(row, col, medi3_R_nomod); + } + } else if (layer_state_cmp(layer_state, _CHAR)) { + draw_image(row, col, char1_R); + } else { + switch (this_layout) { + case 0: // Dvorak + if (mods & MOD_MASK_SHIFT) { + draw_image(row, col, base0_R_dvor_shift); + } else { + draw_image(row, col, base0_R_dvor_nomod); + } + break; + case 1: // Turkish F + if ((mods & MOD_MASK_SHIFT) && (mods & MOD_BIT(KC_RALT))) { + // Shift + AltGr + draw_image(row, col, base0_R_turf_shfgr); + } else if (mods & MOD_MASK_SHIFT) { + // Shift + draw_image(row, col, base0_R_turf_shift); + } else if (mods & MOD_BIT(KC_RALT)) { + // AltGr + draw_image(row, col, base0_R_turf_altgr); + } else { + // Normal + draw_image(row, col, base0_R_turf_nomod); + } + break; + case 2: // Qwerty + if (mods & MOD_MASK_SHIFT) { + draw_image(row, col, base0_R_qwer_shift); + } else { + draw_image(row, col, base0_R_qwer_nomod); + } + break; + } + } + } +} + +// Render the RGB state on the given column and row +void render_rgb(uint8_t row, uint8_t col) { + static const char PROGMEM rgb_enab[12] = {0x08,0x81,0x3c,0x42,0x99,0xbd,0xbd,0x99,0x42,0x3c,0x81,0x10}; + static const char PROGMEM rgb_disa[12] = {0x08,0x81,0x3c,0x42,0x81,0x81,0x81,0x81,0x42,0x3c,0x81,0x10}; + static char rgb_temp4[4] = {0}; + static char rgb_temp3[3] = {0}; + + oled_set_cursor(col, row); +# ifdef RGB_MATRIX_ENABLE + if (rgb_matrix_is_enabled()) { + oled_write_raw_P(rgb_enab, 12); + } else { + oled_write_raw_P(rgb_disa, 12); + } + oled_set_cursor(col + 2, row); + oled_write(" hue sat val", false); + oled_set_cursor(col, row + 1); + itoa(rgb_matrix_get_mode(), rgb_temp3, 10); + oled_write(rgb_temp3, false); + oled_write(" ", false); + itoa(rgb_matrix_get_hue(), rgb_temp4, 10); + oled_write(rgb_temp4, false); + oled_write(" ", false); + itoa(rgb_matrix_get_sat(), rgb_temp4, 10); + oled_write(rgb_temp4, false); + oled_write(" ", false); + itoa(rgb_matrix_get_val(), rgb_temp4, 10); + oled_write(rgb_temp4, false); +# else // RGB_MATRIX_ENABLE + oled_write("-RGB disabled-", false); +# endif // RGB_MATRIX_ENABLE +} + +void render_status_left(uint8_t row, uint8_t col) { + // Left side looks like this on the left half + // (Should be 14 characters per line) + // Mods: <OS> <Alt/Gr> <Ctrl> <Shift> + // Enc: <8 len str> + // Wpm: <wpm here> + // Layout: <dvorak/qwerty/tur. f> + // Right half is whatever layer image needs be + uint8_t this_mod = get_mods(); + uint8_t this_layer = get_highest_layer(layer_state); + + // MODIFIERS + render_modifiers(row + 0, col + 0, this_mod); + // Encoders + render_encoder(row + 1, col + 0, 0, this_layer); + // WPM text + render_wpm(row + 2, col + 0); + // Visual layout + render_keymap(row + 3, col + 0, false); + // Draw the image after 14'th character + render_layout(row + 0, col + 14, this_mod, true); +} + +void render_status_right(uint8_t row, uint8_t col) { + // Right half is whatever layer image needs be on the left + // Right side looks like this on the right half + // (Should be after the 12'th character; max 14 characters per line) + // Mods: <OS> <Alt/Gr> <Ctrl> <Shift> + // Enc: <8 len str> + // Wpm: <wpm here> + // Layout: <dvorak/qwerty/tur. f> + uint8_t this_mod = get_mods(); + uint8_t this_layer = get_highest_layer(layer_state); + + // Draw the image + render_layout(row + 0, col + 0, this_mod, false); + // Modifiers + render_modifiers(row + 0, col + 7, this_mod); + // Encoder + render_encoder(row + 1, col + 7, 1, this_layer); + // RGB State (2 rows) + render_rgb(row + 2, col + 7); +} diff --git a/users/bbaserdem/bb-oled-extra.h b/users/bbaserdem/bb-oled-extra.h new file mode 100644 index 0000000000..c051e6226c --- /dev/null +++ b/users/bbaserdem/bb-oled-extra.h @@ -0,0 +1,25 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bbaserdem.h" + +// OLED layout images writer function +void render_modifiers(uint8_t row, uint8_t col, uint8_t mods); +void render_layout(uint8_t row, uint8_t col, uint8_t mods, bool isLeft); +void render_rgb(uint8_t row, uint8_t col); +void render_status_left(uint8_t row, uint8_t col); +void render_status_right(uint8_t row, uint8_t col); diff --git a/users/bbaserdem/bb-oled.c b/users/bbaserdem/bb-oled.c new file mode 100644 index 0000000000..cf00193c03 --- /dev/null +++ b/users/bbaserdem/bb-oled.c @@ -0,0 +1,216 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bb-oled.h" + +#include <string.h> +// Grab the print function +#ifdef ENCODER_ENABLE +# include "bb-encoder.h" +#endif // ENCODER_ENABLE + +/* OLED + * This contains general purpose oled code + */ + +// Allow default to be overwritten by keymap if they return false +__attribute__ ((weak)) bool oled_task_keymap(void) {return true;} + +// Do sane defaults for regular oled rendering +void oled_task_user(void) { + if (is_oled_on()) { + if (oled_task_keymap()) { + render_status_lite(0, 0); + } + } +} + +/*-------------------------*\ +|*---RENDERING FUNCTIONS---*| +\*-------------------------*/ +void render_qmk_logo(uint8_t row, uint8_t col) { + static const char PROGMEM qmk_logo[] = { + 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d, + 0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6, + 0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4, + 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd, + 0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0}; + oled_set_cursor(col, row); + oled_write_P(qmk_logo, false); +} + +void render_layer(uint8_t row, uint8_t col, uint8_t top_layer) { + // Write the layer state; 17 chars + oled_set_cursor(col, row); + oled_write("Layer: ", false); + switch (top_layer) { + case _BASE: + oled_write("Default ", false); + break; + case _CHAR: + oled_write("Sp. Chars ", false); + break; + case _GAME: + oled_write("Gaming ", false); + break; + case _MEDI: + oled_write("Media Ctr ", false); + break; + case _NAVI: + oled_write("Navigation", false); + break; + case _SYMB: + oled_write("Symbols ", false); + break; + case _NUMB: + oled_write("Numpad ", false); + break; + case _FUNC: + oled_write("Funct Keys", false); + break; + case _MOUS: + oled_write("Mouse Keys", false); + break; + case _MUSI: + oled_write("Music Mode", false); + break; + default: + oled_write("?? N/A ?? ", false); + } +} + +void render_modifiers_lite(uint8_t row, uint8_t col, uint8_t mods) { + // Write the modifier state, 16 characters + oled_set_cursor(col, row); + oled_write((mods & MOD_MASK_SHIFT ) ? "Shft " : " ", false); + oled_write((mods & MOD_MASK_CTRL ) ? "Ctrl " : " ", false); + oled_write((mods & MOD_MASK_ALT ) ? "Alt" : " ", false); + oled_write((mods & MOD_BIT(KC_RALT)) ? "G " : " ", false); + oled_write((mods & MOD_MASK_GUI ) ? "Meta " : " ", false); +} + +void render_encoder(uint8_t row, uint8_t col, uint8_t index, uint8_t layer) { + // Renders the encoder state, 14 characters + oled_set_cursor(col, row); + +# ifdef ENCODER_ENABLE + static char encoder_temp9[9] = {0}; + oled_write("Enc: ", false); + encoder_state_string(index, layer, encoder_temp9); + oled_write(encoder_temp9, false); +# else // ENCODER_ENABLE + oled_write("No enc. avail.", false); +# endif // ENCODER_ENABLE +} + +void render_wpm(uint8_t row, uint8_t col) { + // Renders the WPM, 8 characters + oled_set_cursor(col, row); +# ifdef WPM_ENABLE + static char wpm_temp4[4] = {0}; + oled_write("WPM: ", false); + itoa(get_current_wpm(), wpm_temp4, 10); + oled_write(wpm_temp4, false); + oled_write(" ", false); +# else // WPM_ENABLE + oled_write("WPM: N/A", false); +# endif // WPM_ENABLE +} + +// Writes the currently used OLED display layout +void render_keymap(uint8_t row, uint8_t col, bool isLite) { + // Render the oled layout; lite is 11, regular is 14 characters + oled_set_cursor(col, row); + if (isLite) { + oled_write("KM: ", false); + } else { + oled_write("Layout: ", false); + } + switch (userspace_config.layout % 3) { + case 0: + oled_write("Dvorak", false); + break; + case 1: + oled_write("Tur. F", false); + break; + case 2: + oled_write("Qwerty", false); + break; + } + if (isLite) { + oled_write(" ", false); + } +} + +// Writes the currently used OLED display layout +#ifdef RGB_MATRIX_ENABLE +void render_rgb_lite(uint8_t row, uint8_t col) { + // Writes the currently used OLED display layout, 19 characters + static char rgb_temp4[4] = {0}; + // Render the oled layout + oled_set_cursor(col, row); + oled_write("m", false); + itoa(rgb_matrix_get_mode(), rgb_temp4, 10); + oled_write(rgb_temp4, false); + oled_write(" h", false); + itoa(rgb_matrix_get_hue(), rgb_temp4, 10); + oled_write(rgb_temp4, false); + oled_write(" s", false); + itoa(rgb_matrix_get_sat(), rgb_temp4, 10); + oled_write(rgb_temp4, false); + oled_write(" v", false); + itoa(rgb_matrix_get_val(), rgb_temp4, 10); + oled_write(rgb_temp4, false); +} +#endif // RGB_MATRIX_ENABLE + +void render_status_lite(uint8_t row, uint8_t col) { + // Function to print state information; for low flash memory + uint8_t this_layer = get_highest_layer(layer_state); + uint8_t this_mod = get_mods(); + + // Line 1: Layer State + render_layer(row + 0, col + 0, this_layer); + + // Line 2: Mod or info + switch (this_layer) { + // Show RGB mode as an overlay in media mode. +# ifdef RGB_MATRIX_ENABLE + case _MEDI: + render_rgb_lite(row + 1, col + 0); + break; +# endif // RGB_MATRIX_ENABLE + // Show the modifier if nothing else is doing anything + default: + render_modifiers_lite(row + 1, col + 0, this_mod); + break; + } + + // Line 3: WPM and layout + render_keymap(row + 2, col + 0, true); + render_wpm(row + 2, col + 11); + + // Line 4: Encoder states +# ifdef SPLIT_KEYBOARD + if (is_keyboard_left()) { + render_encoder(row + 3, col + 0, 0, this_layer); + } else { + render_encoder(row + 3, col + 0, 1, this_layer); + } +# else // SPLIT_KEYBOARD + render_encoder(row + 3, col + 0, 0, this_layer); +# endif // SPLIT_KEYBOARD +} diff --git a/users/bbaserdem/bb-oled.h b/users/bbaserdem/bb-oled.h new file mode 100644 index 0000000000..a355c88ca9 --- /dev/null +++ b/users/bbaserdem/bb-oled.h @@ -0,0 +1,32 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bbaserdem.h" + +// Contain the main oled writer here +void oled_task_user(void); +// Some generic rendering functions +void render_qmk_logo(uint8_t row, uint8_t col); +void render_layer(uint8_t row, uint8_t col, uint8_t top_layer); +void render_modifiers_lite(uint8_t row, uint8_t col, uint8_t mods); +void render_encoder(uint8_t row, uint8_t col, uint8_t index, uint8_t layer); +void render_wpm(uint8_t row, uint8_t col); +void render_keymap(uint8_t row, uint8_t col, bool isLite); +#ifdef RGB_MATRIX_ENABLE +void render_rgb_lite(uint8_t row, uint8_t col); +#endif // RGB_MATRIX_ENABLE +void render_status_lite(uint8_t row, uint8_t col); diff --git a/users/bbaserdem/bb-rgb.c b/users/bbaserdem/bb-rgb.c new file mode 100644 index 0000000000..bdb7f12bbd --- /dev/null +++ b/users/bbaserdem/bb-rgb.c @@ -0,0 +1,130 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bb-rgb.h" +#include "color.h" + +#define X_DIV 224/2 +/* Code relating to per-key RGB LED stuff + */ + +// Allow hooking into the RGB matrix indications using keymap code + +// Modulates the brightness of indicator +RGB helper_dimmer(uint8_t r, uint8_t g, uint8_t b) { + RGB output; + output.r = r / 2; + output.g = g / 2; + output.b = b / 2; + return output; +} +// x range from 0-left to 224-right +// y range from 0-top to 64-bottom +void helper_painter(uint8_t led_min, uint8_t led_max, RGB col, uint8_t side) { + if (side == 1) { + // Left + for(uint8_t i = led_min; i <= led_max; i++) { + if((g_led_config.point[i].x < X_DIV) && (g_led_config.flags[i] & LED_FLAG_INDICATOR)) { + rgb_matrix_set_color(i, col.r, col.g, col.b); + } + } + } else if (side == 2) { + // Right + for(uint8_t i = led_min; i <= led_max; i++) { + if((g_led_config.point[i].x > X_DIV) && (g_led_config.flags[i] & LED_FLAG_INDICATOR)) { + rgb_matrix_set_color(i, col.r, col.g, col.b); + } + } + } else if (side == 0) { + // Both + for(uint8_t i = led_min; i <= led_max; i++) { + if(g_led_config.flags[i] & LED_FLAG_INDICATOR) { + rgb_matrix_set_color(i, col.r, col.g, col.b); + } + } + } +} + +// Allow to turn off global handling +__attribute__ ((weak)) bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) { + return false; +} +// Set RGB state depending on layer +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + uint8_t thisInd = 3; + RGB thisCol; + // Load keymap hooks + if(rgb_matrix_indicators_advanced_keymap(led_min, led_max)) { + return; + } + // Grab color info + switch (get_highest_layer(layer_state)) { + case _GAME: // Set left side as purple + thisCol = helper_dimmer(RGB_PURPLE); + thisInd = 1; + break; + case _CHAR: // Set full board as gold + thisCol = helper_dimmer(RGB_GOLD); + thisInd = 0; + break; + case _MEDI: // Set right side as pink + thisCol = helper_dimmer(RGB_MAGENTA); + thisInd = 2; + break; + case _NAVI: // Set right side as green + thisCol = helper_dimmer(RGB_GREEN); + thisInd = 2; + break; + case _SYMB: // Set right side as yellow + thisCol = helper_dimmer(RGB_YELLOW); + thisInd = 2; + break; + case _NUMB: // Set left side as blue + thisCol = helper_dimmer(RGB_BLUE); + thisInd = 1; + break; + case _FUNC: // Set left side as red + thisCol = helper_dimmer(RGB_RED); + thisInd = 1; + break; + case _MOUS: // Set left side as blue-green + thisCol = helper_dimmer(RGB_SPRINGGREEN); + thisInd = 1; + break; + case _MUSI: // Set full board as orange + thisCol = helper_dimmer(RGB_ORANGE); + thisInd = 0; + break; + } + helper_painter(led_min, led_max, thisCol, thisInd); +} + +// Hook into shutdown code to make all perkey LED's red on hitting reset +void shutdown_rgb(void) { + // Flash all the key LED's red on shutdown + uint16_t timer_start = timer_read(); + rgb_matrix_set_color_all(RGB_CORAL); + // Delay until this registers + while(timer_elapsed(timer_start) < 250) {wait_ms(1);} +} + +// Hook into suspend code +void suspend_power_down_rgb(void) { + rgb_matrix_set_suspend_state(true); +} +void suspend_wakeup_init_rgb(void) { + rgb_matrix_set_suspend_state(false); +} diff --git a/users/bbaserdem/bb-rgb.h b/users/bbaserdem/bb-rgb.h new file mode 100644 index 0000000000..62b6da9f2f --- /dev/null +++ b/users/bbaserdem/bb-rgb.h @@ -0,0 +1,28 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bbaserdem.h" + +/* Hooks involving perkey RGB LEDs + */ + +// For custom indicators +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max); +// Hook into shutdown code +void shutdown_rgb(void); +void suspend_wakeup_init_rgb(void); +void suspend_power_down_rgb(void); diff --git a/users/bbaserdem/bb-underglow.c b/users/bbaserdem/bb-underglow.c new file mode 100644 index 0000000000..69aae439f4 --- /dev/null +++ b/users/bbaserdem/bb-underglow.c @@ -0,0 +1,116 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bb-underglow.h" + +/* UNDERGLOW IMPLEMENTATION + */ + +// Define the layer switching code + +// An empty layer on the base +const rgblight_segment_t PROGMEM bb_base_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, 0, HSV_WHITE} +); +// Gaming layer is turquoise +const rgblight_segment_t PROGMEM bb_game_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {RGBLIGHT_LEFT_BEG, RGBLIGHT_LEFT_NUM, HSV_PURPLE} +); +// Character overlay is chartereuse +const rgblight_segment_t PROGMEM bb_char_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, RGBLED_NUM, HSV_GOLD} +); + +// Right-hand layers + +// Media layer is orange +const rgblight_segment_t PROGMEM bb_medi_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {RGBLIGHT_RIGHT_BEG, RGBLIGHT_RIGHT_NUM, HSV_MAGENTA} +); +// Navigation layer is green +const rgblight_segment_t PROGMEM bb_navi_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {RGBLIGHT_RIGHT_BEG, RGBLIGHT_RIGHT_NUM, HSV_GREEN} +); +// Symbol layer is purple +const rgblight_segment_t PROGMEM bb_symb_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {RGBLIGHT_RIGHT_BEG, RGBLIGHT_RIGHT_NUM, HSV_YELLOW} +); + +// Left-hand layers + +// Number layer is blue +const rgblight_segment_t PROGMEM bb_numb_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {RGBLIGHT_LEFT_BEG, RGBLIGHT_LEFT_NUM, HSV_BLUE} +); +// Function layer is red +const rgblight_segment_t PROGMEM bb_func_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {RGBLIGHT_LEFT_BEG, RGBLIGHT_LEFT_NUM, HSV_RED} +); +// Pointer layer is yellow +const rgblight_segment_t PROGMEM bb_mous_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {RGBLIGHT_LEFT_BEG, RGBLIGHT_LEFT_NUM, HSV_SPRINGGREEN} +); + +// Music playback layer is magenta +const rgblight_segment_t PROGMEM bb_musi_layer[] = RGBLIGHT_LAYER_SEGMENTS( + {0, RGBLED_NUM, HSV_ORANGE} +); + +const rgblight_segment_t* const PROGMEM bb_rgb_layers[] = RGBLIGHT_LAYERS_LIST( + bb_base_layer, + bb_char_layer, + bb_game_layer, + bb_medi_layer, + bb_navi_layer, + bb_symb_layer, + bb_numb_layer, + bb_func_layer, + bb_mous_layer, + bb_musi_layer +); + +// Enable the LED switching layers +void keyboard_post_init_underglow(void) { + rgblight_layers = bb_rgb_layers; + // Default rgb mode is rainbow swirl; set this + rgblight_sethsv_noeeprom(100, 255, 255); + rgblight_mode_noeeprom(RGBLIGHT_MODE_RAINBOW_SWIRL + 0); +} + +// Set RGBLIGHT state depending on layer +layer_state_t layer_state_set_underglow(layer_state_t state) { + // Activate layers if on that region + rgblight_set_layer_state(_BASE, layer_state_cmp(state, _BASE)); + rgblight_set_layer_state(_GAME, layer_state_cmp(state, _GAME)); + rgblight_set_layer_state(_CHAR, layer_state_cmp(state, _CHAR)); + rgblight_set_layer_state(_MEDI, layer_state_cmp(state, _MEDI)); + rgblight_set_layer_state(_NAVI, layer_state_cmp(state, _NAVI)); + rgblight_set_layer_state(_SYMB, layer_state_cmp(state, _SYMB)); + rgblight_set_layer_state(_NUMB, layer_state_cmp(state, _NUMB)); + rgblight_set_layer_state(_FUNC, layer_state_cmp(state, _FUNC)); + rgblight_set_layer_state(_MOUS, layer_state_cmp(state, _MOUS)); + rgblight_set_layer_state(_MUSI, layer_state_cmp(state, _MUSI)); + // Return so other stuff can be done + return state; +} + +// Hook into shutdown code +void shutdown_underglow(void) { + // Make the LED's red on shutdown + rgblight_enable_noeeprom(); + rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); + rgblight_sethsv(HSV_WHITE); +} diff --git a/users/bbaserdem/bb-underglow.h b/users/bbaserdem/bb-underglow.h new file mode 100644 index 0000000000..9cc1db3757 --- /dev/null +++ b/users/bbaserdem/bb-underglow.h @@ -0,0 +1,28 @@ +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 "bbaserdem.h" + +/* UNDERGLOW IMPLEMENTATION + */ + +// Used to initialize layer switching overlay +void keyboard_post_init_underglow(void); +// Used to change RGB underglow layers on keymap layer change +layer_state_t layer_state_set_underglow(layer_state_t state); +// Hook into shutdown to show effect on shutdown +void shutdown_underglow(void); diff --git a/users/bbaserdem/bbaserdem.c b/users/bbaserdem/bbaserdem.c index cdacda12ee..e0e204c302 100644 --- a/users/bbaserdem/bbaserdem.c +++ b/users/bbaserdem/bbaserdem.c @@ -1,633 +1,376 @@ -#include "bbaserdem.h" - -/*---------------*\ -|*-----MOUSE-----*| -\*---------------*/ -#ifdef MOUSEKEY_ENABLE -#include "mousekey.h" -#endif - -/*-------------*\ -|*-----RGB-----*| -\*-------------*/ -#ifdef RGBLIGHT_ENABLE -#include "rgblight.h" -#endif - -/*-------------*\ -|*---UNICODE---*| -\*-------------*/ -#ifdef UNICODE_ENABLE -#endif - -/*-----------------*\ -|*-----SECRETS-----*| -\*-----------------*/ -// Enabled by adding a non-tracked secrets.h to this dir. -#if (__has_include("secrets.h")) -#include "secrets.h" -#endif - -/*---------------*\ -|*-----MUSIC-----*| -\*---------------*/ -#ifdef AUDIO_ENABLE -float tone_game[][2] = SONG(ZELDA_PUZZLE); -float tone_return[][2] = SONG(ZELDA_TREASURE); -float tone_linux[][2] = SONG(UNICODE_LINUX); -float tone_windows[][2] = SONG(UNICODE_WINDOWS); -#endif - -/*-------------------*\ -|*-----TAP-DANCE-----*| -\*-------------------*/ -#ifdef TAP_DANCE_ENABLE -qk_tap_dance_action_t tap_dance_actions[] = { - // Shift on double tap of semicolon - [SCL] = ACTION_TAP_DANCE_DOUBLE( KC_SCLN, KC_COLN ) -}; -#endif - -/* In keymaps, instead of writing _user functions, write _keymap functions - * The __attribute__((weak)) allows for empty definitions here, and during - * compilation, if these functions are defined elsewhere, they are written - * over. This allows to include custom code from keymaps in the generic code - * in this file. +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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/>. */ -__attribute__ ((weak)) void matrix_init_keymap(void) { } -__attribute__ ((weak)) void matrix_scan_keymap(void) { } -__attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { - return true; + +#include "bbaserdem.h" +// Language imports +#include <sendstring_dvorak.h> +// Need memcpy and memcmp from string.h along with transfer stuff +#ifdef SPLIT_KEYBOARD +#include "transactions.h" +#include <string.h> +#endif // SPLIT_KEYBOARD + +/*-------------------------*\ +|*-----KEYBOARD CONFIG-----*| +\*-------------------------*/ +userspace_config_t userspace_config; +userspace_runtime_t userspace_runtime; + +/*---------------------------------*\ +|*----SPLIT KEYBOARD TRANSPORT-----*| +\*---------------------------------*/ +#ifdef SPLIT_KEYBOARD +userspace_config_t transport_userspace_config; +userspace_runtime_t transport_userspace_runtime; + +// Translate the RPC data to the local variable +void userspace_config_sync(uint8_t in_buflen, const void* in_data, uint8_t out_buflen, void* out_data) { + // Copy incoming data to local variable + if (in_buflen == sizeof(transport_userspace_config)) { + memcpy(&transport_userspace_config, in_data, in_buflen); + } + // There is no data to send back; so no output handling } -__attribute__ ((weak)) uint32_t layer_state_set_keymap (uint32_t state) { - return state; +void userspace_runtime_sync(uint8_t in_buflen, const void* in_data, uint8_t out_buflen, void* out_data) { + // Copy incoming data to local variable + if (in_buflen == sizeof(transport_userspace_runtime)) { + memcpy(&transport_userspace_runtime, in_data, in_buflen); + } + // There is no data to send back; so no output handling } -__attribute__ ((weak)) void led_set_keymap(uint8_t usb_led) { } -/* ----------------------- *\ - * -----RGB Functions----- * -\* ----------------------- */ -#ifdef RGBLIGHT_ENABLE -// Storage variables -extern rgblight_config_t rgblight_config; -bool base_sta; // Keeps track if in saveable state -bool base_tog; // Whether base state is active or not -int base_hue; // Hue value of base state -int base_sat; // Saturation value of base state -int base_val; // Brightness value of base state -uint8_t base_mod; // Animation mode of the base state - -// Save the current state of the rgb mode -void rgblight_saveBase(void) { - base_hue = rgblight_config.hue; - base_sat = rgblight_config.sat; - base_val = rgblight_config.val; - base_mod = rgblight_config.mode; - base_tog = rgblight_config.enable; - base_sta = false; // If saving, that means base layer is being left +// Either send or receive the correct data +void userspace_transport_update(void) { + if (is_keyboard_master()) { + // If we are the main device; we want to send info. + transport_userspace_config.raw = userspace_config.raw; + transport_userspace_runtime.raw = userspace_runtime.raw; + } else { + // If we are the secondary device; we want to receive info, and save to eeprom. + userspace_config.raw = transport_userspace_config.raw; + userspace_runtime.raw = transport_userspace_runtime.raw; + } } -// Load the base state back -void rgblight_loadBase(void) { - // Don't do anything if not enabled - if ( !base_sta ) { - if ( base_tog ) { - rgblight_enable(); - rgblight_mode( base_mod ); - rgblight_sethsv( base_hue, base_sat, base_val ); - } else { - rgblight_disable(); +// Initiate the protocol on sync +void userspace_transport_sync(bool force_sync) { + if (is_keyboard_master()) { + // Keep track of the last state + static userspace_config_t last_userspace_config; + static userspace_runtime_t last_userspace_runtime; + bool needs_sync = false; + + // Check if the config values are different + if (memcmp(&transport_userspace_config, &last_userspace_config, sizeof(transport_userspace_config))) { + needs_sync = true; + memcpy(&last_userspace_config, &transport_userspace_config, sizeof(transport_userspace_config)); + } + // Perform the sync if requested + if (needs_sync || force_sync) { + transaction_rpc_send(RPC_ID_CONFIG_SYNC, sizeof(transport_userspace_config), &transport_userspace_config); + needs_sync = false; } - } - // Mark that base is loaded, and to be saved before leaving - base_sta = true; -} -// Set to plain HSV color -void rgblight_colorStatic( int hu, int sa, int va ) { - // First, it must be enabled or color change is not written - rgblight_enable(); - rgblight_mode(1); - rgblight_sethsv(hu,sa,va); -} -/* HSV values - * white ( 0, 0, 255) - * red ( 0, 255, 255) - * coral ( 16, 176, 255) - * orange ( 39, 255, 255) - * goldenrod ( 43, 218, 218) - * gold ( 51, 255, 255) - * yellow ( 60, 255, 255) - * chartreuse ( 90, 255, 255) - * green (120, 255, 255) - * springgreen (150, 255, 255) - * turquoise (174, 90, 112) - * teal (180, 255, 128) - * cyan (180, 255, 255) - * azure (186, 102, 255) - * blue (240, 255, 255) - * purple (270, 255, 255) - * magenta (300, 255, 255) - * pink (330, 128, 255) - */ + // Check if the runtime values are different + if (memcmp(&transport_userspace_runtime, &last_userspace_runtime, sizeof(transport_userspace_runtime))) { + needs_sync = true; + memcpy(&last_userspace_runtime, &transport_userspace_runtime, sizeof(transport_userspace_runtime)); + } -// Set RGBLIGHT state depending on layer -void rgblight_change( uint8_t this_layer ) { - // Save state, if saving is requested - if ( base_sta ) { - rgblight_saveBase(); - } - // Change RGB light - switch ( this_layer ) { - case _DV: - // Load base layer - rgblight_loadBase(); - break; - case _AL: - // Do yellow for alternate - rgblight_colorStatic( 60,255,255); - break; - case _GA: - // Do purple for game - rgblight_colorStatic(285,255,255); - break; - case _NU: - // Do azure for number - rgblight_colorStatic(186,200,255); - break; - case _SE: - // Do red for settings - rgblight_colorStatic( 16,255,255); - break; - case _MO: - // Do green for mouse - rgblight_colorStatic(120,255,255); - break; - case _MU: - // Do orange for music - rgblight_colorStatic( 39,255,255); - break; - default: - // Something went wrong - rgblight_colorStatic( 0,255,255); - break; + // Perform the sync if requested + if (needs_sync || force_sync) { + transaction_rpc_send(RPC_ID_RUNTIME_SYNC, sizeof(transport_userspace_runtime), &transport_userspace_runtime); + needs_sync = false; + } } } +#endif // SPLIT_KEYBOARD -#endif +/*---------------------------*\ +|*-----KEYBOARD PRE INIT-----*| +\*---------------------------*/ +/* This code runs before anything is started. + * Good for early hardware setup + */ +__attribute__ ((weak)) void keyboard_pre_init_keymap(void) {} +__attribute__ ((weak)) void keyboard_pre_init_user(void) { + // Keymap specific stuff + keyboard_pre_init_keymap(); +} /*---------------------*\ |*-----MATRIX INIT-----*| \*---------------------*/ +/* This code runs once midway thru the firmware process. + * So far, sets the base layer and fixes unicode mode + */ +__attribute__ ((weak)) void matrix_init_keymap(void) {} void matrix_init_user (void) { - - // Keymap specific things, do it first thing to allow for delays etc + // Keymap specific things matrix_init_keymap(); +} + +/*----------------------------*\ +|*-----KEYBOARD POST INIT-----*| +\*----------------------------*/ +/* This code runs after anything is started. + * Good for late hardware setup, like setting up layer specifications + */ +__attribute__ ((weak)) void keyboard_post_init_keymap(void) {} +__attribute__ ((weak)) void keyboard_post_init_user(void) { + // Fix beginning base layer, in case some other firmware was flashed + // set_single_persistent_default_layer(_BASE); - // Correct unicode -#ifdef UNICODE_ENABLE + // Unicode mode +# ifdef UNICODEMAP_ENABLE set_unicode_input_mode(UC_LNX); -#endif +# endif // UNICODEMAP_ENABLE + + // Split keyboard halves communication +# ifdef SPLIT_KEYBOARD + // Register the transactions + transaction_register_rpc( RPC_ID_CONFIG_SYNC, userspace_config_sync ); + transaction_register_rpc(RPC_ID_RUNTIME_SYNC, userspace_runtime_sync); + // Load default config values + if (is_keyboard_master()) { + // If we are main; load from eeconfig + userspace_config.raw = eeconfig_read_user(); + // And update the transport variable + userspace_transport_update(); + // Do one forced transfer to sync halves + userspace_transport_sync(true); + } else { + // Just sync the data received + userspace_transport_update(); + } +# else // SPLIT_KEYBOARD + // If we are not split; just load from eeprom + userspace_config.raw = eeconfig_read_user(); +# endif // SPLIT_KEYBOARD + + // Backlight LED +# ifdef BACKLIGHT_ENABLE + keyboard_post_init_backlight(); +# endif // BACKLIGHT_ENABLE + + // RGB underglow +# ifdef RGBLIGHT_ENABLE + keyboard_post_init_underglow(); +# endif // RGBLIGHT_ENABLE + + // Keymap specific stuff + keyboard_post_init_keymap(); +} - // Make beginning layer DVORAK - set_single_persistent_default_layer(_DV); +/*---------------------------*\ +|*-----HOUSEKEEPING TASK-----*| +\*---------------------------*/ +/* I have no idea what this does + */ +__attribute__ ((weak)) void housekeeping_task_keymap(void) {} +void housekeeping_task_user(void) { + // Check eeprom every now and then + static userspace_config_t prev_userspace_config; + static fast_timer_t throttle_timer = 0; + static bool init_flag = true; + + // Read this if we never read it before + if (init_flag) { + init_flag = false; + prev_userspace_config.raw = eeconfig_read_user(); + } -//--RGB light initialize base layer -#ifdef RGBLIGHT_ENABLE - // Base hue is white, and RGB disabled - base_hue = 100; - base_sat = 0; - base_val = 255; - base_mod = 2; - base_tog = false; - rgblight_enable(); - rgblight_mode(base_mod); - rgblight_sethsv(base_hue,base_sat,base_val); - rgblight_disable(); - rgblight_loadBase(); -#endif + // Throttled tasks here + if (timer_elapsed_fast(throttle_timer) >= HOUSEKEEPING_THROTTLE_INTERVAL_MS) { + // Refresh timer + throttle_timer = timer_read_fast(); + // Check userspace config for eeprom updates + if (memcmp(&prev_userspace_config, &userspace_config, sizeof(userspace_config))) { + memcpy(&prev_userspace_config, &userspace_config, sizeof(userspace_config)); + eeconfig_update_user(userspace_config.raw); + } + } + + // Do transport stuff +# ifdef SPLIT_KEYBOARD + userspace_transport_update(); + userspace_transport_sync(false); +# endif // SPLIT_KEYBOARD + + // Hook to keymap code + housekeeping_task_keymap(); +} + +/*-----------------------*\ +|*-----EECONFIG INIT-----*| +\*-----------------------*/ +/* Default values to send to the eeprom + */ +void eeconfig_init_user(void) { + // Set everything to default + userspace_config.raw = 0; + // Set encoder states to sane defaults if enabled +# ifdef ENCODER_ENABLE + reset_encoder_state(); +# endif // ENCODER_ENABLE +} +/*------------------------*\ +|*-----PROCESS RECORD-----*| +\*------------------------*/ +/* Process record: custom keycodes to process here + * Allow also the following codes to hook here as well; + * Macro definitions + * Audio hooks + */ +__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 after running through all individual hooks + return + process_record_keymap(keycode, record) && +# ifdef AUDIO_ENABLE + process_record_audio(keycode, record) && +# endif // AUDIO_ENABLE +# ifdef ENCODER_ENABLE + process_record_encoder(keycode, record) && +# endif // ENCODER_ENABLE + process_record_macro(keycode, record); } /*---------------------*\ |*-----MATRIX SCAN-----*| \*---------------------*/ +/* This code runs every frame + * I used to check for layer switching here, but layer state is better used. + * Try to not put anything here; as it runs hundreds time per second-ish + */ +__attribute__ ((weak)) void matrix_scan_keymap(void) { } void matrix_scan_user (void) { - // Keymap specific, do it first + // Keymap specific scan function matrix_scan_keymap(); } -/*------------------*\ -|*-----KEYCODES-----*| -\*------------------*/ -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - - // Shift check - bool is_capital = ( keyboard_report->mods & (MOD_BIT(KC_LSFT)|MOD_BIT(KC_RSFT)) ); - static bool lock_flag = false; - uint8_t layer = biton32 (layer_state); - - switch (keycode) { - // Secrets implementation -#if (__has_include("secrets.h")) - case SECRET1: - if( !record->event.pressed ) { - send_string_P( secret[ keycode - SECRET1 ] ); - } - return false; - break; - case SECRET2: - if( !record->event.pressed ) { - send_string_P( secret[ keycode - SECRET2 ] ); - } - return false; - break; - case SECRET3: - if( !record->event.pressed ) { - send_string_P( secret[ keycode - SECRET3 ] ); - } - return false; - break; -#endif - - // If these keys are pressed, load base layer config, and mark saving -#ifdef RGBLIGHT_ENABLE - case RGB_TOG: - case RGB_MOD: - case RGB_VAI: - case RGB_VAD: - case RGB_SAI: - case RGB_SAD: - case RGB_HUI: - case RGB_HUD: - if ( !base_sta ) { - rgblight_loadBase(); - } - return true; - break; -#endif - - // Lock functionality: These layers are locked if the LOCKED buttons are - // pressed. Otherwise, they are momentary toggles - case K_LOCK: - if (record->event.pressed) { - lock_flag = !lock_flag; - } - return false; - break; - case K_MOUSE: - if (record->event.pressed) { - layer_on(_MO); - lock_flag = false; - } else { - if ( lock_flag ) { - lock_flag = false; - } else { - layer_off(_MO); - } - } - return false; - break; - case K_NUMBR: - if (record->event.pressed) { - layer_on(_NU); - lock_flag = false; - } else { - if ( lock_flag ) { - lock_flag = false; - } else { - layer_off(_NU); - } - } - return false; - break; - - // Layer switches with sound - case K_GAMES: - if (record->event.pressed) { - // On press, turn off layer if active - if ( layer == _GA ) { -#ifdef AUDIO_ENABLE - stop_all_notes(); - PLAY_SONG(tone_return); -#endif - layer_off(_GA); - } - } else { - // After click, turn on layer if accessed from setting - if ( layer == _SE ) { -#ifdef AUDIO_ENABLE - stop_all_notes(); - PLAY_SONG(tone_game); -#endif - layer_on(_GA); - layer_off(_SE); - } - } - return false; - break; - case MU_TOG: - if (record->event.pressed) { - // On press, turn off layer if active - if ( layer == _SE ) { - layer_off(_SE); - layer_on(_MU); - } else { - layer_off(_MU); - } - } - return true; - break; - -//------UNICODE - // Unicode switches with sound -#ifdef UNICODE_ENABLE - case UNI_LI: - if (record->event.pressed) { -#ifdef AUDIO_ENABLE - stop_all_notes(); - PLAY_SONG(tone_linux); -#endif - set_unicode_input_mode(UC_LNX); - } - return false; - break; - case UNI_WN: - if (record->event.pressed) { -#ifdef AUDIO_ENABLE - stop_all_notes(); - PLAY_SONG(tone_windows); -#endif - set_unicode_input_mode(UC_WIN); - } - return false; - break; - - // Turkish letters, with capital functionality - case TUR_A: - if (record->event.pressed) { - if ( is_capital ) { - unicode_input_start(); - register_hex(0x00c2); - unicode_input_finish(); - } else { - unicode_input_start(); - register_hex(0x00e2); - unicode_input_finish(); - } - } - return false; - break; - case TUR_O: - if (record->event.pressed) { - if ( is_capital ) { - unicode_input_start(); - register_hex(0x00d6); - unicode_input_finish(); - } else { - unicode_input_start(); - register_hex(0x00f6); - unicode_input_finish(); - } - } - return false; - break; - case TUR_U: - if (record->event.pressed) { - if ( is_capital ) { - unicode_input_start(); - register_hex(0x00dc); - unicode_input_finish(); - } else { - unicode_input_start(); - register_hex(0x00fc); - unicode_input_finish(); - } - } - return false; - break; - case TUR_I: - if (record->event.pressed) { - if ( is_capital ) { - unicode_input_start(); - register_hex(0x0130); - unicode_input_finish(); - } else { - unicode_input_start(); - register_hex(0x0131); - unicode_input_finish(); - } - } - return false; - break; - case TUR_G: - if (record->event.pressed) { - if ( is_capital ) { - unicode_input_start(); - register_hex(0x011e); - unicode_input_finish(); - } else { - unicode_input_start(); - register_hex(0x011f); - unicode_input_finish(); - } - } - return false; - break; - case TUR_C: - if (record->event.pressed) { - if ( is_capital ) { - unicode_input_start(); - register_hex(0x00c7); - unicode_input_finish(); - } else { - unicode_input_start(); - register_hex(0x00e7); - unicode_input_finish(); - } - } - return false; - break; - case TUR_S: - if (record->event.pressed) { - if ( is_capital ) { - unicode_input_start(); - register_hex(0x015e); - unicode_input_finish(); - } else { - unicode_input_start(); - register_hex(0x015f); - unicode_input_finish(); - } - } - return false; - break; -#endif +/*---------------------*\ +|*-----LAYER STATE-----*| +\*---------------------*/ +/* This code runs after every layer change + * State represents the new layer state. + */ +__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) { + // Keymap layer state setting + state = layer_state_set_keymap(state); + // For underglow stuff +# ifdef RGBLIGHT_ENABLE + state = layer_state_set_underglow(state); +# endif // RGBLIGHT_ENABLE + // Audio playback +# ifdef AUDIO_ENABLE + state = layer_state_set_audio(state); +# endif // AUDIO_ENABLE -//-------Diagonal mouse movements -#ifdef MOUSEKEY_ENABLE - case MO_NE: - if( record->event.pressed ) { - mousekey_on(MO_N); - mousekey_on(MO_E); - mousekey_send(); - } else { - mousekey_off(MO_N); - mousekey_off(MO_E); - mousekey_send(); - } - return false; - break; - case MO_NW: - if( record->event.pressed ) { - mousekey_on(MO_N); - mousekey_on(MO_W); - mousekey_send(); - } else { - mousekey_off(MO_N); - mousekey_off(MO_W); - mousekey_send(); - } - return false; - break; - case MO_SE: - if( record->event.pressed ) { - mousekey_on(MO_S); - mousekey_on(MO_E); - mousekey_send(); - } else { - mousekey_off(MO_S); - mousekey_off(MO_E); - mousekey_send(); - } - return false; - break; - case MO_SW: - if( record->event.pressed ) { - mousekey_on(MO_S); - mousekey_on(MO_W); - mousekey_send(); - } else { - mousekey_off(MO_S); - mousekey_off(MO_W); - mousekey_send(); - } - return false; - break; - case MO_S_NE: - if( record->event.pressed ) { - mousekey_on(MO_S_N); - mousekey_on(MO_S_E); - mousekey_send(); - } else { - mousekey_off(MO_S_N); - mousekey_off(MO_S_E); - mousekey_send(); - } - return false; - break; - case MO_S_NW: - if( record->event.pressed ) { - mousekey_on(MO_S_N); - mousekey_on(MO_S_W); - mousekey_send(); - } else { - mousekey_off(MO_S_N); - mousekey_off(MO_S_W); - mousekey_send(); - } - return false; - break; - case MO_S_SE: - if( record->event.pressed ) { - mousekey_on(MO_S_S); - mousekey_on(MO_S_E); - mousekey_send(); - } else { - mousekey_off(MO_S_S); - mousekey_off(MO_S_E); - mousekey_send(); - } - return false; - break; - case MO_S_SW: - if( record->event.pressed ) { - mousekey_on(MO_S_S); - mousekey_on(MO_S_W); - mousekey_send(); - } else { - mousekey_off(MO_S_S); - mousekey_off(MO_S_W); - mousekey_send(); - } - return false; - break; -#endif + return state; +} -//------DOUBLE PRESS, with added left navigation - case DBL_SPC: - if( record->event.pressed ) { - SEND_STRING(" "SS_TAP(X_LEFT)); - } - return false; - break; - case DBL_ANG: - if( record->event.pressed ) { - SEND_STRING("<>"SS_TAP(X_LEFT)); - } - return false; - break; - case DBL_PAR: - if( record->event.pressed ) { - SEND_STRING("()"SS_TAP(X_LEFT)); - } - return false; - break; - case DBL_SQR: - if( record->event.pressed ) { - SEND_STRING("[]"SS_TAP(X_LEFT)); - } - return false; - break; - case DBL_BRC: - if( record->event.pressed ) { - SEND_STRING("{}"SS_TAP(X_LEFT)); - } - return false; - break; - case DBL_QUO: - if( record->event.pressed ) { - SEND_STRING("\'\'"SS_TAP(X_LEFT)); - } - return false; - break; - case DBL_DQT: - if( record->event.pressed ) { - SEND_STRING("\"\""SS_TAP(X_LEFT)); - } - return false; - break; - case DBL_GRV: - if( record->event.pressed ) { - SEND_STRING("``"SS_TAP(X_LEFT)); - } - return false; - break; -// END OF KEYCODES - } - return process_record_keymap(keycode, record); +/*-----------------------------*\ +|*-----DEFAULT LAYER STATE-----*| +\*-----------------------------*/ +/* This code runs after every time default base layer is changed + */ +__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) { + // Keymap level code + state = default_layer_state_set_keymap(state); + return state; } -/*----------------------*\ -|*-----LAYER CHANGE-----*| -\*----------------------*/ +/*------------------------*\ +|*-----LED SET KEYMAP-----*| +\*------------------------*/ +/* Code for LED indicators + * I'm not sure when exactly does this code run + */ +__attribute__ ((weak)) void led_set_keymap(uint8_t usb_led) {} +void led_set_user(uint8_t usb_led) { + led_set_keymap(usb_led); +} -layer_state_t layer_state_set_user(layer_state_t state) { +/*-----------------*\ +|*-----SUSPEND-----*| +\*-----------------*/ +/* Suspend stuff here, mostly for the rgb lighting. + */ +__attribute__ ((weak)) void suspend_power_down_keymap (void) { } +void suspend_power_down_user(void) { + suspend_power_down_keymap(); + // RGB matrix sleep hook +# ifdef RGB_MATRIX_ENABLE + suspend_power_down_rgb(); +# endif // RGB_MATRIX_ENABLE +} +__attribute__ ((weak)) void suspend_wakeup_init_keymap (void) { } +void suspend_wakeup_init_user(void) { + suspend_wakeup_init_keymap(); + // RGB matrix sleep hook +# ifdef RGB_MATRIX_ENABLE + suspend_wakeup_init_rgb(); +# endif // RGB_MATRIX_ENABLE +} +<<<<<<< HEAD + state = layer_state_set_keymap (state); +#ifdef RGBLIGHT_ENABLE + // Change RGB lighting depending on the last layer activated + rgblight_change( get_highest_layer(state) ); +#endif + return state; +||||||| f439fe6055 state = layer_state_set_keymap (state); #ifdef RGBLIGHT_ENABLE // Change RGB lighting depending on the last layer activated rgblight_change( biton32(state) ); #endif return state; +======= +/*------------------*\ +|*-----SHUTDOWN-----*| +\*------------------*/ +/* Shutdown stuff here; for when entering bootmode. + */ +__attribute__ ((weak)) void shutdown_keymap (void) { } +void shutdown_user(void) { + // Underglow LED hook on boot +# ifdef RGBLIGHT_ENABLE + shutdown_underglow(); +# endif // RGBLIGHT_ENABLE + // Perkey led hook on boot +# ifdef RGB_MATRIX_ENABLE + shutdown_rgb(); +# endif // RGB_MATRIX_ENABLE + // Keymap hooks + shutdown_keymap(); +>>>>>>> upstream/master } diff --git a/users/bbaserdem/bbaserdem.h b/users/bbaserdem/bbaserdem.h index 3a405f2a47..4792d5c2d7 100644 --- a/users/bbaserdem/bbaserdem.h +++ b/users/bbaserdem/bbaserdem.h @@ -1,268 +1,573 @@ -#ifndef USERSPACE -#define USERSPACE - +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 QMK_KEYBOARD_H #include "quantum.h" +#include "keymap_dvorak.h" + +/* Besides loading libraries and definitions, this file has my layout defs + * LAYOUTS: + * This file has a couple layouts I use; so that the general changes can be + * propagated by only editing this file. + */ + +// Macros to use, this has base level code so not affected by enabled features +#include "bb-macro.h" +// Audio from onboard speakers +#ifdef AUDIO_ENABLE +#include "bb-audio.h" +#endif // AUDIO_ENABLE +// Keycap backlight using non-rgb LEDs +#ifdef BACKLIGHT_ENABLE +#include "bb-backlight.h" +#endif // BACKLIGHT_ENABLE +// Underglow light using rgb LEDs +#ifdef RGBLIGHT_ENABLE +#include "bb-underglow.h" +#endif // RGBLIGHT_ENABLE +// Keycap backlight using rgb LEDs +#ifdef RGB_MATRIX_ENABLE +#include "bb-rgb.h" +#endif // RGB_MATRIX_ENABLE +// Rotary encoder +#ifdef ENCODER_ENABLE +#include "bb-encoder.h" +#endif // ENCODER_ENABLE +// Oled screen +#ifdef OLED_ENABLE +#include "bb-oled.h" +#endif // OLED_ENABLE + +// Structure to keep runtime info on encoder state +typedef union { + uint32_t raw; + struct { + bool rgb_sleep; + }; +} userspace_runtime_t; -#define XXX KC_NO +typedef union { + uint32_t raw; + struct { + uint8_t e0base :4; // ( 4:0) The encoder state on most layers; regular function + uint8_t e1base :4; // ( 8:1) 9 states for this; 4 bits + uint8_t e0point :2; // (10:1) The encoder state on mouse layer; moves pointer + uint8_t e1point :2; // (12:1) 4 states for this; 2 bits + uint8_t e0rgb :4; // (16:2) The encoder state on media layer; controls light + uint8_t e1rgb :4; // (20:2) 5 states for this; 3 bits but 4 is better + uint8_t layout :2; // (22:2) Stores keymap layout; 3 states is good on 2 bits + uint16_t :10; // (32:3) Padding here, free space for 10 more bits + }; +} userspace_config_t; -// Layers -#define _DV 0 // Base layer -#define _AL 1 // Alt char overlay -#define _GA 2 // Game layer -#define _NU 3 // Numbers layer -#define _SE 4 // Settings layer -#define _MO 5 // Mouse emulation -#define _MU 6 // Music mode +// Broadcast us to everyone else +extern userspace_runtime_t userspace_runtime; +extern userspace_config_t userspace_config; -// Define short macros -#define UNDO LCTL(KC_Z) -#define REDO LCTL(KC_Y) -#define COPY LCTL(KC_C) -#define CUT LCTL(KC_X) -#define PASTE LCTL(KC_V) +// Function definitions that can be accessed through specific keymaps +// Runs before all initialization +void keyboard_pre_init_keymap(void); +// For code that launches once midway through initialization +void matrix_init_keymap(void); +// For code that launches after initialization is finished. +void keyboard_post_init_keymap(void); +// These will be delegated to keymap specific stuff (weak definition) +bool process_record_keymap(uint16_t keycode, keyrecord_t *record); +// This code runs on every tick +void matrix_scan_keymap(void); +// This code runs after every layer change +layer_state_t layer_state_set_keymap(layer_state_t state); +// This code runs when the default layer changes +layer_state_t default_layer_state_set_keymap (layer_state_t state); +// Some code +void housekeeping_task_user(void); +// This code runs to set LED states +void led_set_keymap(uint8_t usb_led); +// For code that runs on suspend +void suspend_power_down_keymap(void); +void suspend_wakeup_init_keymap(void); +// For code that runs on powerdown +void shutdown_keymap(void); -// Rename mouse keys with 7 letters -#ifdef MOUSEKEY_ENABLE -#define MO_S_N KC_MS_WH_UP -#define MO_S_S KC_MS_WH_DOWN -#define MO_S_E KC_MS_WH_RIGHT -#define MO_S_W KC_MS_WH_LEFT -#define MO_N KC_MS_UP -#define MO_S KC_MS_DOWN -#define MO_E KC_MS_RIGHT -#define MO_W KC_MS_LEFT -#define MO_CL_L KC_MS_BTN1 -#define MO_CL_R KC_MS_BTN2 -#define MO_CL_M KC_MS_BTN3 -#define MO_CL_4 KC_MS_BTN4 -#define MO_CL_5 KC_MS_BTN5 -#define MO_AC_0 KC_MS_ACCEL0 -#define MO_AC_1 KC_MS_ACCEL1 -#define MO_AC_2 KC_MS_ACCEL2 +// Make it so that keymaps can use KEYMAP_SAFE_RANGE for custom keycodes +#ifdef KEYMAP_SAFE_RANGE +#define PLACEHOLDER_SAFE_RANGE KEYMAP_SAFE_RANGE #else -#define MO_S_N KC_NO -#define MO_S_S KC_NO -#define MO_S_E KC_NO -#define MO_S_W KC_NO -#define MO_N KC_NO -#define MO_S KC_NO -#define MO_E KC_NO -#define MO_W KC_NO -#define MO_CL_L KC_NO -#define MO_CL_R KC_NO -#define MO_CL_M KC_NO -#define MO_CL_1 KC_NO -#define MO_CL_2 KC_NO -#define MO_AC_0 KC_NO -#define MO_AC_1 KC_NO -#define MO_AC_2 KC_NO +#define PLACEHOLDER_SAFE_RANGE SAFE_RANGE #endif -// Rename music keys with <8 letters +// Custom macro keycode ranges +enum userspace_custom_keycodes { + // Safe stuff + BB_SAFE = PLACEHOLDER_SAFE_RANGE, + // Double entry macros + DBL_ANG, + DBL_PAR, + DBL_CBR, + DBL_BRC, + // Macro key + BB_PGPK, + // Unicode strings +# ifdef UNICODEMAP_ENABLE + BB_LENY, + BB_TABL, + TR_FLAG, +# endif // UNICODEMAP_ENABLE + // Encoder buttons +# ifdef ENCODER_ENABLE + BB_ENC0, + BB_ENC1, +# endif // ENCODER_ENABLE + // Oled editor +# ifdef OLED_ENABLE + BB_OLED, +# endif // OLED_ENABLE + //use for keymap specific codes + KEYMAP_SAFE_RANGE +}; +// Mask these keycodes if required features are not enabled +#ifndef UNICODEMAP_ENABLE +#define BB_LENY KC_NO +#define BB_TABL KC_NO +#define TR_FLAG KC_NO +#endif // UNICODEMAP_ENABLE +#ifndef ENCODER_ENABLE +#define BB_ENC0 KC_NO +#define BB_ENC1 KC_NO +#endif // ENCODER_ENABLE + +/// Enumerate of layers +enum userspace_layers { + _BASE = 0, // Base layer + _CHAR, // Characters layer + _GAME, // Game layer + _MEDI, // R3: Media layer + _NAVI, // R3: Navigation layer + _SYMB, // R1: Symbols layer + _NUMB, // L1: Numbers layer + _FUNC, // L2: Function keys layer + _MOUS, // L3: Mouse keys layer + _MUSI // Music overlay +}; + +// Use 7 wide characters for keymaps, to keep things aligned with 4 tabs +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +// These defines allow multiple multi-parameter definitions to expand +// for these boards +#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) +#define LAYOUT_ortho_4x12_wrapper(...) LAYOUT_ortho_4x12(__VA_ARGS__) +#define LAYOUT_ortho_5x15_wrapper(...) LAYOUT_ortho_5x15(__VA_ARGS__) +#define LAYOUT_ortho_3x10_wrapper(...) LAYOUT_ortho_3x10(__VA_ARGS__) +#define LAYOUT_split_3x6_3_wrapper(...) LAYOUT_split_3x6_3(__VA_ARGS__) +#define LAYOUT_split_3x5_3_wrapper(...) LAYOUT_split_3x5_3(__VA_ARGS__) + +// Masks +#define ___1___ _______ +#define ___2___ _______,_______ +#define ___3___ _______,_______,_______ +#define ___4___ _______,_______,_______,_______ +#define ___5___ _______,_______,_______,_______,_______ +#define ___6___ _______,_______,_______,_______,_______,_______ +#define xxx1xxx KC_NO +#define xxx2xxx KC_NO, KC_NO +#define xxx3xxx KC_NO, KC_NO, KC_NO +#define xxx4xxx KC_NO, KC_NO, KC_NO, KC_NO +#define xxx5xxx KC_NO, KC_NO, KC_NO, KC_NO, KC_NO +#define xxx6xxx KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO +#define xxx1xxx KC_NO +#define xxx3xxx KC_NO, KC_NO, KC_NO +#define xxx5xxx KC_NO, KC_NO, KC_NO, KC_NO, KC_NO +#define xxx6xxx KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO + +// Quick macros: in dvorak +#define BB_UNDO LCTL(KC_SLSH) // Ctrl + Z +#define BB_REDO LCTL(KC_T) // Ctrl + Y +#define BB_YANK LCTL(KC_I) // Ctrl + C +#define BB_CUT LCTL(KC_B) // Ctrl + X +#define BB_PSTE LCTL(KC_DOT) // Ctrl + V + +// Audio keys #ifdef AUDIO_ENABLE #define MU_REC KC_LCTL #define MU_STOP KC_LALT #define MU_PLAY KC_LGUI -#define MU_PLAY KC_LGUI #define MU_FAST KC_UP #define MU_SLOW KC_DOWN #define MU_MASK KC_A -#else +#define BB_SND MU_ON +#ifdef TAP_DANCE_ENABLE +#define MU_TEMP TD(TD_AUDIO_TEMPO) +#else // TAP_DANCE_ENABLE +#define MU_TEMP KC_DOWN +#endif // TAP_DANCE_ENABLE +#else // AUDIO_ENABLE #define MU_REC KC_NO #define MU_STOP KC_NO #define MU_PLAY KC_NO -#define MU_PLAY KC_NO #define MU_FAST KC_NO +#define MU_TEMP KC_NO #define MU_SLOW KC_NO #define MU_MASK KC_NO -#endif +#define BB_SND KC_MUTE +#endif // AUDIO_ENABLE -// Define non-capitalized UTF shortcuts here -#ifdef UNICODE_ENABLE -#define PHY_HBR UC(0x0127) -#define PHY_DEG UC(0x00b0) -#define CUR_LIR UC(0x20ba) -#define CUR_BIT UC(0x20bf) -#define CUR_EUR UC(0x20ac) -#define CUR_BPN UC(0x00a3) -#define CUR_YEN UC(0x00a5) -#else -#define PHY_HBR KC_NO -#define PHY_DEG KC_NO -#define CUR_LIR KC_NO -#define CUR_BIT KC_NO -#define CUR_EUR KC_NO -#define CUR_BPN KC_NO -#define CUR_YEN KC_NO -#endif +// Unicode keys +#ifdef UNICODEMAP_ENABLE +#define TR_ACIR XP(LOW_A_CIRC, UPC_A_CIRC ) +#define TR_CCED XP(LOW_C_CEDI, UPC_C_CEDI ) +#define TR_GBRE XP(LOW_G_BREV, LOW_G_BREV ) +#define TR_ICIR XP(LOW_I_CIRC, LOW_I_CIRC ) +#define TR_I_NO XP(LOW_I_DOTL, LOW_I_DOTL ) +#define TR_IDOT XP(LOW_I_DOTT, LOW_I_DOTT ) +#define TR_ODIA XP(LOW_O_DIAE, LOW_O_DIAE ) +#define TR_SCED XP(LOW_S_CEDI, LOW_S_CEDI ) +#define TR_UCIR XP(LOW_U_CIRC, LOW_U_CIRC ) +#define TR_UDIA XP(LOW_U_DIAE, LOW_U_DIAE ) +#define GR_ALP XP(LOW_ALPHA, UPC_ALPHA ) +#define GR_BET XP(LOW_BETA, UPC_BETA ) +#define GR_GAM XP(LOW_GAMMA, UPC_GAMMA ) +#define GR_DEL XP(LOW_DELTA, UPC_DELTA ) +#define GR_EPS XP(LOW_EPSILON,UPC_EPSILON) +#define GR_ZET XP(LOW_ZETA, UPC_ZETA ) +#define GR_ETA XP(LOW_ETA, UPC_ETA ) +#define GR_THE XP(LOW_THETA, UPC_THETA ) +#define GR_IOT XP(LOW_IOTA, UPC_IOTA ) +#define GR_KAP XP(LOW_KAPPA, UPC_KAPPA ) +#define GR_LAM XP(LOW_LAMBDA, UPC_LAMBDA ) +#define GR_MU XP(LOW_MU, UPC_MU ) +#define GR_NU XP(LOW_NU, UPC_NU ) +#define GR_XI XP(LOW_XI, UPC_XI ) +#define GR_OMI XP(LOW_OMICRON,UPC_OMICRON) +#define GR_PI XP(LOW_PI, UPC_PI ) +#define GR_RHO XP(LOW_RHO, UPC_RHO ) +#define GR_SIG XP(LOW_SIGMA, UPC_SIGMA ) +#define GR_TAU XP(LOW_TAU, UPC_TAU ) +#define GR_UPS XP(LOW_UPSILON,UPC_UPSILON) +#define GR_PHI XP(LOW_PHI, UPC_PHI ) +#define GR_CHI XP(LOW_CHI, UPC_CHI ) +#define GR_PSI XP(LOW_PSI, UPC_PSI ) +#define GR_OME XP(LOW_OMEGA, UPC_OMEGA ) +#define BB_ELLI X(ELLIPSIS) +#define BB_PLNK X(PLANCK_CON) +#define BB_ANGS X(ANGSTROM) +#define BB_BITC X(BITCOIN) +#else // UNICODEMAP_ENABLE +#define TR_ACIR KC_A +#define TR_CCED KC_C +#define TR_GBRE KC_G +#define TR_ICIR KC_I +#define TR_I_NO KC_I +#define TR_IDOT KC_I +#define TR_ODIA KC_O +#define TR_SCED KC_S +#define TR_UCIR KC_U +#define TR_UDIA KC_U +#define GR_ALP KC_NO +#define GR_BET KC_NO +#define GR_GAM KC_NO +#define GR_DEL KC_NO +#define GR_EPS KC_NO +#define GR_ZET KC_NO +#define GR_ETA KC_NO +#define GR_THE KC_NO +#define GR_IOT KC_NO +#define GR_KAP KC_NO +#define GR_LAM KC_NO +#define GR_MU KC_NO +#define GR_NU KC_NO +#define GR_XI KC_NO +#define GR_OMI KC_NO +#define GR_PI KC_NO +#define GR_RHO KC_NO +#define GR_SIG KC_NO +#define GR_TAU KC_NO +#define GR_UPS KC_NO +#define GR_PHI KC_NO +#define GR_CHI KC_NO +#define GR_PSI KC_NO +#define GR_OME KC_NO +#define BB_ELLI KC_NO +#define BB_PLNK KC_NO +#define BB_ANGS KC_NO +#define BB_BITC KC_NO +#endif // UNICODEMAP_ENABLE -// Custom keycodes -enum userspace_custom_keycodes { - // Turkish letters, with shifting - TUR_A = SAFE_RANGE, - TUR_C, - TUR_G, - TUR_I, - TUR_O, - TUR_S, - TUR_U, - // Unicode mode switch - UNI_LI, - UNI_WN, - // Double keys - DBL_SPC, - DBL_ANG, - DBL_PAR, - DBL_SQR, - DBL_BRC, - DBL_QUO, - DBL_DQT, - DBL_GRV, - // Diagonal mouse movements - MO_NE, - MO_NW, - MO_SE, - MO_SW, - MO_S_NE, - MO_S_NW, - MO_S_SE, - MO_S_SW, - // Layer switches and lock functionality - K_MOUSE, - K_NUMBR, - K_LOCK, - K_GAMES, - // Secret macros - SECRET1, - SECRET2, - SECRET3 -}; +// MOD-tap definitions +#define GUI_A MT(MOD_LGUI, DV_A) +#define ALT_O MT(MOD_LALT, DV_O) +#define CTRL_E MT(MOD_LCTL, DV_E) +#define SHIFT_U MT(MOD_LSFT, DV_U) +#define ALTGR_Q MT(MOD_RALT, DV_Q) +#define GUI_S MT(MOD_RGUI, DV_S) +#define ALT_N MT(MOD_LALT, DV_N) +#define CTRL_T MT(MOD_LCTL, DV_T) +#define SHIFT_H MT(MOD_LSFT, DV_H) +#define ALTGR_V MT(MOD_RALT, DV_V) -// Do tap dancable semicolon key if available -#ifdef TAP_DANCE_ENABLE -enum { - SCL = 0 -}; -#define MY_SCL TD(SCL) -#else -#define MY_SCL KC_SCLN -#endif +// Layer switches +#define MED_DEL LT(_MEDI, KC_DEL ) +#define NAV_TAB LT(_NAVI, KC_TAB ) +#define SYM_SPC LT(_SYMB, KC_SPC ) +#define NUM_ENT LT(_NUMB, KC_ENT ) +#define FUN_ESC LT(_FUNC, KC_ESC ) +#define MOU_BSP LT(_MOUS, KC_BSPC) + +// Layer switches +#define BB_CHAR OSL(_CHAR) +#define BB_GAME TG(_GAME) -// Shared keymaps -#define LAYOUT_planck_wrapper(...) LAYOUT_planck_grid(__VA_ARGS__) -#define LAYOUT_letssplit_wrapper(...) LAYOUT_ortho_4x12(__VA_ARGS__) +/* Depending on how the layouts change with language; the keys are shown as; + * ┌────────────────────────────────────────────────┐ + * │AltGr -none- Shift Shift+AltGr │ + * └────────────────────────────────────────────────┘ + * If there is an exclamation mark; it indicates a dead key on this map. + */ -/* Dvorak - * ,------------------------------------------------------------------------. - * | Esc | ' " | , | . | P | Y || F | G | C | R | L | Bkp | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | Tab | A | O | E | U | I || D | H | T | N | S | / ? | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | SYM | ; : | Q | J | K | X || B | M | W | V | Z | SET | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | TUR | OS | Ctrl| Alt | Shf | Spc || Ent | Lft | Dwn | Up | Rght| MSE | - * `------------------------------------------------------------------------' */ -#define DVORAK \ - KC_ESC, KC_QUOT,KC_COMM,KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ - KC_TAB, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ - K_NUMBR,MY_SCL, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, MO(_SE), \ - MO(_AL),KC_LGUI,KC_LCTL,KC_LALT,KC_LSFT,KC_SPC, KC_ENT, KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,K_MOUSE +/* Base layout + * DVORAK + * ┌─────┬─────┬─────┬─────┬─────┐ ┌─────┬─────┬─────┬─────┬─────┐ + * ` ~ │ ' " │ , < │ . > │ p P │ y Y │ │ f F │ g G │ c C │ r R │ l L │ < > + * ├─────┼─────┼─────┼─────┼─────┤ ├─────┼─────┼─────┼─────┼─────┤ + * \ | │ a A │ o O │ e E │ u U │ i I │ │ d D │ h H │ t T │ n N │ s S │ - _ + * ├─Gui─┼─Alt─┼─Ctr─┼─Sft─┼─────┤ ├─────┼─Sft─┼─Ctr─┼─Alt─┼─Gui─┤ + * / ? │ ; : │ q Q │ j J │ k K │ x X │ │ b B │ m M │ w W │ v V │ z Z │ = + + * └─────┴AltGr┴─────┼─────┼─────┼─────┐ ┌─────┼─────┼─────┼─────┴AltGr┴─────┘ + * │ Del │ Tab │Space│ │Enter│ Esc │BkSpc│ + * └─Med─┴─Nav─┴─Sym─┘ └─Num─┴─Fun─┴─Mou─┘ + * TURKISH F + * ┌─────┬─────┬─────┬─────┬─────┐ ┌─────┬─────┬─────┬─────┬─────┐ + * ¬+ *±│@f F │ g G │ ğ Ğ │¶ı I │ôo OÔ│ │¥d D │®r R │ n N │°h H │£p P │|< >¦ + * !├─────┼─────┼─────┼─────┼─────┤ ├─────┼─────┼─────┼─────┼────!┤ ! + * `x Xà│ûu UÛ│îi İÎ│€e E │âa AÂ│ûü ÜÛ│ │₺t T │ k K │µm M │ l L │´y Yá│#ş Şǎ + * ! !├─Gui─┼─Alt─┼─Ctr─┼─Sft─┼─────┤ ├─────┼─Sft─┼─Ctr─┼─Alt!┼─Gui─┤ + * äq Qå│«j J<│»ö Ö>│“v V │¢c C©│”ç Ç │ │ z Z │§s S │×b B │÷. :ȧ│·, ; │~w W + * └─────┴AltGr┴─────┼─────┼─────┼─────┐ ┌─────┼─────┼─────┼─────┴AltGr┴─────┘ + * │ Del │ Tab │Space│ │Enter│ Esc │BkSpc│ + * └─Med─┴─Nav─┴─Sym─┘ └─Num─┴─Fun─┴─Mou─┘ + * The thing about this layout is that these will fit most boards I have. + */ +#define _BL1_5_ DV_QUOT,DV_COMM,DV_DOT, DV_P, DV_Y +#define _BR1_5_ DV_F, DV_G, DV_C, DV_R, DV_L +#define _BL2_5_ GUI_A, ALT_O, CTRL_E, SHIFT_U,DV_I +#define _BR2_5_ DV_D, SHIFT_H,CTRL_T, ALT_N, GUI_S +#define _BL3_5_ DV_SCLN,ALTGR_Q,DV_J, DV_K, DV_X +#define _BR3_5_ DV_B, DV_M, DV_W, ALTGR_V,DV_Z +#define _BL4_3_ MED_DEL,NAV_TAB,SYM_SPC +#define _BR4_3_ NUM_ENT,FUN_ESC,MOU_BSP +// The extra line for the 6th (or 0th) row +#define _BL1_1_ DV_GRV +#define _BR1_1_ KC_NUBS +#define _BL2_1_ DV_BSLS +#define _BR2_1_ DV_MINS +#define _BL3_1_ DV_SLSH +#define _BR3_1_ DV_EQL -/* Alternative character overlay - * ,------------------------------------------------------------------------. - * | | ' ' | Undo| Redo|Pound| Yen || | G | C | |TLira| Del | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | | A | O | Euro| U | I ||Degre|Plank| | | S | Ins | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | | " " | Cut | Copy|Paste| || BTC | < > | ( ) | [ ] | { } | PgUp| - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | | | | | | || | Home|PgDwn| PgUp| End | | - * `------------------------------------------------------------------------' */ -#define ALTCHAR \ - _______,DBL_QUO,UNDO, REDO, CUR_BPN,CUR_YEN,_______,TUR_G, TUR_C, _______,CUR_LIR,KC_DEL , \ - _______,TUR_A, TUR_O, CUR_EUR,TUR_U, TUR_I, PHY_DEG,PHY_HBR,_______,_______,TUR_S, KC_INS , \ - _______,DBL_DQT,CUT, COPY, PASTE, DBL_GRV,CUR_BIT,DBL_ANG,DBL_PAR,DBL_SQR,DBL_BRC,_______, \ - _______,_______,_______,_______,_______,DBL_SPC,_______,KC_HOME,KC_PGDN,KC_PGUP,KC_END, _______ +/* Extra characters layer + * This is accessed using unicode; so IBus compatible apps only. + * ┌─────┬─────┬─────┬─────┬─────┐ ┌─────┬─────┬─────┬─────┬─────┐ + * │TrFlg│Lenny│Table│ π │ υ │ │ φ │ γ │ χ │ ρ │ λ │ + * ├─────┼─────┼─────┼─────┼─────┤ ├─────┼─────┼─────┼─────┼─────┤ + * │ α │ ο │ ε │ ψ │ ι │ │ δ │ η │ τ │ ν │ σ │ + * ├─────┼─────┼─────┼─────┼─────┤ ├─────┼─────┼─────┼─────┼─────┤ + * │ ₿ │ θ │ ℏ │ κ │ ξ │ │ β │ μ │ ω │ Å │ ζ │ + * └─────┴─────┴─────┼─────┼─────┼─────┐ ┌─────┼─────┼─────┼─────┴─────┴─────┘ + * │ Shf │ ... │ GPG │ │ │ │ Shf │ + * └─────┴─────┴─────┘ └─────┴─────┴─────┘ + * + */ +#define _CL1_5_ TR_FLAG,BB_LENY,BB_TABL,GR_PI, GR_UPS +#define _CR1_5_ GR_PHI, GR_GAM, GR_CHI, GR_RHO, GR_LAM +#define _CL2_5_ GR_ALP, GR_OMI, GR_EPS, GR_PSI, GR_IOT +#define _CR2_5_ GR_DEL, GR_ETA, GR_TAU, GR_NU, GR_SIG +#define _CL3_5_ BB_BITC,GR_THE, BB_PLNK,GR_KAP, GR_XI +#define _CR3_5_ GR_BET, GR_MU, GR_OME, BB_ANGS,GR_ZET +#define _CL4_3_ KC_RSFT,BB_ELLI,BB_PGPK +#define _CR4_3_ XXXXXXX,XXXXXXX,KC_LSFT /* Game layer - * ,------------------------------------------------------------------------. - * | OFF | Q | W | E | R | T || Esc | 7 | 8 | 9 |NumLk|Bkspc| - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | Tab | A | S | D | F | G || F1 | 4 | 5 | 6 | \ | Ent | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | | Z | X | C | V | B || F2 | 1 | 2 | 3 | ^ | | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | / | ` | | | | Spc || Spc | Ent | 0 | < | v | > | - * `------------------------------------------------------------------------' */ -#define GAME \ - K_GAMES,KC_Q, KC_W, KC_E, KC_R, KC_T, KC_ESC, KC_P7, KC_P8, KC_P9, KC_NLCK,KC_BSPC, \ - KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_F1, KC_P4, KC_P5, KC_P6, KC_BSLS,KC_ENT , \ - _______,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_F2, KC_P1, KC_P2, KC_P3, KC_UP, _______, \ - KC_SLSH,KC_GRV, _______,_______,_______,KC_SPC, KC_SPC, KC_ENT, KC_P0, KC_LEFT,KC_DOWN,KC_RGHT + * This layer turns off the tap-hold keys for the left half. + * ┌─────┬─────┬─────┬─────┬─────┐ + * │ Q │ W │ E │ R │ T │ + * ├─────┼─────┼─────┼─────┼─────┤ + * Tab │ A │ S │ D │ F │ G │ + * ├─────┼─────┼─────┼─────┼─────┤ + * Shift│ Z │ X │ C │ V │ B │ + * └─────┴─────┴─────┼─────┼─────┼─────┐ + * │ Esc │Enter│Space│ + * └─────┴─────┴─────┘ + */ +#define _GA1_5_ KC_Q, KC_W, KC_E, KC_R, KC_T +#define _GA1_1_ _______ +#define _GA2_5_ KC_A, KC_S, KC_D, KC_F, KC_G +#define _GA2_1_ KC_TAB +#define _GA3_5_ KC_Z, KC_X, KC_C, KC_V, KC_B +#define _GA3_1_ KC_LSFT +#define _GA4_3_ KC_ESC, KC_ENT, KC_SPC + +/* Media layer + * ┌─────┬─────┬─────┬─────┬─────┐ + * │Speed│ Mod │ Hue │ Sat │ Bri │ RGB light control + * ├─────┼─────┼─────┼─────┼─────┤ + * │Togg.│Prev.│MuTog│MuStp│Next │ Media control + * ├─────┼─────┼─────┼─────┼─────┤ + * │Sink │Vol -│ Mut │Eject│Vol +│ Volume control + * ┌─────┼─────┼─────┼─────┴─────┴─────┘ + * │OledL│Veloc│Music│ Feature control on keyboard + * └─────┴─────┴─────┘ + */ +#define _ME1_5_ RGB_SPI,RGB_MOD,RGB_HUI,RGB_SAI,RGB_VAI +#define _ME2_5_ RGB_TOG,KC_MPRV,KC_MPLY,KC_MSTP,KC_MNXT +#define _ME3_5_ KC_F13, KC_VOLD,KC_MUTE,KC_EJCT,KC_VOLU +#define _ME4_3_ BB_OLED,VLK_TOG,MU_TOG + +/* Navigation layer + * ┌─────┬─────┬─────┬─────┬─────┐ + * │Redo │Paste│Yank │ Cut │PrScr│ + * ├─────┼─────┼─────┼─────┼─────┤ + * │Undo │ < │ v │ ^ │ > │ + * ├─────┼─────┼─────┼─────┼─────┤ + * │ Ins │Home │PgDwn│PgUp │ End │ + * ┌─────┼─────┼─────┼─────┴─────┴─────┘ + * │Enter│ Esc │BkSpc│ + * └─────┴─────┴─────┘ + */ +#define _NA1_5_ BB_REDO,BB_PSTE,BB_YANK,BB_CUT, KC_PSCR +#define _NA2_5_ BB_UNDO,KC_LEFT,KC_DOWN,KC_UP, KC_RGHT +#define _NA3_5_ KC_INS, KC_HOME,KC_PGDN,KC_PGUP,KC_END +#define _NA4_3_ KC_ENT, KC_ESC, KC_BSPC /* Symbols layer - * ,------------------------------------------------------------------------. - * | OFF | ` | ~ | [ | ] | { || } | - | _ | = | + | | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | \ | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | | ! | @ | # | $ | % || ^ | & | * | ( | ) | LCK | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | | | | | | | || | | | | | | - * `------------------------------------------------------------------------' */ -#define NUMBERS \ - K_NUMBR,KC_GRV, KC_TILD,KC_LBRC,KC_RBRC,KC_LCBR,KC_RCBR,KC_MINS,KC_UNDS,KC_EQL, KC_PLUS,_______, \ - _______,KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS, \ - _______,KC_EXLM,KC_AT, KC_HASH,KC_DLR, KC_PERC,KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RPRN,K_LOCK , \ - KC_PIPE,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______ + * This layer has the central columns shifted for convenience + * DVORAK + * ┌─────┬─────┬─────┬─────┬─────┐ + * │ ` │ { │ } │ / │ = │ + * ├─────┼─────┼─────┼─────┼─────┤ + * │ ~ │ [ │ ] │ ? │ + │ + * ├─────┼─────┼─────┼─────┼─────┤ + * │CapsL│ ( │ ) │ \ │ | │ + * ┌─────┼─────┼─────┼─────┴─────┴─────┘ + * │Enter│ Esc │BkSpc│ + * └─────┴─────┴─────┘ + * Turkish F + * (AltGr is right on the central column, red. keys on main layer are omitted) + * ┌─────┬─────┬─────┬─────┬─────┐ + * │ + ¬ │ / \ │ - | │ │ │ + * ├─────┼─────┼─────┼─────┼─────┤ + * │ * ± │ ? ¿ │ _ │ │ │ + * ├─────┼─────┼─────┼─────┼─────┤ + * │CapsL│ │ │ │ │ + * ┌─────┼─────┼─────┼─────┴─────┴─────┘ + * │Enter│ Esc │BkSpc│ + * └─────┴─────┴─────┘ + * QWERTY + * ┌─────┬─────┬─────┬─────┬─────┐ + * │ ` │ - │ = │ { │ } │ + * ├─────┼─────┼─────┼─────┼─────┤ + * │ ~ │ _ │ + │ [ │ ] │ + * ├─────┼─────┼─────┼─────┼─────┤ + * │CapsL│ ( │ ) │ \ │ | │ + * ┌─────┼─────┼─────┼─────┴─────┴─────┘ + * │Enter│ Esc │BkSpc│ + * └─────┴─────┴─────┘ + */ +#define _SY1_5_ DV_GRV, DV_LCBR,DV_RCBR,DV_SLSH,DV_EQL +#define _SY2_5_ DV_TILD,DV_LBRC,DV_RBRC,DV_QUES,DV_PLUS +#define _SY3_5_ KC_CAPS,DV_LPRN,DV_RPRN,DV_BSLS,DV_PIPE +#define _SY4_3_ KC_ENT, KC_ESC, KC_BSPC -/* Settings layer - * ,------------------------------------------------------------------------. - * |BLLed| F1 | F2 | F3 | F4 | Lin || Win | Wake| |Hue -|Hue +|Reset| - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | | F5 | F6 | F7 | F8 | || | |RGBto|Sat -|Sat +| | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | Game| F9 | F10 | F11 | F12 |Vol 0||PrtSc| |RGBan|Bri -|Bri +| | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * |Musir| | | | |Vol -||Vol +| Prev| Stop|TogMu| Next| | - * `------------------------------------------------------------------------' */ -#define SETTINGS \ - BL_STEP,KC_F1, KC_F2, KC_F3, KC_F4, UNI_LI, UNI_WN, KC_WAKE,_______,RGB_HUD,RGB_HUI,RESET , \ - _______,KC_F5, KC_F6, KC_F7, KC_F8, _______,_______,_______,RGB_TOG,RGB_SAD,RGB_SAI,_______, \ - K_GAMES,KC_F9, KC_F10, KC_F11, KC_F12, KC_MUTE,KC_PSCR,_______,RGB_MOD,RGB_VAD,RGB_VAI,_______, \ - MU_TOG, _______,_______,_______,_______,KC_VOLD,KC_VOLU,KC_MPRV,KC_MSTP,KC_MPLY,KC_MNXT,_______ +/* Numbers layer + * This layer contains numbers and the associated symbols. + * DVORAK + * ┌─────┬─────┬─────┬─────┬─────┐ + * │ < │ 7 & │ 8 * │ 9 ( │ 0 ) │ + * ├─────┼─────┼─────┼─────┼─────┤ + * │ _ │ 4 $ │ 5 % │ 6 ^ │ - │ + * ├─────┼─────┼─────┼─────┼─────┤ + * │ > │ 1 ! │ 2 @ │ 3 # │Char.│ + * └─────┴─────┴─────┼─────┼─────┼─────┐ + * │ Del │ Tab │Space│ + * └─────┴─────┴─────┘ + * Turkish F + * ┌─────┬─────┬─────┬─────┬─────┐ + * │ < | │{7 ' │[8 ( │]9 )±│}0 =°│ + * ├─────┼─────┼─────┼─────┼─────┤ + * │ │¼4 $ │½5 %⅜│¾6 & │ │ + * ├─────┼─────┼─────┼─────┼─────┤ + * │ > ¦ │¹1 !¡│²2 " │#3 ^³│Char.│ + * └─────┴─────┴─────┼─────┼─────┼─────┐ + * │ Del │ Tab │Space│ + * └─────┴─────┴─────┘ + */ +#define _NU1_5_ KC_NUBS,KC_7, KC_8, KC_9, KC_0 +#define _NU2_5_ DV_UNDS,KC_4, KC_5, KC_6, DV_MINS +#define _NU3_5_ LSFT(KC_NUBS), KC_1, KC_2, KC_3, BB_CHAR +#define _NU4_3_ KC_DEL, KC_TAB, KC_SPC + +/* Function layer + * ┌─────┬─────┬─────┬─────┬─────┐ + * │ F01 │ F02 │ F03 │ F04 │EEPRM│ + * ├─────┼─────┼─────┼─────┼─────┤ + * │ F05 │ F06 │ F07 │ F08 │EEPRM│ + * ├─────┼─────┼─────┼─────┼─────┤ + * │ F09 │ F10 │ F11 │ F12 │GameL│ + * └─────┴─────┴─────┼─────┼─────┼─────┐ + * │ Del │ Tab │Space│ + * └─────┴─────┴─────┘ + */ +#define _FU1_5_ KC_F1, KC_F2, KC_F3, KC_F4, RESET +#define _FU2_5_ KC_F5, KC_F6, KC_F7, KC_F8, EEP_RST +#define _FU3_5_ KC_F9, KC_F10, KC_F11, KC_F12, BB_GAME +#define _FU4_3_ KC_DEL, KC_TAB, KC_SPC /* Mouse layer - * ,------------------------------------------------------------------------. - * |Ulock| \ | ^ | / |.....|.....||.....|.....| |\|.| |^| | |/|.| | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | | < | Mid | > |Btn 4|.....||.....|Btn 5| <-- | Mid | --> | | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | | / | v | \ |.....|.....||.....|.....| |/| | |v| | |\| | LCK | - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | | | | | | Left||Right| | |Accl0|Accl1|Accl2| - * `------------------------------------------------------------------------' */ -#define MOUSE \ - K_MOUSE,MO_NW, MO_N, MO_NE, XXX, XXX ,XXX, XXX, MO_S_NW,MO_S_N, MO_S_NE,_______, \ - _______,MO_W, MO_CL_M,MO_E, MO_CL_4,XXX ,XXX, MO_CL_5,MO_S_W, MO_CL_M,MO_S_E, _______, \ - _______,MO_SW, MO_S, MO_SE, XXX, XXX ,XXX, XXX, MO_S_SW,MO_S_S, MO_S_SE,K_LOCK , \ - _______,_______,_______,_______,_______,MO_CL_L,MO_CL_R,_______,MO_AC_0,MO_AC_1,MO_AC_2,_______ + * ┌─────┬─────┬─────┬─────┬─────┐ + * │Slow │Right│ Mid │ Lft │Fast │ + * ├─────┼─────┼─────┼─────┼─────┤ + * │ |<| │ |v| │ |^| │ |>| │ Bt4 │ + * ├─────┼─────┼─────┼─────┼─────┤ + * │ <<< │ vvv │ ^^^ │ >>> │ Bt5 │ + * └─────┴─────┴─────┼─────┼─────┼─────┐ + * │ Del │ Tab │Space│ + * └─────┴─────┴─────┘ + */ +#define _MO1_5_ KC_ACL0,KC_BTN1,KC_BTN2,KC_BTN3,KC_ACL2 +#define _MO2_5_ KC_MS_L,KC_MS_D,KC_MS_U,KC_MS_R,KC_BTN4 +#define _MO3_5_ KC_WH_L,KC_WH_D,KC_WH_U,KC_WH_R,KC_BTN5 +#define _MO4_3_ KC_DEL, KC_TAB, KC_SPC /* Music layer - * ,------------------------------------------------------------------------. - * |.....|.....|.....|.....|.....|.....||.....|.....|.....|.....|.....|.....| - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * |.....|.....|.....|.....|.....|.....||.....|.....|.....|.....|.....|.....| - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * |.....|.....|.....|.....|.....|.....||.....|.....|.....|.....|.....|.....| - * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| - * | togg| rec | stop| play| slow| fast||modes|.....|.....|.....|.....|.....| - * `------------------------------------------------------------------------' + * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ + * │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ + * ├───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┤ + * │ │ │ │ │ │ │ │ │ │ │ │ │ + * └───┴───┴───┼───┼───┼───┼───┼───┼───┼───┴───┴───┘ + * │Rec│Stp│Ply│Tmp│Mod│Off│ + * └───┴───┴───┴───┴───┴───┘ */ -#define MUSIC \ - MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK, \ - MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK, \ - MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK, \ - MU_TOG, MU_REC, MU_STOP,MU_PLAY,MU_SLOW,MU_FAST,MU_MOD, MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK - -#endif +#define _MUL_3_ MU_REC, MU_STOP,MU_PLAY +#define _MUR_3_ MU_TEMP,MU_MOD, MU_TOG +#define _MU_01_ MU_MASK +#define _MU_02_ MU_MASK,MU_MASK +#define _MU_03_ MU_MASK,MU_MASK,MU_MASK +#define _MU_06_ MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK +#define _MU_08_ MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK +#define _MU_10_ MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK +#define _MU_12_ MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK,MU_MASK diff --git a/users/bbaserdem/config.h b/users/bbaserdem/config.h index 3dde5772cc..477378102b 100644 --- a/users/bbaserdem/config.h +++ b/users/bbaserdem/config.h @@ -1,9 +1,134 @@ -#ifndef USERSPACE_CONFIG_H -#define USERSPACE_CONFIG_H +/* Copyright 2021 Batuhan Başerdem + * <baserdem.batuhan@gmail.com> @bbaserdem + * + * 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 -#ifdef TAP_DANCE_ENABLE - #define TAPPING_TERM 300 - #define TAPPING_TOGGLE 1 +/* CONFIG + * Common hardware configuration accross my boards + */ +// Space saving +#ifdef LOCKING_SUPPORT_ENABLE +# undef LOCKING_SUPPORT_ENABLE #endif +#ifdef LOCKING_RESYNC_ENABLE +# undef LOCKING_RESYNC_ENABLE +#endif +#ifndef NO_DEBUG +# define NO_DEBUG +#endif + +#if !defined(NO_PRINT) && !defined(CONSOLE_ENABLE) +# define NO_PRINT +#endif + +// Some of my own settings +# define HOUSEKEEPING_THROTTLE_INTERVAL_MS 250 + +// Split transport settings +#ifdef SPLIT_KEYBOARD +# define SPLIT_TRANSPORT_MIRROR +# define SPLIT_LAYER_STATE_ENABLE +# define SPLIT_MODS_ENABLE +# define SPLIT_TRANSACTION_IDS_USER RPC_ID_CONFIG_SYNC, RPC_ID_RUNTIME_SYNC, RPC_ID_KEYMAP_SYNC +# define SPLIT_LED_STATE_ENABLE +# ifdef WPM_ENABLE +# define SPLIT_WPM_ENABLE +# endif // WPM_ENABLE +# ifdef OLED_ENABLE +# define SPLIT_OLED_ENABLE +# endif // OLED_ENABLE +#endif // SPLIT_KEYBOARD + +// Unicode entry mode +#ifdef UNICODEMAP_ENABLE +# define UNICODE_SELECTED_MODES UC_LNX + // Adapt the unicode entry mode to dvorak +# ifdef UNICODE_KEY_LNX +# undef UNICODE_KEY_LNX +# endif +# define UNICODE_KEY_LNX LCTL(LSFT(KC_F)) +#endif // UNICODEMAP_ENABLE + +// Mousekey mode +#ifdef MOUSEKEY_ENABLE +# define MK_COMBINED +#endif // MOUSEKEY_ENABLE + +// Tap-hold settings +#define TAPPING_TERM 200 +#define TAP_CODE_DELAY 20 +#define IGNORE_MOD_TAP_INTERRUPT +#define PERMISSIVE_HOLD +#define TAPPING_FORCE_HOLD + +// Backlight settings +#ifdef BACKLIGHT_ENABLE +# define BACKLIGHT_BREATHING +# define BREATHING_PERIOD 5 +#endif // BACKLIGHT_ENABLE + +// Audio definitions +#ifdef AUDIO_ENABLE +//# define AUDIO_ENABLE_TONE_MULTIPLEXING + // Make findable songs as defaults +# ifdef HOROLOGY +# define STARTUP_SONG SONG(HOROLOGY) +# endif +# ifdef PEOPLE_VULTURES +# define GOODBYE_SONG SONG(PEOPLE_VULTURES) +# endif +# ifdef NONAGON_INFINITY +# define MUSIC_ON_SONG SONG(NONAGON_INFINITY) +# endif +# ifdef WAH_WAH +# define MUSIC_OFF_SONG SONG(WAH_WAH) +# endif + // Audio code expects these to be defined +# ifdef BIG_FIG_WASP +# define GAME_ON_SONG SONG(BIG_FIG_WASP) +# else +# define GAME_ON_SONG SONG(USSR_ANTHEM) +# endif +# ifdef POLYGONDWANALAND +# define GAME_OFF_SONG SONG(POLYGONDWANALAND) +# else +# define GAME_OFF_SONG SONG(NOCTURNE_OP_9_NO_1) +# endif +#endif // AUDIO_ENABLE + +// OLED definitions +#ifdef OLED_ENABLE + // Timeout does not work for split secondary board; i implemented it myself +# define OLED_TIMEOUT 30000 + // Fade out the screen when timing out +# define OLED_FADE_OUT +# define OLED_FADE_OUT_INTERVAL 15 +#endif // OLED_ENABLE -#endif // !USERSPACE_CONFIG_H +// For perkey leds +#ifdef RGB_MATRIX_ENABLE +// This is not working +//# define RGB_DISABLE_TIMEOUT 1800000 +# define RGB_DISABLE_WHEN_USB_SUSPENDED true + // Start using this mode +# define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_RAINBOW_BEACON +# define RGB_MATRIX_STARTUP_HUE 100 +# define RGB_MATRIX_STARTUP_SAT 255 +# define RGB_MATRIX_STARTUP_VAL RGB_MATRIX_MAXIMUM_BRIGHTNESS + // Some config options +# define RGB_MATRIX_KEYRELEASES +# define RGB_MATRIX_FRAMEBUFFER_EFFECTS // Enable framebuffer effects +#endif // RGB_MATRIX_ENABLE diff --git a/users/bbaserdem/keymap-bitmaps/.gitignore b/users/bbaserdem/keymap-bitmaps/.gitignore new file mode 100644 index 0000000000..6448f593d6 --- /dev/null +++ b/users/bbaserdem/keymap-bitmaps/.gitignore @@ -0,0 +1,4 @@ +*.bmp +splitImages +templates +!.gitignore diff --git a/users/bbaserdem/keymap-bitmaps/cropBmp b/users/bbaserdem/keymap-bitmaps/cropBmp new file mode 100755 index 0000000000..4a322b4175 --- /dev/null +++ b/users/bbaserdem/keymap-bitmaps/cropBmp @@ -0,0 +1,38 @@ +#!/bin/bash + +# Copyright 2021 Batuhan Başerdem +# <baserdem.batuhan@gmail.com> @bbaserdem +# +# 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/>. + +# Goes through all the files and turns them into strips in their respective folder +if [ -z "${1}" ] ; then + echo 'No argument; defaulting to script directory.' + target_dir="$(dirname "${0}")" +elif [ -d "${1}" ] ; then + echo "Targeting files in '${1}'." + target_dir="${1}" +else + echo 'Argument is not directory.' + exit 1 +fi + +output_dir="${target_dir}/splitImages" +mkdir -p "${output_dir}" + +for this_image in "${target_dir}/"*.bmp ; do + echo "Found '${this_image}'." + this_name="$(basename "${this_image%%.bmp}")" + convert "${this_image}" -crop 'x8' "${output_dir}/${this_name}"_%d.bmp +done diff --git a/users/bbaserdem/readme.md b/users/bbaserdem/readme.md new file mode 100644 index 0000000000..0a1b80cc74 --- /dev/null +++ b/users/bbaserdem/readme.md @@ -0,0 +1,131 @@ +# BBASERDEM userspace code for qmk + +My userspace code for my various keyboards; available here. + +## Builds + +These are my keyboard builds and info, it allows me to plan out my builds. + +### Planck SERVER + +* Board: `kprepublic/jj40` +* Microcontroller: Embedded +* Layout: `ortho_4x12` +* Functionality: Underglow RGB Lighting, LED diode lighting. +* Case: Clear Acrylic Top and Bottow, with Frosted Acrylic Diffuser (Smashing Acrylics) +* Switches: BOX Navy +* Keycaps: Datamancer Tall Deco Typewriter Keycaps + +Just a decorative planck replacement (for my rev4 PCB that died.) + +### Planck Light + +* Board: `planck/light` +* Microcontroller: Embedded +* Layout: `ortho_4x12` +* Functionality: Per-key RGB Lighting, Audio. +* Case: Clear Acrylic Top and Bottow, with Frosted Acrylic Diffuser (Smashing Acrylics) +* Switches: BOX Navy +* Keycaps: Datamancer Tall Deco Typewriter Keycaps + +Just a decorative planck replacement (for my rev4 PCB that died.) + +### Corne ARM + +* Board: `crkbd/rev1` +* Microcontroller: Proton C (x2) +* Layout: `split_3x6_3` +* Functionality: OLED, Audio, Per-key RGB Lighting, Rotary Encoder (x2) +* Case: IMK Corne Case v2 Polycarbonate +* Switches: Healios V2 +* Keycaps: POM Jelly + +PCB is actually [Proton-C Compatible crkbd PCB](https://github.com/ItsWaffIe/waffle_corne). + +### Corne Lite + +* Board: `crkbd/rev1` +* Microcontroller: Pro Micro (x2) +* Layout: `split_3x5_3` +* Functionality: Per-key RGB Lighting, OLED (No firmware space) +* Case: Custom +* Switches: Choc Low Burnt Orange +* Keycaps: [Scooped Choc Keycaps](https://mkultra.click/collections/keycaps/products/scooped-choc-keycaps?variant=31223543365730) + +Maybe try adding a trackpad for this, as detailed +[here](https://github.com/manna-harbour/crkbd/blob/master/trackpoint/readme.org). + +### Kyria + +* Board: `splitkb/kyria/rev1` +* Microcontroller: Pro Micro (x2) +* Layout: `split_3x6_6` +* Functionality: OLED, Underglow RGB Lighting (No firmware space), Rotary Encoder (x2) +* Case: Matte Black Acrylic High-Profile case +* Switches: Gateron Ink Silent Black +* Keycaps: Oblotzky SA Oblivion + +Main driver at work currently; love the switches and the board layout. + +# Firmware building + +## Archlinux + +On archlinux, the package *arm-none-eabi-gcc* is too new. +To fix; add to the environment `CFLAGS="-Wno-error=deprecated"` to compilation commands. +Also; says to run `avr-gcc` version `8.4.0` for smaller firmware, +but I find that it only saves a few bytes. + +## Bootloader + +Needed to type this out from the QMK website. +If I want to flash a new bootloader for a machine; here are steps; + +1. Flash the util/pro_micro_ISP_B6_10.hex to a spare promicro using; +`avrdude -p atmega32u4 -P "$(ls /dev/ttyACM*)" -c avr109 -D -U flash:w:pro_micro_ISP_B6_10.hex` +2. Wire the pins; (first is the ISP pro micro; second is the target) +``` +Pro Micro 10 (B6) <-> Keyboard RESET +Pro Micro 15 (B1) <-> Keyboard B1 (SCLK) +Pro Micro 16 (B2) <-> Keyboard B2 (MOSI) +Pro Micro 14 (B3) <-> Keyboard B3 (MISO) +Pro Micro VCC <-> Keyboard VCC +Pro Micro GND <-> Keyboard GND +``` +I do have this on hand I believe; from massdrop's planck light firmware updater. +3. Connect the flashed pro micro to my computer and run +`avrdude -c avrisp -P "$(ls /dev/ttyACM*)" -p atmega32u4 -U flash:w:bootloader_atmega32u4_1.0.0.hex:i -U lfuse:w:0x5E:m -U hfuse:w:0xD9:m -U efuse:w:0xC3:m` + +The avrisp here refers to the firmware on the ISP flasher pro micro. +The `atmega32u4` refers to the CPU used in the respective breakout boards. +The `avrdude` command interacts with catalina bootloader. +The shell call after the `-P` flag auto finds the port that the pro micro connects to. +The last few arguments are some jumpers apparently. + +# Features + +My userspace has a lot of shared code between different keyboards. +These files are prefixed with `sbp-` to remove any naming clash. + +* [bb-audio](bb-audio.c): Code dealing with audio playback using onboard sound. +* [bb-encoder](bb-encoder.c): Rotary encoder sutff. +* [bb-macro](bb-macro.c): My custom keycodes; macros, tap dances, etc. +* [bb-oled](bb-oled.c): Controls OLED displays. For higher memory; there is also [bb-oled-extra](bb-oled-extra.c). +* [bb-rgb](bb-rgb.c): Controls per-key RGB LED matrix stuff, and layer indication. Uses `RGB_MATRIX`. +* [bb-underglaw](bb-underglow.c): Controls RGB LED strip, and layer indication. Uses `RGBLIGHT`. + +# Layout + +My personal layout is mostly inspired by the +[Miryoku layout](../manna-harbour_miryoku/miryoku.org). +There are some changes to make it friendlier to international keyboards. +My board is compatible with software implementation of Dvorak and Turkish F. + +## Base + +Base layer uses tap-hold functionality to have access to modifiers. +The modifiers are mirrored on each half of the layout; +as to make those modifiers accessible to the keys that overlap them. +Besides the Alt key; each side has the proper L/R version of the modifier. +Since Right Alt key functions as AltGr key; +both the L and R versions are available on each side. diff --git a/users/bbaserdem/rules.mk b/users/bbaserdem/rules.mk index 9c7e78e2f8..58f72bb110 100644 --- a/users/bbaserdem/rules.mk +++ b/users/bbaserdem/rules.mk @@ -1,21 +1,87 @@ +# Copyright 2021 Batuhan Başerdem +# <baserdem.batuhan@gmail.com> @bbaserdem +# +# 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/>. + +# Common compilation flags +LTO_ENABLE = yes + +# These should be enabled in all boards +MOUSEKEY_ENABLE = yes # Mouse emulation keys +EXTRAKEY_ENABLE = yes # OS signals like volume control +UNICODEMAP_ENABLE = yes # Used for unicode character emulation + +# These should be disabled in all boards +BOOTMAGIC_ENABLE = no # Access to EEPROM settings, not needed +CONSOLE_ENABLE = no # Allows console output with a command +COMMAND_ENABLE = no # Some bootmagic thing i dont use +SLEEP_LED_ENABLE = no # Breathes LED's when computer is asleep. Untested. +MIDI_ENABLE = no # Midi driver (untested) +UNICODE_ENABLE = no # We use unicodemap, not unicode +UCIS_ENABLE = no # We use unicodemap, not ucis +VARIABLE_TRACE = no # Allows debugging variables +KEY_LOCK_ENABLE = no # Allows locking any key. Not used in general +RGBLIGHT_ENABLE = no # LED strip, but there is RGB_MATRIX instead +TAP_DANCE_ENABLE = no # Tap dance keys; i don't use tap dance + +# These features can be disabled at whim +NKRO_ENABLE ?= yes # Default is 6KRO +VELOCIKEY_ENABLE ?= yes # Speed effects change with typing speed +WPM_ENABLE ?= yes # Get WPM reports as you type + +# Manually configure these on each keyboard individually +# AUDIO_ENABLE # Audio stuff +# BACKLIGHT_ENABLE # Switch LEDs +# ENCODER_ENABLE # Rotary encoder +# RGB_MATRIX_ENABLE # RGB LEDs +# OLED_ENABLE # For OLED + +# Userspace code SRC += bbaserdem.c -EXTRAFLAGS += -flto # Used to make code smaller -# ENABLE -UNICODE_ENABLE = yes # Used for unicode character emulation -EXTRAKEY_ENABLE = yes # OS signals like volume control +# Macros +SRC += bb-macro.c + +# Audio code +ifeq ($(strip $(AUDIO_ENABLE)), yes) +SRC += bb-audio.c +endif + +# Rotary encoder stuff +ifeq ($(strip $(ENCODER_ENABLE)), yes) +SRC += bb-encoder.c +endif + +# RGB LED (Underglow) code +ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) +SRC += bb-underglow.c +endif + +# RGB LED (Perkey) code +ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes) +SRC += bb-rgb.c +endif + +# Backlight code +ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) +SRC += bb-backlight.c +endif -# DISABLE -ifndef BLUETOOTH_ENABLE - BLUETOOTH_ENABLE = no # No bluetooth +# OLED code +ifeq ($(strip $(OLED_ENABLE)), yes) + SRC += bb-oled.c + ifeq ($(strip $(CTPC)), yes) + SRC += bb-oled-extra.c + endif endif -COMMAND_ENABLE = no # Some bootmagic thing i dont use -BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite -CONSOLE_ENABLE = no # Allows console output with a command -SLEEP_LED_ENABLE = no # Breathes LED's when computer is asleep. Untested. -NKRO_ENABLE = no # Default is 6KRO which is plenty -MIDI_ENABLE = no # Untested feature -KEY_LOCK_ENABLE = no # Allows locking any key. Not used - -# Disabling this makes it compile, i dont know why -# VARIABLE_TRACE = no # Allows debugging variables diff --git a/users/bcat/rules.mk b/users/bcat/rules.mk index 1ad2ee0aa8..090f7474eb 100644 --- a/users/bcat/rules.mk +++ b/users/bcat/rules.mk @@ -47,7 +47,6 @@ endif COMMAND_ENABLE = no CONSOLE_ENABLE = no MOUSEKEY_ENABLE = no -TERMINAL_ENABLE = no # Disable unwanted hardware options on all keyboards. (Some keyboards turn # these features on by default even though they aren't actually required.) diff --git a/users/billypython/billypython.c b/users/billypython/billypython.c index 180b478d7a..f165d2e260 100644 --- a/users/billypython/billypython.c +++ b/users/billypython/billypython.c @@ -23,7 +23,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } __attribute__((weak)) -uint32_t layer_state_set_keymap(uint32_t state) { +layer_state_t layer_state_set_keymap(layer_state_t state) { return state; } diff --git a/users/billypython/billypython.h b/users/billypython/billypython.h index 4a444e9787..cdf5121f2f 100644 --- a/users/billypython/billypython.h +++ b/users/billypython/billypython.h @@ -31,4 +31,4 @@ enum layers_user { }; bool process_record_keymap(uint16_t keycode, keyrecord_t *record); -uint32_t layer_state_set_keymap(uint32_t state); +layer_state_t layer_state_set_keymap(layer_state_t state); diff --git a/users/charlesrocket/apl.c b/users/charlesrocket/apl.c new file mode 100644 index 0000000000..63d835c909 --- /dev/null +++ b/users/charlesrocket/apl.c @@ -0,0 +1,183 @@ +/* Copyright 2022 charlesrocket + * + * 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 QMK_KEYBOARD_H + +enum unicode_names { + DIAMOND, + QUAD_DIAMOND, + DIAERESIS, + IBEAM, + MACRON, + DEL_TILDE, + LESS, + DEL_STILE, + LESS_EQUAL, + DELTA_STILE, + EQUALS, + CIRCLE_STILE, + GREATER_EQUAL, + CIRCLE_BACKSLASH, + GREATER, + CIRCLED_MINUS, + NOT_EQUAL, + CIRCLE_STAR, + OR, + DOWN_CARET_TILDE, + AND, + UP_CARET_TILDE, + MULT, + EXCL, + DIVISION, + QUAD_DIVIDE, + QUESTION_MARK, + OMEGA, + OMEGA_UNDERBAR, + EPSILON, + SMALL_ELEMENT, + EPSILON_UNDERBAR, + RHO, + TILDE, + TILDE_DIAERESIS, + UPWARDS_ARROW, + DOWNWARDS_ARROW, + IOTA, + IOTA_UNDERBAR, + WHITE_CIRCLE, + CIRCLE_DIAERESIS, + STAR_OPERATOR, + STAR_DIAERESIS, + LEFT_ARROW, + QUOTE_QUAD, + RIGHT_ARROW, + ZILDE, + ALPHA, + ALPHA_UNDERBAR, + LEFT_CEILING, + LEFT_FLOOR, + LOW_LINE, + NABLA, + INCREMENT, + DELTA_UNDERBAR, + RING_OPERATOR, + JOT_DIAERESIS, + APOSTROPHE, + QUAD_EQUAL, + QUAD, + SQUISH_QUAD, + DOWN_TACK_JOT, + IDENTICAL, + UP_TACK_JOT, + NOT_IDENTICAL, + RIGHT_TACK, + LEFT_TACK, + SUBSET, + SUPERSET, + CHI, + INTERSECTION, + UNION, + UP_TACK, + DOWN_TACK, + VERTICAL_LINE, + UP_SHOE_JOT, + COMMA_BAR, + BACKSLASH_BAR, + SLASH_BAR, + QUAD_COLON +}; + +const uint32_t PROGMEM unicode_map[] = { + [DIAMOND] = 0x25CA, // ◊ 0 + [QUAD_DIAMOND] = 0x233A, // ⌺ + [DIAERESIS] = 0x00A8, // ¨ + [IBEAM] = 0x2336, // ⌶ + [MACRON] = 0x00AF, // ¯ + [DEL_TILDE] = 0x236B, // ⍫ 5 + [LESS] = 0x003C, // < + [DEL_STILE] = 0x2352, // ⍒ + [LESS_EQUAL] = 0x2264, // ≤ + [DELTA_STILE] = 0x234B, // ⍋ + [EQUALS] = 0x003D, // = 10 + [CIRCLE_STILE] = 0x233D, // ⌽ + [GREATER_EQUAL] = 0x2265, // ≥ + [CIRCLE_BACKSLASH] = 0x2349, // ⍉ + [GREATER] = 0x003E, // > + [CIRCLED_MINUS] = 0x2296, // ⊖ 15 + [NOT_EQUAL] = 0x2260, // ≠ + [CIRCLE_STAR] = 0x235F, // ⍟ + [OR] = 0x2228, // ∨ + [DOWN_CARET_TILDE] = 0x2371, // ⍱ + [AND] = 0x2227, // ∧ 20 + [UP_CARET_TILDE] = 0x2372, // ⍲ + [MULT] = 0x00D7, // × + [EXCL] = 0x0021, // ! + [DIVISION] = 0x00F7, // ÷ + [QUAD_DIVIDE] = 0x2339, // ⌹ 25 + [QUESTION_MARK] = 0x003F, // ? + [OMEGA] = 0x2375, // ⍵ + [OMEGA_UNDERBAR] = 0x2379, // ⍹ + [EPSILON] = 0x03B5, // ε + [SMALL_ELEMENT] = 0x220A, // ∊ 30 + [EPSILON_UNDERBAR] = 0x2377, // ⍷ + [RHO] = 0x2374, // ⍴ + [TILDE] = 0x007E, // ~ + [TILDE_DIAERESIS] = 0x2368, // ⍨ + [UPWARDS_ARROW] = 0x2191, // ↑ 35 + [DOWNWARDS_ARROW] = 0x2193, // ↓ + [IOTA] = 0x2373, // ⍳ + [IOTA_UNDERBAR] = 0x2378, // ⍸ + [WHITE_CIRCLE] = 0x25CB, // ○ + [CIRCLE_DIAERESIS] = 0x2365, // ⍥ 40 + [STAR_OPERATOR] = 0x22C6, // ⋆ + [STAR_DIAERESIS] = 0x2363, // ⍣ + [LEFT_ARROW] = 0x2190, // ← + [QUOTE_QUAD] = 0x235E, // ⍞ + [RIGHT_ARROW] = 0x2192, // → 45 + [ZILDE] = 0x236C, // ⍬ + [ALPHA] = 0x237A, // ⍺ + [ALPHA_UNDERBAR] = 0x2376, // ⍶ + [LEFT_CEILING] = 0x2308, // ⌈ + [LEFT_FLOOR] = 0x230A, // ⌊ 50 + [LOW_LINE] = 0x005F, // _ + [NABLA] = 0x2207, // ∇ + [INCREMENT] = 0x2206, // ∆ + [DELTA_UNDERBAR] = 0x2359, // ⍙ + [RING_OPERATOR] = 0x2218, // ∘ 55 + [JOT_DIAERESIS] = 0x2364, // ⍤ + [APOSTROPHE] = 0x0027, // ' + [QUAD_EQUAL] = 0x2338, // ⌸ + [QUAD] = 0x2395, // ⎕ + [SQUISH_QUAD] = 0x2337, // ⌷ 60 + [DOWN_TACK_JOT] = 0x234E, // ⍎ + [IDENTICAL] = 0x2261, // ≡ + [UP_TACK_JOT] = 0x2355, // ⍕ + [NOT_IDENTICAL] = 0x2262, // ≢ + [RIGHT_TACK] = 0x22A2, // ⊢ 65 + [LEFT_TACK] = 0x22A3, // ⊣ + [SUBSET] = 0x2282, // ⊂ + [SUPERSET] = 0x2283, // ⊃ + [CHI] = 0x03C7, // χ + [INTERSECTION] = 0x2229, // ∩ 70 + [UNION] = 0x222A, // ∪ + [UP_TACK] = 0x22A5, // ⊥ + [DOWN_TACK] = 0x22A4, // ⊤ + [VERTICAL_LINE] = 0x007C, // | + [UP_SHOE_JOT] = 0x235D, // ⍝ 75 + [COMMA_BAR] = 0x236A, // ⍪ + [BACKSLASH_BAR] = 0x2340, // ⍀ + [SLASH_BAR] = 0x233F, // ⌿ + [QUAD_COLON] = 0x2360, // ⍠ 79 +}; diff --git a/users/charlesrocket/rules.mk b/users/charlesrocket/rules.mk new file mode 100644 index 0000000000..ec5aa5585d --- /dev/null +++ b/users/charlesrocket/rules.mk @@ -0,0 +1,3 @@ +ifeq ($(strip $(APL_ENABLE)), yes) + SRC += apl.c +endif diff --git a/users/csc027/custom_rgb.c b/users/csc027/custom_rgb.c index 1d3232d72c..657d40d7af 100644 --- a/users/csc027/custom_rgb.c +++ b/users/csc027/custom_rgb.c @@ -28,15 +28,15 @@ void keyboard_post_init_user(void) { rgblight_sethsv_noeeprom((i + user_hue) % 256, 255, 255); wait_ms(5); } - rgblight_sethsv_noeeprom(0, 0, 0); + rgblight_sethsv_noeeprom(HSV_BLACK); } void on_usb_led_off(void) { - rgblight_sethsv_noeeprom(0, 0, rgblight_get_val() - 85); + rgblight_sethsv_noeeprom(HS_GRAY, rgblight_get_val() - 85); } void on_usb_led_on(void) { - rgblight_sethsv_noeeprom(0, 0, rgblight_get_val() + 85); + rgblight_sethsv_noeeprom(HS_GRAY, rgblight_get_val() + 85); } #endif diff --git a/users/csc027/defines.h b/users/csc027/defines.h index 9654cd9f02..85d7d065b7 100644 --- a/users/csc027/defines.h +++ b/users/csc027/defines.h @@ -183,7 +183,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. * |-----------------------------------| |-----------------------------------| * | | | App | LCAD|MRDCC|NmLck| |MVTDL|MVTDC|MVTDN|MVTDR| | | * |-----------------------------------| |-----------------------------------| - * | | | | | | | | | | | | | | + * | | |MStop|MPrev|MPlay|MNext| |MMute|MVolD|MVolD| | | | * |-----------------------------------| |-----------------------------------| * | | | | | | | | | | | | | | * `-----------------------------------' `-----------------------------------' @@ -191,12 +191,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define ___________________CONVENIENCE_L1__________________ XXXXXXX, XXXXXXX, KC_INS, KC_SLCK, KC_PSCR, XXXXXXX #define ___________________CONVENIENCE_L2__________________ _______, XXXXXXX, KC_APP, MC_lcad, MC_rdcc, KC_NLCK -#define ___________________CONVENIENCE_L3__________________ _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +#define ___________________CONVENIENCE_L3__________________ _______, XXXXXXX, KC_MSTP, KC_MPRV, KC_MPLY, KC_MNXT #define ___________________CONVENIENCE_L4__________________ _______, _______, _______, _______, _______, _______ #define ___________________CONVENIENCE_R1__________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BSPC #define ___________________CONVENIENCE_R2__________________ MC_vtdl, MC_vtdc, MC_vtdn, MC_vtdr, XXXXXXX, XXXXXXX -#define ___________________CONVENIENCE_R3__________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______ +#define ___________________CONVENIENCE_R3__________________ KC_MUTE, KC_VOLD, KC_VOLU, XXXXXXX, XXXXXXX, _______ #define ___________________CONVENIENCE_R4__________________ _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX /* Windows Terminal Layer @@ -321,3 +321,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. CUSTOM_NAME(vtdc) CUSTOM_STRING(SS_LCTL(SS_LGUI(SS_TAP(X_F4)))) CUSTOM_DELIM() \ CUSTOM_NAME(vtdn) CUSTOM_STRING(SS_LCTL(SS_LGUI("d"))) CUSTOM_DELIM() \ CUSTOM_NAME(vtdr) CUSTOM_STRING(SS_LCTL(SS_LGUI(SS_TAP(X_RIGHT)))) + +// Additional color definitions for simplicity +#define HS_AZURE 132, 102 +#define HS_BLACK 0, 0 +#define HS_BLUE 170, 255 +#define HS_CHARTREUSE 64, 255 +#define HS_CORAL 11, 176 +#define HS_CYAN 128, 255 +#define HS_GOLD 36, 255 +#define HS_GOLDENROD 30, 218 +#define HS_GRAY 0, 0 +#define HS_GREEN 85, 255 +#define HS_MAGENTA 213, 255 +#define HS_ORANGE 28, 255 +#define HS_PINK 234, 128 +#define HS_PURPLE 191, 255 +#define HS_RED 0, 255 +#define HS_SPRINGGREEN 106, 255 +#define HS_TEAL 128, 255 +#define HS_TURQUOISE 123, 90 +#define HS_WHITE 0, 0 +#define HS_YELLOW 43, 255 diff --git a/users/curry/config.h b/users/curry/config.h index 3301ebe533..0c96293bd5 100644 --- a/users/curry/config.h +++ b/users/curry/config.h @@ -65,10 +65,6 @@ # define ONESHOT_TIMEOUT 3000 #endif // !ONESHOT_TIMEOUT -#if !defined(QMK_KEYS_PER_SCAN) -# define QMK_KEYS_PER_SCAN 4 -#endif // !QMK_KEYS_PER_SCAN - #define IGNORE_MOD_TAP_INTERRUPT #undef PERMISSIVE_HOLD diff --git a/users/davidkristoffersen/davidkristoffersen.h b/users/davidkristoffersen/davidkristoffersen.h new file mode 100644 index 0000000000..0485e00013 --- /dev/null +++ b/users/davidkristoffersen/davidkristoffersen.h @@ -0,0 +1,18 @@ +// Copyright 2022 David Kristoffersen (@davidkristoffersen) +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include QMK_KEYBOARD_H + +#include "src/enums.h" + +#ifdef LAYER_NO +# include "macros/norwegian.h" +#endif + +#include "util/functions.h" + +#include "hardware/split_space.h" + +#include "macros/macros.h" diff --git a/users/davidkristoffersen/hardware/readme.md b/users/davidkristoffersen/hardware/readme.md new file mode 100644 index 0000000000..f31601812b --- /dev/null +++ b/users/davidkristoffersen/hardware/readme.md @@ -0,0 +1,3 @@ +# Hardware + +This directory contains hardware related macros. diff --git a/users/davidkristoffersen/hardware/split_space.c b/users/davidkristoffersen/hardware/split_space.c new file mode 100644 index 0000000000..da25343f3d --- /dev/null +++ b/users/davidkristoffersen/hardware/split_space.c @@ -0,0 +1,23 @@ +// Copyright 2022 David Kristoffersen (@davidkristoffersen) +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "split_space.h" + +#ifdef SPLIT_SPACE +void handle_split_space(uint16_t keycode) { + // Disable modifiers when numpad is active + if (IS_LAYER_ON(NUMPAD)) clear_oneshot_mods(); + + if (keycode == KC_LSPC) { + // 2ng tap: Activate ctrl if shift is active + if (get_oneshot_mods() & MOD_MASK_SHIFT) { + clear_oneshot_mods(); + set_oneshot_mods(MOD_LCTL); + } + // 1st. tap: Activate shift if no modifier is active + else { + set_oneshot_mods(MOD_LSFT); + } + } +} +#endif diff --git a/users/davidkristoffersen/hardware/split_space.h b/users/davidkristoffersen/hardware/split_space.h new file mode 100644 index 0000000000..a9736b5ca1 --- /dev/null +++ b/users/davidkristoffersen/hardware/split_space.h @@ -0,0 +1,16 @@ +// Copyright 2022 David Kristoffersen (@davidkristoffersen) +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "davidkristoffersen.h" + +#define KC_RSPC KC_SPACE + +#ifdef SPLIT_SPACE +# define KC_LSPC LT(NUMPAD, KC_NO) +#else +# define KC_LSPC KC_SPACE +#endif + +void handle_split_space(uint16_t keycode); diff --git a/users/davidkristoffersen/macros/debug.c b/users/davidkristoffersen/macros/debug.c new file mode 100644 index 0000000000..64fdc4a702 --- /dev/null +++ b/users/davidkristoffersen/macros/debug.c @@ -0,0 +1,36 @@ +// Copyright 2022 David Kristoffersen (@davidkristoffersen) +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "macros.h" + +// Replace key records with macros +bool handle_test(uint16_t keycode) { + switch (keycode) { + case KC_T0: { + // Test QK_MAKE command + SEND_STRING("qmk compile -kb " QMK_KEYBOARD " -km " QMK_KEYMAP); + break; + } + case KC_T1: + // Test ascii characters + SEND_STRING(" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"); + break; + case KC_T2: +#ifdef LAYER_NO + // Test other characters + tap_code16(NO_AE); + tap_code16(NO_OE); + tap_code16(NO_AA); + tap_code16(S(NO_AE)); + tap_code16(S(NO_OE)); + tap_code16(S(NO_AA)); +#endif + return false; + } + return true; +}; + +bool process_debug(uint16_t keycode, keyrecord_t* record) { + HANDLE_FALSE(handle_test(keycode)); + return true; +} diff --git a/users/davidkristoffersen/macros/language.c b/users/davidkristoffersen/macros/language.c new file mode 100644 index 0000000000..9b6dca79ca --- /dev/null +++ b/users/davidkristoffersen/macros/language.c @@ -0,0 +1,40 @@ +// Copyright 2022 David Kristoffersen (@davidkristoffersen) +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "macros.h" + +bool handle_language(uint16_t keycode) { +#ifdef LAYER_NO + // Handle conversion of English to Norwegian codes + uint16_t org_keycode = keycode; + keycode = get_norwegian_code(keycode); +#endif + +#ifndef NO_SPECIAL_SHIFT + // Handle conversion of special shift codes + if (get_mods() & MOD_MASK_SHIFT) { + uint16_t shifted_key = get_special_shifted_code(keycode); + if (shifted_key != keycode) { + // Tap shifted key while shift is disabled + unregister_code(KC_LSFT); + tap_code16(shifted_key); + register_code(KC_LSFT); + return false; + } + } +#endif + +#ifdef LAYER_NO + // Tap new language key + if (keycode != org_keycode) { + tap_code16(keycode); + return false; + } +#endif + return true; +} + +bool process_language(uint16_t keycode, keyrecord_t* record) { + HANDLE_FALSE(handle_language(keycode)); + return true; +} diff --git a/users/davidkristoffersen/macros/macros.c b/users/davidkristoffersen/macros/macros.c new file mode 100644 index 0000000000..6d8c0b6f57 --- /dev/null +++ b/users/davidkristoffersen/macros/macros.c @@ -0,0 +1,16 @@ +// Copyright 2022 David Kristoffersen (@davidkristoffersen) +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "macros.h" + +// Prepend key records with macros +bool process_record_user(uint16_t keycode, keyrecord_t* record) { + if (record->event.pressed) { +#ifdef SPLIT_SPACE + handle_split_space(keycode, record); +#endif + HANDLE_FALSE(process_debug(keycode, record)); + HANDLE_FALSE(process_language(keycode, record)); + } + return true; +} diff --git a/users/davidkristoffersen/macros/macros.h b/users/davidkristoffersen/macros/macros.h new file mode 100644 index 0000000000..fb1e5c862c --- /dev/null +++ b/users/davidkristoffersen/macros/macros.h @@ -0,0 +1,23 @@ +// Copyright 2022 David Kristoffersen (@davidkristoffersen) +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "davidkristoffersen.h" + +enum keycodes { + // Test keys + KC_T0 = SAFE_RANGE, + KC_T1, + KC_T2, + // Norwegian Æ, Ø, Å + KC_AE, + KC_OE, + KC_AA +}; + +bool process_debug(uint16_t keycode, keyrecord_t* record); +bool process_language(uint16_t keycode, keyrecord_t* record); + +// Prepend key records with macros +bool process_record_user(uint16_t keycode, keyrecord_t* record); diff --git a/users/davidkristoffersen/macros/norwegian.h b/users/davidkristoffersen/macros/norwegian.h new file mode 100644 index 0000000000..575d1e9f2f --- /dev/null +++ b/users/davidkristoffersen/macros/norwegian.h @@ -0,0 +1,19 @@ +// Copyright 2022 David Kristoffersen (@davidkristoffersen) +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "keymap_extras/keymap_norwegian.h" +#include "davidkristoffersen.h" + +// Better norwegian defines +#undef NO_LESS +#define NO_LESS KC_NUBS // < +#undef NO_GRTR +#define NO_GRTR S(NO_LESS) // > +#undef NO_AE +#define NO_AE KC_QUOT // Æ +#undef NO_OE +#define NO_OE KC_SCLN // Ø +#undef NO_AA +#define NO_AA KC_LBRC // Å diff --git a/users/davidkristoffersen/macros/readme.md b/users/davidkristoffersen/macros/readme.md new file mode 100644 index 0000000000..7c074b2bb5 --- /dev/null +++ b/users/davidkristoffersen/macros/readme.md @@ -0,0 +1,3 @@ +# Macros + +This directory contains any type of dynamic and static macros. diff --git a/users/davidkristoffersen/post_config.h b/users/davidkristoffersen/post_config.h new file mode 100644 index 0000000000..3d1f5a93f4 --- /dev/null +++ b/users/davidkristoffersen/post_config.h @@ -0,0 +1,8 @@ +// Copyright 2022 David Kristoffersen (@davidkristoffersen) +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#ifndef LAYER_EN +# define LAYER_EN LAYER_DEFAULT +#endif diff --git a/users/davidkristoffersen/readme.md b/users/davidkristoffersen/readme.md new file mode 100644 index 0000000000..20ff58003e --- /dev/null +++ b/users/davidkristoffersen/readme.md @@ -0,0 +1,3 @@ +# Overview + +This userspace contains all the utility functions and macros related to my keymaps. diff --git a/users/davidkristoffersen/rules.mk b/users/davidkristoffersen/rules.mk new file mode 100644 index 0000000000..5901b68540 --- /dev/null +++ b/users/davidkristoffersen/rules.mk @@ -0,0 +1,12 @@ +SRC += $(USER_PATH)/util/functions.c \ + $(USER_PATH)/hardware/split_space.c \ + $(USER_PATH)/macros/macros.c \ + $(USER_PATH)/macros/debug.c \ + $(USER_PATH)/macros/language.c + +# Firmware size optimizations +ifeq ($(strip $(SIZE_OPTIMIZE)), yes) + CONSOLE_ENABLE := no # 1646: Console for debug + AUDIO_ENABLE := no # 8682: Audio output on port C6 + LTO_ENABLE := yes # 2772: Link time optimization +endif diff --git a/users/davidkristoffersen/util/functions.c b/users/davidkristoffersen/util/functions.c new file mode 100644 index 0000000000..781d8f214d --- /dev/null +++ b/users/davidkristoffersen/util/functions.c @@ -0,0 +1,111 @@ +// Copyright 2022 David Kristoffersen (@davidkristoffersen) +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "functions.h" + +#ifndef NO_SPECIAL_SHIFT +// Code set to swap struct +typedef struct code_set { + uint16_t pre; + uint16_t post; +} code_set_t; + +// Shift codes conversion struct +typedef struct shift_code { + int lang; + int size; + code_set_t* codes; +} shift_code_t; + +#ifdef LAYER_NO +code_set_t NO_SHIFT_CODES [] = { + {NO_QUOT, NO_DQUO}, + {NO_BSLS, NO_PIPE}, +}; +#endif + +code_set_t EN_SHIFT_CODES [] = { + {KC_COMM, KC_SCLN}, + {KC_DOT, KC_COLN}, +}; + +// Array of shift code conversions +const shift_code_t SHIFT_CODES [] = { +#ifdef LAYER_NO + {.lang = LAYER_NO, + .size = ARR_LEN(NO_SHIFT_CODES), + .codes = NO_SHIFT_CODES}, +#endif + {.lang = LAYER_EN, + .size = ARR_LEN(EN_SHIFT_CODES), + .codes = EN_SHIFT_CODES}, +}; +const int SHIFT_CODES_SIZE = ARR_LEN(SHIFT_CODES); +#endif + +#ifdef LAYER_NO +// Array of English to Norwegian code translations +const code_set_t EN2NO_CODES [] = { + {KC_QUOT, NO_QUOT}, + {KC_MINS, NO_MINS}, + {KC_BSLS, NO_BSLS}, + {KC_LBRC, NO_LBRC}, + {KC_LCBR, NO_LCBR}, + {KC_LPRN, NO_LPRN}, + {KC_LT, NO_LESS}, + {KC_GT, NO_GRTR}, + {KC_RPRN, NO_RPRN}, + {KC_RCBR, NO_RCBR}, + {KC_RBRC, NO_RBRC}, + {KC_AMPR, NO_AMPR}, + {KC_EQL, NO_EQL}, + {KC_PLUS, NO_PLUS}, + {KC_ASTR, NO_ASTR}, + {KC_SLSH, NO_SLSH}, + {KC_TILD, NO_TILD}, + {KC_AE, NO_AE}, + {KC_OE, NO_OE}, + {KC_AA, NO_AA}, + {KC_QUES, NO_QUES}, + {KC_AT, NO_AT}, + {KC_CIRC, NO_CIRC}, + {KC_DLR, NO_DLR}, + {KC_GRV, NO_GRV} +}; +const int EN2NO_CODES_SIZE = ARR_LEN(EN2NO_CODES); +#endif + +// Check if layer is an active default layer +bool is_default_on(int layer) { + return layer == LAYER_DEFAULT + ? true + : layer_state_cmp(default_layer_state, layer); +} + +#ifndef NO_SPECIAL_SHIFT +// Get special shifted code +uint16_t get_special_shifted_code(uint16_t keycode) { + for (int i = 0; i < SHIFT_CODES_SIZE; i++) { + if (IS_DEFAULT_OFF(SHIFT_CODES[i].lang)) continue; + for (int j = 0; j < SHIFT_CODES[i].size; j++) { + if (keycode == SHIFT_CODES[i].codes[j].pre) + return SHIFT_CODES[i].codes[j].post; + } + } + return keycode; +} +#endif + +#ifdef LAYER_NO +// Get language specific code +uint16_t get_norwegian_code(uint16_t keycode) { + if (IS_DEFAULT_ON(LAYER_NO)) { + for (int i = 0; i < EN2NO_CODES_SIZE; i++) { + if (keycode == EN2NO_CODES[i].pre) { + return EN2NO_CODES[i].post; + } + } + } + return keycode; +} +#endif diff --git a/users/davidkristoffersen/util/functions.h b/users/davidkristoffersen/util/functions.h new file mode 100644 index 0000000000..eee1dadc57 --- /dev/null +++ b/users/davidkristoffersen/util/functions.h @@ -0,0 +1,32 @@ +// Copyright 2022 David Kristoffersen (@davidkristoffersen) +// SPDX-License-Identifier: GPL-3.0-or-later + +#pragma once + +#include "davidkristoffersen.h" + +// Default layer if none is specified +#define LAYER_DEFAULT -1 + +// Check if layer is an active default layer +#define IS_DEFAULT_ON(layer) is_default_on(layer) +// Check if layer is an inactive default layer +#define IS_DEFAULT_OFF(layer) !is_default_on(layer) + +// Return false if test equal false +#define HANDLE_FALSE(bool) if (!bool) return false; +// Generic array lenght define +#define ARR_LEN(arr) (sizeof(arr) / sizeof(arr)[0]) +// Printf-like functionality for send_string +#define SEND_VAR(str, ...) \ + do { \ + char var[128]; \ + sprintf(var, str, __VA_ARGS__); \ + send_string(var); \ + } while(0) + +// Get special shifted code +uint16_t get_special_shifted_code(uint16_t keycode); + +// Get language specific code +uint16_t get_norwegian_code(uint16_t keycode); diff --git a/users/davidkristoffersen/util/readme.md b/users/davidkristoffersen/util/readme.md new file mode 100644 index 0000000000..90635f30e5 --- /dev/null +++ b/users/davidkristoffersen/util/readme.md @@ -0,0 +1,3 @@ +# Utility + +This directory contains utility functions meant to assist the other files of the userspace. diff --git a/users/dhertz/dhertz.c b/users/dhertz/dhertz.c index 163b1cb644..1a2b6e38f1 100644 --- a/users/dhertz/dhertz.c +++ b/users/dhertz/dhertz.c @@ -18,7 +18,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } __attribute__ ((weak)) @@ -107,4 +107,3 @@ layer_state_t layer_state_set_user (layer_state_t state) { void led_set_user(uint8_t usb_led) { led_set_keymap(usb_led); } - diff --git a/users/doogle999/doogle999.c b/users/doogle999/doogle999.c index 320de7cff8..c9ee125741 100644 --- a/users/doogle999/doogle999.c +++ b/users/doogle999/doogle999.c @@ -382,7 +382,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) static char text[CALC_BUFFER_SIZE + 1]; // Used to store input and then output when ready to print static char backspaceText[CALC_BUFFER_SIZE + 1]; // Pretty dumb waste of memory because only backspace characters, used with send_string to backspace and remove input - if((biton32(layer_state) == CALC_LAYER && CALC_FORCE_NUM_LOCK_INSIDE_CALC) || (biton32(layer_state) != CALC_LAYER && CALC_FORCE_NUM_LOCK_OUTSIDE_CALC)) + if((get_highest_layer(layer_state) == CALC_LAYER && CALC_FORCE_NUM_LOCK_INSIDE_CALC) || (get_highest_layer(layer_state) != CALC_LAYER && CALC_FORCE_NUM_LOCK_OUTSIDE_CALC)) { bool numpadKeyPressed = record->event.pressed && !(get_mods() & MODS_SHIFT_MASK) && @@ -397,7 +397,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) } } - if(biton32(layer_state) != CALC_LAYER) { return true; } + if(get_highest_layer(layer_state) != CALC_LAYER) { return true; } int action = process_input(keycode, get_mods(), record->event); switch(action) @@ -457,4 +457,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) send_string(characterToSend); } return false; -}
\ No newline at end of file +} diff --git a/users/drashna/autocorrect_data.h b/users/drashna/autocorrect_data.h index bcb5858aa8..52ed7fa9a7 100644 --- a/users/drashna/autocorrect_data.h +++ b/users/drashna/autocorrect_data.h @@ -1,5 +1,93 @@ #if __has_include("../qmk_secrets/autocorrection_data.h") +# pragma message "Loading custom library" # include "../qmk_secrets/autocorrection_data.h" +# define AUTOCORRECTION_MIN_LENGTH AUTOCORRECT_MIN_LENGTH +# define AUTOCORRECTION_MAX_LENGTH AUTOCORRECT_MAX_LENGTH + #else -# include "autocorrect_data_default.h" +// Generated code. + +// Autocorrection dictionary (70 entries): +// :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 +// retrun -> return +// retun -> return +// reuslt -> result +// reutrn -> return +// saftey -> safety +// seperate -> separate +// singed -> signed +// stirng -> string +// strign -> string +// swithc -> switch +// swtich -> switch +// thresold -> threshold +// udpate -> update +// widht -> width + +#define AUTOCORRECT_MIN_LENGTH 5 // ":ture" +#define AUTOCORRECT_MAX_LENGTH 10 // "accomodate" + +#define DICTIONARY_SIZE 1104 + +static const uint8_t autocorrect_data[DICTIONARY_SIZE] 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}; #endif diff --git a/users/drashna/bootmagic_better.c b/users/drashna/bootmagic_better.c new file mode 100644 index 0000000000..4932e25f1d --- /dev/null +++ b/users/drashna/bootmagic_better.c @@ -0,0 +1,56 @@ +// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "drashna.h" +#include "bootmagic_lite.h" + +void bootmagic_lite(void) { + bool perform_reset = false; + // We need multiple scans because debouncing can't be turned off. + matrix_scan(); +#if defined(DEBOUNCE) && DEBOUNCE > 0 + wait_ms(DEBOUNCE * 2); +#else + wait_ms(30); +#endif + matrix_scan(); + + // If the configured key (commonly Esc) is held down on power up, + // reset the EEPROM valid state and jump to bootloader. + // This isn't very generalized, but we need something that doesn't + // rely on user's keymaps in firmware or EEPROM. + uint8_t row = BOOTMAGIC_LITE_ROW, col = BOOTMAGIC_LITE_COLUMN; +#if defined(BOOTMAGIC_LITE_EEPROM_ROW) && defined(BOOTMAGIC_LITE_EEPROM_COLUMN) + uint8_t row_e = BOOTMAGIC_LITE_EEPROM_ROW, col_e = BOOTMAGIC_LITE_EEPROM_COLUMN; +#endif + +#if defined(SPLIT_KEYBOARD) && defined(BOOTMAGIC_LITE_ROW_RIGHT) && defined(BOOTMAGIC_LITE_COLUMN_RIGHT) + if (!is_keyboard_left()) { + row = BOOTMAGIC_LITE_ROW_RIGHT; + col = BOOTMAGIC_LITE_COLUMN_RIGHT; +#if defined(BOOTMAGIC_LITE_EEPROM_ROW) && defined(BOOTMAGIC_LITE_EEPROM_COLUMN) && defined(BOOTMAGIC_LITE_EEPROM_ROW_RIGHT) && defined(BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT) + row_e = BOOTMAGIC_LITE_EEPROM_ROW_RIGHT; + col_e = BOOTMAGIC_LITE_EEPROM_COLUMN_RIGHT; +# endif + } +#endif + +#if defined(BOOTMAGIC_LITE_EEPROM_ROW) && defined(BOOTMAGIC_LITE_EEPROM_COLUMN) + if (matrix_get_row(row_e) & (1 << col_e)) { + eeconfig_disable(); + perform_reset = true; + } +#endif + if (matrix_get_row(row) & (1 << col)) { + perform_reset = true; + } +#ifdef STM32F411xE + if (!readPin(A0)) { + perform_reset = true; + } +#endif + + if (perform_reset) { + bootloader_jump(); + } +} diff --git a/users/drashna/callbacks.c b/users/drashna/callbacks.c index 0ceb1aebe5..111b5f79d7 100644 --- a/users/drashna/callbacks.c +++ b/users/drashna/callbacks.c @@ -3,6 +3,12 @@ #include "drashna.h" + +#ifdef I2C_SCANNER_ENABLE +void matrix_scan_i2c(void); +void keyboard_post_init_i2c(void); +#endif + __attribute__((weak)) void keyboard_pre_init_keymap(void) {} void keyboard_pre_init_user(void) { userspace_config.raw = eeconfig_read_user(); @@ -42,6 +48,10 @@ void keyboard_post_init_user(void) { #if defined(SPLIT_KEYBOARD) && defined(SPLIT_TRANSACTION_IDS_USER) keyboard_post_init_transport_sync(); #endif +#ifdef I2C_SCANNER_ENABLE + matrix_scan_i2c(); +#endif + keyboard_post_init_keymap(); } @@ -54,12 +64,12 @@ void shutdown_user(void) { #ifdef RGBLIGHT_ENABLE rgblight_enable_noeeprom(); rgblight_mode_noeeprom(1); - rgblight_setrgb_red(); -#endif // RGBLIGHT_ENABLE + rgblight_setrgb(rgblight_get_val(), 0x00, 0x00); +#endif // RGBLIGHT_ENABLE #ifdef RGB_MATRIX_ENABLE - rgb_matrix_set_color_all(0xFF, 0x00, 0x00); + rgb_matrix_set_color_all(rgb_matrix_get_val(), 0x00, 0x00); rgb_matrix_update_pwm_buffers(); -#endif // RGB_MATRIX_ENABLE +#endif // RGB_MATRIX_ENABLE #ifdef OLED_ENABLE oled_off(); #endif @@ -88,7 +98,7 @@ void suspend_power_down_user(void) { __attribute__((weak)) void suspend_wakeup_init_keymap(void) {} void suspend_wakeup_init_user(void) { #ifdef OLED_ENABLE - oled_timer_reset(); + oled_timer_reset(); #endif suspend_wakeup_init_keymap(); } @@ -104,15 +114,21 @@ void matrix_scan_user(void) { startup_user(); } -#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. +#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. run_diablo_macro_check(); -#endif // TAP_DANCE_ENABLE +#endif // TAP_DANCE_ENABLE #ifdef CAPS_WORD_ENABLE caps_word_task(); #endif #if defined(CUSTOM_RGB_MATRIX) matrix_scan_rgb_matrix(); #endif +#ifdef I2C_SCANNER_ENABLE + matrix_scan_i2c(); +#endif +#ifdef CUSTOM_OLED_DRIVER + matrix_scan_oled(); +#endif matrix_scan_secret(); matrix_scan_keymap(); @@ -124,8 +140,10 @@ float doom_song[][2] = SONG(E1M1_DOOM); // 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) { +__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; } @@ -136,7 +154,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { #endif #if defined(CUSTOM_RGBLIGHT) state = layer_state_set_rgb_light(state); -#endif // CUSTOM_RGBLIGHT +#endif // CUSTOM_RGBLIGHT #if defined(AUDIO_ENABLE) && !defined(__arm__) static bool is_gamepad_on = false; if (layer_state_cmp(state, _GAMEPAD) != is_gamepad_on) { @@ -153,28 +171,31 @@ layer_state_t layer_state_set_user(layer_state_t 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) { +__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(CUSTOM_RGBLIGHT) || defined(RGB_MATRIX_ENABLE) - state = default_layer_state_set_rgb(state); -# endif +#if defined(CUSTOM_RGBLIGHT) + state = default_layer_state_set_rgb_light(state); #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); } +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; + userspace_config.autocorrection = true; eeconfig_update_user(userspace_config.raw); eeconfig_init_keymap(); } @@ -187,8 +208,8 @@ void matrix_slave_scan_user(void) { music_task(); # endif # ifdef AUDIO_INIT_DELAY - if (!is_keyboard_master()) { - static bool delayed_tasks_run = false; + 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) { @@ -214,3 +235,11 @@ void matrix_slave_scan_user(void) { matrix_slave_scan_keymap(); } #endif + +__attribute__((weak)) void housekeeping_task_keymap(void) {} +void housekeeping_task_user(void) { +#if defined(SPLIT_KEYBOARD) && defined(SPLIT_TRANSACTION_IDS_USER) + housekeeping_task_transport_sync(); +#endif + housekeeping_task_keymap(); +} diff --git a/users/drashna/callbacks.h b/users/drashna/callbacks.h index f6ac6b88de..15f8997619 100644 --- a/users/drashna/callbacks.h +++ b/users/drashna/callbacks.h @@ -16,6 +16,7 @@ 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); +void housekeeping_task_keymap(void); #ifdef CUSTOM_UNICODE_ENABLE void matrix_init_unicode(void); diff --git a/users/drashna/config.h b/users/drashna/config.h index 4a34f5d66a..57b26786b3 100644 --- a/users/drashna/config.h +++ b/users/drashna/config.h @@ -4,41 +4,35 @@ #pragma once // Use custom magic number so that when switching branches, EEPROM always gets reset -#define EECONFIG_MAGIC_NUMBER (uint16_t)0x1339 +#define EECONFIG_MAGIC_NUMBER (uint16_t)0x1339 #ifdef IS_COMMAND -#undef IS_COMMAND +# undef IS_COMMAND #endif #define IS_COMMAND() (((get_mods() | get_oneshot_mods()) & MOD_MASK_SHIFT) == MOD_MASK_SHIFT) -/* Set Polling rate to 1000Hz */ -#define USB_POLLING_INTERVAL_MS 1 #if defined(SPLIT_KEYBOARD) -// # define SPLIT_TRANSPORT_MIRROR -# define SPLIT_LAYER_STATE_ENABLE -# define SPLIT_LED_STATE_ENABLE -# define SPLIT_MODS_ENABLE -# ifdef WPM_ENABLE -# define SPLIT_WPM_ENABLE -# endif -# ifdef OLED_ENABLE -# define SPLIT_OLED_ENABLE -# endif -# if defined(__AVR__) && !defined(SELECT_SOFT_SERIAL_SPEED) -# define SELECT_SOFT_SERIAL_SPEED 1 -# endif -# ifdef CUSTOM_SPLIT_TRANSPORT_SYNC -# define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC, RPC_ID_USER_KEYMAP_SYNC, RPC_ID_USER_CONFIG_SYNC, RPC_ID_USER_WATCHDOG_SYNC, RPC_ID_USER_KEYLOG_STR -# endif +# include "split/split_config.h" +#endif +#ifdef RGBLIGHT_ENABLE +# include "rgb/rgblight_config.h" +#endif // RGBLIGHT_ENABLE + +#ifdef RGB_MATRIX_ENABLE +# include "rgb/rgb_matrix_config.h" +#endif // RGB_MATRIX_ENABLE + +#ifdef OLED_ENABLE +# include "oled/oled_config.h" #endif #if defined(WPM_ENABLE) // # define WPM_LAUNCH_CONTROL // # define WPM_ALLOW_COUNT_REGRESSOIN // # define WPM_UNFILTERED -# define WPM_SAMPLE_SECONDS 10 -# define WPM_SAMPLE_PERIODS 50 +# define WPM_SAMPLE_SECONDS 10 +# define WPM_SAMPLE_PERIODS 50 # define WPM_ESTIMATED_WORD_SIZE 5 #endif @@ -51,171 +45,26 @@ # define GOODBYE_SONG SONG(SONIC_RING) # define DEFAULT_LAYER_SONGS \ { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(OVERWATCH_THEME) } -# define UNICODE_SONG_MAC SONG(MARIO_THEME) -# define UNICODE_SONG_LNX SONG(MARIO_POWERUP) -# define UNICODE_SONG_WIN SONG(MARIO_ONEUP) -# define UNICODE_SONG_BSD SONG(RICK_ROLL) +# define UNICODE_SONG_MAC SONG(MARIO_THEME) +# define UNICODE_SONG_LNX SONG(MARIO_POWERUP) +# define UNICODE_SONG_WIN SONG(MARIO_ONEUP) +# define UNICODE_SONG_BSD SONG(RICK_ROLL) # define UNICODE_SONG_WINC SONG(RICK_ROLL) # else # define STARTUP_SONG SONG(STARTUP_SOUND) # define GOODBYE_SONG SONG(GOODBYE_SOUND) # define DEFAULT_LAYER_SONGS \ { SONG(QWERTY_SOUND), SONG(COLEMAK_SOUND), SONG(DVORAK_SOUND), SONG(WORKMAN_SOUND) } -# define UNICODE_SONG_MAC SONG(QWERTY_SOUND) -# define UNICODE_SONG_LNX SONG(COLEMAK_SOUND) -# define UNICODE_SONG_WIN SONG(DVORAK_SOUND) -# define UNICODE_SONG_BSD SONG(WORKMAN_SOUND) +# define UNICODE_SONG_MAC SONG(QWERTY_SOUND) +# define UNICODE_SONG_LNX SONG(COLEMAK_SOUND) +# define UNICODE_SONG_WIN SONG(DVORAK_SOUND) +# define UNICODE_SONG_BSD SONG(WORKMAN_SOUND) # define UNICODE_SONG_WINC SONG(PLOVER_GOODBYE_SOUND) # endif -#endif // !AUDIO_ENABLE +#endif // !AUDIO_ENABLE #define UNICODE_SELECTED_MODES UC_WINC, UC_MAC -#ifdef RGBLIGHT_ENABLE -# define RGBLIGHT_SLEEP -# define RGBLIGHT_EFFECT_TWINKLE_LIFE 250 -# define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 24 -#endif // RGBLIGHT_ENABLE - -#ifdef RGB_MATRIX_ENABLE -# define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot) -// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened) -# define RGB_MATRIX_FRAMEBUFFER_EFFECTS -// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects -// # define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended - -# undef ENABLE_RGB_MATRIX_ALPHAS_MODS -# undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -# undef ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -# undef ENABLE_RGB_MATRIX_BREATHING -# undef ENABLE_RGB_MATRIX_BAND_SAT -# undef ENABLE_RGB_MATRIX_BAND_VAL -# undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -# undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -# undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -# undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -# undef ENABLE_RGB_MATRIX_CYCLE_ALL -# undef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -# undef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN -# undef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON -# undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN -# undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL -# undef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL -# undef ENABLE_RGB_MATRIX_CYCLE_SPIRAL -# undef ENABLE_RGB_MATRIX_DUAL_BEACON -# undef ENABLE_RGB_MATRIX_RAINBOW_BEACON -# undef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS -# undef ENABLE_RGB_MATRIX_RAINDROPS -# undef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -# undef ENABLE_RGB_MATRIX_HUE_BREATHING -# undef ENABLE_RGB_MATRIX_HUE_PENDULUM -# undef ENABLE_RGB_MATRIX_HUE_WAVE -# undef ENABLE_RGB_MATRIX_PIXEL_RAIN -# undef ENABLE_RGB_MATRIX_PIXEL_FLOW -# undef ENABLE_RGB_MATRIX_PIXEL_FRACTAL -// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined -# undef ENABLE_RGB_MATRIX_TYPING_HEATMAP -# undef ENABLE_RGB_MATRIX_DIGITAL_RAIN -// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -# undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -# undef ENABLE_RGB_MATRIX_SPLASH -# undef ENABLE_RGB_MATRIX_MULTISPLASH -# undef ENABLE_RGB_MATRIX_SOLID_SPLASH -# undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH - -# define ENABLE_RGB_MATRIX_TYPING_HEATMAP -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL -# if !defined(SPLIT_KEYBOARD) && !defined(KEYBOARD_ergodox_ez) && !defined(KEYBOARD_moonlander) -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN -# endif -# if defined(__arm__) || defined(__AVR_AT90USB1286__) || defined(KEYBOARD_launchpad) -// RGB Matrix Animation modes. Explicitly enabled -// For full list of effects, see: -// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects -# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN -# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT -# define ENABLE_RGB_MATRIX_BREATHING -# define ENABLE_RGB_MATRIX_BAND_SAT -# define ENABLE_RGB_MATRIX_BAND_VAL -# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT -# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL -# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT -# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL -# define ENABLE_RGB_MATRIX_CYCLE_ALL -# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT -# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN -# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON -# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN -# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL -# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL -# define ENABLE_RGB_MATRIX_DUAL_BEACON -# define ENABLE_RGB_MATRIX_RAINBOW_BEACON -# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS -# define ENABLE_RGB_MATRIX_RAINDROPS -# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS -# define ENABLE_RGB_MATRIX_HUE_BREATHING -# define ENABLE_RGB_MATRIX_HUE_PENDULUM -# define ENABLE_RGB_MATRIX_HUE_WAVE -# define ENABLE_RGB_MATRIX_PIXEL_RAIN -# define ENABLE_RGB_MATRIX_PIXEL_FLOW -# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL -# define ENABLE_RGB_MATRIX_DIGITAL_RAIN -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS -# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS -# define ENABLE_RGB_MATRIX_SPLASH -# define ENABLE_RGB_MATRIX_MULTISPLASH -# define ENABLE_RGB_MATRIX_SOLID_SPLASH -# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH -# endif // AVR -#endif // RGB_MATRIX_ENABLE - -#ifdef OLED_ENABLE -# ifdef SPLIT_KEYBOARD -# define OLED_UPDATE_INTERVAL 60 -# else -# define OLED_UPDATE_INTERVAL 15 -# endif -# define OLED_DISABLE_TIMEOUT -# ifdef OLED_FONT_H -# undef OLED_FONT_H -# endif -# define OLED_FONT_H "oled/drashna_font.h" -# define OLED_FONT_END 255 -// # define OLED_FONT_5X5 -// # define OLED_FONT_AZTECH -// # define OLED_FONT_BMPLAIN -// # define OLED_FONT_CRACKERS -# define OLED_FONT_DEAD_MEAL -// # define OLED_FONT_EIN -// # define OLED_FONT_HISKYF21 -// # define OLED_FONT_SQUASH -// # define OLED_FONT_ZXPIX -// # define OLED_FONT_SUPER_DIGG - -// # define OLED_LOGO_BEBOP -// # 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_SCIFI -// # define OLED_LOGO_SETS3N -// # define OLED_LOGO_SKEEB -#endif - // #define WPM_ESTIMATED_WORD_SIZE 5 #define WPM_ALLOW_COUNT_REGRESSION // #define WPM_UNFILTERED @@ -223,21 +72,26 @@ // #define WPM_SAMPLE_PERIODS 50 // #define WPM_LAUNCH_CONTROL - #ifndef ONESHOT_TAP_TOGGLE # define ONESHOT_TAP_TOGGLE 2 -#endif // !ONESHOT_TAP_TOGGLE +#endif // !ONESHOT_TAP_TOGGLE #ifndef ONESHOT_TIMEOUT # define ONESHOT_TIMEOUT 3000 -#endif // !ONESHOT_TIMEOUT - -#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY -#define PERMISSIVE_HOLD_PER_KEY -#define TAPPING_FORCE_HOLD_PER_KEY -#define RETRO_TAPPING_PER_KEY -#define TAPPING_TERM_PER_KEY - +#endif // !ONESHOT_TIMEOUT + +#if defined(PER_KEY_TAPPING) +# define IGNORE_MOD_TAP_INTERRUPT_PER_KEY +# define PERMISSIVE_HOLD_PER_KEY +# define TAPPING_FORCE_HOLD_PER_KEY +# define HOLD_ON_OTHER_KEY +# define RETRO_TAPPING_PER_KEY +# define HOLD_ON_OTHER_KEY_PRESS_PER_KEY +# define TAPPING_TERM_PER_KEY +#else +# define IGNORE_MOD_TAP_INTERRUPT +# undef PERMISSIVE_HOLD +#endif #ifndef TAPPING_TOGGLE # define TAPPING_TOGGLE 1 @@ -255,12 +109,12 @@ #ifdef CONVERT_TO_PROTON_C // pins that are available but not present on Pro Micro -# define A3 PAL_LINE(GPIOA, 3) -# define A4 PAL_LINE(GPIOA, 4) -# define A5 PAL_LINE(GPIOA, 5) -# define A6 PAL_LINE(GPIOA, 6) -# define A7 PAL_LINE(GPIOA, 7) -# define A8 PAL_LINE(GPIOA, 8) +# define A3 PAL_LINE(GPIOA, 3) +# define A4 PAL_LINE(GPIOA, 4) +# define A5 PAL_LINE(GPIOA, 5) +# define A6 PAL_LINE(GPIOA, 6) +# define A7 PAL_LINE(GPIOA, 7) +# define A8 PAL_LINE(GPIOA, 8) # define A13 PAL_LINE(GPIOA, 13) # define A14 PAL_LINE(GPIOA, 14) # define A15 PAL_LINE(GPIOA, 15) @@ -272,30 +126,6 @@ # define C15 PAL_LINE(GPIOC, 15) #endif -#ifdef OLED_DRIVER_SH1107 -# define OLED_DISPLAY_CUSTOM -# define OLED_IC_SH1107 2 -# define OLED_DISPLAY_128X128 -# define OLED_DISPLAY_WIDTH 128 -# define OLED_DISPLAY_HEIGHT 128 -# define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) -# define OLED_BLOCK_TYPE uint32_t -# define OLED_SOURCE_MAP \ - { 0, 8, 16, 24, 32, 40, 48, 56 } -# define OLED_TARGET_MAP \ - { 56, 48, 40, 32, 24, 16, 8, 0 } -# define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) -# define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) -# define OLED_COM_PINS COM_PINS_ALT -# define OLED_IC OLED_IC_SH1107 -# ifndef OLED_BRIGHTNESS -# define OLED_BRIGHTNESS 50 -# endif -# if !defined(STM32F4XX) -# undef OLED_UPDATE_INTERVAL -# define OLED_UPDATE_INTERVAL 75 -# endif -#endif #define ENABLE_COMPILE_KEYCODE diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 6e8d4ac9bd..91f3a06b7c 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -2,9 +2,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later #include "drashna.h" -#ifdef __AVR__ -# include <avr/wdt.h> -#endif userspace_config_t userspace_config; @@ -76,49 +73,59 @@ void tap_code16_nomods(uint16_t kc) { set_mods(temp_mod); } -/** - * @brief Run shutdown routine and soft reboot firmware. - * - */ - -#ifdef HAPTIC_ENABLE -# include "haptic.h" -#endif +#ifdef I2C_SCANNER_ENABLE +# include "i2c_master.h" +# include "debug.h" -#ifdef AUDIO_ENABLE -# ifndef GOODBYE_SONG -# define GOODBYE_SONG SONG(GOODBYE_SOUND) +# ifndef I2C_SCANNER_TIMEOUT +# define I2C_SCANNER_TIMEOUT 50 # endif -float reset_song[][2] = GOODBYE_SONG; -#endif -void software_reset(void) { - clear_keyboard(); -#if defined(MIDI_ENABLE) && defined(MIDI_BASIC) - process_midi_all_notes_off(); -#endif -#ifdef AUDIO_ENABLE -# ifndef NO_MUSIC_MODE - music_all_notes_off(); -# endif - uint16_t timer_start = timer_read(); - PLAY_SONG(reset_song); - shutdown_user(); - while (timer_elapsed(timer_start) < 250) wait_ms(1); - stop_all_notes(); -#else - shutdown_user(); - wait_ms(250); -#endif -#ifdef HAPTIC_ENABLE - haptic_shutdown(); -#endif +i2c_status_t i2c_start_bodge(uint8_t address, uint16_t timeout) { + i2c_start(address); -#if defined(PROTOCOL_LUFA) - wdt_enable(WDTO_250MS); -#elif defined(PROTOCOL_CHIBIOS) -# if defined(MCU_STM32) || defined(MCU_KINETIS) - NVIC_SystemReset(); -# endif -#endif + // except on ChibiOS where the only way is do do "something" + uint8_t data = 0; + return i2c_readReg(address, 0, &data, sizeof(data), I2C_SCANNER_TIMEOUT); } + +# define i2c_start i2c_start_bodge + +void do_scan(void) { + uint8_t nDevices = 0; + + dprintf("Scanning...\n"); + + for (uint8_t address = 1; address < 127; address++) { + // The i2c_scanner uses the return value of + // i2c_start to see if a device did acknowledge to the address. + i2c_status_t error = i2c_start(address << 1, I2C_SCANNER_TIMEOUT); + if (error == I2C_STATUS_SUCCESS) { + i2c_stop(); + xprintf(" I2C device found at address 0x%02X\n", I2C_SCANNER_TIMEOUT); + nDevices++; + } else { + // dprintf(" Unknown error (%u) at address 0x%02X\n", error, address); + } + } + + if (nDevices == 0) + xprintf("No I2C devices found\n"); + else + xprintf("done\n"); +} + +uint16_t scan_timer = 0; + +void matrix_scan_i2c(void) { + if (timer_elapsed(scan_timer) > 5000) { + do_scan(); + scan_timer = timer_read(); + } +} + +void keyboard_post_init_i2c(void) { + i2c_init(); + scan_timer = timer_read(); +} +#endif diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index 0bf1de84cf..16d7cda638 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -79,7 +79,6 @@ bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed); bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer); bool hasAllBitsInMask(uint8_t value, uint8_t mask); void tap_code16_nomods(uint16_t kc); -void software_reset(void); // clang-format off typedef union { diff --git a/users/drashna/keyrecords/autocorrection/autocorrection.c b/users/drashna/keyrecords/autocorrection/autocorrection.c index 682d6fd49c..90fdba8f5e 100644 --- a/users/drashna/keyrecords/autocorrection/autocorrection.c +++ b/users/drashna/keyrecords/autocorrection/autocorrection.c @@ -52,7 +52,7 @@ void autocorrect_enable(void) { */ void autocorrect_disable(void) { userspace_config.autocorrection = false; - typo_buffer_size = 0; + typo_buffer_size = 0; eeconfig_update_user(userspace_config.raw); } @@ -62,7 +62,7 @@ void autocorrect_disable(void) { */ void autocorrect_toggle(void) { userspace_config.autocorrection = !userspace_config.autocorrection; - typo_buffer_size = 0; + typo_buffer_size = 0; eeconfig_update_user(userspace_config.raw); } @@ -98,15 +98,15 @@ __attribute__((weak)) bool process_autocorrect_user(uint16_t *keycode, keyrecord } *keycode &= 0xFF; // Get the basic keycode. return true; -#ifndef NO_ACTION_TAPPING +# ifndef NO_ACTION_TAPPING // Exclude tap-hold keys when they are held down // and mask for base keycode when they are tapped. case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: -# ifdef NO_ACTION_LAYER +# ifdef NO_ACTION_LAYER // Exclude Layer Tap, if layers are disabled // but action tapping is still enabled. return false; -# endif +# endif case QK_MOD_TAP ... QK_MOD_TAP_MAX: // Exclude hold keycode if (!record->tap.count) { @@ -114,25 +114,25 @@ __attribute__((weak)) bool process_autocorrect_user(uint16_t *keycode, keyrecord } *keycode &= 0xFF; break; -#else +# else case QK_MOD_TAP ... QK_MOD_TAP_MAX: case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: // Exclude if disabled return false; -#endif +# endif // Exclude swap hands keys when they are held down // and mask for base keycode when they are tapped. case QK_SWAP_HANDS ... QK_SWAP_HANDS_MAX: -#ifdef SWAP_HANDS_ENABLE +# ifdef SWAP_HANDS_ENABLE if (*keycode >= 0x56F0 || !record->tap.count) { return false; } *keycode &= 0xFF; break; -#else +# else // Exclude if disabled return false; -#endif +# endif } // Disable autocorrect while a mod other than shift is active. @@ -166,9 +166,9 @@ __attribute__((weak)) bool apply_autocorrect(uint8_t backspaces, const char *str */ bool process_autocorrection(uint16_t keycode, keyrecord_t *record) { uint8_t mods = get_mods(); -#ifndef NO_ACTION_ONESHOT +# ifndef NO_ACTION_ONESHOT mods |= get_oneshot_mods(); -#endif +# endif if ((keycode >= AUTOCORRECT_ON && keycode <= AUTOCORRECT_TOGGLE) && record->event.pressed) { if (keycode == AUTOCORRECT_ON) { diff --git a/users/drashna/keyrecords/autocorrection/autocorrection_data.h b/users/drashna/keyrecords/autocorrection/autocorrection_data.h new file mode 100644 index 0000000000..90484d3b12 --- /dev/null +++ b/users/drashna/keyrecords/autocorrection/autocorrection_data.h @@ -0,0 +1 @@ +#include "autocorrect_data.h" diff --git a/users/drashna/keyrecords/process_records.c b/users/drashna/keyrecords/process_records.c index 240156e816..197fd94171 100644 --- a/users/drashna/keyrecords/process_records.c +++ b/users/drashna/keyrecords/process_records.c @@ -6,9 +6,6 @@ #ifdef AUTOCORRECTION_ENABLE # include "autocorrection/autocorrection.h" #endif -#ifdef __AVR__ -# include <avr/wdt.h> -#endif uint16_t copy_paste_timer; bool host_driver_disabled = false; @@ -20,8 +17,12 @@ bool host_driver_disabled = false; * * This handles the keycodes at the keymap level, useful for keyboard specific customization */ -__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } -__attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { return true; } +__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { + return true; +} +__attribute__((weak)) bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { + return true; +} /** * @brief Main user keycode handler @@ -45,11 +46,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { #endif // If console is enabled, it will print the matrix position and status of each key pressed #ifdef KEYLOGGER_ENABLE - uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %b, time: %5u, int: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count); -#endif // KEYLOGGER_ENABLE + uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %1d, time: %5u, int: %1d, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count); +#endif // KEYLOGGER_ENABLE #if defined(OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER) process_record_user_oled(keycode, record); -#endif // OLED +#endif // OLED if (!(process_record_keymap(keycode, record) && process_record_secrets(keycode, record) #ifdef CUSTOM_RGB_MATRIX @@ -90,34 +91,34 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } break; - case VRSN: // Prints firmware version + case VRSN: // Prints firmware version if (record->event.pressed) { send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), TAP_CODE_DELAY); } break; - case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them + case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them #ifdef TAP_DANCE_ENABLE if (record->event.pressed) { for (uint8_t index = 0; index < 4; index++) { diablo_timer[index].key_interval = 0; } } -#endif // TAP_DANCE_ENABLE +#endif // TAP_DANCE_ENABLE break; - case KC_CCCV: // One key copy/paste + case KC_CCCV: // One key copy/paste if (record->event.pressed) { copy_paste_timer = timer_read(); } else { - if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy + if (timer_elapsed(copy_paste_timer) > TAPPING_TERM) { // Hold, copy tap_code16(LCTL(KC_C)); - } else { // Tap, paste + } else { // Tap, paste tap_code16(LCTL(KC_V)); } } break; - case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal + case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal #if defined(CUSTOM_RGBLIGHT) || defined(CUSTOM_RGB_MATRIX) if (record->event.pressed) { userspace_config.rgb_layer_change ^= 1; @@ -140,7 +141,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { # endif } } -#endif // CUSTOM_RGBLIGHT +#endif // CUSTOM_RGBLIGHT break; #if defined(CUSTOM_RGBLIGHT) || defined(CUSTOM_RGB_MATRIX) @@ -160,7 +161,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; - case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions + case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions if (record->event.pressed) { bool is_eeprom_updated; # if defined(CUSTOM_RGBLIGHT) && !defined(RGBLIGHT_DISABLE_KEYCODES) @@ -200,9 +201,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } break; } - } + } return true; } __attribute__((weak)) void post_process_record_keymap(uint16_t keycode, keyrecord_t *record) {} -void post_process_record_user(uint16_t keycode, keyrecord_t *record) { post_process_record_keymap(keycode, record); } +void post_process_record_user(uint16_t keycode, keyrecord_t *record) { + post_process_record_keymap(keycode, record); +} diff --git a/users/drashna/keyrecords/process_records.h b/users/drashna/keyrecords/process_records.h index e83e4ce308..be31f992cb 100644 --- a/users/drashna/keyrecords/process_records.h +++ b/users/drashna/keyrecords/process_records.h @@ -13,30 +13,30 @@ #endif enum userspace_custom_keycodes { - VRSN = PLACEHOLDER_SAFE_RANGE, // Prints QMK Firmware and board info - KC_QWERTY, // Sets default layer to QWERTY - FIRST_DEFAULT_LAYER_KEYCODE = KC_QWERTY, // Sets default layer to QWERTY - KC_COLEMAK_DH, // Sets default layer to COLEMAK - KC_COLEMAK, // Sets default layer to COLEMAK - KC_DVORAK, // Sets default layer to DVORAK - LAST_DEFAULT_LAYER_KEYCODE = KC_DVORAK, // Sets default layer to WORKMAN - KC_DIABLO_CLEAR, // Clears all Diablo Timers - KC_RGB_T, // Toggles RGB Layer Indication mode - RGB_IDL, // RGB Idling animations - KC_SECRET_1, // test1 - KC_SECRET_2, // test2 - KC_SECRET_3, // test3 - KC_SECRET_4, // test4 - KC_SECRET_5, // test5 - KC_CCCV, // Hold to copy, tap to paste - KC_NUKE, // NUCLEAR LAUNCH DETECTED!!! - UC_FLIP, // (ಠ痊ಠ)┻━┻ - UC_TABL, // ┬─┬ノ( º _ ºノ) - UC_SHRG, // ¯\_(ツ)_/¯ - UC_DISA, // ಠ_ಠ + VRSN = PLACEHOLDER_SAFE_RANGE, // Prints QMK Firmware and board info + KC_QWERTY, // Sets default layer to QWERTY + FIRST_DEFAULT_LAYER_KEYCODE = KC_QWERTY, // Sets default layer to QWERTY + KC_COLEMAK_DH, // Sets default layer to COLEMAK + KC_COLEMAK, // Sets default layer to COLEMAK + KC_DVORAK, // Sets default layer to DVORAK + LAST_DEFAULT_LAYER_KEYCODE = KC_DVORAK, // Sets default layer to WORKMAN + KC_DIABLO_CLEAR, // Clears all Diablo Timers + KC_RGB_T, // Toggles RGB Layer Indication mode + RGB_IDL, // RGB Idling animations + KC_SECRET_1, // test1 + KC_SECRET_2, // test2 + KC_SECRET_3, // test3 + KC_SECRET_4, // test4 + KC_SECRET_5, // test5 + KC_CCCV, // Hold to copy, tap to paste + KC_NUKE, // NUCLEAR LAUNCH DETECTED!!! + UC_FLIP, // (ಠ痊ಠ)┻━┻ + UC_TABL, // ┬─┬ノ( º _ ºノ) + UC_SHRG, // ¯\_(ツ)_/¯ + UC_DISA, // ಠ_ಠ UC_IRNY, UC_CLUE, - KEYLOCK, // Locks keyboard by unmounting driver + KEYLOCK, // Locks keyboard by unmounting driver KC_NOMODE, KC_WIDE, KC_SCRIPT, @@ -44,11 +44,12 @@ enum userspace_custom_keycodes { KC_REGIONAL, KC_AUSSIE, KC_ZALGO, + KC_SUPER, KC_ACCEL, AUTOCORRECT_ON, AUTOCORRECT_OFF, AUTOCORRECT_TOGGLE, - NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes + NEW_SAFE_RANGE // use "NEWPLACEHOLDER for keymap specific codes }; bool process_record_secrets(uint16_t keycode, keyrecord_t *record); @@ -58,37 +59,37 @@ void post_process_record_keymap(uint16_t keycode, keyrecord_t *record); bool process_record_unicode(uint16_t keycode, keyrecord_t *record); #endif -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) -#define ADJUST MO(_ADJUST) -#define TG_MODS OS_TOGG -#define TG_GAME TG(_GAMEPAD) -#define TG_DBLO TG(_DIABLO) -#define OS_LWR OSL(_LOWER) -#define OS_RSE OSL(_RAISE) +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) +#define ADJUST MO(_ADJUST) +#define TG_MODS OS_TOGG +#define TG_GAME TG(_GAMEPAD) +#define TG_DBLO TG(_DIABLO) +#define OS_LWR OSL(_LOWER) +#define OS_RSE OSL(_RAISE) -#define KC_SEC1 KC_SECRET_1 -#define KC_SEC2 KC_SECRET_2 -#define KC_SEC3 KC_SECRET_3 -#define KC_SEC4 KC_SECRET_4 -#define KC_SEC5 KC_SECRET_5 +#define KC_SEC1 KC_SECRET_1 +#define KC_SEC2 KC_SECRET_2 +#define KC_SEC3 KC_SECRET_3 +#define KC_SEC4 KC_SECRET_4 +#define KC_SEC5 KC_SECRET_5 -#define QWERTY KC_QWERTY -#define DVORAK KC_DVORAK -#define COLEMAK KC_COLEMAK +#define QWERTY KC_QWERTY +#define DVORAK KC_DVORAK +#define COLEMAK KC_COLEMAK #define COLEMAKDH KC_COLEMAK_DH -#define DEFLYR1 FIRST_DEFAULT_LAYER_KEYCODE -#define DEFLYR2 (FIRST_DEFAULT_LAYER_KEYCODE + 1) -#define DEFLYR3 (FIRST_DEFAULT_LAYER_KEYCODE + 2) -#define DEFLYR4 (FIRST_DEFAULT_LAYER_KEYCODE + 3) +#define DEFLYR1 FIRST_DEFAULT_LAYER_KEYCODE +#define DEFLYR2 (FIRST_DEFAULT_LAYER_KEYCODE + 1) +#define DEFLYR3 (FIRST_DEFAULT_LAYER_KEYCODE + 2) +#define DEFLYR4 (FIRST_DEFAULT_LAYER_KEYCODE + 3) #if LAST_DEFAULT_LAYER_KEYCODE > (FIRST_DEFAULT_LAYER_KEYCODE + 3) # define DEFLYR5 (FIRST_DEFAULT_LAYER_KEYCODE + 4) # define DEFLYR6 (FIRST_DEFAULT_LAYER_KEYCODE + 5) # define DEFLYR7 (FIRST_DEFAULT_LAYER_KEYCODE + 6) # define DEFLYR8 (FIRST_DEFAULT_LAYER_KEYCODE + 7) # if LAST_DEFAULT_LAYER_KEYCODE > (FIRST_DEFAULT_LAYER_KEYCODE + 7) -# define DEFLYR9 (FIRST_DEFAULT_LAYER_KEYCODE + 8) +# define DEFLYR9 (FIRST_DEFAULT_LAYER_KEYCODE + 8) # define DEFLYR10 (FIRST_DEFAULT_LAYER_KEYCODE + 9) # define DEFLYR11 (FIRST_DEFAULT_LAYER_KEYCODE + 10) # define DEFLYR12 (FIRST_DEFAULT_LAYER_KEYCODE + 11) @@ -99,9 +100,9 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record); # define KC_C1R3 SH_T(KC_TAB) #elif defined(DRASHNA_LP) # define KC_C1R3 TG(_GAMEPAD) -#else // SWAP_HANDS_ENABLE +#else // SWAP_HANDS_ENABLE # define KC_C1R3 KC_TAB -#endif // SWAP_HANDS_ENABLE +#endif // SWAP_HANDS_ENABLE #define BK_LWER LT(_LOWER, KC_BSPC) #define SP_LWER LT(_LOWER, KC_SPC) @@ -120,7 +121,7 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record); #define OS_RCTL OSM(MOD_RCTL) #define OS_LALT OSM(MOD_LALT) #define OS_RALT OSM(MOD_RALT) -#define OS_MEH OSM(MOD_MEH) +#define OS_MEH OSM(MOD_MEH) #define OS_HYPR OSM(MOD_HYPR) #define ALT_APP ALT_T(KC_APP) @@ -138,9 +139,9 @@ We use custom codes here, so we can substitute the right stuff # define KC_D3_2 TD(TD_D3_2) # define KC_D3_3 TD(TD_D3_3) # define KC_D3_4 TD(TD_D3_4) -#else // TAP_DANCE_ENABLE +#else // TAP_DANCE_ENABLE # define KC_D3_1 KC_1 # define KC_D3_2 KC_2 # define KC_D3_3 KC_3 # define KC_D3_4 KC_4 -#endif // TAP_DANCE_ENABLE +#endif // TAP_DANCE_ENABLE diff --git a/users/drashna/keyrecords/tap_dances.c b/users/drashna/keyrecords/tap_dances.c index a1a7439164..6caf6b6b3e 100644 --- a/users/drashna/keyrecords/tap_dances.c +++ b/users/drashna/keyrecords/tap_dances.c @@ -26,7 +26,7 @@ void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data) { if (state->count >= (sizeof(diablo_times) / sizeof(uint8_t))) { diablo_timer[diablo_keys->index].key_interval = 0; reset_tap_dance(state); - } else { // else set the interval (tapdance count starts at 1, array starts at 0, so offset by one) + } else { // else set the interval (tapdance count starts at 1, array starts at 0, so offset by one) diablo_timer[diablo_keys->index].key_interval = diablo_times[state->count - 1]; } } diff --git a/users/drashna/keyrecords/tap_dances.h b/users/drashna/keyrecords/tap_dances.h index d9baedc867..81d1f07fe0 100644 --- a/users/drashna/keyrecords/tap_dances.h +++ b/users/drashna/keyrecords/tap_dances.h @@ -28,4 +28,4 @@ enum { TD_D3_3, TD_D3_4, }; -#endif // TAP_DANCE_ENABLE +#endif // TAP_DANCE_ENABLE diff --git a/users/drashna/keyrecords/tapping.c b/users/drashna/keyrecords/tapping.c index 9c4892b33d..7496610c2f 100644 --- a/users/drashna/keyrecords/tapping.c +++ b/users/drashna/keyrecords/tapping.c @@ -3,6 +3,7 @@ #include "drashna.h" +#ifdef TAPPING_TERM_PER_KEY __attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case BK_LWER: @@ -11,7 +12,9 @@ __attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *r return TAPPING_TERM; } } +#endif // TAPPING_TERM_PER_KEY +#ifdef PERMISSIVE_HOLD_PER_KEY __attribute__((weak)) bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) { // Immediately select the hold action when another key is tapped: // return true; @@ -22,20 +25,24 @@ __attribute__((weak)) bool get_permissive_hold(uint16_t keycode, keyrecord_t *re return false; } } +#endif // PERMISSIVE_HOLD_PER_KEY +#ifdef HOLD_ON_OTHER_KEY_PRESS_PER_KEY __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; +// case QK_LAYER_TAP ... QK_LAYER_TAP_MAX: +// return true; default: return false; } } +#endif // HOLD_ON_OTHER_KEY_PRESS_PER_KEY +#ifdef IGNORE_MOD_TAP_INTERRUPT_PER_KEY __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. @@ -48,17 +55,22 @@ __attribute__((weak)) bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrec return true; } } +#endif // IGNORE_MOD_TAP_INTERRUPT_PER_KEY +#ifdef TAPPING_FORCE_HOLD_PER_KEY __attribute__((weak)) bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) { switch (keycode) { default: return false; } } +#endif // TAPPING_FORCE_HOLD_PER_KEY +#ifdef RETRO_TAPPING_PER_KEY __attribute__((weak)) bool get_retro_tapping(uint16_t keycode, keyrecord_t *record) { switch (keycode) { default: return false; } } +#endif // RETRO_TAPPING_PER_KEY diff --git a/users/drashna/keyrecords/unicode.c b/users/drashna/keyrecords/unicode.c index c1fe8df2c3..b3fc71cb09 100644 --- a/users/drashna/keyrecords/unicode.c +++ b/users/drashna/keyrecords/unicode.c @@ -69,7 +69,7 @@ bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, tra } return false; } else if (KC_1 <= keycode && keycode <= KC_0) { - if (is_shifted) { // skip shifted numbers, so that we can still use symbols etc. + if (is_shifted) { // skip shifted numbers, so that we can still use symbols etc. return process_record_keymap(keycode, record); } if (record->event.pressed) { @@ -92,42 +92,81 @@ DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_boxes, 0x1F170, 0x1F170 DEFINE_UNICODE_RANGE_TRANSLATOR(unicode_range_translator_regional, 0x1F1E6, 0x1F1E6, '0', '1', 0x2003); DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_aussie, - 0x0250, // a - 'q', // b - 0x0254, // c - 'p', // d - 0x01DD, // e - 0x025F, // f - 0x0183, // g - 0x0265, // h - 0x1D09, // i - 0x027E, // j - 0x029E, // k - 'l', // l - 0x026F, // m - 'u', // n - 'o', // o - 'd', // p - 'b', // q - 0x0279, // r - 's', // s - 0x0287, // t - 'n', // u - 0x028C, // v - 0x028D, // w - 0x2717, // x - 0x028E, // y - 'z', // z - 0x0269, // 1 - 0x3139, // 2 - 0x0190, // 3 - 0x3123, // 4 - 0x03DB, // 5 - '9', // 6 - 0x3125, // 7 - '8', // 8 - '6', // 9 - '0' // 0 + 0x0250, // a + 'q', // b + 0x0254, // c + 'p', // d + 0x01DD, // e + 0x025F, // f + 0x0183, // g + 0x0265, // h + 0x1D09, // i + 0x027E, // j + 0x029E, // k + 'l', // l + 0x026F, // m + 'u', // n + 'o', // o + 'd', // p + 'b', // q + 0x0279, // r + 's', // s + 0x0287, // t + 'n', // u + 0x028C, // v + 0x028D, // w + 0x2717, // x + 0x028E, // y + 'z', // z + 0x0269, // 1 + 0x3139, // 2 + 0x0190, // 3 + 0x3123, // 4 + 0x03DB, // 5 + '9', // 6 + 0x3125, // 7 + '8', // 8 + '6', // 9 + '0' // 0 +); + +DEFINE_UNICODE_LUT_TRANSLATOR(unicode_lut_translator_super, + 0x1D43, // a + 0x1D47, // b + 0x1D9C, // c + 0x1D48, // d + 0x1D49, // e + 0x1DA0, // f + 0x1D4D, // g + 0x02B0, // h + 0x2071, // i + 0x02B2, // j + 0x1D4F, // k + 0x02E1, // l + 0x1D50, // m + 0x207F, // n + 0x1D52, // o + 0x1D56, // p + 0x06F9, // q + 0x02B3, // r + 0x02E2, // s + 0x1D57, // t + 0x1D58, // u + 0x1D5B, // v + 0x02B7, // w + 0x02E3, // x + 0x02B8, // y + 0x1DBB, // z + 0x00B9, // 1 + 0x00B2, // 2 + 0x00B3, // 3 + 0x2074, // 4 + 0x2075, // 5 + 0x2076, // 6 + 0x2077, // 7 + 0x2078, // 8 + 0x2079, // 9 + 0x2070 // 0 ); bool process_record_aussie(uint16_t keycode, keyrecord_t *record) { @@ -207,41 +246,41 @@ bool process_record_zalgo(uint16_t keycode, keyrecord_t *record) { bool process_record_unicode(uint16_t keycode, keyrecord_t *record) { switch (keycode) { - case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻ + case UC_FLIP: // (ノಠ痊ಠ)ノ彡┻━┻ if (record->event.pressed) { send_unicode_string("(ノಠ痊ಠ)ノ彡┻━┻"); } break; - case UC_TABL: // ┬─┬ノ( º _ ºノ) + case UC_TABL: // ┬─┬ノ( º _ ºノ) if (record->event.pressed) { send_unicode_string("┬─┬ノ( º _ ºノ)"); } break; - case UC_SHRG: // ¯\_(ツ)_/¯ + case UC_SHRG: // ¯\_(ツ)_/¯ if (record->event.pressed) { send_unicode_string("¯\\_(ツ)_/¯"); } break; - case UC_DISA: // ಠ_ಠ + case UC_DISA: // ಠ_ಠ if (record->event.pressed) { send_unicode_string("ಠ_ಠ"); } break; - case UC_IRNY: // ⸮ + case UC_IRNY: // ⸮ if (record->event.pressed) { register_unicode(0x2E2E); } break; - case UC_CLUE: // ‽ + case UC_CLUE: // ‽ if (record->event.pressed) { register_unicode(0x203D); } break; - case KC_NOMODE ... KC_ZALGO: + case KC_NOMODE ... KC_SUPER: if (record->event.pressed) { if (typing_mode != keycode - KC_NOMODE) { typing_mode = keycode - KC_NOMODE; @@ -280,6 +319,10 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record) { return false; } } + } else if (typing_mode == UCTM_SUPER) { + if (((KC_A <= keycode) && (keycode <= KC_0))) { + return process_record_glyph_replacement(keycode, record, unicode_lut_translator_super); + } } else if (typing_mode == UCTM_AUSSIE) { return process_record_aussie(keycode, record); } else if (typing_mode == UCTM_ZALGO) { @@ -292,4 +335,6 @@ bool process_record_unicode(uint16_t keycode, keyrecord_t *record) { * @brief Initialize the default unicode mode on firmware startu * */ -void matrix_init_unicode(void) { unicode_input_mode_init(); } +void matrix_init_unicode(void) { + unicode_input_mode_init(); +} diff --git a/users/drashna/keyrecords/unicode.h b/users/drashna/keyrecords/unicode.h index dd261d3406..6885d4dd7f 100644 --- a/users/drashna/keyrecords/unicode.h +++ b/users/drashna/keyrecords/unicode.h @@ -11,6 +11,7 @@ enum unicode_typing_mode { UCTM_REGIONAL, UCTM_AUSSIE, UCTM_ZALGO, + UCTM_SUPER, }; extern uint8_t typing_mode; diff --git a/users/drashna/oled/oled_config.h b/users/drashna/oled/oled_config.h new file mode 100644 index 0000000000..c46c0c39ce --- /dev/null +++ b/users/drashna/oled/oled_config.h @@ -0,0 +1,63 @@ +// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#ifndef OLED_UPDATE_INTERVAL +# ifdef OLED_DRIVER_SH1107 +# define OLED_UPDATE_INTERVAL 75 +# else +# ifdef SPLIT_KEYBOARD +# define OLED_UPDATE_INTERVAL 60 +# else +# define OLED_UPDATE_INTERVAL 15 +# endif +# endif +#endif +#define OLED_DISABLE_TIMEOUT +#ifdef OLED_FONT_H +# undef OLED_FONT_H +#endif +#define OLED_FONT_H "oled/drashna_font.h" +#define OLED_FONT_END 255 +// # define OLED_FONT_5X5 +// # define OLED_FONT_AZTECH +// # define OLED_FONT_BMPLAIN +// # define OLED_FONT_CRACKERS +#define OLED_FONT_DEAD_MEAL +// # define OLED_FONT_EIN +// # define OLED_FONT_HISKYF21 +// # define OLED_FONT_SQUASH +// # define OLED_FONT_ZXPIX +// # define OLED_FONT_SUPER_DIGG + +// # define OLED_LOGO_BEBOP +// # 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_SCIFI +// # define OLED_LOGO_SETS3N +// # define OLED_LOGO_SKEEB + +#ifdef OLED_DRIVER_SH1107 +# define OLED_DISPLAY_CUSTOM +# define OLED_IC_SH1107 2 +# define OLED_DISPLAY_128X128 +# define OLED_DISPLAY_WIDTH 128 +# define OLED_DISPLAY_HEIGHT 128 +# define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) +# define OLED_BLOCK_TYPE uint32_t +# define OLED_SOURCE_MAP \ + { 0, 8, 16, 24, 32, 40, 48, 56 } +# define OLED_TARGET_MAP \ + { 56, 48, 40, 32, 24, 16, 8, 0 } +# define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) +# define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) +# define OLED_COM_PINS COM_PINS_ALT +# define OLED_IC OLED_IC_SH1107 +# ifndef OLED_BRIGHTNESS +# define OLED_BRIGHTNESS 50 +# endif +#endif diff --git a/users/drashna/oled/oled_stuff.c b/users/drashna/oled/oled_stuff.c index 8c76897fba..e082f8ab3e 100644 --- a/users/drashna/oled/oled_stuff.c +++ b/users/drashna/oled/oled_stuff.c @@ -28,13 +28,15 @@ #endif #include <string.h> +bool is_oled_enabled = true; + extern bool host_driver_disabled; uint32_t oled_timer = 0; char keylog_str[OLED_KEYLOGGER_LENGTH] = {0}; static uint16_t log_timer = 0; #ifdef OLED_DISPLAY_VERBOSE -static const char PROGMEM display_border[3] = {0x0, 0xFF, 0x0}; +const char PROGMEM display_border[3] = {0x0, 0xFF, 0x0}; #endif deferred_token kittoken; @@ -117,9 +119,9 @@ void oled_timer_reset(void) { * @brief Renders keylogger buffer to oled * */ -void render_keylogger_status(void) { +void render_keylogger_status(uint8_t col, uint8_t line) { #ifdef OLED_DISPLAY_VERBOSE - oled_set_cursor(1, 6); + oled_set_cursor(col, line); #endif oled_write_P(PSTR(OLED_RENDER_KEYLOGGER), false); oled_write(keylog_str, false); @@ -132,9 +134,9 @@ void render_keylogger_status(void) { * @brief Renders default layer state (aka layout) to oled * */ -void render_default_layer_state(void) { +void render_default_layer_state(uint8_t col, uint8_t line) { #ifdef OLED_DISPLAY_VERBOSE - oled_set_cursor(1, 1); + oled_set_cursor(col, line); #endif oled_write_P(PSTR(OLED_RENDER_LAYOUT_NAME), false); switch (get_highest_layer(default_layer_state)) { @@ -160,7 +162,7 @@ void render_default_layer_state(void) { * @brief Renders the active layers to the OLED * */ -void render_layer_state(void) { +void render_layer_state(uint8_t col, uint8_t line) { #ifdef OLED_DISPLAY_VERBOSE // clang-format off static const char PROGMEM tri_layer_image[][3][24] = { @@ -286,33 +288,33 @@ void render_layer_state(void) { layer_is[2] = 5; } - oled_set_cursor(1, 2); + oled_set_cursor(col, line); oled_write_raw_P(tri_layer_image[layer_is[0]][0], sizeof(tri_layer_image[0][0])); - oled_set_cursor(5, 2); + oled_set_cursor(col + 4, line); oled_write_raw_P(tri_layer_image[layer_is[1]][0], sizeof(tri_layer_image[0][0])); - oled_set_cursor(9, 2); + oled_set_cursor(col + 8, line); oled_write_raw_P(tri_layer_image[layer_is[2]][0], sizeof(tri_layer_image[0][0])); - oled_set_cursor(14, 2); + oled_set_cursor(col + 13, line); oled_write_P(PSTR("Diablo2"), layer_state_is(_DIABLOII)); oled_advance_page(true); - oled_set_cursor(1, 3); + oled_set_cursor(col, line + 1); oled_write_raw_P(tri_layer_image[layer_is[0]][1], sizeof(tri_layer_image[0][0])); - oled_set_cursor(5, 3); + oled_set_cursor(col + 4, line + 1); oled_write_raw_P(tri_layer_image[layer_is[1]][1], sizeof(tri_layer_image[0][0])); - oled_set_cursor(9, 3); + oled_set_cursor(col + 8, line + 1); oled_write_raw_P(tri_layer_image[layer_is[2]][1], sizeof(tri_layer_image[0][0])); - oled_set_cursor(14, 3); + oled_set_cursor(col + 13, line + 1); oled_write_P(PSTR("Diablo3"), layer_state_is(_DIABLO)); oled_advance_page(true); - oled_set_cursor(1, 4); + oled_set_cursor(col, line + 2); oled_write_raw_P(tri_layer_image[layer_is[0]][2], sizeof(tri_layer_image[0][0])); - oled_set_cursor(5, 4); + oled_set_cursor(col + 4, line + 2); oled_write_raw_P(tri_layer_image[layer_is[1]][2], sizeof(tri_layer_image[0][0])); - oled_set_cursor(9, 4); + oled_set_cursor(col + 8, line + 2); oled_write_raw_P(tri_layer_image[layer_is[2]][2], sizeof(tri_layer_image[0][0])); - oled_set_cursor(14, 4); + oled_set_cursor(col + 13, line + 2); oled_write_P(PSTR("Media"), layer_state_is(_MEDIA)); #else oled_write_P(PSTR(OLED_RENDER_LAYER_NAME), false); @@ -327,9 +329,12 @@ void render_layer_state(void) { * * @param led_usb_state Current keyboard led state */ -void render_keylock_status(led_t led_usb_state) { +void render_keylock_status(led_t led_usb_state, uint8_t col, uint8_t line) { #if defined(OLED_DISPLAY_VERBOSE) - oled_set_cursor(1, 6); + oled_set_cursor(col, line); +#endif +#ifdef CAPS_WORD_ENABLE + led_usb_state.caps_lock |= is_caps_word_on(); #endif oled_write_P(PSTR(OLED_RENDER_LOCK_NAME), false); #if !defined(OLED_DISPLAY_VERBOSE) @@ -348,8 +353,9 @@ void render_keylock_status(led_t led_usb_state) { * @brief Renders the matrix scan rate to the host system * */ -void render_matrix_scan_rate(uint8_t padding) { +void render_matrix_scan_rate(uint8_t padding, uint8_t col, uint8_t line) { #ifdef DEBUG_MATRIX_SCAN_RATE + oled_set_cursor(col, line); oled_write_P(PSTR("MS:"), false); if (padding) { for (uint8_t n = padding; n > 0; n--) { @@ -365,10 +371,10 @@ void render_matrix_scan_rate(uint8_t padding) { * * @param modifiers Modifiers to check against (real, weak, onesheot, etc;) */ -void render_mod_status(uint8_t modifiers) { +void render_mod_status(uint8_t modifiers, uint8_t col, uint8_t line) { static const char PROGMEM mod_status[5][3] = {{0xE8, 0xE9, 0}, {0xE4, 0xE5, 0}, {0xE6, 0xE7, 0}, {0xEA, 0xEB, 0}, {0xEC, 0xED, 0}}; #if defined(OLED_DISPLAY_VERBOSE) - oled_set_cursor(1, 5); + oled_set_cursor(col, line); #endif oled_write_P(PSTR(OLED_RENDER_MODS_NAME), false); #if defined(OLED_DISPLAY_VERBOSE) @@ -393,7 +399,7 @@ void render_mod_status(uint8_t modifiers) { extern bool swap_hands; #endif -void render_bootmagic_status(void) { +void render_bootmagic_status(uint8_t col, uint8_t line) { /* Show Ctrl-Gui Swap options */ static const char PROGMEM logo[][2][3] = { {{0x97, 0x98, 0}, {0xb7, 0xb8, 0}}, @@ -402,7 +408,8 @@ void render_bootmagic_status(void) { bool is_bootmagic_on; #ifdef OLED_DISPLAY_VERBOSE - oled_set_cursor(7, 3); + oled_set_cursor(col, line); + // oled_set_cursor(7, 3); is_bootmagic_on = !keymap_config.swap_lctl_lgui; #else is_bootmagic_on = keymap_config.swap_lctl_lgui; @@ -435,7 +442,7 @@ void render_bootmagic_status(void) { oled_write_P(PSTR(OLED_RENDER_BOOTMAGIC_NOGUI), keymap_config.no_gui); #endif #ifdef OLED_DISPLAY_VERBOSE - oled_set_cursor(7, 4); + oled_set_cursor(col, line + 1); if (keymap_config.swap_lctl_lgui) { oled_write_P(logo[1][1], is_bootmagic_on); } else { @@ -455,7 +462,7 @@ void render_bootmagic_status(void) { extern bool tap_toggling; #endif -void render_user_status(void) { +void render_user_status(uint8_t col, uint8_t line) { #ifdef AUDIO_ENABLE bool is_audio_on = false, l_is_clicky_on = false; # ifdef SPLIT_KEYBOARD @@ -472,7 +479,7 @@ void render_user_status(void) { # endif #endif #if defined(OLED_DISPLAY_VERBOSE) - oled_set_cursor(1, 5); + oled_set_cursor(col, line); #endif oled_write_P(PSTR(OLED_RENDER_USER_NAME), false); #if !defined(OLED_DISPLAY_VERBOSE) @@ -523,9 +530,27 @@ void render_user_status(void) { #endif } -void render_wpm(uint8_t padding) { -#ifdef WPM_ENABLE +void render_rgb_hsv(uint8_t col, uint8_t line) { + oled_set_cursor(col, line); + oled_write_P(PSTR("HSV: "), false); +#ifdef RGB_MATRIX_ENABLE + oled_write(get_u8_str(rgb_matrix_get_hue(), ' '), false); + oled_write_P(PSTR(", "), false); + oled_write(get_u8_str(rgb_matrix_get_sat(), ' '), false); + oled_write_P(PSTR(", "), false); + oled_write(get_u8_str(rgb_matrix_get_val(), ' '), false); +#elif RGBLIGHT_ENABLE + oled_write(get_u8_str(rgblight_get_hue(), ' '), false); + oled_write_P(PSTR(", "), false); + oled_write(get_u8_str(rgblight_get_sat(), ' '), false); + oled_write_P(PSTR(", "), false); + oled_write(get_u8_str(rgblight_get_val(), ' '), false); +#endif +} +void render_wpm(uint8_t padding, uint8_t col, uint8_t line) { +#ifdef WPM_ENABLE + oled_set_cursor(col, line); oled_write_P(PSTR(OLED_RENDER_WPM_COUNTER), false); if (padding) { for (uint8_t n = padding; n > 0; n--) { @@ -591,7 +616,8 @@ void render_wpm_graph(uint8_t max_lines_graph, uint8_t vertical_offset) { } #if defined(POINTING_DEVICE_ENABLE) -void render_pointing_dpi_status(uint16_t cpi, uint8_t padding) { +void render_pointing_dpi_status(uint16_t cpi, uint8_t padding, uint8_t col, uint8_t line) { + oled_set_cursor(col, line); oled_write_P(PSTR("CPI:"), false); if (padding) { for (uint8_t n = padding - 1; n > 0; n--) { @@ -603,13 +629,6 @@ void render_pointing_dpi_status(uint16_t cpi, uint8_t padding) { } #endif -__attribute__((weak)) void oled_driver_render_logo_right(void) { -#if defined(OLED_DISPLAY_VERBOSE) - oled_set_cursor(0, 1); -#endif - render_default_layer_state(); -} - // WPM-responsive animation stuff here #define OLED_SLEEP_FRAMES 2 #define OLED_SLEEP_SPEED 10 // below this wpm value your animation will idle @@ -635,7 +654,7 @@ __attribute__((weak)) void oled_driver_render_logo_right(void) { static uint8_t animation_frame = 0; static uint8_t animation_type = 0; -void render_kitty(void) { +void render_kitty(uint8_t col, uint8_t line) { // Images credit j-inc(/James Incandenza) and pixelbenny. // Credit to obosob for initial animation approach. // heavily modified by drashna because he's a glutton for punishment @@ -712,11 +731,44 @@ void render_kitty(void) { // clang-format on for (uint8_t i = 0; i < 4; i++) { - oled_set_cursor(1, i + 1); + oled_set_cursor(col, line + i); oled_write_raw_P(animation[animation_type][animation_frame][i], OLED_ANIM_SIZE); } } +void render_unicode_mode(uint8_t col, uint8_t line) { +#ifdef CUSTOM_UNICODE_ENABLE + oled_set_cursor(col, line); + oled_write_ln_P(PSTR("Unicode:"), false); + switch (typing_mode) { + case UCTM_WIDE: + oled_write_P(PSTR(" Wide"), false); + break; + case UCTM_SCRIPT: + oled_write_P(PSTR(" Script"), false); + break; + case UCTM_BLOCKS: + oled_write_P(PSTR(" Blocks"), false); + break; + case UCTM_REGIONAL: + oled_write_P(PSTR(" Regional"), false); + break; + case UCTM_AUSSIE: + oled_write_P(PSTR(" Aussie"), false); + break; + case UCTM_ZALGO: + oled_write_P(PSTR(" Zalgo"), false); + break; + case UCTM_NO_MODE: + oled_write_P(PSTR(" Normal"), false); + break; + default: + oled_write_P(PSTR(" Unknown"), false); + break; + } +#endif +} + uint32_t kitty_animation_phases(uint32_t triger_time, void *cb_arg) { static uint32_t anim_frame_duration = 500; #ifdef CUSTOM_POINTING_DEVICE @@ -748,34 +800,8 @@ uint32_t kitty_animation_phases(uint32_t triger_time, void *cb_arg) { return anim_frame_duration; } -void oled_driver_render_logo_left(void) { -#if defined(OLED_DISPLAY_VERBOSE) - oled_set_cursor(0, 1); - render_kitty(); - -# if defined(KEYBOARD_handwired_tractyl_manuform) - oled_set_cursor(7, 0); - oled_write_P(PSTR("Tractyl"), true); -# elif defined(KEYBOARD_bastardkb_charybdis) - oled_set_cursor(6, 0); - oled_write_P(PSTR("Charybdis"), true); -# elif defined(KEYBOARD_splitkb_kyria) - oled_set_cursor(7, 0); - oled_write_P(PSTR("SplitKB"), true); -# else - oled_set_cursor(8, 0); - oled_write_P(PSTR("Left"), true); -# endif - oled_set_cursor(7, 1); -# if defined(WPM_ENABLE) - render_wpm(1); -# elif defined(DEBUG_MATRIX_SCAN_RATE) - render_matrix_scan_rate(2); -# endif - oled_set_cursor(7, 2); -# if (defined(KEYBOARD_bastardkb_charybdis) || defined(KEYBOARD_handwired_tractyl_manuform)) && defined(POINTING_DEVICE_ENABLE) - render_pointing_dpi_status(charybdis_get_pointer_sniping_enabled() ? charybdis_get_pointer_sniping_dpi() : charybdis_get_pointer_default_dpi(), 1); - +void render_mouse_mode(uint8_t col, uint8_t line) { +#if (defined(KEYBOARD_bastardkb_charybdis) || defined(KEYBOARD_handwired_tractyl_manuform)) && defined(POINTING_DEVICE_ENABLE) // credit and thanks to jaspertandy on discord for these images static const char PROGMEM mouse_logo[3][2][16] = {// mouse icon {{0, 0, 0, 252, 2, 2, 2, 58, 2, 2, 2, 252, 0, 0, 0, 0}, {0, 0, 63, 96, 64, 64, 64, 64, 64, 64, 64, 96, 63, 0, 0, 0}}, @@ -785,27 +811,20 @@ void oled_driver_render_logo_left(void) { {{0, 0, 112, 136, 156, 2, 15, 1, 15, 2, 140, 68, 56, 0, 0, 0}, {0, 0, 2, 6, 15, 28, 60, 124, 60, 28, 15, 6, 2, 0, 0, 0}}}; uint8_t image_index = 0; -# ifdef OLED_DISPLAY_TEST +# ifdef OLED_DISPLAY_TEST image_index = animation_frame; -# else +# else if (charybdis_get_pointer_sniping_enabled()) { image_index = 1; } else if (charybdis_get_pointer_dragscroll_enabled()) { image_index = 2; } -# endif +# endif - oled_set_cursor(17, 1); + oled_set_cursor(col, line); oled_write_raw_P(mouse_logo[image_index][0], 16); - oled_set_cursor(17, 2); + oled_set_cursor(col, line + 1); oled_write_raw_P(mouse_logo[image_index][1], 16); -# elif defined(WPM_ENABLE) && defined(DEBUG_MATRIX_SCAN_RATE) - render_matrix_scan_rate(2); -# endif - - oled_set_cursor(0, 5); -#else - render_default_layer_state(); #endif } @@ -823,27 +842,73 @@ void render_status_right(void) { oled_set_cursor(8, 0); oled_write_P(PSTR("Right"), true); #endif - oled_driver_render_logo_right(); +#if defined(OLED_DISPLAY_VERBOSE) + render_default_layer_state(1, 1); +#else + render_default_layer_state(0, 0); +#endif + /* Show Keyboard Layout */ - render_layer_state(); - render_mod_status(get_mods() | get_oneshot_mods()); -#if !defined(OLED_DISPLAY_VERBOSE) && defined(WPM_ENABLE) && !defined(CONVERT_TO_PROTON_C) - render_wpm(2); + render_layer_state(1, 2); + render_mod_status(get_mods() | get_oneshot_mods(), 1, 5); +#if !defined(OLED_DISPLAY_VERBOSE) && defined(WPM_ENABLE) && !defined(STM32F303xC) + render_wpm(2, 7, 1); #endif - render_keylock_status(host_keyboard_led_state()); + render_keylock_status(host_keyboard_led_state(), 1, 6); } void render_status_left(void) { - oled_driver_render_logo_left(); +#if defined(OLED_DISPLAY_VERBOSE) + render_kitty(0, 1); +# if defined(KEYBOARD_handwired_tractyl_manuform) + oled_set_cursor(7, 0); + oled_write_P(PSTR("Tractyl"), true); +# elif defined(KEYBOARD_bastardkb_charybdis) + oled_set_cursor(6, 0); + oled_write_P(PSTR("Charybdis"), true); +# elif defined(KEYBOARD_splitkb_kyria) + oled_set_cursor(7, 0); + oled_write_P(PSTR("SplitKB"), true); +# elif defined(KEYBOARD_handwired_fingerpunch_rockon) + oled_set_cursor(7, 0); + oled_write_P(PSTR("Rock On"), true); +# else + oled_set_cursor(8, 0); + oled_write_P(PSTR("Left"), true); +# endif + +# if defined(WPM_ENABLE) + render_wpm(1, 7, 1); +# elif defined(DEBUG_MATRIX_SCAN_RATE) + render_matrix_scan_rate(1, 7, 1); +# endif +# if (defined(KEYBOARD_bastardkb_charybdis) || defined(KEYBOARD_handwired_tractyl_manuform)) && defined(POINTING_DEVICE_ENABLE) + render_pointing_dpi_status(charybdis_get_pointer_sniping_enabled() ? charybdis_get_pointer_sniping_dpi() : charybdis_get_pointer_default_dpi(), 1, 7, 2); + render_mouse_mode(17, 1); +# elif defined(WPM_ENABLE) && defined(DEBUG_MATRIX_SCAN_RATE) + render_matrix_scan_rate(1, 7, 2); +# endif /* Show Keyboard Layout */ - render_bootmagic_status(); - render_user_status(); + render_bootmagic_status(7, 3); + render_user_status(1, 5); - render_keylogger_status(); + render_keylogger_status(1, 6); +#else + render_default_layer_state(0, 0); + /* Show Keyboard Layout */ + render_bootmagic_status(7, 3); + render_user_status(1, 5); + + render_keylogger_status(1, 6); +#endif } -__attribute__((weak)) void oled_render_large_display(bool side) {} +__attribute__((weak)) void oled_render_large_display(bool side) { + if (!side) { + render_unicode_mode(1, 14); + } +} __attribute__((weak)) oled_rotation_t oled_init_keymap(oled_rotation_t rotation) { return rotation; @@ -866,16 +931,14 @@ __attribute__((weak)) bool oled_task_keymap(void) { } bool oled_task_user(void) { - if (is_keyboard_master()) { #ifndef OLED_DISPLAY_TEST - if (timer_elapsed32(oled_timer) > 60000) { - oled_off(); - return false; - } else + if (!is_oled_enabled) { + oled_off(); + return false; + } else #endif - { - oled_on(); - } + { + oled_on(); } if (!oled_task_keymap()) { @@ -895,14 +958,12 @@ bool oled_task_user(void) { #endif render_status_left(); #if defined(OLED_DISPLAY_128X128) - oled_set_cursor(0, 7); oled_render_large_display(true); #endif #ifndef OLED_DISPLAY_TEST } else { render_status_right(); # if defined(OLED_DISPLAY_128X128) - oled_set_cursor(0, 7); oled_render_large_display(false); # endif } @@ -929,3 +990,9 @@ bool oled_task_user(void) { return false; } + +extern bool oled_initialized; + +__attribute__((weak)) void matrix_scan_oled(void) { + is_oled_enabled = !(timer_elapsed32(oled_timer) > 60000); +} diff --git a/users/drashna/oled/oled_stuff.h b/users/drashna/oled/oled_stuff.h index 4dea4b7be4..df1a6d1805 100644 --- a/users/drashna/oled/oled_stuff.h +++ b/users/drashna/oled/oled_stuff.h @@ -18,132 +18,137 @@ #include "quantum.h" #include "oled_driver.h" +#ifdef DEFFERED_EXEC_ENABLE extern deferred_token kittoken; +#endif void oled_driver_render_logo(void); bool process_record_user_oled(uint16_t keycode, keyrecord_t *record); oled_rotation_t oled_init_keymap(oled_rotation_t rotation); void oled_timer_reset(void); -void render_keylogger_status(void); -void render_default_layer_state(void); -void render_layer_state(void); -void render_keylock_status(led_t led_usb_state); -void render_matrix_scan_rate(uint8_t padding); -void render_mod_status(uint8_t modifiers); -void render_bootmagic_status(void); -void render_user_status(void); +void render_keylogger_status(uint8_t col, uint8_t line); +void render_default_layer_state(uint8_t col, uint8_t line); +void render_layer_state(uint8_t col, uint8_t line); +void render_keylock_status(led_t led_usb_state, uint8_t col, uint8_t line); +void render_matrix_scan_rate(uint8_t padding, uint8_t col, uint8_t line); +void render_mod_status(uint8_t modifiers, uint8_t col, uint8_t line); +void render_bootmagic_status(uint8_t col, uint8_t line); +void render_user_status(uint8_t col, uint8_t line); void oled_driver_render_logo(void); -void render_wpm(uint8_t padding); -void render_pointing_dpi_status(uint16_t cpi, uint8_t padding); +void render_wpm(uint8_t padding, uint8_t col, uint8_t line); +void render_pointing_dpi_status(uint16_t cpi, uint8_t padding, uint8_t col, uint8_t line); void oled_driver_render_logo_left(void); void oled_driver_render_logo_right(void); void oled_render_large_display(bool side); -void render_wpm_graph(uint8_t max_lines_graph, uint8_t vertical_offset); +void render_wpm_graph(uint8_t max_lines_graph, uint8_t vertical_offset); +void render_kitty(uint8_t col, uint8_t line); +void render_unicode_mode(uint8_t col, uint8_t line); +void render_rgb_hsv(uint8_t col, uint8_t line); +void render_mouse_mode(uint8_t col, uint8_t line); +void matrix_scan_oled(void); void oled_pan_section(bool left, uint16_t y_start, uint16_t y_end, uint16_t x_start, uint16_t x_end); - #if defined(OLED_DISPLAY_128X128) || defined(OLED_DISPLAY_128X64) # define OLED_DISPLAY_VERBOSE -# define OLED_RENDER_KEYLOGGER "Keylogger: " +# define OLED_RENDER_KEYLOGGER "Keylogger: " # ifndef OLED_KEYLOGGER_LENGTH -# define OLED_KEYLOGGER_LENGTH 9 +# define OLED_KEYLOGGER_LENGTH 9 # endif -# define OLED_RENDER_LAYOUT_NAME "Layout: " -# define OLED_RENDER_LAYOUT_QWERTY "Qwerty" +# define OLED_RENDER_LAYOUT_NAME "Layout: " +# define OLED_RENDER_LAYOUT_QWERTY "Qwerty" # define OLED_RENDER_LAYOUT_COLEMAK_DH "Colemak DH" -# define OLED_RENDER_LAYOUT_COLEMAK "Colemak" -# define OLED_RENDER_LAYOUT_DVORAK "Dvorak" -# define OLED_RENDER_LAYOUT_WORKMAN "Workman" -# define OLED_RENDER_LAYOUT_NORMAN "Norman" -# define OLED_RENDER_LAYOUT_MALTRON "Matron" -# define OLED_RENDER_LAYOUT_EUCALYN "Eucalyn" -# define OLED_RENDER_LAYOUT_CARPLAX "Carplax" - -# define OLED_RENDER_LAYER_NAME "Layer:" -# define OLED_RENDER_LAYER_LOWER "Lower" -# define OLED_RENDER_LAYER_RAISE "Raise" -# define OLED_RENDER_LAYER_ADJUST "Adjust" -# define OLED_RENDER_LAYER_MODS "Mods" - -# define OLED_RENDER_LOCK_NAME "Lock: " -# define OLED_RENDER_LOCK_NUML "NUM" -# define OLED_RENDER_LOCK_CAPS "CAPS" -# define OLED_RENDER_LOCK_SCLK "SCLK" - -# define OLED_RENDER_MODS_NAME "Mods" -# define OLED_RENDER_MODS_SFT "Sft" -# define OLED_RENDER_MODS_CTL "Ctl" -# define OLED_RENDER_MODS_ALT "Alt" -# define OLED_RENDER_MODS_GUI "GUI" - -# define OLED_RENDER_BOOTMAGIC_NAME "Boot " -# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO" -# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI" -# define OLED_RENDER_BOOTMAGIC_GRV "GRV" +# define OLED_RENDER_LAYOUT_COLEMAK "Colemak" +# define OLED_RENDER_LAYOUT_DVORAK "Dvorak" +# define OLED_RENDER_LAYOUT_WORKMAN "Workman" +# define OLED_RENDER_LAYOUT_NORMAN "Norman" +# define OLED_RENDER_LAYOUT_MALTRON "Matron" +# define OLED_RENDER_LAYOUT_EUCALYN "Eucalyn" +# define OLED_RENDER_LAYOUT_CARPLAX "Carplax" + +# define OLED_RENDER_LAYER_NAME "Layer:" +# define OLED_RENDER_LAYER_LOWER "Lower" +# define OLED_RENDER_LAYER_RAISE "Raise" +# define OLED_RENDER_LAYER_ADJUST "Adjust" +# define OLED_RENDER_LAYER_MODS "Mods" + +# define OLED_RENDER_LOCK_NAME "Lock: " +# define OLED_RENDER_LOCK_NUML "NUM" +# define OLED_RENDER_LOCK_CAPS "CAPS" +# define OLED_RENDER_LOCK_SCLK "SCLK" + +# define OLED_RENDER_MODS_NAME "Mods" +# define OLED_RENDER_MODS_SFT "Sft" +# define OLED_RENDER_MODS_CTL "Ctl" +# define OLED_RENDER_MODS_ALT "Alt" +# define OLED_RENDER_MODS_GUI "GUI" + +# define OLED_RENDER_BOOTMAGIC_NAME "Boot " +# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO" +# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI" +# define OLED_RENDER_BOOTMAGIC_GRV "GRV" # define OLED_RENDER_BOOTMAGIC_ONESHOT "1SHT" -# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP" -# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS" +# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP" +# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS" -# define OLED_RENDER_USER_NAME "USER:" -# define OLED_RENDER_USER_ANIM "Anim" -# define OLED_RENDER_USER_LAYR "Layr" -# define OLED_RENDER_USER_NUKE "Nuke" +# define OLED_RENDER_USER_NAME "USER:" +# define OLED_RENDER_USER_ANIM "Anim" +# define OLED_RENDER_USER_LAYR "Layr" +# define OLED_RENDER_USER_NUKE "Nuke" -# define OLED_RENDER_WPM_COUNTER "WPM: " +# define OLED_RENDER_WPM_COUNTER "WPM: " #else -# define OLED_RENDER_KEYLOGGER "KLogr" +# define OLED_RENDER_KEYLOGGER "KLogr" # ifndef OLED_KEYLOGGER_LENGTH -# define OLED_KEYLOGGER_LENGTH 5 +# define OLED_KEYLOGGER_LENGTH 5 # endif -# define OLED_RENDER_LAYOUT_NAME "Lyout" -# define OLED_RENDER_LAYOUT_QWERTY " QRTY" +# define OLED_RENDER_LAYOUT_NAME "Lyout" +# define OLED_RENDER_LAYOUT_QWERTY " QRTY" # define OLED_RENDER_LAYOUT_COLEMAK_DH " cmDH" -# define OLED_RENDER_LAYOUT_COLEMAK " COLE" -# define OLED_RENDER_LAYOUT_DVORAK " DVRK" -# define OLED_RENDER_LAYOUT_WORKMAN " WKMN" -# define OLED_RENDER_LAYOUT_NORMAN " NORM" -# define OLED_RENDER_LAYOUT_MALTRON " MLTN" -# define OLED_RENDER_LAYOUT_EUCALYN " ECLN" -# define OLED_RENDER_LAYOUT_CARPLAX " CRPX" - -# define OLED_RENDER_LAYER_NAME "LAYER" -# define OLED_RENDER_LAYER_LOWER "Lower" -# define OLED_RENDER_LAYER_RAISE "Raise" -# define OLED_RENDER_LAYER_ADJUST "Adjst" -# define OLED_RENDER_LAYER_MODS " Mods" - -# define OLED_RENDER_LOCK_NAME "Lock:" -# define OLED_RENDER_LOCK_NUML "NumL" -# define OLED_RENDER_LOCK_CAPS "CapL" -# define OLED_RENDER_LOCK_SCLK "ScrL" - -# define OLED_RENDER_MODS_NAME "Mods: " -# define OLED_RENDER_MODS_SFT "Shft" -# define OLED_RENDER_MODS_CTL "Ctrl" -# define OLED_RENDER_MODS_ALT "Alt\n" -# define OLED_RENDER_MODS_GUI "GUI\n" - -# define OLED_RENDER_BOOTMAGIC_NAME "BTMGK" -# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO" -# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI" -# define OLED_RENDER_BOOTMAGIC_GRV "GRV" +# define OLED_RENDER_LAYOUT_COLEMAK " COLE" +# define OLED_RENDER_LAYOUT_DVORAK " DVRK" +# define OLED_RENDER_LAYOUT_WORKMAN " WKMN" +# define OLED_RENDER_LAYOUT_NORMAN " NORM" +# define OLED_RENDER_LAYOUT_MALTRON " MLTN" +# define OLED_RENDER_LAYOUT_EUCALYN " ECLN" +# define OLED_RENDER_LAYOUT_CARPLAX " CRPX" + +# define OLED_RENDER_LAYER_NAME "LAYER" +# define OLED_RENDER_LAYER_LOWER "Lower" +# define OLED_RENDER_LAYER_RAISE "Raise" +# define OLED_RENDER_LAYER_ADJUST "Adjst" +# define OLED_RENDER_LAYER_MODS " Mods" + +# define OLED_RENDER_LOCK_NAME "Lock:" +# define OLED_RENDER_LOCK_NUML "NumL" +# define OLED_RENDER_LOCK_CAPS "CapL" +# define OLED_RENDER_LOCK_SCLK "ScrL" + +# define OLED_RENDER_MODS_NAME "Mods: " +# define OLED_RENDER_MODS_SFT "Shft" +# define OLED_RENDER_MODS_CTL "Ctrl" +# define OLED_RENDER_MODS_ALT "Alt\n" +# define OLED_RENDER_MODS_GUI "GUI\n" + +# define OLED_RENDER_BOOTMAGIC_NAME "BTMGK" +# define OLED_RENDER_BOOTMAGIC_NKRO "NKRO" +# define OLED_RENDER_BOOTMAGIC_NOGUI "nGUI" +# define OLED_RENDER_BOOTMAGIC_GRV "GRV" # define OLED_RENDER_BOOTMAGIC_ONESHOT "1SHT" -# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP" -# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS" +# define OLED_RENDER_BOOTMAGIC_SWAP "SWAP" +# define OLED_RENDER_BOOTMAGIC_CAPS "CAPS" -# define OLED_RENDER_USER_NAME "USER:" -# define OLED_RENDER_USER_ANIM "Anim" -# define OLED_RENDER_USER_LAYR "Layr" -# define OLED_RENDER_USER_NUKE "Nuke" +# define OLED_RENDER_USER_NAME "USER:" +# define OLED_RENDER_USER_ANIM "Anim" +# define OLED_RENDER_USER_LAYR "Layr" +# define OLED_RENDER_USER_NUKE "Nuke" -# define OLED_RENDER_WPM_COUNTER "WPM: " +# define OLED_RENDER_WPM_COUNTER "WPM: " #endif - -extern char keylog_str[OLED_KEYLOGGER_LENGTH]; +extern char keylog_str[OLED_KEYLOGGER_LENGTH]; #ifndef OLED_WPM_GRAPH_MAX_WPM # define OLED_WPM_GRAPH_MAX_WPM 120 diff --git a/users/drashna/oled/sh110x.c b/users/drashna/oled/sh110x.c index aa081ca732..9fed5a9d1a 100644 --- a/users/drashna/oled/sh110x.c +++ b/users/drashna/oled/sh110x.c @@ -52,7 +52,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define PAGE_ADDR 0x22 #define PAM_SETCOLUMN_LSB 0x00 #define PAM_SETCOLUMN_MSB 0x10 -#define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7 +#define PAM_PAGE_ADDR 0xB0 // 0xb0 -- 0xb7 // Hardware Configuration Commands #define DISPLAY_START_LINE 0x40 @@ -109,9 +109,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define I2C_DATA 0x40 #if defined(__AVR__) # define I2C_TRANSMIT_P(data) i2c_transmit_P((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), OLED_I2C_TIMEOUT) -#else // defined(__AVR__) +#else // defined(__AVR__) # define I2C_TRANSMIT_P(data) i2c_transmit((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), OLED_I2C_TIMEOUT) -#endif // defined(__AVR__) +#endif // defined(__AVR__) #define I2C_TRANSMIT(data) i2c_transmit((OLED_DISPLAY_ADDRESS << 1), &data[0], sizeof(data), OLED_I2C_TIMEOUT) #define I2C_WRITE_REG(mode, data, size) i2c_writeReg((OLED_DISPLAY_ADDRESS << 1), mode, data, size, OLED_I2C_TIMEOUT) @@ -122,7 +122,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // parts of the display unusable or don't get cleared correctly // and also allows for drawing & inverting uint8_t oled_buffer[OLED_MATRIX_SIZE]; -uint8_t * oled_cursor; +uint8_t *oled_cursor; OLED_BLOCK_TYPE oled_dirty = 0; bool oled_initialized = false; bool oled_active = false; @@ -131,7 +131,7 @@ bool oled_inverted = false; uint8_t oled_brightness = OLED_BRIGHTNESS; oled_rotation_t oled_rotation = 0; uint8_t oled_rotation_width = 0; -uint8_t oled_scroll_speed = 0; // this holds the speed after being remapped to ssd1306 internal values +uint8_t oled_scroll_speed = 0; // this holds the speed after being remapped to ssd1306 internal values uint8_t oled_scroll_start = 0; uint8_t oled_scroll_end = 7; #if OLED_TIMEOUT > 0 @@ -261,8 +261,12 @@ bool oled_init(oled_rotation_t rotation) { return true; } -__attribute__((weak)) oled_rotation_t oled_init_kb(oled_rotation_t rotation) { return rotation; } -__attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { return rotation; } +__attribute__((weak)) oled_rotation_t oled_init_kb(oled_rotation_t rotation) { + return rotation; +} +__attribute__((weak)) oled_rotation_t oled_init_user(oled_rotation_t rotation) { + return rotation; +} void oled_clear(void) { memset(oled_buffer, 0, sizeof(oled_buffer)); @@ -299,9 +303,9 @@ static void calc_bounds_90(uint8_t update_start, uint8_t *cmd_array) { // Only the Page Addressing Mode is supported uint8_t start_page = bottom_block_top_page - (OLED_BLOCK_SIZE * update_start % OLED_DISPLAY_HEIGHT / 8); uint8_t start_column = OLED_BLOCK_SIZE * update_start / OLED_DISPLAY_HEIGHT * 8; - cmd_array[0] = PAM_PAGE_ADDR | start_page; - cmd_array[1] = PAM_SETCOLUMN_LSB | ((OLED_COLUMN_OFFSET + start_column) & 0x0f); - cmd_array[2] = PAM_SETCOLUMN_MSB | ((OLED_COLUMN_OFFSET + start_column) >> 4 & 0x0f); + cmd_array[0] = PAM_PAGE_ADDR | start_page; + cmd_array[1] = PAM_SETCOLUMN_LSB | ((OLED_COLUMN_OFFSET + start_column) & 0x0f); + cmd_array[2] = PAM_SETCOLUMN_MSB | ((OLED_COLUMN_OFFSET + start_column) >> 4 & 0x0f); } uint8_t crot(uint8_t a, int8_t n) { @@ -339,9 +343,9 @@ void oled_render(void) { // Set column & page position static uint8_t display_start[] = {I2C_CMD, PAM_PAGE_ADDR, PAM_SETCOLUMN_LSB, PAM_SETCOLUMN_MSB}; if (!HAS_FLAGS(oled_rotation, OLED_ROTATION_90)) { - calc_bounds(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start + calc_bounds(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start } else { - calc_bounds_90(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start + calc_bounds_90(update_start, &display_start[1]); // Offset from I2C_CMD byte at the start } // Send column & page position @@ -369,7 +373,7 @@ void oled_render(void) { // For SH1106 or SH1107 the data chunk must be split into separate pieces for each page const uint8_t columns_in_block = (OLED_BLOCK_SIZE + OLED_DISPLAY_HEIGHT - 1) / OLED_DISPLAY_HEIGHT * 8; - const uint8_t num_pages = OLED_BLOCK_SIZE / columns_in_block; + const uint8_t num_pages = OLED_BLOCK_SIZE / columns_in_block; for (uint8_t i = 0; i < num_pages; ++i) { // Send column & page position for all pages except the first one if (i > 0) { @@ -414,7 +418,8 @@ void oled_advance_page(bool clearPageRemainder) { remaining = remaining / OLED_FONT_WIDTH; // Write empty character until next line - while (remaining--) oled_write_char(' ', false); + while (remaining--) + oled_write_char(' ', false); } else { // Next page index out of bounds? if (index + remaining >= OLED_MATRIX_SIZE) { @@ -465,7 +470,7 @@ void oled_write_char(const char data, bool invert) { _Static_assert(sizeof(font) >= ((OLED_FONT_END + 1 - OLED_FONT_START) * OLED_FONT_WIDTH), "OLED_FONT_END references outside array"); // set the reder buffer data - uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index + uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index if (cast_data < OLED_FONT_START || cast_data > OLED_FONT_END) { memset(oled_cursor, 0x00, OLED_FONT_WIDTH); } else { @@ -610,7 +615,7 @@ void oled_write_raw_P(const char *data, uint16_t size) { oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE)); } } -#endif // defined(__AVR__) +#endif // defined(__AVR__) bool oled_on(void) { if (!oled_initialized) { @@ -660,7 +665,9 @@ bool oled_off(void) { return !oled_active; } -bool is_oled_on(void) { return oled_active; } +bool is_oled_on(void) { + return oled_active; +} uint8_t oled_set_brightness(uint8_t level) { if (!oled_initialized) { @@ -678,7 +685,9 @@ uint8_t oled_set_brightness(uint8_t level) { return oled_brightness; } -uint8_t oled_get_brightness(void) { return oled_brightness; } +uint8_t oled_get_brightness(void) { + return oled_brightness; +} // Set the specific 8 lines rows of the screen to scroll. // 0 is the default for start, and 7 for end, which is the entire @@ -758,7 +767,9 @@ bool oled_scroll_off(void) { return !oled_scrolling; } -bool is_oled_scrolling(void) { return oled_scrolling; } +bool is_oled_scrolling(void) { + return oled_scrolling; +} bool oled_invert(bool invert) { if (!oled_initialized) { @@ -842,6 +853,9 @@ void oled_task(void) { #endif } - -__attribute__((weak)) bool oled_task_kb(void) { return oled_task_user(); } -__attribute__((weak)) bool oled_task_user(void) { return true; } +__attribute__((weak)) bool oled_task_kb(void) { + return oled_task_user(); +} +__attribute__((weak)) bool oled_task_user(void) { + return true; +} diff --git a/users/drashna/pointing/pointing.c b/users/drashna/pointing/pointing.c index 551034ff45..c9a7945a84 100644 --- a/users/drashna/pointing/pointing.c +++ b/users/drashna/pointing/pointing.c @@ -22,7 +22,7 @@ __attribute__((weak)) report_mouse_t pointing_device_task_keymap(report_mouse_t } report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { - int8_t x = mouse_report.x, y = mouse_report.y; + mouse_xy_report_t x = mouse_report.x, y = mouse_report.y; mouse_report.x = 0; mouse_report.y = 0; @@ -33,8 +33,8 @@ report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { #endif if (timer_elapsed(mouse_debounce_timer) > TAP_CHECK) { if (enable_acceleration) { - x = (x > 0 ? x * x / 16 + x : -x * x / 16 + x); - y = (y > 0 ? y * y / 16 + y : -y * y / 16 + y); + x = (mouse_xy_report_t)(x > 0 ? x * x / 16 + x : -x * x / 16 + x); + y = (mouse_xy_report_t)(y > 0 ? y * y / 16 + y : -y * y / 16 + y); } mouse_report.x = x; mouse_report.y = y; diff --git a/users/drashna/post_config.h b/users/drashna/post_config.h index 2d5e6438d6..ec9aa49462 100644 --- a/users/drashna/post_config.h +++ b/users/drashna/post_config.h @@ -37,10 +37,6 @@ # define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_REST_MODE #endif -#ifndef QMK_KEYS_PER_SCAN -# define QMK_KEYS_PER_SCAN 8 -#endif - #ifdef MOUSEKEY_ENABLE // mouse movement config # ifdef MK_3_SPEED @@ -117,13 +113,17 @@ # endif #endif // MOUSEKEY_ENABLE -#if !defined(LAYER_STATE_16BIT) && !defined(LAYER_STATE_8BIT) && !defined(LAYER_STATE_32BIT) -# define LAYER_STATE_16BIT -#endif -#ifndef DYNAMIC_KEYMAP_LAYER_COUNT -# define DYNAMIC_KEYMAP_LAYER_COUNT 11 -#endif +#define MOUSE_EXTENDED_REPORT #ifndef TAPPING_TERM # define TAPPING_TERM 175 #endif + +#ifndef SECURE_UNLOCK_SEQUENCE +# define SECURE_UNLOCK_SEQUENCE \ + { \ + {2, 1}, {2, 2}, {2, 3}, { \ + 2, 4 \ + } \ + } +#endif diff --git a/users/drashna/rgb/rgb_matrix_config.h b/users/drashna/rgb/rgb_matrix_config.h new file mode 100644 index 0000000000..33979a198e --- /dev/null +++ b/users/drashna/rgb/rgb_matrix_config.h @@ -0,0 +1,107 @@ +// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#define RGB_MATRIX_KEYPRESSES // reacts to keypresses (will slow down matrix scan by a lot) +// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (not recommened) +#define RGB_MATRIX_FRAMEBUFFER_EFFECTS +// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects +// # define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended + +#undef ENABLE_RGB_MATRIX_ALPHAS_MODS +#undef ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +#undef ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +#undef ENABLE_RGB_MATRIX_BREATHING +#undef ENABLE_RGB_MATRIX_BAND_SAT +#undef ENABLE_RGB_MATRIX_BAND_VAL +#undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +#undef ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +#undef ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +#undef ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +#undef ENABLE_RGB_MATRIX_CYCLE_ALL +#undef ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +#undef ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +#undef ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +#undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN +#undef ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +#undef ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +#undef ENABLE_RGB_MATRIX_CYCLE_SPIRAL +#undef ENABLE_RGB_MATRIX_DUAL_BEACON +#undef ENABLE_RGB_MATRIX_RAINBOW_BEACON +#undef ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +#undef ENABLE_RGB_MATRIX_RAINDROPS +#undef ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +#undef ENABLE_RGB_MATRIX_HUE_BREATHING +#undef ENABLE_RGB_MATRIX_HUE_PENDULUM +#undef ENABLE_RGB_MATRIX_HUE_WAVE +#undef ENABLE_RGB_MATRIX_PIXEL_RAIN +#undef ENABLE_RGB_MATRIX_PIXEL_FLOW +#undef ENABLE_RGB_MATRIX_PIXEL_FRACTAL +// enabled only if RGB_MATRIX_FRAMEBUFFER_EFFECTS is defined +#undef ENABLE_RGB_MATRIX_TYPING_HEATMAP +#undef ENABLE_RGB_MATRIX_DIGITAL_RAIN +// enabled only of RGB_MATRIX_KEYPRESSES or RGB_MATRIX_KEYRELEASES is defined +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +#undef ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +#undef ENABLE_RGB_MATRIX_SPLASH +#undef ENABLE_RGB_MATRIX_MULTISPLASH +#undef ENABLE_RGB_MATRIX_SOLID_SPLASH +#undef ENABLE_RGB_MATRIX_SOLID_MULTISPLASH + +#define ENABLE_RGB_MATRIX_TYPING_HEATMAP +#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN_DUAL +#if !defined(SPLIT_KEYBOARD) && !defined(KEYBOARD_ergodox_ez) && !defined(KEYBOARD_moonlander) +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +#endif +#if defined(__arm__) || defined(__AVR_AT90USB1286__) || defined(KEYBOARD_launchpad) +// RGB Matrix Animation modes. Explicitly enabled +// For full list of effects, see: +// https://docs.qmk.fm/#/feature_rgb_matrix?id=rgb-matrix-effects +# define ENABLE_RGB_MATRIX_GRADIENT_UP_DOWN +# define ENABLE_RGB_MATRIX_GRADIENT_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_BREATHING +# define ENABLE_RGB_MATRIX_BAND_SAT +# define ENABLE_RGB_MATRIX_BAND_VAL +# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_SAT +# define ENABLE_RGB_MATRIX_BAND_PINWHEEL_VAL +# define ENABLE_RGB_MATRIX_BAND_SPIRAL_SAT +# define ENABLE_RGB_MATRIX_BAND_SPIRAL_VAL +# define ENABLE_RGB_MATRIX_CYCLE_ALL +# define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT +# define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN +# define ENABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON +# define ENABLE_RGB_MATRIX_CYCLE_OUT_IN +# define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL +# define ENABLE_RGB_MATRIX_CYCLE_SPIRAL +# define ENABLE_RGB_MATRIX_DUAL_BEACON +# define ENABLE_RGB_MATRIX_RAINBOW_BEACON +# define ENABLE_RGB_MATRIX_RAINBOW_PINWHEELS +# define ENABLE_RGB_MATRIX_RAINDROPS +# define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS +# define ENABLE_RGB_MATRIX_HUE_BREATHING +# define ENABLE_RGB_MATRIX_HUE_PENDULUM +# define ENABLE_RGB_MATRIX_HUE_WAVE +# define ENABLE_RGB_MATRIX_PIXEL_RAIN +# define ENABLE_RGB_MATRIX_PIXEL_FLOW +# define ENABLE_RGB_MATRIX_PIXEL_FRACTAL +# define ENABLE_RGB_MATRIX_DIGITAL_RAIN +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS +# define ENABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS +# define ENABLE_RGB_MATRIX_SPLASH +# define ENABLE_RGB_MATRIX_MULTISPLASH +# define ENABLE_RGB_MATRIX_SOLID_SPLASH +# define ENABLE_RGB_MATRIX_SOLID_MULTISPLASH +#endif // AVR diff --git a/users/drashna/rgb/rgb_matrix_stuff.c b/users/drashna/rgb/rgb_matrix_stuff.c index 36a7502733..2c23c29784 100644 --- a/users/drashna/rgb/rgb_matrix_stuff.c +++ b/users/drashna/rgb/rgb_matrix_stuff.c @@ -15,7 +15,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode } switch (mode) { - case 1: // breathing + case 1: // breathing { uint16_t time = scale16by8(g_rgb_timer, speed / 8); hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v); @@ -27,7 +27,7 @@ void rgb_matrix_layer_helper(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode } break; } - default: // Solid Color + default: // Solid Color { RGB rgb = hsv_to_rgb(hsv); for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { @@ -59,6 +59,8 @@ void keyboard_post_init_rgb_matrix(void) { #endif if (userspace_config.rgb_layer_change) { rgb_matrix_set_flags(LED_FLAG_UNDERGLOW | LED_FLAG_KEYLIGHT | LED_FLAG_INDICATOR); + } else { + rgb_matrix_set_flags(LED_FLAG_ALL); } } @@ -70,7 +72,7 @@ bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record) { } #endif switch (keycode) { - case RGB_IDL: // This allows me to use underglow as layer indication, or as normal + case RGB_IDL: // This allows me to use underglow as layer indication, or as normal #if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) if (record->event.pressed) { userspace_config.rgb_matrix_idle_anim ^= 1; @@ -86,9 +88,13 @@ bool process_record_user_rgb_matrix(uint16_t keycode, keyrecord_t *record) { return true; } -__attribute__((weak)) bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) { return true; } -void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { - if (!rgb_matrix_indicators_advanced_keymap(led_min, led_max)) { return; } +__attribute__((weak)) bool rgb_matrix_indicators_advanced_keymap(uint8_t led_min, uint8_t led_max) { + return true; +} +void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) { + if (!rgb_matrix_indicators_advanced_keymap(led_min, led_max)) { + return; + } #if defined(RGBLIGHT_ENABLE) if (!userspace_config.rgb_layer_change) @@ -96,19 +102,7 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, if (userspace_config.rgb_layer_change) #endif { - switch (get_highest_layer(layer_state | default_layer_state)) { - case _DEFAULT_LAYER_1: - rgb_matrix_layer_helper(DEFAULT_LAYER_1_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); - break; - case _DEFAULT_LAYER_2: - rgb_matrix_layer_helper(DEFAULT_LAYER_2_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); - break; - case _DEFAULT_LAYER_3: - rgb_matrix_layer_helper(DEFAULT_LAYER_3_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); - break; - case _DEFAULT_LAYER_4: - rgb_matrix_layer_helper(DEFAULT_LAYER_4_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); - break; + switch (get_highest_layer(layer_state & ~((layer_state_t)1 << _MOUSE))) { case _GAMEPAD: rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; @@ -124,9 +118,33 @@ void rgb_matrix_indicators_advanced_user(uint8_t led_min, case _ADJUST: rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); break; + default: + if (layer_state_is(_MOUSE)) { + rgb_matrix_layer_helper(HSV_PURPLE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); + } else { + switch (get_highest_layer(default_layer_state)) { + case _DEFAULT_LAYER_1: + rgb_matrix_layer_helper(DEFAULT_LAYER_1_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); + break; + case _DEFAULT_LAYER_2: + rgb_matrix_layer_helper(DEFAULT_LAYER_2_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); + break; + case _DEFAULT_LAYER_3: + rgb_matrix_layer_helper(DEFAULT_LAYER_3_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); + break; + case _DEFAULT_LAYER_4: + rgb_matrix_layer_helper(DEFAULT_LAYER_4_HSV, 0, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max); + break; + } + } + break; } } } -__attribute__((weak)) bool rgb_matrix_indicators_keymap(void) { return true; } -void rgb_matrix_indicators_user(void) { rgb_matrix_indicators_keymap(); } +__attribute__((weak)) bool rgb_matrix_indicators_keymap(void) { + return true; +} +void rgb_matrix_indicators_user(void) { + rgb_matrix_indicators_keymap(); +} diff --git a/users/drashna/rgb/rgb_stuff.c b/users/drashna/rgb/rgb_stuff.c index 7d2cf0c73d..c283e58d26 100644 --- a/users/drashna/rgb/rgb_stuff.c +++ b/users/drashna/rgb/rgb_stuff.c @@ -1,28 +1,30 @@ // Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> // SPDX-License-Identifier: GPL-2.0-or-later -#ifdef RGBLIGHT_ENABLE - -# include "drashna.h" -# include "rgb_stuff.h" -# include "eeprom.h" +#include "drashna.h" +#include "rgb_stuff.h" +#include "eeprom.h" bool has_initialized; -void rgblight_sethsv_default_helper(uint8_t index) { rgblight_sethsv_at(rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val(), index); } +void rgblight_sethsv_default_helper(uint8_t index) { + rgblight_sethsv_at(rgblight_get_hue(), rgblight_get_sat(), rgblight_get_val(), index); +} void rgblight_set_hsv_and_mode(uint8_t hue, uint8_t sat, uint8_t val, uint8_t mode) { rgblight_sethsv_noeeprom(hue, sat, val); // wait_us(175); // Add a slight delay between color and mode to ensure it's processed correctly rgblight_mode_noeeprom(mode); } -bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) { return true; } +bool process_record_user_rgb_light(uint16_t keycode, keyrecord_t *record) { + return true; +} -# if defined(RGBLIGHT_STARTUP_ANIMATION) -static bool is_enabled; -static bool is_rgblight_startup; -static HSV old_hsv; -static uint8_t old_mode; +#if defined(RGBLIGHT_STARTUP_ANIMATION) +static bool is_enabled; +static bool is_rgblight_startup; +static HSV old_hsv; +static uint8_t old_mode; deferred_token rgb_startup_token; uint32_t rgb_startup_animation(uint32_t triger_time, void *cb_arg) { @@ -44,10 +46,10 @@ uint32_t rgb_startup_animation(uint32_t triger_time, void *cb_arg) { } return is_rgblight_startup ? 10 : 0; } -# endif +#endif void keyboard_post_init_rgb_light(void) { -# if defined(RGBLIGHT_STARTUP_ANIMATION) +#if defined(RGBLIGHT_STARTUP_ANIMATION) is_enabled = rgblight_is_enabled(); if (userspace_config.rgb_layer_change) { layer_state_set_rgb_light(layer_state); @@ -56,27 +58,17 @@ void keyboard_post_init_rgb_light(void) { old_mode = rgblight_get_mode(); rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); is_rgblight_startup = true; - rgb_startup_token = defer_exec(300, rgb_startup_animation, NULL); -# endif + rgb_startup_token = defer_exec(300, rgb_startup_animation, NULL); +#endif if (userspace_config.rgb_layer_change) { layer_state_set_rgb_light(layer_state); } - } layer_state_t layer_state_set_rgb_light(layer_state_t state) { -# ifdef RGBLIGHT_ENABLE +#ifdef RGBLIGHT_ENABLE if (userspace_config.rgb_layer_change) { - switch (get_highest_layer(state | default_layer_state)) { - case _MOUSE: // mouse - if (!layer_state_cmp(state, _GAMEPAD) && !layer_state_cmp(state, _DIABLO)) { -# if defined(RGBLIGHT_EFFECT_TWINKLE) - rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_TWINKLE + 5); -# else - rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_BREATHING + 3); -# endif - } - break; + switch (get_highest_layer(state & ~((layer_state_t)1 << _MOUSE))) { case _MEDIA: rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_KNIGHT + 1); break; @@ -84,6 +76,7 @@ layer_state_t layer_state_set_rgb_light(layer_state_t state) { rgblight_set_hsv_and_mode(HSV_ORANGE, RGBLIGHT_MODE_SNAKE + 2); break; case _DIABLO: + case _DIABLOII: rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_BREATHING + 3); break; case _RAISE: @@ -95,23 +88,36 @@ layer_state_t layer_state_set_rgb_light(layer_state_t state) { case _ADJUST: rgblight_set_hsv_and_mode(HSV_RED, RGBLIGHT_MODE_KNIGHT + 2); break; - case _DEFAULT_LAYER_1: - rgblight_set_hsv_and_mode(DEFAULT_LAYER_1_HSV, RGBLIGHT_MODE_STATIC_LIGHT); - break; - case _DEFAULT_LAYER_2: - rgblight_set_hsv_and_mode(DEFAULT_LAYER_2_HSV, RGBLIGHT_MODE_STATIC_LIGHT); - break; - case _DEFAULT_LAYER_3: - rgblight_set_hsv_and_mode(DEFAULT_LAYER_3_HSV, RGBLIGHT_MODE_STATIC_LIGHT); - break; - case _DEFAULT_LAYER_4: - rgblight_set_hsv_and_mode(DEFAULT_LAYER_4_HSV, RGBLIGHT_MODE_STATIC_LIGHT); - break; + default: + if (layer_state_cmp(state, _MOUSE)) { +# if defined(RGBLIGHT_EFFECT_TWINKLE) + rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_TWINKLE + 5); +# else + rgblight_set_hsv_and_mode(HSV_CHARTREUSE, RGBLIGHT_MODE_BREATHING + 3); +# endif + } else { + default_layer_state_set_rgb_light(default_layer_state); + } } +#endif // RGBLIGHT_ENABLE } -# endif // RGBLIGHT_ENABLE - return state; } -#endif +layer_state_t default_layer_state_set_rgb_light(layer_state_t state) { + switch (get_highest_layer(state)) { + case _DEFAULT_LAYER_1: + rgblight_set_hsv_and_mode(DEFAULT_LAYER_1_HSV, RGBLIGHT_MODE_STATIC_LIGHT); + break; + case _DEFAULT_LAYER_2: + rgblight_set_hsv_and_mode(DEFAULT_LAYER_2_HSV, RGBLIGHT_MODE_STATIC_LIGHT); + break; + case _DEFAULT_LAYER_3: + rgblight_set_hsv_and_mode(DEFAULT_LAYER_3_HSV, RGBLIGHT_MODE_STATIC_LIGHT); + break; + case _DEFAULT_LAYER_4: + rgblight_set_hsv_and_mode(DEFAULT_LAYER_4_HSV, RGBLIGHT_MODE_STATIC_LIGHT); + break; + } + return state; +} diff --git a/users/drashna/rgb/rgblight_config.h b/users/drashna/rgb/rgblight_config.h new file mode 100644 index 0000000000..bb2bc3b3ef --- /dev/null +++ b/users/drashna/rgb/rgblight_config.h @@ -0,0 +1,8 @@ +// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +# define RGBLIGHT_SLEEP +# define RGBLIGHT_EFFECT_TWINKLE_LIFE 250 +# define RGBLIGHT_EFFECT_TWINKLE_PROBABILITY 1 / 24 diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index b96e8a532b..5644aad2c4 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk @@ -3,6 +3,8 @@ SRC += $(USER_PATH)/drashna.c \ $(USER_PATH)/keyrecords/process_records.c \ $(USER_PATH)/keyrecords/tapping.c +# TOP_SYMBOLS = yes + ifneq ($(PLATFORM),CHIBIOS) ifneq ($(strip $(LTO_SUPPORTED)), no) LTO_ENABLE = yes @@ -15,6 +17,7 @@ GRAVE_ESC_ENABLE = no ifneq ($(strip $(NO_SECRETS)), yes) ifneq ("$(wildcard $(USER_PATH)/../../../qmk_secrets/secrets.c)","") SRC += $(USER_PATH)/../../../qmk_secrets/secrets.c + $(shell touch $(USER_PATH)/../../../qmk_secrets/secrets.c) SECURE_ENABLE = yes endif ifeq ($(strip $(NO_SECRETS)), lite) @@ -33,6 +36,10 @@ ifeq ($(strip $(PROTOCOL)), VUSB) NKRO_ENABLE := no endif +ifeq ($(strip $(PER_KEY_TAPPING)), yes) + OPT_DEFS += -DPER_KEY_TAPPING +endif + CUSTOM_UNICODE_ENABLE ?= yes ifeq ($(strip $(CUSTOM_UNICODE_ENABLE)), yes) UNICODE_ENABLE := no @@ -80,6 +87,11 @@ ifdef CONSOLE_ENABLE endif endif +ifeq ($(strip $(I2C_SCANNER_ENABLE)), yes) + OPT_DEFS += -DI2C_SCANNER_ENABLE + CONSOLE_ENABLE := yes +endif + CUSTOM_OLED_DRIVER ?= yes ifeq ($(strip $(OLED_ENABLE)), yes) ifeq ($(strip $(OLED_DRIVER)), custom) @@ -103,7 +115,6 @@ ifeq ($(strip $(POINTING_DEVICE_ENABLE)), yes) ifeq ($(strip $(CUSTOM_POINTING_DEVICE)), yes) SRC += $(USER_PATH)/pointing/pointing.c OPT_DEFS += -DCUSTOM_POINTING_DEVICE - OPT_DEFS += -DMOUSE_EXT_REPORT endif endif @@ -119,5 +130,10 @@ endif AUTOCORRECTION_ENABLE ?= no ifeq ($(strip $(AUTOCORRECTION_ENABLE)), yes) SRC += $(USER_PATH)/keyrecords/autocorrection/autocorrection.c + $(shell touch $(USER_PATH)/keyrecords/autocorrection/autocorrection.c) OPT_DEFS += -DAUTOCORRECTION_ENABLE endif + +ifeq ($(strip $(BOOTMAGIC_ENABLE)), yes) + SRC += bootmagic_better.c +endif diff --git a/users/drashna/split/split_config.h b/users/drashna/split/split_config.h new file mode 100644 index 0000000000..66c12392d9 --- /dev/null +++ b/users/drashna/split/split_config.h @@ -0,0 +1,21 @@ +// Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com> +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +// # define SPLIT_TRANSPORT_MIRROR +#define SPLIT_LAYER_STATE_ENABLE +#define SPLIT_LED_STATE_ENABLE +#define SPLIT_MODS_ENABLE +#ifdef WPM_ENABLE +# define SPLIT_WPM_ENABLE +#endif +#ifdef OLED_ENABLE +# undef SPLIT_OLED_ENABLE +#endif +#if defined(__AVR__) && !defined(SELECT_SOFT_SERIAL_SPEED) +# define SELECT_SOFT_SERIAL_SPEED 1 +#endif +#ifdef CUSTOM_SPLIT_TRANSPORT_SYNC +# define SPLIT_TRANSACTION_IDS_USER RPC_ID_USER_STATE_SYNC, RPC_ID_USER_KEYMAP_SYNC, RPC_ID_USER_CONFIG_SYNC, RPC_ID_USER_WATCHDOG_SYNC, RPC_ID_USER_KEYLOG_STR +#endif diff --git a/users/drashna/split/transport_sync.c b/users/drashna/split/transport_sync.c index 38df8fda3f..6b5c384480 100644 --- a/users/drashna/split/transport_sync.c +++ b/users/drashna/split/transport_sync.c @@ -4,9 +4,6 @@ #include "transport_sync.h" #include "transactions.h" #include <string.h> -#ifdef __AVR__ -# include <avr/wdt.h> -#endif #ifdef UNICODE_COMMON_ENABLE # include "process_unicode_common.h" @@ -18,6 +15,9 @@ extern unicode_config_t unicode_config; extern audio_config_t audio_config; extern bool delayed_tasks_run; #endif +#if defined(OLED_ENABLE) && !defined(SPLIT_OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER) +extern bool is_oled_enabled; +#endif #if defined(POINTING_DEVICE_ENABLE) && defined(KEYBOARD_handwired_tractyl_manuform) extern bool tap_toggling; #endif @@ -55,7 +55,9 @@ void user_config_sync(uint8_t initiator2target_buffer_size, const void* initiato } #if defined(SPLIT_WATCHDOG_TIMEOUT) -void watchdog_handler(uint8_t in_buflen, const void* in_data, uint8_t out_buflen, void* out_data) { watchdog_ping_done = true; } +void watchdog_handler(uint8_t in_buflen, const void* in_data, uint8_t out_buflen, void* out_data) { + watchdog_ping_done = true; +} #endif #ifdef CUSTOM_OLED_DRIVER @@ -93,11 +95,14 @@ void user_transport_update(void) { user_state.audio_enable = is_audio_on(); user_state.audio_clicky_enable = is_clicky_on(); #endif +#if defined(OLED_ENABLE) && !defined(SPLIT_OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER) + user_state.is_oled_enabled = is_oled_enabled; +#endif #if defined(CUSTOM_POINTING_DEVICE) user_state.tap_toggling = tap_toggling; #endif #ifdef UNICODE_COMMON_ENABLE - user_state.unicode_mode = unicode_config.input_mode; + user_state.unicode_mode = unicode_config.input_mode; user_state.unicode_typing_mode = typing_mode; #endif #ifdef SWAP_HANDS_ENABLE @@ -112,7 +117,10 @@ void user_transport_update(void) { user_state.raw = transport_user_state; #ifdef UNICODE_COMMON_ENABLE unicode_config.input_mode = user_state.unicode_mode; - typing_mode = user_state.unicode_typing_mode; + typing_mode = user_state.unicode_typing_mode; +#endif +#if defined(OLED_ENABLE) && !defined(SPLIT_OLED_ENABLE) && defined(CUSTOM_OLED_DRIVER) + is_oled_enabled = user_state.is_oled_enabled; #endif #if defined(CUSTOM_POINTING_DEVICE) tap_toggling = user_state.tap_toggling; @@ -216,7 +224,7 @@ void user_transport_sync(void) { if (timer_elapsed32(watchdog_timer) > 100) { uint8_t any_data = 1; if (transaction_rpc_send(RPC_ID_USER_WATCHDOG_SYNC, sizeof(any_data), &any_data)) { - watchdog_ping_done = true; // successful ping + watchdog_ping_done = true; // successful ping } else { dprint("Watchdog ping failed!\n"); } @@ -224,7 +232,7 @@ void user_transport_sync(void) { } } else { if (timer_elapsed32(watchdog_timer) > 3500) { - software_reset(); + mcu_reset(); while (1) { } } @@ -233,7 +241,7 @@ void user_transport_sync(void) { #endif } -void housekeeping_task_user(void) { +void housekeeping_task_transport_sync(void) { // Update kb_state so we can send to slave user_transport_update(); diff --git a/users/drashna/split/transport_sync.h b/users/drashna/split/transport_sync.h index 77e5140eda..8bfb49bf63 100644 --- a/users/drashna/split/transport_sync.h +++ b/users/drashna/split/transport_sync.h @@ -12,16 +12,18 @@ extern char keylog_str[OLED_KEYLOGGER_LENGTH]; typedef union { uint32_t raw; struct { - bool audio_enable :1; - bool audio_clicky_enable :1; - bool tap_toggling :1; - uint8_t unicode_mode :3; - bool swap_hands :1; - bool host_driver_disabled :1; - uint8_t unicode_typing_mode :3; + bool audio_enable :1; + bool audio_clicky_enable :1; + bool tap_toggling :1; + uint8_t unicode_mode :3; + bool swap_hands :1; + bool host_driver_disabled :1; + uint8_t unicode_typing_mode :3; + bool is_oled_enabled :1; }; } user_runtime_config_t; extern user_runtime_config_t user_state; void keyboard_post_init_transport_sync(void); +void housekeeping_task_transport_sync(void); diff --git a/users/dshields/dshields.h b/users/dshields/dshields.h index 54268210c9..34544b0260 100644 --- a/users/dshields/dshields.h +++ b/users/dshields/dshields.h @@ -17,6 +17,14 @@ #define MT_SPC SFT_T(KC_SPC) #define MT_BSPC SFT_T(KC_BSPC) #define MT_ESC LGUI_T(KC_ESC) +#define MT_A LGUI_T(KC_A) +#define MT_S LALT_T(KC_S) +#define MT_D LSFT_T(KC_D) +#define MT_F LCTL_T(KC_F) +#define MT_J RCTL_T(KC_J) +#define MT_K RSFT_T(KC_K) +#define MT_L RALT_T(KC_L) +#define MT_SCLN RGUI_T(KC_SCLN) // LED/RGB controls #ifdef KEYBOARD_planck_light diff --git a/users/edvorakjp/edvorakjp.c b/users/edvorakjp/edvorakjp.c index c44d8bb440..c95b03d981 100644 --- a/users/edvorakjp/edvorakjp.c +++ b/users/edvorakjp/edvorakjp.c @@ -12,7 +12,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { return layer_state_set_keymap(state); } -__attribute__((weak)) uint32_t layer_state_set_keymap(uint32_t state) { return state; } +__attribute__((weak)) layer_state_t layer_state_set_keymap(layer_state_t state) { return state; } bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user_result = process_record_keymap(keycode, record) && process_record_edvorakjp_swap_scln(keycode, record) && process_record_edvorakjp_config(keycode, record) && process_record_layer(keycode, record) && process_record_ime(keycode, record); diff --git a/users/edvorakjp/edvorakjp.h b/users/edvorakjp/edvorakjp.h index 93cd9851b7..a878f71ca8 100644 --- a/users/edvorakjp/edvorakjp.h +++ b/users/edvorakjp/edvorakjp.h @@ -68,7 +68,7 @@ enum tap_dance_code { void matrix_init_user(void); void matrix_init_keymap(void); layer_state_t layer_state_set_user(layer_state_t state); -uint32_t layer_state_set_keymap(uint32_t state); +layer_state_t layer_state_set_keymap(layer_state_t state); bool process_record_user(uint16_t keycode, keyrecord_t *record); bool process_record_keymap(uint16_t keycode, keyrecord_t *record); diff --git a/users/edvorakjp/edvorakjp_tap_dance.c b/users/edvorakjp/edvorakjp_tap_dance.c index cee10de693..69fcbac1ca 100644 --- a/users/edvorakjp/edvorakjp_tap_dance.c +++ b/users/edvorakjp/edvorakjp_tap_dance.c @@ -64,6 +64,15 @@ void td_raise_reset(qk_tap_dance_state_t *state, void *user_data) { } qk_tap_dance_action_t tap_dance_actions[] = { - [TD_EDVORAKJP_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_lower_finished, td_lower_reset, 150), - [TD_EDVORAKJP_RAISE] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_raise_finished, td_raise_reset, 150), + [TD_EDVORAKJP_LOWER] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, td_lower_finished, td_lower_reset), + [TD_EDVORAKJP_RAISE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, td_raise_finished, td_raise_reset), }; + +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QK_TAP_DANCE ... QK_TAP_DANCE_MAX: + return 150; + default: + return TAPPING_TERM; + } +} diff --git a/users/ericgebhart/ericgebhart.c b/users/ericgebhart/ericgebhart.c index 2a34110ae2..a071fb8c2e 100755 --- a/users/ericgebhart/ericgebhart.c +++ b/users/ericgebhart/ericgebhart.c @@ -40,7 +40,7 @@ __attribute__ ((weak)) void matrix_scan_keymap(void) {} __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } diff --git a/users/ericgebhart/tap_dances.c b/users/ericgebhart/tap_dances.c index 9f344986aa..8f9503a261 100755 --- a/users/ericgebhart/tap_dances.c +++ b/users/ericgebhart/tap_dances.c @@ -47,7 +47,7 @@ void tap_dance_mouse_btns (qk_tap_dance_state_t *state, void *user_data) { // counting on all the qwerty layers to be less than dvorak_on_bepo int on_qwerty(){ - uint8_t deflayer = (biton32(default_layer_state)); + uint8_t deflayer = (get_highest_layer(default_layer_state)); return (deflayer < _DVORAK_BP); } @@ -58,7 +58,7 @@ static void switch_default_layer(uint8_t layer) { // so the keyboard remembers which layer it's in after power disconnect. /* - uint32_t default_layer_state_set_kb(uint32_t state) { + layer_state_t default_layer_state_set_kb(layer_state_t state) { eeconfig_update_default_layer(state); return state; } diff --git a/users/gourdo1/autocorrect/autocorrection.c b/users/gourdo1/autocorrect/autocorrection.c new file mode 100644 index 0000000000..bc711016d9 --- /dev/null +++ b/users/gourdo1/autocorrect/autocorrection.c @@ -0,0 +1,182 @@ +// 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. +// +// +// For full documentation, see +// https://getreuer.info/posts/keyboards/autocorrection + +#include "autocorrection.h" + +#include <string.h> +#include "autocorrection_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) { + if (user_config.autocorrect) { + 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 // NO_ACTION_ONESHOT + // 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 // NO_ACTION_LAYER + // Ignore when tap-hold keys are held. + if (record->tap.count == 0) { return true; } + // Otherwise when tapped, get the basic keycode. + // Fallthrough intended. + #endif // NO_ACTION_TAPPING + + // 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; + } + return true; +} diff --git a/users/gourdo1/autocorrect/autocorrection.h b/users/gourdo1/autocorrect/autocorrection.h new file mode 100644 index 0000000000..d344a815f7 --- /dev/null +++ b/users/gourdo1/autocorrect/autocorrection.h @@ -0,0 +1,40 @@ +// 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. +// +// +// Autocorrection on your keyboard. +// +// This library implements rudimentary autocorrection, automatically detecting +// and fixing some misspellings. Beware that the autocorrection logic is +// unaware of hotkey or mouse-based cursor movement. +// +// For full documentation, see +// https://getreuer.info/posts/keyboards/autocorrection + +#pragma once + +#include "quantum.h" + +#include "gourdo1.h" + +#ifdef __cplusplus +extern "C" { +#endif + +bool process_autocorrection(uint16_t keycode, keyrecord_t* record); + +#ifdef __cplusplus +} +#endif + diff --git a/users/gourdo1/autocorrect/autocorrection_data.h b/users/gourdo1/autocorrect/autocorrection_data.h new file mode 100644 index 0000000000..66518201e2 --- /dev/null +++ b/users/gourdo1/autocorrect/autocorrection_data.h @@ -0,0 +1,722 @@ +// Generated code. + +// Autocorrection dictionary (400 entries): +// :acheiv -> achiev +// :agian -> again +// :agred -> agreed +// :ajust -> adjust +// :alot: -> a lot +// :andteh -> and the +// :andthe -> and the +// :anual -> annual +// :asign -> assign +// :aslo: -> also +// :asthe -> as the +// :atthe -> at the +// :casue -> cause +// :choses -> chooses +// :eveyr -> every +// :foudn -> found +// :gaurd -> guard +// :goign -> going +// :gonig -> going +// :graet -> great +// :grammer -> grammar +// :guage -> gauge +// :haev -> have +// :hapen -> happen +// :htere -> there +// :htikn -> think +// :htink -> think +// :hwihc -> which +// :hwile -> while +// :idaes -> ideas +// :jstu: -> just +// :jsut: -> just +// :knwo -> know +// :konw -> know +// :kwno -> know +// :moeny -> money +// :ocuntry -> country +// :ocur -> occur +// :olther -> other +// :otehr -> other +// :owudl -> would +// :rference -> reference +// :sicne -> since +// :socre -> score +// :szie -> size +// :the:the: -> the +// :theri -> their +// :thier -> their +// :thsoe -> those +// :tothe -> to the +// :ture -> true +// :turth -> truth +// :uesd: -> used +// :usally -> usually +// :yaers -> years +// :yeasr -> years +// abbout -> about +// aberation -> aberration +// abilties -> abilities +// abilty -> ability +// abotu -> about +// abouta -> about a +// aboutit -> about it +// aboutthe -> about the +// abvove -> above +// accesories -> accessories +// accomodate -> accommodate +// accross -> across +// acommodate -> accommodate +// acomplish -> accomplish +// actualy -> actually +// acurate -> accurate +// acutally -> actually +// addtion -> addition +// adviced -> advised +// againnst -> against +// aganist -> against +// aggreed -> agreed +// agianst -> against +// ahppn -> happen +// aledge -> allege +// alledge -> allege +// allign -> align +// almsot -> almost +// alomst -> almost +// alwasy -> always +// alwyas -> always +// amature -> amateur +// anohter -> another +// anomolous -> anomalous +// anomoly -> anomaly +// anytying -> anything +// aparent -> apparent +// aparrent -> apparent +// apparant -> apparent +// apparrent -> apparent +// aquire -> acquire +// aroud -> around +// arround -> around +// arund -> around +// asthetic -> aesthetic +// auxilary -> auxiliary +// auxillary -> auxiliary +// auxilliary -> auxiliary +// availabe -> available +// availaible -> available +// availalbe -> available +// availble -> available +// availiable -> available +// avalable -> available +// avaliable -> available +// avilable -> available +// baceause -> because +// bandwith -> bandwidth +// bankrupcy -> bankruptcy +// baout -> about +// beacuse -> because +// becasue -> because +// beccause -> because +// becouse -> because +// becuase -> because +// bedore -> before +// beeing -> being +// befoer -> before +// begginer -> beginner +// beleif -> belief +// beleive -> believe +// belive -> believe +// beteen -> between +// beween -> between +// bewteen -> between +// breif -> brief +// burried -> buried +// busness -> business +// bussiness -> business +// cacheing -> caching +// calander -> calendar +// caluclate -> calculate +// caluculate -> calculate +// calulate -> calculate +// catagory -> category +// cauhgt -> caught +// ceratin -> certain +// certian -> certain +// cheif -> chief +// chekc -> check +// childen -> children +// chnage -> change +// choosen -> chosen +// cieling -> ceiling +// circut -> circuit +// claer -> clear +// clasic -> classic +// cmoputer -> computer +// coform -> conform +// cognizent -> cognizant +// collegue -> colleague +// comapny -> company +// comittee -> committee +// comming: -> coming +// commitee -> committee +// competance -> competence +// competant -> competent +// complier -> compiler +// concensus -> consensus +// considerd -> considered +// contian -> contain +// copywrite: -> copyright +// cosnt -> const +// coudl -> could +// dervied -> derived +// desicion -> decision +// didnot -> did not +// diferent -> different +// diferrent -> different +// differnt -> different +// diffrent -> different +// divison -> division +// doulbe -> double +// dyanmic -> dynamic +// effecient -> efficient +// elasped -> elapsed +// eligable -> eligible +// elpased -> elapsed +// embarass -> embarrass +// embeded -> embedded +// encypt -> encrypt +// excecut -> execut +// excercise -> exercise +// failse -> false +// fales -> false +// fasle -> false +// feild -> field +// finaly -> finally +// firend -> friend +// firts -> first +// fitler -> filter +// flase -> false +// follwo -> follow +// foriegn -> foreign +// foward -> forward +// fraciton -> fraction +// freind -> friend +// frequecy -> frequency +// fromthe -> from the +// fucntion -> function +// fufill -> fulfill +// fullfill -> fulfill +// futher -> further +// ganerate -> generate +// garantee -> guarantee +// gaurantee -> guarantee +// generaly -> generally +// govement -> government +// govenment -> government +// goverment -> government +// governmnet -> government +// govorment -> government +// govornment -> government +// greatful -> grateful +// guaratee -> guarantee +// heigher -> higher +// heigth -> height +// heirarchy -> hierarchy +// higest -> highest +// howver -> however +// hydogen -> hydrogen +// hygeine -> hygiene +// hypocracy -> hypocrisy +// hypocrasy -> hypocrisy +// hypocricy -> hypocrisy +// hypocrit: -> hypocrite +// iamge -> image +// importamt -> important +// inclued -> include +// indeces -> indices +// indecies -> indices +// indicies -> indices +// inital -> initial +// insted -> instead +// interator -> iterator +// intput -> input +// intrest -> interest +// invliad -> invalid +// laguage -> language +// largst -> largest +// learnign -> learning +// lenght -> length +// levle -> level +// liasion -> liaison +// libary -> library +// likly -> likely +// lisense -> license +// listner -> listener +// littel -> little +// looses: -> loses +// looup -> lookup +// macthing -> matching +// maintence -> maintenance +// manefist -> manifest +// mesage -> message +// morgage -> mortgage +// mysefl -> myself +// namesapce -> namespace +// namespcae -> namespace +// naturual -> natural +// neccesary -> necessary +// necesary -> necessary +// nulltpr -> nullptr +// occassion -> occasion +// occured -> occurred +// operaotr -> operator +// ouptut -> output +// ouput -> output +// overide -> override +// ovveride -> override +// pallete -> palette +// paralel -> parallel +// parralel -> parallel +// parrallel -> parallel +// particualr -> particular +// paticular -> particular +// peaple -> people +// peice -> piece +// peolpe -> people +// peopel -> people +// perhasp -> perhaps +// perheaps -> perhaps +// perhpas -> perhaps +// perphas -> perhaps +// persue -> pursue +// poeople -> people +// poeple -> people +// poitner -> pointer +// posess -> possess +// postion -> position +// preiod -> period +// primarly -> primarily +// priviledge -> privilege +// privte -> private +// probablly -> probably +// probaly -> probably +// probelm -> problem +// proccess -> process +// proeprty -> property +// prominant -> prominent +// proove -> prove +// propery -> property +// propogate -> propagate +// psuedo -> pseudo +// raelly -> really +// realtion -> relation +// realy -> really +// reasearch -> research +// receiev -> receiv +// recepient -> recipient +// reciept -> receipt +// reciev -> receiv +// recipiant -> recipient +// recrod -> record +// recuring -> recurring +// referece -> reference +// refered -> referred +// regluar -> regular +// relaly -> really +// releated -> related +// relevent -> relevant +// repitition -> repetition +// reponse -> response +// reprot -> report +// resutl -> result +// retrun -> return +// retun -> return +// reuslt -> result +// reutrn -> return +// reveiw -> review +// saftey -> safety +// safty -> safety +// satisifed -> satisfied +// scheduel -> schedule +// seperat -> separat +// sequnce -> sequence +// shoudl -> should +// similiar -> similar +// simmilar -> similar +// singed -> signed +// singel -> single +// slighly -> slightly +// somehwat -> somewhat +// spectogram -> spectrogram +// statment -> statement +// stirng -> string +// stregth -> strength +// strengh -> strength +// strign -> string +// succsess -> success +// sucess -> success +// sugest -> suggest +// sumary -> summary +// supress -> suppress +// surpress -> suppress +// swithc -> switch +// swtich -> switch +// symetric -> symmetric +// teamplate -> template +// tempalte -> template +// theese -> these +// therfore -> therefore +// thign -> thing +// thigsn -> things +// thikn -> think +// thiunk -> think +// thnigs -> things +// thresold -> threshold +// throught -> thought +// tihkn -> think +// tkaes -> takes +// todya -> today +// toghether -> together +// tolerence -> tolerance +// tongiht -> tonight +// tranpose -> transpose +// typcial -> typical +// udpate -> update +// unkown -> unknown +// unqiue -> unique +// ususally -> usually +// verticies -> vertices +// virutal -> virtual +// vitual -> virtual +// whcih -> which +// whereever -> wherever +// wherre -> where +// whihc -> which +// whlch -> which +// widht -> width +// wierd -> weird +// wihch -> which +// woudl -> would +// yeild -> yield + +#define AUTOCORRECTION_MIN_LENGTH 5 // "abotu" +#define AUTOCORRECTION_MAX_LENGTH 10 // "auxilliary" + +static const uint8_t autocorrection_data[5967] PROGMEM = {108, 67, 0, 4, 212, 0, + 6, 236, 0, 7, 100, 1, 8, 15, 3, 9, 169, 8, 10, 204, 8, 11, 68, 9, 12, 246, 9, + 14, 0, 10, 15, 28, 10, 16, 79, 11, 17, 129, 11, 18, 175, 13, 19, 227, 13, 21, + 253, 13, 22, 194, 15, 23, 121, 17, 24, 201, 20, 25, 210, 20, 26, 8, 21, 28, + 34, 21, 0, 71, 89, 0, 8, 99, 0, 10, 130, 0, 18, 142, 0, 22, 152, 0, 23, 163, + 0, 24, 202, 0, 0, 22, 8, 24, 44, 0, 131, 115, 101, 100, 0, 75, 106, 0, 23, + 115, 0, 0, 23, 44, 8, 11, 23, 44, 0, 132, 0, 12, 21, 26, 28, 19, 18, 6, 0, + 133, 114, 105, 103, 104, 116, 0, 17, 12, 16, 16, 18, 6, 0, 132, 105, 110, 103, + 0, 15, 22, 4, 44, 0, 131, 108, 115, 111, 0, 8, 22, 18, 18, 15, 0, 132, 115, + 101, 115, 0, 76, 173, 0, 18, 183, 0, 24, 193, 0, 0, 21, 6, 18, 19, 28, 11, 0, + 128, 101, 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, 219, 0, 28, 228, 0, + 0, 24, 18, 5, 4, 0, 128, 32, 97, 0, 7, 18, 23, 0, 129, 97, 121, 0, 75, 246, 0, + 12, 28, 1, 14, 92, 1, 0, 76, 253, 0, 23, 20, 1, 0, 75, 4, 1, 26, 10, 1, 0, 26, + 0, 129, 99, 104, 0, 11, 44, 0, 132, 119, 104, 105, 99, 104, 0, 12, 26, 22, 0, + 129, 99, 104, 0, 80, 41, 1, 21, 53, 1, 22, 67, 1, 23, 76, 1, 0, 17, 4, 28, 7, + 0, 132, 110, 97, 109, 105, 99, 0, 23, 8, 16, 28, 22, 0, 132, 109, 101, 116, + 114, 105, 99, 0, 4, 15, 6, 0, 129, 115, 105, 99, 0, 8, 11, 23, 22, 4, 0, 134, + 101, 115, 116, 104, 101, 116, 105, 99, 0, 8, 11, 6, 0, 129, 99, 107, 0, 68, + 122, 1, 8, 134, 1, 15, 84, 2, 17, 124, 2, 18, 180, 2, 21, 207, 2, 24, 7, 3, 0, + 12, 15, 25, 17, 12, 0, 131, 97, 108, 105, 100, 0, 70, 168, 1, 7, 178, 1, 8, + 188, 1, 9, 199, 1, 10, 212, 1, 12, 222, 1, 19, 248, 1, 21, 3, 2, 22, 38, 2, + 23, 50, 2, 24, 75, 2, 0, 12, 25, 7, 4, 0, 130, 115, 101, 100, 0, 8, 5, 16, 8, + 0, 129, 100, 101, 100, 0, 21, 10, 10, 4, 0, 132, 114, 101, 101, 100, 0, 12, + 22, 12, 23, 4, 22, 0, 131, 102, 105, 101, 100, 0, 17, 12, 22, 0, 131, 103, + 110, 101, 100, 0, 85, 229, 1, 25, 238, 1, 0, 21, 24, 5, 0, 131, 105, 101, 100, + 0, 21, 8, 7, 0, 131, 105, 118, 101, 100, 0, 22, 4, 15, 8, 0, 131, 112, 115, + 101, 100, 0, 72, 13, 2, 10, 22, 2, 24, 29, 2, 0, 9, 8, 21, 0, 129, 114, 101, + 100, 0, 4, 44, 0, 128, 101, 100, 0, 6, 6, 18, 0, 129, 114, 101, 100, 0, 4, 19, + 15, 8, 0, 132, 97, 112, 115, 101, 100, 0, 68, 57, 2, 22, 68, 2, 0, 8, 15, 8, + 21, 0, 132, 97, 116, 101, 100, 0, 17, 12, 0, 128, 97, 100, 0, 15, 6, 17, 12, + 0, 129, 100, 101, 0, 76, 91, 2, 18, 112, 2, 0, 8, 0, 73, 100, 2, 28, 106, 2, + 0, 131, 105, 101, 108, 100, 0, 131, 105, 101, 108, 100, 0, 22, 8, 21, 11, 23, + 0, 130, 104, 111, 108, 100, 0, 72, 134, 2, 12, 145, 2, 24, 155, 2, 0, 21, 12, + 9, 0, 132, 114, 105, 101, 110, 100, 0, 8, 21, 9, 0, 131, 105, 101, 110, 100, + 0, 82, 162, 2, 21, 172, 2, 0, 21, 21, 4, 0, 132, 111, 117, 110, 100, 0, 4, 0, + 130, 111, 117, 110, 100, 0, 76, 187, 2, 21, 198, 2, 0, 8, 21, 19, 0, 132, 101, + 114, 105, 111, 100, 0, 6, 8, 21, 0, 130, 111, 114, 100, 0, 68, 217, 2, 8, 228, + 2, 24, 253, 2, 0, 26, 18, 9, 0, 131, 114, 119, 97, 114, 100, 0, 71, 235, 2, + 12, 245, 2, 0, 12, 22, 17, 18, 6, 0, 128, 101, 100, 0, 26, 0, 131, 101, 105, + 114, 100, 0, 4, 10, 44, 0, 131, 117, 97, 114, 100, 0, 18, 21, 4, 0, 128, 110, + 100, 0, 68, 67, 3, 5, 80, 3, 6, 123, 3, 7, 251, 3, 8, 23, 4, 10, 107, 4, 11, + 227, 4, 12, 52, 5, 15, 61, 5, 17, 0, 6, 18, 27, 6, 19, 37, 6, 21, 47, 6, 22, + 156, 6, 23, 82, 7, 24, 45, 8, 25, 115, 8, 0, 6, 19, 22, 8, 16, 4, 17, 0, 130, + 97, 99, 101, 0, 68, 87, 3, 15, 97, 3, 0, 15, 12, 4, 25, 4, 0, 128, 108, 101, + 0, 68, 104, 3, 24, 115, 3, 0, 15, 12, 4, 25, 4, 0, 130, 98, 108, 101, 0, 18, + 7, 0, 130, 98, 108, 101, 0, 72, 136, 3, 12, 147, 3, 17, 156, 3, 19, 238, 3, 0, + 21, 8, 9, 8, 21, 0, 129, 110, 99, 101, 0, 8, 19, 0, 131, 105, 101, 99, 101, 0, + 68, 166, 3, 8, 179, 3, 24, 228, 3, 0, 23, 8, 19, 16, 18, 6, 0, 131, 101, 110, + 99, 101, 0, 85, 186, 3, 23, 217, 3, 0, 8, 0, 73, 195, 3, 15, 208, 3, 0, 21, + 44, 0, 134, 101, 102, 101, 114, 101, 110, 99, 101, 0, 18, 23, 0, 131, 97, 110, + 99, 101, 0, 17, 12, 4, 16, 0, 129, 97, 110, 99, 101, 0, 20, 8, 22, 0, 130, + 101, 110, 99, 101, 0, 4, 22, 8, 16, 4, 17, 0, 131, 112, 97, 99, 101, 0, 12, + 21, 8, 25, 0, 82, 7, 4, 25, 13, 4, 0, 130, 114, 105, 100, 101, 0, 18, 0, 133, + 101, 114, 114, 105, 100, 101, 0, 23, 0, 68, 38, 4, 12, 49, 4, 17, 59, 4, 23, + 94, 4, 0, 21, 4, 24, 10, 0, 130, 110, 116, 101, 101, 0, 16, 16, 18, 6, 0, 129, + 116, 101, 101, 0, 4, 21, 0, 68, 69, 4, 24, 81, 4, 0, 10, 0, 134, 117, 97, 114, + 97, 110, 116, 101, 101, 0, 4, 10, 0, 135, 117, 97, 114, 97, 110, 116, 101, + 101, 0, 12, 16, 18, 6, 0, 132, 109, 105, 116, 116, 101, 101, 0, 68, 117, 4, 7, + 184, 4, 16, 218, 4, 0, 74, 130, 4, 17, 141, 4, 22, 150, 4, 24, 159, 4, 0, 21, + 18, 16, 0, 131, 116, 103, 97, 103, 101, 0, 11, 6, 0, 131, 97, 110, 103, 101, + 0, 8, 16, 0, 130, 115, 97, 103, 101, 0, 10, 0, 108, 168, 4, 4, 174, 4, 0, 131, + 97, 117, 103, 101, 0, 15, 0, 132, 110, 103, 117, 97, 103, 101, 0, 8, 15, 0, + 68, 197, 4, 12, 203, 4, 15, 212, 4, 0, 131, 108, 101, 103, 101, 0, 25, 12, 21, + 19, 0, 130, 103, 101, 0, 4, 0, 130, 103, 101, 0, 4, 12, 0, 131, 109, 97, 103, + 101, 0, 23, 0, 71, 245, 4, 16, 255, 4, 18, 9, 5, 22, 18, 5, 23, 27, 5, 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, + 34, 5, 24, 42, 5, 0, 44, 0, 130, 32, 116, 104, 101, 0, 18, 5, 4, 0, 130, 32, + 116, 104, 101, 0, 29, 22, 44, 0, 130, 105, 122, 101, 0, 69, 77, 5, 12, 190, 5, + 19, 201, 5, 22, 241, 5, 25, 249, 5, 0, 68, 87, 5, 12, 167, 5, 15, 179, 5, 0, + 74, 97, 5, 12, 107, 5, 15, 137, 5, 0, 12, 15, 8, 0, 131, 105, 98, 108, 101, 0, + 15, 0, 68, 116, 5, 12, 127, 5, 0, 25, 4, 0, 133, 105, 108, 97, 98, 108, 101, + 0, 4, 25, 4, 0, 132, 97, 98, 108, 101, 0, 68, 144, 5, 12, 155, 5, 0, 25, 4, 0, + 132, 105, 108, 97, 98, 108, 101, 0, 25, 4, 0, 133, 97, 105, 108, 97, 98, 108, + 101, 0, 4, 15, 12, 4, 25, 4, 0, 131, 98, 108, 101, 0, 12, 4, 25, 4, 0, 130, + 97, 98, 108, 101, 0, 26, 11, 44, 0, 132, 119, 104, 105, 108, 101, 0, 68, 211, + 5, 8, 220, 5, 18, 230, 5, 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, 4, 9, 0, 130, 108, 115, 101, 0, 8, 15, 0, 129, 101, 108, 0, 70, 7, 6, 12, + 16, 6, 0, 12, 22, 44, 0, 130, 110, 99, 101, 0, 8, 10, 28, 11, 0, 131, 105, + 101, 110, 101, 0, 22, 11, 23, 44, 0, 130, 111, 115, 101, 0, 15, 18, 8, 19, 0, + 130, 112, 108, 101, 0, 70, 66, 6, 8, 76, 6, 12, 87, 6, 18, 99, 6, 21, 127, 6, + 24, 134, 6, 0, 18, 22, 44, 0, 131, 99, 111, 114, 101, 0, 23, 11, 44, 0, 132, + 116, 104, 101, 114, 101, 0, 24, 20, 4, 0, 132, 99, 113, 117, 105, 114, 101, 0, + 71, 106, 6, 9, 115, 6, 0, 8, 5, 0, 131, 102, 111, 114, 101, 0, 21, 8, 11, 23, + 0, 131, 101, 102, 111, 114, 101, 0, 8, 11, 26, 0, 129, 101, 0, 23, 0, 108, + 143, 6, 4, 148, 6, 0, 130, 114, 117, 101, 0, 16, 4, 0, 130, 101, 117, 114, 0, + 68, 178, 6, 8, 203, 6, 12, 211, 6, 15, 226, 6, 17, 235, 6, 18, 9, 7, 24, 22, + 7, 0, 79, 185, 6, 24, 193, 6, 0, 9, 0, 131, 97, 108, 115, 101, 0, 6, 8, 5, 0, + 131, 97, 117, 115, 101, 0, 8, 11, 23, 0, 130, 115, 101, 0, 6, 21, 8, 6, 27, 8, + 0, 134, 101, 114, 99, 105, 115, 101, 0, 12, 4, 9, 0, 131, 108, 115, 101, 0, + 72, 242, 6, 18, 253, 6, 0, 22, 12, 15, 0, 132, 99, 101, 110, 115, 101, 0, 19, + 8, 21, 0, 132, 115, 112, 111, 110, 115, 101, 0, 19, 17, 4, 21, 23, 0, 131, + 115, 112, 111, 115, 101, 0, 68, 32, 7, 6, 61, 7, 18, 72, 7, 0, 70, 39, 7, 8, + 49, 7, 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, 68, 95, 7, 8, 13, 8, 15, 24, 8, 25, 36, 8, 0, 71, 111, + 7, 10, 148, 7, 15, 161, 7, 19, 228, 7, 21, 238, 7, 0, 18, 16, 0, 80, 121, 7, + 18, 136, 7, 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, 18, 19, 18, 21, 19, 0, 132, + 97, 103, 97, 116, 101, 0, 70, 171, 7, 19, 184, 7, 24, 197, 7, 0, 24, 15, 4, 6, + 0, 133, 99, 117, 108, 97, 116, 101, 0, 16, 4, 8, 23, 0, 134, 109, 112, 108, + 97, 116, 101, 0, 70, 204, 7, 15, 217, 7, 0, 24, 15, 4, 6, 0, 134, 99, 117, + 108, 97, 116, 101, 0, 4, 6, 0, 132, 99, 117, 108, 97, 116, 101, 0, 7, 24, 0, + 132, 112, 100, 97, 116, 101, 0, 72, 245, 7, 24, 2, 8, 0, 17, 4, 10, 0, 134, + 101, 110, 101, 114, 97, 116, 101, 0, 6, 4, 0, 132, 99, 117, 114, 97, 116, 101, + 0, 15, 15, 4, 19, 0, 131, 101, 116, 116, 101, 0, 4, 19, 16, 8, 23, 0, 131, + 108, 97, 116, 101, 0, 12, 21, 19, 0, 129, 97, 116, 101, 0, 74, 55, 8, 12, 67, + 8, 22, 77, 8, 0, 8, 15, 15, 18, 6, 0, 130, 97, 103, 117, 101, 0, 20, 17, 24, + 0, 131, 105, 113, 117, 101, 0, 68, 84, 8, 21, 105, 8, 0, 6, 0, 108, 93, 8, 8, + 98, 8, 0, 130, 117, 115, 101, 0, 5, 0, 130, 117, 115, 101, 0, 8, 19, 0, 132, + 117, 114, 115, 117, 101, 0, 76, 122, 8, 18, 147, 8, 0, 72, 129, 8, 15, 139, 8, + 0, 15, 8, 5, 0, 131, 105, 101, 118, 101, 0, 8, 5, 0, 129, 101, 118, 101, 0, + 82, 154, 8, 25, 161, 8, 0, 21, 19, 0, 130, 118, 101, 0, 5, 4, 0, 131, 111, + 118, 101, 0, 12, 8, 0, 75, 182, 8, 15, 189, 8, 21, 197, 8, 0, 6, 0, 130, 105, + 101, 102, 0, 8, 5, 0, 130, 105, 101, 102, 0, 5, 0, 130, 105, 101, 102, 0, 76, + 211, 8, 17, 221, 8, 0, 17, 18, 10, 44, 0, 130, 105, 110, 103, 0, 76, 228, 8, + 21, 58, 9, 0, 72, 244, 8, 11, 11, 9, 15, 24, 9, 21, 36, 9, 28, 47, 9, 0, 72, + 251, 8, 11, 2, 9, 0, 5, 0, 131, 105, 110, 103, 0, 6, 4, 6, 0, 131, 105, 110, + 103, 0, 23, 6, 4, 16, 0, 133, 116, 99, 104, 105, 110, 103, 0, 8, 12, 6, 0, + 133, 101, 105, 108, 105, 110, 103, 0, 24, 6, 8, 21, 0, 130, 114, 105, 110, + 103, 0, 23, 28, 17, 4, 0, 131, 104, 105, 110, 103, 0, 12, 23, 22, 0, 131, 114, + 105, 110, 103, 0, 70, 87, 9, 8, 142, 9, 10, 154, 9, 12, 164, 9, 22, 173, 9, + 23, 191, 9, 0, 75, 100, 9, 12, 109, 9, 15, 119, 9, 21, 127, 9, 0, 12, 26, 0, + 131, 104, 105, 99, 104, 0, 23, 26, 22, 0, 131, 105, 116, 99, 104, 0, 11, 26, + 0, 130, 105, 99, 104, 0, 4, 8, 22, 4, 8, 21, 0, 134, 115, 101, 97, 114, 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, 12, 15, 19, 16, 18, 6, + 4, 0, 134, 99, 111, 109, 112, 108, 105, 115, 104, 0, 74, 201, 9, 12, 225, 9, + 21, 236, 9, 0, 72, 208, 9, 12, 218, 9, 0, 21, 23, 22, 0, 130, 110, 103, 116, + 104, 0, 8, 11, 0, 129, 104, 116, 0, 26, 7, 17, 4, 5, 0, 129, 100, 116, 104, 0, + 24, 23, 44, 0, 131, 114, 117, 116, 104, 0, 21, 8, 11, 23, 44, 0, 129, 105, + 114, 0, 17, 0, 76, 9, 10, 24, 20, 10, 0, 23, 11, 44, 0, 132, 116, 104, 105, + 110, 107, 0, 12, 11, 23, 0, 130, 110, 107, 0, 68, 50, 10, 7, 134, 10, 8, 177, + 10, 9, 17, 11, 15, 26, 11, 23, 55, 11, 24, 64, 11, 0, 76, 60, 10, 23, 71, 10, + 24, 96, 10, 0, 6, 19, 28, 23, 0, 131, 105, 99, 97, 108, 0, 76, 78, 10, 24, 86, + 10, 0, 17, 12, 0, 129, 105, 97, 108, 0, 21, 12, 25, 0, 131, 116, 117, 97, 108, + 0, 81, 106, 10, 21, 115, 10, 23, 124, 10, 0, 4, 44, 0, 130, 110, 117, 97, 108, + 0, 24, 23, 4, 17, 0, 130, 97, 108, 0, 12, 25, 0, 131, 114, 116, 117, 97, 108, + 0, 24, 0, 82, 143, 10, 26, 167, 10, 0, 70, 153, 10, 11, 157, 10, 26, 163, 10, + 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, 193, 10, 15, 201, 10, 19, 247, 10, 23, + 255, 10, 24, 7, 11, 0, 17, 12, 22, 0, 129, 108, 101, 0, 68, 208, 10, 15, 234, + 10, 0, 21, 0, 68, 217, 10, 21, 224, 10, 0, 19, 0, 129, 108, 101, 108, 0, 4, + 19, 0, 132, 97, 108, 108, 101, 108, 0, 4, 21, 21, 4, 19, 0, 133, 97, 108, 108, + 101, 108, 0, 18, 8, 19, 0, 129, 108, 101, 0, 23, 12, 15, 0, 129, 108, 101, 0, + 7, 8, 11, 6, 22, 0, 129, 108, 101, 0, 8, 22, 28, 16, 0, 129, 108, 102, 0, 12, + 9, 0, 79, 36, 11, 24, 46, 11, 0, 15, 24, 9, 0, 132, 102, 105, 108, 108, 0, 9, + 0, 131, 108, 102, 105, 108, 108, 0, 24, 22, 8, 21, 0, 129, 108, 116, 0, 9, 23, + 4, 8, 21, 10, 0, 133, 97, 116, 101, 102, 117, 108, 0, 68, 89, 11, 15, 106, 11, + 21, 117, 11, 0, 21, 10, 18, 23, 6, 8, 19, 22, 0, 132, 114, 111, 103, 114, 97, + 109, 0, 8, 5, 18, 21, 19, 0, 130, 108, 101, 109, 0, 18, 9, 18, 6, 0, 131, 110, + 102, 111, 114, 109, 0, 68, 166, 11, 7, 206, 11, 8, 215, 11, 10, 58, 12, 12, + 141, 12, 14, 153, 12, 18, 192, 12, 19, 108, 13, 21, 120, 13, 22, 131, 13, 24, + 141, 13, 26, 164, 13, 0, 12, 0, 74, 175, 11, 23, 183, 11, 0, 4, 44, 0, 130, + 97, 105, 110, 0, 81, 190, 11, 21, 198, 11, 0, 18, 6, 0, 130, 97, 105, 110, 0, + 8, 6, 0, 130, 97, 105, 110, 0, 24, 18, 9, 44, 0, 129, 110, 100, 0, 71, 231, + 11, 8, 241, 11, 10, 27, 12, 19, 39, 12, 22, 48, 12, 0, 15, 12, 11, 6, 0, 129, + 114, 101, 110, 0, 87, 248, 11, 26, 17, 12, 0, 72, 255, 11, 26, 7, 12, 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, 18, 7, 28, 11, 0, 131, 114, 111, 103, 101, + 110, 0, 4, 11, 44, 0, 129, 112, 101, 110, 0, 18, 18, 11, 6, 0, 131, 115, 101, + 110, 0, 72, 65, 12, 12, 76, 12, 0, 12, 21, 18, 9, 0, 131, 101, 105, 103, 110, + 0, 75, 95, 12, 15, 101, 12, 17, 109, 12, 18, 118, 12, 21, 125, 12, 22, 132, + 12, 0, 23, 0, 129, 110, 103, 0, 15, 4, 0, 131, 105, 103, 110, 0, 21, 4, 8, 15, + 0, 129, 110, 103, 0, 10, 44, 0, 129, 110, 103, 0, 23, 22, 0, 129, 110, 103, 0, + 4, 44, 0, 130, 115, 105, 103, 110, 0, 23, 4, 21, 8, 6, 0, 131, 116, 97, 105, + 110, 0, 75, 160, 12, 12, 169, 12, 0, 12, 23, 0, 131, 104, 105, 110, 107, 0, + 75, 176, 12, 23, 182, 12, 0, 23, 0, 129, 110, 107, 0, 11, 44, 0, 132, 116, + 104, 105, 110, 107, 0, 76, 202, 12, 22, 86, 13, 23, 96, 13, 0, 70, 212, 12, + 22, 225, 12, 23, 251, 12, 0, 12, 22, 8, 7, 0, 133, 99, 105, 115, 105, 111, + 110, 0, 68, 232, 12, 22, 241, 12, 0, 12, 15, 0, 131, 105, 115, 111, 110, 0, 4, + 6, 6, 18, 0, 131, 105, 111, 110, 0, 68, 14, 13, 7, 27, 13, 12, 37, 13, 15, 52, + 13, 17, 64, 13, 22, 76, 13, 0, 21, 8, 5, 4, 0, 132, 114, 97, 116, 105, 111, + 110, 0, 7, 4, 0, 131, 105, 116, 105, 111, 110, 0, 23, 12, 19, 8, 21, 0, 134, + 101, 116, 105, 116, 105, 111, 110, 0, 4, 8, 21, 0, 133, 108, 97, 116, 105, + 111, 110, 0, 6, 24, 9, 0, 133, 110, 99, 116, 105, 111, 110, 0, 18, 19, 0, 131, + 105, 116, 105, 111, 110, 0, 12, 25, 12, 7, 0, 129, 105, 111, 110, 0, 12, 6, 4, + 21, 9, 0, 131, 116, 105, 111, 110, 0, 19, 11, 4, 0, 132, 104, 97, 112, 112, + 101, 110, 0, 23, 24, 8, 21, 0, 131, 116, 117, 114, 110, 0, 10, 12, 11, 23, 0, + 130, 110, 103, 115, 0, 85, 148, 13, 23, 157, 13, 0, 23, 8, 21, 0, 130, 117, + 114, 110, 0, 8, 21, 0, 128, 114, 110, 0, 18, 14, 17, 24, 0, 130, 110, 111, + 119, 110, 0, 71, 185, 13, 17, 196, 13, 26, 205, 13, 0, 8, 24, 22, 19, 0, 131, + 101, 117, 100, 111, 0, 26, 14, 44, 0, 130, 110, 111, 119, 0, 79, 212, 13, 17, + 220, 13, 0, 15, 18, 9, 0, 129, 111, 119, 0, 14, 44, 0, 129, 111, 119, 0, 86, + 234, 13, 24, 244, 13, 0, 4, 11, 21, 8, 19, 0, 129, 112, 115, 0, 18, 18, 15, 0, + 129, 107, 117, 112, 0, 68, 28, 14, 8, 93, 14, 11, 103, 15, 15, 113, 15, 18, + 127, 15, 19, 144, 15, 22, 155, 15, 23, 164, 15, 24, 176, 15, 28, 185, 15, 0, + 76, 38, 14, 15, 48, 14, 24, 82, 14, 0, 15, 12, 16, 12, 22, 0, 130, 97, 114, 0, + 76, 55, 14, 24, 66, 14, 0, 16, 16, 12, 22, 0, 132, 105, 108, 97, 114, 0, 6, + 12, 23, 4, 19, 0, 134, 114, 116, 105, 99, 117, 108, 97, 114, 0, 15, 10, 8, 21, + 0, 131, 117, 108, 97, 114, 0, 68, 124, 14, 7, 132, 14, 11, 145, 14, 12, 203, + 14, 15, 229, 14, 16, 239, 14, 17, 249, 14, 18, 37, 15, 23, 45, 15, 25, 76, 15, + 0, 15, 6, 0, 130, 101, 97, 114, 0, 17, 4, 15, 4, 6, 0, 132, 101, 110, 100, 97, + 114, 0, 74, 152, 14, 23, 163, 14, 0, 12, 8, 11, 0, 133, 105, 103, 104, 101, + 114, 0, 72, 173, 14, 15, 185, 14, 24, 194, 14, 0, 11, 10, 18, 23, 0, 133, 101, + 116, 104, 101, 114, 0, 18, 44, 0, 132, 116, 104, 101, 114, 0, 9, 0, 131, 114, + 116, 104, 101, 114, 0, 75, 210, 14, 15, 218, 14, 0, 23, 44, 0, 130, 101, 105, + 114, 0, 19, 16, 18, 6, 0, 131, 105, 108, 101, 114, 0, 23, 12, 9, 0, 131, 108, + 116, 101, 114, 0, 16, 4, 21, 10, 44, 0, 129, 97, 114, 0, 76, 0, 15, 23, 12, + 15, 0, 10, 10, 8, 5, 0, 132, 105, 110, 110, 101, 114, 0, 76, 19, 15, 22, 28, + 15, 0, 18, 19, 0, 131, 110, 116, 101, 114, 0, 12, 15, 0, 130, 101, 110, 101, + 114, 0, 9, 8, 5, 0, 129, 114, 101, 0, 75, 52, 15, 24, 62, 15, 0, 18, 17, 4, 0, + 131, 116, 104, 101, 114, 0, 19, 18, 16, 6, 0, 134, 111, 109, 112, 117, 116, + 101, 114, 0, 72, 83, 15, 26, 94, 15, 0, 8, 21, 8, 11, 26, 0, 131, 118, 101, + 114, 0, 18, 11, 0, 130, 101, 118, 101, 114, 0, 8, 23, 18, 44, 0, 130, 104, + 101, 114, 0, 4, 24, 6, 12, 23, 21, 4, 19, 0, 130, 108, 97, 114, 0, 23, 4, 21, + 8, 23, 17, 12, 0, 135, 116, 101, 114, 97, 116, 111, 114, 0, 23, 15, 15, 24, + 17, 0, 130, 112, 116, 114, 0, 4, 8, 28, 44, 0, 129, 114, 115, 0, 18, 4, 21, 8, + 19, 18, 0, 130, 116, 111, 114, 0, 6, 18, 44, 0, 129, 99, 117, 114, 0, 8, 25, + 8, 44, 0, 129, 114, 121, 0, 68, 219, 15, 8, 3, 16, 10, 147, 16, 19, 158, 16, + 21, 170, 16, 22, 181, 16, 23, 77, 17, 24, 85, 17, 0, 75, 229, 15, 19, 240, 15, + 28, 250, 15, 0, 19, 21, 8, 19, 0, 131, 104, 97, 112, 115, 0, 11, 21, 8, 19, 0, + 130, 97, 112, 115, 0, 26, 15, 4, 0, 130, 97, 121, 115, 0, 68, 19, 16, 6, 42, + 16, 12, 53, 16, 15, 129, 16, 22, 136, 16, 0, 71, 26, 16, 14, 34, 16, 0, 12, + 44, 0, 130, 101, 97, 115, 0, 23, 0, 131, 97, 107, 101, 115, 0, 8, 7, 17, 12, + 0, 131, 105, 99, 101, 115, 0, 70, 63, 16, 21, 102, 16, 23, 117, 16, 0, 72, 70, + 16, 12, 80, 16, 0, 7, 17, 12, 0, 132, 105, 99, 101, 115, 0, 71, 87, 16, 23, + 94, 16, 0, 17, 12, 0, 130, 101, 115, 0, 21, 8, 25, 0, 130, 101, 115, 0, 18, + 22, 8, 6, 6, 4, 0, 132, 115, 111, 114, 105, 101, 115, 0, 15, 12, 5, 4, 0, 131, + 105, 116, 105, 101, 115, 0, 4, 9, 0, 129, 115, 101, 0, 18, 11, 6, 44, 0, 130, + 111, 115, 101, 115, 0, 12, 17, 11, 23, 0, 131, 105, 110, 103, 115, 0, 4, 8, + 11, 21, 8, 19, 0, 131, 97, 112, 115, 0, 8, 4, 28, 44, 0, 131, 101, 97, 114, + 115, 0, 68, 191, 16, 8, 203, 16, 18, 66, 17, 0, 21, 4, 5, 16, 8, 0, 130, 114, + 97, 115, 115, 0, 70, 216, 16, 17, 240, 16, 21, 13, 17, 22, 42, 17, 0, 70, 223, + 16, 24, 232, 16, 0, 18, 21, 19, 0, 131, 101, 115, 115, 0, 22, 0, 130, 99, 101, + 115, 115, 0, 76, 247, 16, 22, 3, 17, 0, 22, 22, 24, 5, 0, 133, 105, 110, 101, + 115, 115, 0, 24, 5, 0, 131, 105, 110, 101, 115, 115, 0, 19, 0, 85, 22, 17, 24, + 33, 17, 0, 24, 22, 0, 133, 112, 112, 114, 101, 115, 115, 0, 22, 0, 131, 112, + 114, 101, 115, 115, 0, 70, 49, 17, 18, 58, 17, 0, 6, 24, 22, 0, 131, 101, 115, + 115, 0, 19, 0, 130, 115, 101, 115, 115, 0, 21, 6, 6, 4, 0, 132, 114, 111, 115, + 115, 0, 21, 12, 9, 0, 129, 115, 116, 0, 82, 92, 17, 22, 106, 17, 0, 15, 18, + 16, 18, 17, 4, 0, 132, 97, 108, 111, 117, 115, 0, 17, 8, 6, 17, 18, 6, 0, 133, + 115, 101, 110, 115, 117, 115, 0, 68, 158, 17, 8, 188, 17, 10, 217, 17, 11, + 227, 17, 12, 25, 18, 15, 36, 18, 16, 47, 18, 17, 59, 18, 18, 151, 19, 19, 189, + 19, 22, 217, 19, 24, 107, 20, 0, 85, 165, 17, 26, 176, 17, 0, 8, 19, 8, 22, 0, + 131, 97, 114, 97, 116, 0, 11, 8, 16, 18, 22, 0, 131, 119, 104, 97, 116, 0, 68, + 195, 17, 17, 204, 17, 0, 21, 10, 44, 0, 130, 101, 97, 116, 0, 16, 17, 21, 8, + 25, 18, 10, 0, 130, 101, 110, 116, 0, 11, 24, 4, 6, 0, 130, 103, 104, 116, 0, + 71, 237, 17, 10, 244, 17, 12, 14, 18, 0, 12, 26, 0, 129, 116, 104, 0, 81, 251, + 17, 24, 2, 18, 0, 8, 15, 0, 129, 116, 104, 0, 18, 21, 11, 23, 0, 133, 111, + 117, 103, 104, 116, 0, 10, 17, 18, 23, 0, 131, 105, 103, 104, 116, 0, 23, 24, + 18, 5, 4, 0, 129, 32, 105, 116, 0, 22, 24, 8, 21, 0, 131, 115, 117, 108, 116, + 0, 4, 23, 21, 18, 19, 16, 12, 0, 129, 110, 116, 0, 68, 72, 18, 8, 128, 18, 21, + 132, 19, 22, 143, 19, 0, 76, 85, 18, 17, 96, 18, 21, 107, 18, 23, 117, 18, 0, + 19, 12, 6, 8, 21, 0, 130, 101, 110, 116, 0, 12, 16, 18, 21, 19, 0, 130, 101, + 110, 116, 0, 4, 19, 19, 4, 0, 130, 101, 110, 116, 0, 8, 19, 16, 18, 6, 0, 130, + 101, 110, 116, 0, 76, 144, 18, 16, 177, 18, 21, 21, 19, 25, 111, 19, 29, 121, + 19, 0, 70, 151, 18, 19, 164, 18, 0, 8, 9, 9, 8, 0, 133, 105, 99, 105, 101, + 110, 116, 0, 8, 6, 8, 21, 0, 133, 105, 112, 105, 101, 110, 116, 0, 72, 190, + 18, 17, 202, 18, 21, 235, 18, 23, 10, 19, 0, 25, 18, 10, 0, 131, 114, 110, + 109, 101, 110, 116, 0, 72, 209, 18, 21, 221, 18, 0, 25, 18, 10, 0, 132, 114, + 110, 109, 101, 110, 116, 0, 18, 25, 18, 10, 0, 134, 101, 114, 110, 109, 101, + 110, 116, 0, 72, 242, 18, 18, 253, 18, 0, 25, 18, 10, 0, 131, 110, 109, 101, + 110, 116, 0, 25, 18, 10, 0, 133, 101, 114, 110, 109, 101, 110, 116, 0, 4, 23, + 22, 0, 131, 101, 109, 101, 110, 116, 0, 68, 34, 19, 8, 45, 19, 9, 57, 19, 21, + 68, 19, 0, 19, 4, 0, 132, 112, 97, 114, 101, 110, 116, 0, 9, 12, 7, 0, 132, + 102, 101, 114, 101, 110, 116, 0, 9, 12, 7, 0, 131, 101, 114, 101, 110, 116, 0, + 68, 75, 19, 8, 99, 19, 0, 19, 0, 68, 84, 19, 19, 92, 19, 0, 133, 112, 97, 114, + 101, 110, 116, 0, 4, 0, 131, 101, 110, 116, 0, 9, 12, 7, 0, 133, 102, 101, + 114, 101, 110, 116, 0, 8, 15, 8, 21, 0, 130, 97, 110, 116, 0, 12, 17, 10, 18, + 6, 0, 130, 97, 110, 116, 0, 8, 9, 9, 12, 7, 0, 129, 101, 110, 116, 0, 18, 6, + 0, 130, 110, 115, 116, 0, 81, 161, 19, 21, 171, 19, 22, 180, 19, 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, 72, 196, 19, 28, 207, 19, 0, 12, 6, 8, 21, 0, 131, + 101, 105, 112, 116, 0, 6, 17, 8, 0, 130, 114, 121, 112, 116, 0, 72, 236, 19, + 10, 21, 20, 12, 30, 20, 16, 59, 20, 17, 69, 20, 24, 96, 20, 0, 74, 243, 19, + 21, 10, 20, 0, 76, 250, 19, 24, 2, 20, 0, 11, 0, 130, 104, 101, 115, 116, 0, + 22, 0, 130, 103, 101, 115, 116, 0, 23, 17, 12, 0, 131, 101, 114, 101, 115, + 116, 0, 21, 4, 15, 0, 129, 101, 115, 116, 0, 73, 37, 20, 17, 49, 20, 0, 8, 17, + 4, 16, 0, 132, 105, 102, 101, 115, 116, 0, 4, 10, 4, 0, 131, 105, 110, 115, + 116, 0, 18, 15, 4, 0, 131, 109, 111, 115, 116, 0, 68, 76, 20, 17, 87, 20, 0, + 12, 10, 4, 0, 132, 97, 105, 110, 115, 116, 0, 12, 4, 10, 4, 0, 130, 115, 116, + 0, 13, 4, 44, 0, 131, 100, 106, 117, 115, 116, 0, 70, 120, 20, 18, 144, 20, + 19, 168, 20, 23, 191, 20, 0, 72, 127, 20, 21, 137, 20, 0, 6, 27, 8, 0, 132, + 101, 99, 117, 116, 0, 12, 6, 0, 128, 105, 116, 0, 68, 151, 20, 5, 160, 20, 0, + 5, 0, 132, 97, 98, 111, 117, 116, 0, 5, 4, 0, 131, 111, 117, 116, 0, 87, 175, + 20, 24, 183, 20, 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, 72, 217, 20, 12, 253, 20, 0, 68, 224, 20, 12, 231, 20, 0, 11, 44, + 0, 129, 118, 101, 0, 70, 238, 20, 8, 246, 20, 0, 8, 21, 0, 130, 101, 105, 118, + 0, 6, 8, 21, 0, 129, 118, 0, 8, 11, 6, 4, 44, 0, 130, 105, 101, 118, 0, 76, + 15, 21, 17, 25, 21, 0, 8, 25, 8, 21, 0, 130, 105, 101, 119, 0, 18, 14, 44, 0, + 130, 110, 111, 119, 0, 70, 59, 21, 8, 118, 21, 11, 128, 21, 15, 146, 21, 17, + 87, 22, 21, 114, 22, 22, 12, 23, 23, 39, 23, 0, 68, 72, 21, 8, 84, 21, 12, 95, + 21, 19, 106, 21, 0, 21, 6, 18, 19, 28, 11, 0, 130, 105, 115, 121, 0, 24, 20, + 8, 21, 9, 0, 129, 110, 99, 121, 0, 21, 6, 18, 19, 28, 11, 0, 129, 115, 121, 0, + 24, 21, 14, 17, 4, 5, 0, 129, 116, 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, 68, 165, 21, 11, 232, 21, 14, 242, 21, 15, 250, 21, 18, 66, 22, 21, 76, 22, + 0, 69, 184, 21, 8, 193, 21, 15, 199, 21, 17, 208, 21, 21, 215, 21, 24, 224, + 21, 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, 12, 9, 0, 128, 108, 121, 0, 8, 17, 8, 10, 0, 128, + 108, 121, 0, 23, 6, 4, 0, 128, 108, 121, 0, 10, 12, 15, 22, 0, 129, 116, 108, + 121, 0, 12, 15, 0, 129, 101, 108, 121, 0, 68, 4, 22, 5, 47, 22, 8, 56, 22, 0, + 86, 11, 22, 23, 35, 22, 0, 24, 0, 108, 20, 22, 22, 27, 22, 0, 131, 117, 97, + 108, 108, 121, 0, 24, 0, 132, 97, 108, 108, 121, 0, 24, 6, 4, 0, 133, 116, + 117, 97, 108, 108, 121, 0, 4, 5, 18, 21, 19, 0, 129, 121, 0, 4, 21, 0, 132, + 101, 97, 108, 108, 121, 0, 16, 18, 17, 4, 0, 130, 97, 108, 121, 0, 4, 16, 12, + 21, 19, 0, 129, 105, 108, 121, 0, 72, 94, 22, 19, 103, 22, 0, 18, 16, 44, 0, + 130, 110, 101, 121, 0, 4, 16, 18, 6, 0, 131, 112, 97, 110, 121, 0, 68, 127, + 22, 8, 231, 22, 18, 240, 22, 23, 253, 22, 0, 69, 143, 22, 12, 152, 22, 15, + 165, 22, 16, 193, 22, 22, 202, 22, 0, 12, 15, 0, 130, 114, 97, 114, 121, 0, + 15, 15, 12, 27, 24, 4, 0, 132, 105, 97, 114, 121, 0, 76, 172, 22, 15, 182, 22, + 0, 27, 24, 4, 0, 130, 105, 97, 114, 121, 0, 12, 27, 24, 4, 0, 131, 105, 97, + 114, 121, 0, 24, 22, 0, 130, 109, 97, 114, 121, 0, 8, 6, 0, 70, 212, 22, 8, + 223, 22, 0, 8, 17, 0, 133, 101, 115, 115, 97, 114, 121, 0, 17, 0, 130, 115, + 97, 114, 121, 0, 19, 18, 21, 19, 0, 128, 116, 121, 0, 10, 4, 23, 4, 6, 0, 132, + 101, 103, 111, 114, 121, 0, 17, 24, 6, 18, 44, 0, 134, 99, 111, 117, 110, 116, + 114, 121, 0, 4, 0, 85, 21, 23, 26, 32, 23, 0, 6, 18, 19, 28, 11, 0, 130, 105, + 115, 121, 0, 15, 4, 0, 129, 121, 115, 0, 73, 49, 23, 15, 57, 23, 21, 66, 23, + 0, 4, 22, 0, 129, 101, 116, 121, 0, 12, 5, 4, 0, 129, 105, 116, 121, 0, 19, 8, + 18, 21, 19, 0, 132, 112, 101, 114, 116, 121, 0}; + diff --git a/users/gourdo1/autocorrect/autocorrection_data.h (large) b/users/gourdo1/autocorrect/autocorrection_data.h (large) new file mode 100644 index 0000000000..66518201e2 --- /dev/null +++ b/users/gourdo1/autocorrect/autocorrection_data.h (large) @@ -0,0 +1,722 @@ +// Generated code. + +// Autocorrection dictionary (400 entries): +// :acheiv -> achiev +// :agian -> again +// :agred -> agreed +// :ajust -> adjust +// :alot: -> a lot +// :andteh -> and the +// :andthe -> and the +// :anual -> annual +// :asign -> assign +// :aslo: -> also +// :asthe -> as the +// :atthe -> at the +// :casue -> cause +// :choses -> chooses +// :eveyr -> every +// :foudn -> found +// :gaurd -> guard +// :goign -> going +// :gonig -> going +// :graet -> great +// :grammer -> grammar +// :guage -> gauge +// :haev -> have +// :hapen -> happen +// :htere -> there +// :htikn -> think +// :htink -> think +// :hwihc -> which +// :hwile -> while +// :idaes -> ideas +// :jstu: -> just +// :jsut: -> just +// :knwo -> know +// :konw -> know +// :kwno -> know +// :moeny -> money +// :ocuntry -> country +// :ocur -> occur +// :olther -> other +// :otehr -> other +// :owudl -> would +// :rference -> reference +// :sicne -> since +// :socre -> score +// :szie -> size +// :the:the: -> the +// :theri -> their +// :thier -> their +// :thsoe -> those +// :tothe -> to the +// :ture -> true +// :turth -> truth +// :uesd: -> used +// :usally -> usually +// :yaers -> years +// :yeasr -> years +// abbout -> about +// aberation -> aberration +// abilties -> abilities +// abilty -> ability +// abotu -> about +// abouta -> about a +// aboutit -> about it +// aboutthe -> about the +// abvove -> above +// accesories -> accessories +// accomodate -> accommodate +// accross -> across +// acommodate -> accommodate +// acomplish -> accomplish +// actualy -> actually +// acurate -> accurate +// acutally -> actually +// addtion -> addition +// adviced -> advised +// againnst -> against +// aganist -> against +// aggreed -> agreed +// agianst -> against +// ahppn -> happen +// aledge -> allege +// alledge -> allege +// allign -> align +// almsot -> almost +// alomst -> almost +// alwasy -> always +// alwyas -> always +// amature -> amateur +// anohter -> another +// anomolous -> anomalous +// anomoly -> anomaly +// anytying -> anything +// aparent -> apparent +// aparrent -> apparent +// apparant -> apparent +// apparrent -> apparent +// aquire -> acquire +// aroud -> around +// arround -> around +// arund -> around +// asthetic -> aesthetic +// auxilary -> auxiliary +// auxillary -> auxiliary +// auxilliary -> auxiliary +// availabe -> available +// availaible -> available +// availalbe -> available +// availble -> available +// availiable -> available +// avalable -> available +// avaliable -> available +// avilable -> available +// baceause -> because +// bandwith -> bandwidth +// bankrupcy -> bankruptcy +// baout -> about +// beacuse -> because +// becasue -> because +// beccause -> because +// becouse -> because +// becuase -> because +// bedore -> before +// beeing -> being +// befoer -> before +// begginer -> beginner +// beleif -> belief +// beleive -> believe +// belive -> believe +// beteen -> between +// beween -> between +// bewteen -> between +// breif -> brief +// burried -> buried +// busness -> business +// bussiness -> business +// cacheing -> caching +// calander -> calendar +// caluclate -> calculate +// caluculate -> calculate +// calulate -> calculate +// catagory -> category +// cauhgt -> caught +// ceratin -> certain +// certian -> certain +// cheif -> chief +// chekc -> check +// childen -> children +// chnage -> change +// choosen -> chosen +// cieling -> ceiling +// circut -> circuit +// claer -> clear +// clasic -> classic +// cmoputer -> computer +// coform -> conform +// cognizent -> cognizant +// collegue -> colleague +// comapny -> company +// comittee -> committee +// comming: -> coming +// commitee -> committee +// competance -> competence +// competant -> competent +// complier -> compiler +// concensus -> consensus +// considerd -> considered +// contian -> contain +// copywrite: -> copyright +// cosnt -> const +// coudl -> could +// dervied -> derived +// desicion -> decision +// didnot -> did not +// diferent -> different +// diferrent -> different +// differnt -> different +// diffrent -> different +// divison -> division +// doulbe -> double +// dyanmic -> dynamic +// effecient -> efficient +// elasped -> elapsed +// eligable -> eligible +// elpased -> elapsed +// embarass -> embarrass +// embeded -> embedded +// encypt -> encrypt +// excecut -> execut +// excercise -> exercise +// failse -> false +// fales -> false +// fasle -> false +// feild -> field +// finaly -> finally +// firend -> friend +// firts -> first +// fitler -> filter +// flase -> false +// follwo -> follow +// foriegn -> foreign +// foward -> forward +// fraciton -> fraction +// freind -> friend +// frequecy -> frequency +// fromthe -> from the +// fucntion -> function +// fufill -> fulfill +// fullfill -> fulfill +// futher -> further +// ganerate -> generate +// garantee -> guarantee +// gaurantee -> guarantee +// generaly -> generally +// govement -> government +// govenment -> government +// goverment -> government +// governmnet -> government +// govorment -> government +// govornment -> government +// greatful -> grateful +// guaratee -> guarantee +// heigher -> higher +// heigth -> height +// heirarchy -> hierarchy +// higest -> highest +// howver -> however +// hydogen -> hydrogen +// hygeine -> hygiene +// hypocracy -> hypocrisy +// hypocrasy -> hypocrisy +// hypocricy -> hypocrisy +// hypocrit: -> hypocrite +// iamge -> image +// importamt -> important +// inclued -> include +// indeces -> indices +// indecies -> indices +// indicies -> indices +// inital -> initial +// insted -> instead +// interator -> iterator +// intput -> input +// intrest -> interest +// invliad -> invalid +// laguage -> language +// largst -> largest +// learnign -> learning +// lenght -> length +// levle -> level +// liasion -> liaison +// libary -> library +// likly -> likely +// lisense -> license +// listner -> listener +// littel -> little +// looses: -> loses +// looup -> lookup +// macthing -> matching +// maintence -> maintenance +// manefist -> manifest +// mesage -> message +// morgage -> mortgage +// mysefl -> myself +// namesapce -> namespace +// namespcae -> namespace +// naturual -> natural +// neccesary -> necessary +// necesary -> necessary +// nulltpr -> nullptr +// occassion -> occasion +// occured -> occurred +// operaotr -> operator +// ouptut -> output +// ouput -> output +// overide -> override +// ovveride -> override +// pallete -> palette +// paralel -> parallel +// parralel -> parallel +// parrallel -> parallel +// particualr -> particular +// paticular -> particular +// peaple -> people +// peice -> piece +// peolpe -> people +// peopel -> people +// perhasp -> perhaps +// perheaps -> perhaps +// perhpas -> perhaps +// perphas -> perhaps +// persue -> pursue +// poeople -> people +// poeple -> people +// poitner -> pointer +// posess -> possess +// postion -> position +// preiod -> period +// primarly -> primarily +// priviledge -> privilege +// privte -> private +// probablly -> probably +// probaly -> probably +// probelm -> problem +// proccess -> process +// proeprty -> property +// prominant -> prominent +// proove -> prove +// propery -> property +// propogate -> propagate +// psuedo -> pseudo +// raelly -> really +// realtion -> relation +// realy -> really +// reasearch -> research +// receiev -> receiv +// recepient -> recipient +// reciept -> receipt +// reciev -> receiv +// recipiant -> recipient +// recrod -> record +// recuring -> recurring +// referece -> reference +// refered -> referred +// regluar -> regular +// relaly -> really +// releated -> related +// relevent -> relevant +// repitition -> repetition +// reponse -> response +// reprot -> report +// resutl -> result +// retrun -> return +// retun -> return +// reuslt -> result +// reutrn -> return +// reveiw -> review +// saftey -> safety +// safty -> safety +// satisifed -> satisfied +// scheduel -> schedule +// seperat -> separat +// sequnce -> sequence +// shoudl -> should +// similiar -> similar +// simmilar -> similar +// singed -> signed +// singel -> single +// slighly -> slightly +// somehwat -> somewhat +// spectogram -> spectrogram +// statment -> statement +// stirng -> string +// stregth -> strength +// strengh -> strength +// strign -> string +// succsess -> success +// sucess -> success +// sugest -> suggest +// sumary -> summary +// supress -> suppress +// surpress -> suppress +// swithc -> switch +// swtich -> switch +// symetric -> symmetric +// teamplate -> template +// tempalte -> template +// theese -> these +// therfore -> therefore +// thign -> thing +// thigsn -> things +// thikn -> think +// thiunk -> think +// thnigs -> things +// thresold -> threshold +// throught -> thought +// tihkn -> think +// tkaes -> takes +// todya -> today +// toghether -> together +// tolerence -> tolerance +// tongiht -> tonight +// tranpose -> transpose +// typcial -> typical +// udpate -> update +// unkown -> unknown +// unqiue -> unique +// ususally -> usually +// verticies -> vertices +// virutal -> virtual +// vitual -> virtual +// whcih -> which +// whereever -> wherever +// wherre -> where +// whihc -> which +// whlch -> which +// widht -> width +// wierd -> weird +// wihch -> which +// woudl -> would +// yeild -> yield + +#define AUTOCORRECTION_MIN_LENGTH 5 // "abotu" +#define AUTOCORRECTION_MAX_LENGTH 10 // "auxilliary" + +static const uint8_t autocorrection_data[5967] PROGMEM = {108, 67, 0, 4, 212, 0, + 6, 236, 0, 7, 100, 1, 8, 15, 3, 9, 169, 8, 10, 204, 8, 11, 68, 9, 12, 246, 9, + 14, 0, 10, 15, 28, 10, 16, 79, 11, 17, 129, 11, 18, 175, 13, 19, 227, 13, 21, + 253, 13, 22, 194, 15, 23, 121, 17, 24, 201, 20, 25, 210, 20, 26, 8, 21, 28, + 34, 21, 0, 71, 89, 0, 8, 99, 0, 10, 130, 0, 18, 142, 0, 22, 152, 0, 23, 163, + 0, 24, 202, 0, 0, 22, 8, 24, 44, 0, 131, 115, 101, 100, 0, 75, 106, 0, 23, + 115, 0, 0, 23, 44, 8, 11, 23, 44, 0, 132, 0, 12, 21, 26, 28, 19, 18, 6, 0, + 133, 114, 105, 103, 104, 116, 0, 17, 12, 16, 16, 18, 6, 0, 132, 105, 110, 103, + 0, 15, 22, 4, 44, 0, 131, 108, 115, 111, 0, 8, 22, 18, 18, 15, 0, 132, 115, + 101, 115, 0, 76, 173, 0, 18, 183, 0, 24, 193, 0, 0, 21, 6, 18, 19, 28, 11, 0, + 128, 101, 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, 219, 0, 28, 228, 0, + 0, 24, 18, 5, 4, 0, 128, 32, 97, 0, 7, 18, 23, 0, 129, 97, 121, 0, 75, 246, 0, + 12, 28, 1, 14, 92, 1, 0, 76, 253, 0, 23, 20, 1, 0, 75, 4, 1, 26, 10, 1, 0, 26, + 0, 129, 99, 104, 0, 11, 44, 0, 132, 119, 104, 105, 99, 104, 0, 12, 26, 22, 0, + 129, 99, 104, 0, 80, 41, 1, 21, 53, 1, 22, 67, 1, 23, 76, 1, 0, 17, 4, 28, 7, + 0, 132, 110, 97, 109, 105, 99, 0, 23, 8, 16, 28, 22, 0, 132, 109, 101, 116, + 114, 105, 99, 0, 4, 15, 6, 0, 129, 115, 105, 99, 0, 8, 11, 23, 22, 4, 0, 134, + 101, 115, 116, 104, 101, 116, 105, 99, 0, 8, 11, 6, 0, 129, 99, 107, 0, 68, + 122, 1, 8, 134, 1, 15, 84, 2, 17, 124, 2, 18, 180, 2, 21, 207, 2, 24, 7, 3, 0, + 12, 15, 25, 17, 12, 0, 131, 97, 108, 105, 100, 0, 70, 168, 1, 7, 178, 1, 8, + 188, 1, 9, 199, 1, 10, 212, 1, 12, 222, 1, 19, 248, 1, 21, 3, 2, 22, 38, 2, + 23, 50, 2, 24, 75, 2, 0, 12, 25, 7, 4, 0, 130, 115, 101, 100, 0, 8, 5, 16, 8, + 0, 129, 100, 101, 100, 0, 21, 10, 10, 4, 0, 132, 114, 101, 101, 100, 0, 12, + 22, 12, 23, 4, 22, 0, 131, 102, 105, 101, 100, 0, 17, 12, 22, 0, 131, 103, + 110, 101, 100, 0, 85, 229, 1, 25, 238, 1, 0, 21, 24, 5, 0, 131, 105, 101, 100, + 0, 21, 8, 7, 0, 131, 105, 118, 101, 100, 0, 22, 4, 15, 8, 0, 131, 112, 115, + 101, 100, 0, 72, 13, 2, 10, 22, 2, 24, 29, 2, 0, 9, 8, 21, 0, 129, 114, 101, + 100, 0, 4, 44, 0, 128, 101, 100, 0, 6, 6, 18, 0, 129, 114, 101, 100, 0, 4, 19, + 15, 8, 0, 132, 97, 112, 115, 101, 100, 0, 68, 57, 2, 22, 68, 2, 0, 8, 15, 8, + 21, 0, 132, 97, 116, 101, 100, 0, 17, 12, 0, 128, 97, 100, 0, 15, 6, 17, 12, + 0, 129, 100, 101, 0, 76, 91, 2, 18, 112, 2, 0, 8, 0, 73, 100, 2, 28, 106, 2, + 0, 131, 105, 101, 108, 100, 0, 131, 105, 101, 108, 100, 0, 22, 8, 21, 11, 23, + 0, 130, 104, 111, 108, 100, 0, 72, 134, 2, 12, 145, 2, 24, 155, 2, 0, 21, 12, + 9, 0, 132, 114, 105, 101, 110, 100, 0, 8, 21, 9, 0, 131, 105, 101, 110, 100, + 0, 82, 162, 2, 21, 172, 2, 0, 21, 21, 4, 0, 132, 111, 117, 110, 100, 0, 4, 0, + 130, 111, 117, 110, 100, 0, 76, 187, 2, 21, 198, 2, 0, 8, 21, 19, 0, 132, 101, + 114, 105, 111, 100, 0, 6, 8, 21, 0, 130, 111, 114, 100, 0, 68, 217, 2, 8, 228, + 2, 24, 253, 2, 0, 26, 18, 9, 0, 131, 114, 119, 97, 114, 100, 0, 71, 235, 2, + 12, 245, 2, 0, 12, 22, 17, 18, 6, 0, 128, 101, 100, 0, 26, 0, 131, 101, 105, + 114, 100, 0, 4, 10, 44, 0, 131, 117, 97, 114, 100, 0, 18, 21, 4, 0, 128, 110, + 100, 0, 68, 67, 3, 5, 80, 3, 6, 123, 3, 7, 251, 3, 8, 23, 4, 10, 107, 4, 11, + 227, 4, 12, 52, 5, 15, 61, 5, 17, 0, 6, 18, 27, 6, 19, 37, 6, 21, 47, 6, 22, + 156, 6, 23, 82, 7, 24, 45, 8, 25, 115, 8, 0, 6, 19, 22, 8, 16, 4, 17, 0, 130, + 97, 99, 101, 0, 68, 87, 3, 15, 97, 3, 0, 15, 12, 4, 25, 4, 0, 128, 108, 101, + 0, 68, 104, 3, 24, 115, 3, 0, 15, 12, 4, 25, 4, 0, 130, 98, 108, 101, 0, 18, + 7, 0, 130, 98, 108, 101, 0, 72, 136, 3, 12, 147, 3, 17, 156, 3, 19, 238, 3, 0, + 21, 8, 9, 8, 21, 0, 129, 110, 99, 101, 0, 8, 19, 0, 131, 105, 101, 99, 101, 0, + 68, 166, 3, 8, 179, 3, 24, 228, 3, 0, 23, 8, 19, 16, 18, 6, 0, 131, 101, 110, + 99, 101, 0, 85, 186, 3, 23, 217, 3, 0, 8, 0, 73, 195, 3, 15, 208, 3, 0, 21, + 44, 0, 134, 101, 102, 101, 114, 101, 110, 99, 101, 0, 18, 23, 0, 131, 97, 110, + 99, 101, 0, 17, 12, 4, 16, 0, 129, 97, 110, 99, 101, 0, 20, 8, 22, 0, 130, + 101, 110, 99, 101, 0, 4, 22, 8, 16, 4, 17, 0, 131, 112, 97, 99, 101, 0, 12, + 21, 8, 25, 0, 82, 7, 4, 25, 13, 4, 0, 130, 114, 105, 100, 101, 0, 18, 0, 133, + 101, 114, 114, 105, 100, 101, 0, 23, 0, 68, 38, 4, 12, 49, 4, 17, 59, 4, 23, + 94, 4, 0, 21, 4, 24, 10, 0, 130, 110, 116, 101, 101, 0, 16, 16, 18, 6, 0, 129, + 116, 101, 101, 0, 4, 21, 0, 68, 69, 4, 24, 81, 4, 0, 10, 0, 134, 117, 97, 114, + 97, 110, 116, 101, 101, 0, 4, 10, 0, 135, 117, 97, 114, 97, 110, 116, 101, + 101, 0, 12, 16, 18, 6, 0, 132, 109, 105, 116, 116, 101, 101, 0, 68, 117, 4, 7, + 184, 4, 16, 218, 4, 0, 74, 130, 4, 17, 141, 4, 22, 150, 4, 24, 159, 4, 0, 21, + 18, 16, 0, 131, 116, 103, 97, 103, 101, 0, 11, 6, 0, 131, 97, 110, 103, 101, + 0, 8, 16, 0, 130, 115, 97, 103, 101, 0, 10, 0, 108, 168, 4, 4, 174, 4, 0, 131, + 97, 117, 103, 101, 0, 15, 0, 132, 110, 103, 117, 97, 103, 101, 0, 8, 15, 0, + 68, 197, 4, 12, 203, 4, 15, 212, 4, 0, 131, 108, 101, 103, 101, 0, 25, 12, 21, + 19, 0, 130, 103, 101, 0, 4, 0, 130, 103, 101, 0, 4, 12, 0, 131, 109, 97, 103, + 101, 0, 23, 0, 71, 245, 4, 16, 255, 4, 18, 9, 5, 22, 18, 5, 23, 27, 5, 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, + 34, 5, 24, 42, 5, 0, 44, 0, 130, 32, 116, 104, 101, 0, 18, 5, 4, 0, 130, 32, + 116, 104, 101, 0, 29, 22, 44, 0, 130, 105, 122, 101, 0, 69, 77, 5, 12, 190, 5, + 19, 201, 5, 22, 241, 5, 25, 249, 5, 0, 68, 87, 5, 12, 167, 5, 15, 179, 5, 0, + 74, 97, 5, 12, 107, 5, 15, 137, 5, 0, 12, 15, 8, 0, 131, 105, 98, 108, 101, 0, + 15, 0, 68, 116, 5, 12, 127, 5, 0, 25, 4, 0, 133, 105, 108, 97, 98, 108, 101, + 0, 4, 25, 4, 0, 132, 97, 98, 108, 101, 0, 68, 144, 5, 12, 155, 5, 0, 25, 4, 0, + 132, 105, 108, 97, 98, 108, 101, 0, 25, 4, 0, 133, 97, 105, 108, 97, 98, 108, + 101, 0, 4, 15, 12, 4, 25, 4, 0, 131, 98, 108, 101, 0, 12, 4, 25, 4, 0, 130, + 97, 98, 108, 101, 0, 26, 11, 44, 0, 132, 119, 104, 105, 108, 101, 0, 68, 211, + 5, 8, 220, 5, 18, 230, 5, 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, 4, 9, 0, 130, 108, 115, 101, 0, 8, 15, 0, 129, 101, 108, 0, 70, 7, 6, 12, + 16, 6, 0, 12, 22, 44, 0, 130, 110, 99, 101, 0, 8, 10, 28, 11, 0, 131, 105, + 101, 110, 101, 0, 22, 11, 23, 44, 0, 130, 111, 115, 101, 0, 15, 18, 8, 19, 0, + 130, 112, 108, 101, 0, 70, 66, 6, 8, 76, 6, 12, 87, 6, 18, 99, 6, 21, 127, 6, + 24, 134, 6, 0, 18, 22, 44, 0, 131, 99, 111, 114, 101, 0, 23, 11, 44, 0, 132, + 116, 104, 101, 114, 101, 0, 24, 20, 4, 0, 132, 99, 113, 117, 105, 114, 101, 0, + 71, 106, 6, 9, 115, 6, 0, 8, 5, 0, 131, 102, 111, 114, 101, 0, 21, 8, 11, 23, + 0, 131, 101, 102, 111, 114, 101, 0, 8, 11, 26, 0, 129, 101, 0, 23, 0, 108, + 143, 6, 4, 148, 6, 0, 130, 114, 117, 101, 0, 16, 4, 0, 130, 101, 117, 114, 0, + 68, 178, 6, 8, 203, 6, 12, 211, 6, 15, 226, 6, 17, 235, 6, 18, 9, 7, 24, 22, + 7, 0, 79, 185, 6, 24, 193, 6, 0, 9, 0, 131, 97, 108, 115, 101, 0, 6, 8, 5, 0, + 131, 97, 117, 115, 101, 0, 8, 11, 23, 0, 130, 115, 101, 0, 6, 21, 8, 6, 27, 8, + 0, 134, 101, 114, 99, 105, 115, 101, 0, 12, 4, 9, 0, 131, 108, 115, 101, 0, + 72, 242, 6, 18, 253, 6, 0, 22, 12, 15, 0, 132, 99, 101, 110, 115, 101, 0, 19, + 8, 21, 0, 132, 115, 112, 111, 110, 115, 101, 0, 19, 17, 4, 21, 23, 0, 131, + 115, 112, 111, 115, 101, 0, 68, 32, 7, 6, 61, 7, 18, 72, 7, 0, 70, 39, 7, 8, + 49, 7, 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, 68, 95, 7, 8, 13, 8, 15, 24, 8, 25, 36, 8, 0, 71, 111, + 7, 10, 148, 7, 15, 161, 7, 19, 228, 7, 21, 238, 7, 0, 18, 16, 0, 80, 121, 7, + 18, 136, 7, 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, 18, 19, 18, 21, 19, 0, 132, + 97, 103, 97, 116, 101, 0, 70, 171, 7, 19, 184, 7, 24, 197, 7, 0, 24, 15, 4, 6, + 0, 133, 99, 117, 108, 97, 116, 101, 0, 16, 4, 8, 23, 0, 134, 109, 112, 108, + 97, 116, 101, 0, 70, 204, 7, 15, 217, 7, 0, 24, 15, 4, 6, 0, 134, 99, 117, + 108, 97, 116, 101, 0, 4, 6, 0, 132, 99, 117, 108, 97, 116, 101, 0, 7, 24, 0, + 132, 112, 100, 97, 116, 101, 0, 72, 245, 7, 24, 2, 8, 0, 17, 4, 10, 0, 134, + 101, 110, 101, 114, 97, 116, 101, 0, 6, 4, 0, 132, 99, 117, 114, 97, 116, 101, + 0, 15, 15, 4, 19, 0, 131, 101, 116, 116, 101, 0, 4, 19, 16, 8, 23, 0, 131, + 108, 97, 116, 101, 0, 12, 21, 19, 0, 129, 97, 116, 101, 0, 74, 55, 8, 12, 67, + 8, 22, 77, 8, 0, 8, 15, 15, 18, 6, 0, 130, 97, 103, 117, 101, 0, 20, 17, 24, + 0, 131, 105, 113, 117, 101, 0, 68, 84, 8, 21, 105, 8, 0, 6, 0, 108, 93, 8, 8, + 98, 8, 0, 130, 117, 115, 101, 0, 5, 0, 130, 117, 115, 101, 0, 8, 19, 0, 132, + 117, 114, 115, 117, 101, 0, 76, 122, 8, 18, 147, 8, 0, 72, 129, 8, 15, 139, 8, + 0, 15, 8, 5, 0, 131, 105, 101, 118, 101, 0, 8, 5, 0, 129, 101, 118, 101, 0, + 82, 154, 8, 25, 161, 8, 0, 21, 19, 0, 130, 118, 101, 0, 5, 4, 0, 131, 111, + 118, 101, 0, 12, 8, 0, 75, 182, 8, 15, 189, 8, 21, 197, 8, 0, 6, 0, 130, 105, + 101, 102, 0, 8, 5, 0, 130, 105, 101, 102, 0, 5, 0, 130, 105, 101, 102, 0, 76, + 211, 8, 17, 221, 8, 0, 17, 18, 10, 44, 0, 130, 105, 110, 103, 0, 76, 228, 8, + 21, 58, 9, 0, 72, 244, 8, 11, 11, 9, 15, 24, 9, 21, 36, 9, 28, 47, 9, 0, 72, + 251, 8, 11, 2, 9, 0, 5, 0, 131, 105, 110, 103, 0, 6, 4, 6, 0, 131, 105, 110, + 103, 0, 23, 6, 4, 16, 0, 133, 116, 99, 104, 105, 110, 103, 0, 8, 12, 6, 0, + 133, 101, 105, 108, 105, 110, 103, 0, 24, 6, 8, 21, 0, 130, 114, 105, 110, + 103, 0, 23, 28, 17, 4, 0, 131, 104, 105, 110, 103, 0, 12, 23, 22, 0, 131, 114, + 105, 110, 103, 0, 70, 87, 9, 8, 142, 9, 10, 154, 9, 12, 164, 9, 22, 173, 9, + 23, 191, 9, 0, 75, 100, 9, 12, 109, 9, 15, 119, 9, 21, 127, 9, 0, 12, 26, 0, + 131, 104, 105, 99, 104, 0, 23, 26, 22, 0, 131, 105, 116, 99, 104, 0, 11, 26, + 0, 130, 105, 99, 104, 0, 4, 8, 22, 4, 8, 21, 0, 134, 115, 101, 97, 114, 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, 12, 15, 19, 16, 18, 6, + 4, 0, 134, 99, 111, 109, 112, 108, 105, 115, 104, 0, 74, 201, 9, 12, 225, 9, + 21, 236, 9, 0, 72, 208, 9, 12, 218, 9, 0, 21, 23, 22, 0, 130, 110, 103, 116, + 104, 0, 8, 11, 0, 129, 104, 116, 0, 26, 7, 17, 4, 5, 0, 129, 100, 116, 104, 0, + 24, 23, 44, 0, 131, 114, 117, 116, 104, 0, 21, 8, 11, 23, 44, 0, 129, 105, + 114, 0, 17, 0, 76, 9, 10, 24, 20, 10, 0, 23, 11, 44, 0, 132, 116, 104, 105, + 110, 107, 0, 12, 11, 23, 0, 130, 110, 107, 0, 68, 50, 10, 7, 134, 10, 8, 177, + 10, 9, 17, 11, 15, 26, 11, 23, 55, 11, 24, 64, 11, 0, 76, 60, 10, 23, 71, 10, + 24, 96, 10, 0, 6, 19, 28, 23, 0, 131, 105, 99, 97, 108, 0, 76, 78, 10, 24, 86, + 10, 0, 17, 12, 0, 129, 105, 97, 108, 0, 21, 12, 25, 0, 131, 116, 117, 97, 108, + 0, 81, 106, 10, 21, 115, 10, 23, 124, 10, 0, 4, 44, 0, 130, 110, 117, 97, 108, + 0, 24, 23, 4, 17, 0, 130, 97, 108, 0, 12, 25, 0, 131, 114, 116, 117, 97, 108, + 0, 24, 0, 82, 143, 10, 26, 167, 10, 0, 70, 153, 10, 11, 157, 10, 26, 163, 10, + 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, 193, 10, 15, 201, 10, 19, 247, 10, 23, + 255, 10, 24, 7, 11, 0, 17, 12, 22, 0, 129, 108, 101, 0, 68, 208, 10, 15, 234, + 10, 0, 21, 0, 68, 217, 10, 21, 224, 10, 0, 19, 0, 129, 108, 101, 108, 0, 4, + 19, 0, 132, 97, 108, 108, 101, 108, 0, 4, 21, 21, 4, 19, 0, 133, 97, 108, 108, + 101, 108, 0, 18, 8, 19, 0, 129, 108, 101, 0, 23, 12, 15, 0, 129, 108, 101, 0, + 7, 8, 11, 6, 22, 0, 129, 108, 101, 0, 8, 22, 28, 16, 0, 129, 108, 102, 0, 12, + 9, 0, 79, 36, 11, 24, 46, 11, 0, 15, 24, 9, 0, 132, 102, 105, 108, 108, 0, 9, + 0, 131, 108, 102, 105, 108, 108, 0, 24, 22, 8, 21, 0, 129, 108, 116, 0, 9, 23, + 4, 8, 21, 10, 0, 133, 97, 116, 101, 102, 117, 108, 0, 68, 89, 11, 15, 106, 11, + 21, 117, 11, 0, 21, 10, 18, 23, 6, 8, 19, 22, 0, 132, 114, 111, 103, 114, 97, + 109, 0, 8, 5, 18, 21, 19, 0, 130, 108, 101, 109, 0, 18, 9, 18, 6, 0, 131, 110, + 102, 111, 114, 109, 0, 68, 166, 11, 7, 206, 11, 8, 215, 11, 10, 58, 12, 12, + 141, 12, 14, 153, 12, 18, 192, 12, 19, 108, 13, 21, 120, 13, 22, 131, 13, 24, + 141, 13, 26, 164, 13, 0, 12, 0, 74, 175, 11, 23, 183, 11, 0, 4, 44, 0, 130, + 97, 105, 110, 0, 81, 190, 11, 21, 198, 11, 0, 18, 6, 0, 130, 97, 105, 110, 0, + 8, 6, 0, 130, 97, 105, 110, 0, 24, 18, 9, 44, 0, 129, 110, 100, 0, 71, 231, + 11, 8, 241, 11, 10, 27, 12, 19, 39, 12, 22, 48, 12, 0, 15, 12, 11, 6, 0, 129, + 114, 101, 110, 0, 87, 248, 11, 26, 17, 12, 0, 72, 255, 11, 26, 7, 12, 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, 18, 7, 28, 11, 0, 131, 114, 111, 103, 101, + 110, 0, 4, 11, 44, 0, 129, 112, 101, 110, 0, 18, 18, 11, 6, 0, 131, 115, 101, + 110, 0, 72, 65, 12, 12, 76, 12, 0, 12, 21, 18, 9, 0, 131, 101, 105, 103, 110, + 0, 75, 95, 12, 15, 101, 12, 17, 109, 12, 18, 118, 12, 21, 125, 12, 22, 132, + 12, 0, 23, 0, 129, 110, 103, 0, 15, 4, 0, 131, 105, 103, 110, 0, 21, 4, 8, 15, + 0, 129, 110, 103, 0, 10, 44, 0, 129, 110, 103, 0, 23, 22, 0, 129, 110, 103, 0, + 4, 44, 0, 130, 115, 105, 103, 110, 0, 23, 4, 21, 8, 6, 0, 131, 116, 97, 105, + 110, 0, 75, 160, 12, 12, 169, 12, 0, 12, 23, 0, 131, 104, 105, 110, 107, 0, + 75, 176, 12, 23, 182, 12, 0, 23, 0, 129, 110, 107, 0, 11, 44, 0, 132, 116, + 104, 105, 110, 107, 0, 76, 202, 12, 22, 86, 13, 23, 96, 13, 0, 70, 212, 12, + 22, 225, 12, 23, 251, 12, 0, 12, 22, 8, 7, 0, 133, 99, 105, 115, 105, 111, + 110, 0, 68, 232, 12, 22, 241, 12, 0, 12, 15, 0, 131, 105, 115, 111, 110, 0, 4, + 6, 6, 18, 0, 131, 105, 111, 110, 0, 68, 14, 13, 7, 27, 13, 12, 37, 13, 15, 52, + 13, 17, 64, 13, 22, 76, 13, 0, 21, 8, 5, 4, 0, 132, 114, 97, 116, 105, 111, + 110, 0, 7, 4, 0, 131, 105, 116, 105, 111, 110, 0, 23, 12, 19, 8, 21, 0, 134, + 101, 116, 105, 116, 105, 111, 110, 0, 4, 8, 21, 0, 133, 108, 97, 116, 105, + 111, 110, 0, 6, 24, 9, 0, 133, 110, 99, 116, 105, 111, 110, 0, 18, 19, 0, 131, + 105, 116, 105, 111, 110, 0, 12, 25, 12, 7, 0, 129, 105, 111, 110, 0, 12, 6, 4, + 21, 9, 0, 131, 116, 105, 111, 110, 0, 19, 11, 4, 0, 132, 104, 97, 112, 112, + 101, 110, 0, 23, 24, 8, 21, 0, 131, 116, 117, 114, 110, 0, 10, 12, 11, 23, 0, + 130, 110, 103, 115, 0, 85, 148, 13, 23, 157, 13, 0, 23, 8, 21, 0, 130, 117, + 114, 110, 0, 8, 21, 0, 128, 114, 110, 0, 18, 14, 17, 24, 0, 130, 110, 111, + 119, 110, 0, 71, 185, 13, 17, 196, 13, 26, 205, 13, 0, 8, 24, 22, 19, 0, 131, + 101, 117, 100, 111, 0, 26, 14, 44, 0, 130, 110, 111, 119, 0, 79, 212, 13, 17, + 220, 13, 0, 15, 18, 9, 0, 129, 111, 119, 0, 14, 44, 0, 129, 111, 119, 0, 86, + 234, 13, 24, 244, 13, 0, 4, 11, 21, 8, 19, 0, 129, 112, 115, 0, 18, 18, 15, 0, + 129, 107, 117, 112, 0, 68, 28, 14, 8, 93, 14, 11, 103, 15, 15, 113, 15, 18, + 127, 15, 19, 144, 15, 22, 155, 15, 23, 164, 15, 24, 176, 15, 28, 185, 15, 0, + 76, 38, 14, 15, 48, 14, 24, 82, 14, 0, 15, 12, 16, 12, 22, 0, 130, 97, 114, 0, + 76, 55, 14, 24, 66, 14, 0, 16, 16, 12, 22, 0, 132, 105, 108, 97, 114, 0, 6, + 12, 23, 4, 19, 0, 134, 114, 116, 105, 99, 117, 108, 97, 114, 0, 15, 10, 8, 21, + 0, 131, 117, 108, 97, 114, 0, 68, 124, 14, 7, 132, 14, 11, 145, 14, 12, 203, + 14, 15, 229, 14, 16, 239, 14, 17, 249, 14, 18, 37, 15, 23, 45, 15, 25, 76, 15, + 0, 15, 6, 0, 130, 101, 97, 114, 0, 17, 4, 15, 4, 6, 0, 132, 101, 110, 100, 97, + 114, 0, 74, 152, 14, 23, 163, 14, 0, 12, 8, 11, 0, 133, 105, 103, 104, 101, + 114, 0, 72, 173, 14, 15, 185, 14, 24, 194, 14, 0, 11, 10, 18, 23, 0, 133, 101, + 116, 104, 101, 114, 0, 18, 44, 0, 132, 116, 104, 101, 114, 0, 9, 0, 131, 114, + 116, 104, 101, 114, 0, 75, 210, 14, 15, 218, 14, 0, 23, 44, 0, 130, 101, 105, + 114, 0, 19, 16, 18, 6, 0, 131, 105, 108, 101, 114, 0, 23, 12, 9, 0, 131, 108, + 116, 101, 114, 0, 16, 4, 21, 10, 44, 0, 129, 97, 114, 0, 76, 0, 15, 23, 12, + 15, 0, 10, 10, 8, 5, 0, 132, 105, 110, 110, 101, 114, 0, 76, 19, 15, 22, 28, + 15, 0, 18, 19, 0, 131, 110, 116, 101, 114, 0, 12, 15, 0, 130, 101, 110, 101, + 114, 0, 9, 8, 5, 0, 129, 114, 101, 0, 75, 52, 15, 24, 62, 15, 0, 18, 17, 4, 0, + 131, 116, 104, 101, 114, 0, 19, 18, 16, 6, 0, 134, 111, 109, 112, 117, 116, + 101, 114, 0, 72, 83, 15, 26, 94, 15, 0, 8, 21, 8, 11, 26, 0, 131, 118, 101, + 114, 0, 18, 11, 0, 130, 101, 118, 101, 114, 0, 8, 23, 18, 44, 0, 130, 104, + 101, 114, 0, 4, 24, 6, 12, 23, 21, 4, 19, 0, 130, 108, 97, 114, 0, 23, 4, 21, + 8, 23, 17, 12, 0, 135, 116, 101, 114, 97, 116, 111, 114, 0, 23, 15, 15, 24, + 17, 0, 130, 112, 116, 114, 0, 4, 8, 28, 44, 0, 129, 114, 115, 0, 18, 4, 21, 8, + 19, 18, 0, 130, 116, 111, 114, 0, 6, 18, 44, 0, 129, 99, 117, 114, 0, 8, 25, + 8, 44, 0, 129, 114, 121, 0, 68, 219, 15, 8, 3, 16, 10, 147, 16, 19, 158, 16, + 21, 170, 16, 22, 181, 16, 23, 77, 17, 24, 85, 17, 0, 75, 229, 15, 19, 240, 15, + 28, 250, 15, 0, 19, 21, 8, 19, 0, 131, 104, 97, 112, 115, 0, 11, 21, 8, 19, 0, + 130, 97, 112, 115, 0, 26, 15, 4, 0, 130, 97, 121, 115, 0, 68, 19, 16, 6, 42, + 16, 12, 53, 16, 15, 129, 16, 22, 136, 16, 0, 71, 26, 16, 14, 34, 16, 0, 12, + 44, 0, 130, 101, 97, 115, 0, 23, 0, 131, 97, 107, 101, 115, 0, 8, 7, 17, 12, + 0, 131, 105, 99, 101, 115, 0, 70, 63, 16, 21, 102, 16, 23, 117, 16, 0, 72, 70, + 16, 12, 80, 16, 0, 7, 17, 12, 0, 132, 105, 99, 101, 115, 0, 71, 87, 16, 23, + 94, 16, 0, 17, 12, 0, 130, 101, 115, 0, 21, 8, 25, 0, 130, 101, 115, 0, 18, + 22, 8, 6, 6, 4, 0, 132, 115, 111, 114, 105, 101, 115, 0, 15, 12, 5, 4, 0, 131, + 105, 116, 105, 101, 115, 0, 4, 9, 0, 129, 115, 101, 0, 18, 11, 6, 44, 0, 130, + 111, 115, 101, 115, 0, 12, 17, 11, 23, 0, 131, 105, 110, 103, 115, 0, 4, 8, + 11, 21, 8, 19, 0, 131, 97, 112, 115, 0, 8, 4, 28, 44, 0, 131, 101, 97, 114, + 115, 0, 68, 191, 16, 8, 203, 16, 18, 66, 17, 0, 21, 4, 5, 16, 8, 0, 130, 114, + 97, 115, 115, 0, 70, 216, 16, 17, 240, 16, 21, 13, 17, 22, 42, 17, 0, 70, 223, + 16, 24, 232, 16, 0, 18, 21, 19, 0, 131, 101, 115, 115, 0, 22, 0, 130, 99, 101, + 115, 115, 0, 76, 247, 16, 22, 3, 17, 0, 22, 22, 24, 5, 0, 133, 105, 110, 101, + 115, 115, 0, 24, 5, 0, 131, 105, 110, 101, 115, 115, 0, 19, 0, 85, 22, 17, 24, + 33, 17, 0, 24, 22, 0, 133, 112, 112, 114, 101, 115, 115, 0, 22, 0, 131, 112, + 114, 101, 115, 115, 0, 70, 49, 17, 18, 58, 17, 0, 6, 24, 22, 0, 131, 101, 115, + 115, 0, 19, 0, 130, 115, 101, 115, 115, 0, 21, 6, 6, 4, 0, 132, 114, 111, 115, + 115, 0, 21, 12, 9, 0, 129, 115, 116, 0, 82, 92, 17, 22, 106, 17, 0, 15, 18, + 16, 18, 17, 4, 0, 132, 97, 108, 111, 117, 115, 0, 17, 8, 6, 17, 18, 6, 0, 133, + 115, 101, 110, 115, 117, 115, 0, 68, 158, 17, 8, 188, 17, 10, 217, 17, 11, + 227, 17, 12, 25, 18, 15, 36, 18, 16, 47, 18, 17, 59, 18, 18, 151, 19, 19, 189, + 19, 22, 217, 19, 24, 107, 20, 0, 85, 165, 17, 26, 176, 17, 0, 8, 19, 8, 22, 0, + 131, 97, 114, 97, 116, 0, 11, 8, 16, 18, 22, 0, 131, 119, 104, 97, 116, 0, 68, + 195, 17, 17, 204, 17, 0, 21, 10, 44, 0, 130, 101, 97, 116, 0, 16, 17, 21, 8, + 25, 18, 10, 0, 130, 101, 110, 116, 0, 11, 24, 4, 6, 0, 130, 103, 104, 116, 0, + 71, 237, 17, 10, 244, 17, 12, 14, 18, 0, 12, 26, 0, 129, 116, 104, 0, 81, 251, + 17, 24, 2, 18, 0, 8, 15, 0, 129, 116, 104, 0, 18, 21, 11, 23, 0, 133, 111, + 117, 103, 104, 116, 0, 10, 17, 18, 23, 0, 131, 105, 103, 104, 116, 0, 23, 24, + 18, 5, 4, 0, 129, 32, 105, 116, 0, 22, 24, 8, 21, 0, 131, 115, 117, 108, 116, + 0, 4, 23, 21, 18, 19, 16, 12, 0, 129, 110, 116, 0, 68, 72, 18, 8, 128, 18, 21, + 132, 19, 22, 143, 19, 0, 76, 85, 18, 17, 96, 18, 21, 107, 18, 23, 117, 18, 0, + 19, 12, 6, 8, 21, 0, 130, 101, 110, 116, 0, 12, 16, 18, 21, 19, 0, 130, 101, + 110, 116, 0, 4, 19, 19, 4, 0, 130, 101, 110, 116, 0, 8, 19, 16, 18, 6, 0, 130, + 101, 110, 116, 0, 76, 144, 18, 16, 177, 18, 21, 21, 19, 25, 111, 19, 29, 121, + 19, 0, 70, 151, 18, 19, 164, 18, 0, 8, 9, 9, 8, 0, 133, 105, 99, 105, 101, + 110, 116, 0, 8, 6, 8, 21, 0, 133, 105, 112, 105, 101, 110, 116, 0, 72, 190, + 18, 17, 202, 18, 21, 235, 18, 23, 10, 19, 0, 25, 18, 10, 0, 131, 114, 110, + 109, 101, 110, 116, 0, 72, 209, 18, 21, 221, 18, 0, 25, 18, 10, 0, 132, 114, + 110, 109, 101, 110, 116, 0, 18, 25, 18, 10, 0, 134, 101, 114, 110, 109, 101, + 110, 116, 0, 72, 242, 18, 18, 253, 18, 0, 25, 18, 10, 0, 131, 110, 109, 101, + 110, 116, 0, 25, 18, 10, 0, 133, 101, 114, 110, 109, 101, 110, 116, 0, 4, 23, + 22, 0, 131, 101, 109, 101, 110, 116, 0, 68, 34, 19, 8, 45, 19, 9, 57, 19, 21, + 68, 19, 0, 19, 4, 0, 132, 112, 97, 114, 101, 110, 116, 0, 9, 12, 7, 0, 132, + 102, 101, 114, 101, 110, 116, 0, 9, 12, 7, 0, 131, 101, 114, 101, 110, 116, 0, + 68, 75, 19, 8, 99, 19, 0, 19, 0, 68, 84, 19, 19, 92, 19, 0, 133, 112, 97, 114, + 101, 110, 116, 0, 4, 0, 131, 101, 110, 116, 0, 9, 12, 7, 0, 133, 102, 101, + 114, 101, 110, 116, 0, 8, 15, 8, 21, 0, 130, 97, 110, 116, 0, 12, 17, 10, 18, + 6, 0, 130, 97, 110, 116, 0, 8, 9, 9, 12, 7, 0, 129, 101, 110, 116, 0, 18, 6, + 0, 130, 110, 115, 116, 0, 81, 161, 19, 21, 171, 19, 22, 180, 19, 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, 72, 196, 19, 28, 207, 19, 0, 12, 6, 8, 21, 0, 131, + 101, 105, 112, 116, 0, 6, 17, 8, 0, 130, 114, 121, 112, 116, 0, 72, 236, 19, + 10, 21, 20, 12, 30, 20, 16, 59, 20, 17, 69, 20, 24, 96, 20, 0, 74, 243, 19, + 21, 10, 20, 0, 76, 250, 19, 24, 2, 20, 0, 11, 0, 130, 104, 101, 115, 116, 0, + 22, 0, 130, 103, 101, 115, 116, 0, 23, 17, 12, 0, 131, 101, 114, 101, 115, + 116, 0, 21, 4, 15, 0, 129, 101, 115, 116, 0, 73, 37, 20, 17, 49, 20, 0, 8, 17, + 4, 16, 0, 132, 105, 102, 101, 115, 116, 0, 4, 10, 4, 0, 131, 105, 110, 115, + 116, 0, 18, 15, 4, 0, 131, 109, 111, 115, 116, 0, 68, 76, 20, 17, 87, 20, 0, + 12, 10, 4, 0, 132, 97, 105, 110, 115, 116, 0, 12, 4, 10, 4, 0, 130, 115, 116, + 0, 13, 4, 44, 0, 131, 100, 106, 117, 115, 116, 0, 70, 120, 20, 18, 144, 20, + 19, 168, 20, 23, 191, 20, 0, 72, 127, 20, 21, 137, 20, 0, 6, 27, 8, 0, 132, + 101, 99, 117, 116, 0, 12, 6, 0, 128, 105, 116, 0, 68, 151, 20, 5, 160, 20, 0, + 5, 0, 132, 97, 98, 111, 117, 116, 0, 5, 4, 0, 131, 111, 117, 116, 0, 87, 175, + 20, 24, 183, 20, 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, 72, 217, 20, 12, 253, 20, 0, 68, 224, 20, 12, 231, 20, 0, 11, 44, + 0, 129, 118, 101, 0, 70, 238, 20, 8, 246, 20, 0, 8, 21, 0, 130, 101, 105, 118, + 0, 6, 8, 21, 0, 129, 118, 0, 8, 11, 6, 4, 44, 0, 130, 105, 101, 118, 0, 76, + 15, 21, 17, 25, 21, 0, 8, 25, 8, 21, 0, 130, 105, 101, 119, 0, 18, 14, 44, 0, + 130, 110, 111, 119, 0, 70, 59, 21, 8, 118, 21, 11, 128, 21, 15, 146, 21, 17, + 87, 22, 21, 114, 22, 22, 12, 23, 23, 39, 23, 0, 68, 72, 21, 8, 84, 21, 12, 95, + 21, 19, 106, 21, 0, 21, 6, 18, 19, 28, 11, 0, 130, 105, 115, 121, 0, 24, 20, + 8, 21, 9, 0, 129, 110, 99, 121, 0, 21, 6, 18, 19, 28, 11, 0, 129, 115, 121, 0, + 24, 21, 14, 17, 4, 5, 0, 129, 116, 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, 68, 165, 21, 11, 232, 21, 14, 242, 21, 15, 250, 21, 18, 66, 22, 21, 76, 22, + 0, 69, 184, 21, 8, 193, 21, 15, 199, 21, 17, 208, 21, 21, 215, 21, 24, 224, + 21, 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, 12, 9, 0, 128, 108, 121, 0, 8, 17, 8, 10, 0, 128, + 108, 121, 0, 23, 6, 4, 0, 128, 108, 121, 0, 10, 12, 15, 22, 0, 129, 116, 108, + 121, 0, 12, 15, 0, 129, 101, 108, 121, 0, 68, 4, 22, 5, 47, 22, 8, 56, 22, 0, + 86, 11, 22, 23, 35, 22, 0, 24, 0, 108, 20, 22, 22, 27, 22, 0, 131, 117, 97, + 108, 108, 121, 0, 24, 0, 132, 97, 108, 108, 121, 0, 24, 6, 4, 0, 133, 116, + 117, 97, 108, 108, 121, 0, 4, 5, 18, 21, 19, 0, 129, 121, 0, 4, 21, 0, 132, + 101, 97, 108, 108, 121, 0, 16, 18, 17, 4, 0, 130, 97, 108, 121, 0, 4, 16, 12, + 21, 19, 0, 129, 105, 108, 121, 0, 72, 94, 22, 19, 103, 22, 0, 18, 16, 44, 0, + 130, 110, 101, 121, 0, 4, 16, 18, 6, 0, 131, 112, 97, 110, 121, 0, 68, 127, + 22, 8, 231, 22, 18, 240, 22, 23, 253, 22, 0, 69, 143, 22, 12, 152, 22, 15, + 165, 22, 16, 193, 22, 22, 202, 22, 0, 12, 15, 0, 130, 114, 97, 114, 121, 0, + 15, 15, 12, 27, 24, 4, 0, 132, 105, 97, 114, 121, 0, 76, 172, 22, 15, 182, 22, + 0, 27, 24, 4, 0, 130, 105, 97, 114, 121, 0, 12, 27, 24, 4, 0, 131, 105, 97, + 114, 121, 0, 24, 22, 0, 130, 109, 97, 114, 121, 0, 8, 6, 0, 70, 212, 22, 8, + 223, 22, 0, 8, 17, 0, 133, 101, 115, 115, 97, 114, 121, 0, 17, 0, 130, 115, + 97, 114, 121, 0, 19, 18, 21, 19, 0, 128, 116, 121, 0, 10, 4, 23, 4, 6, 0, 132, + 101, 103, 111, 114, 121, 0, 17, 24, 6, 18, 44, 0, 134, 99, 111, 117, 110, 116, + 114, 121, 0, 4, 0, 85, 21, 23, 26, 32, 23, 0, 6, 18, 19, 28, 11, 0, 130, 105, + 115, 121, 0, 15, 4, 0, 129, 121, 115, 0, 73, 49, 23, 15, 57, 23, 21, 66, 23, + 0, 4, 22, 0, 129, 101, 116, 121, 0, 12, 5, 4, 0, 129, 105, 116, 121, 0, 19, 8, + 18, 21, 19, 0, 132, 112, 101, 114, 116, 121, 0}; + diff --git a/users/gourdo1/autocorrect/autocorrection_data.h (small) b/users/gourdo1/autocorrect/autocorrection_data.h (small) new file mode 100644 index 0000000000..f98471bb08 --- /dev/null +++ b/users/gourdo1/autocorrect/autocorrection_data.h (small) @@ -0,0 +1,152 @@ +// 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. + +// Generated code. + +// Autocorrection dictionary (71 entries): +// :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 +// dosen't -> doesn't +// 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 +// retrun -> return +// retun -> return +// reuslt -> result +// reutrn -> return +// saftey -> safety +// seperate -> separate +// singed -> signed +// stirng -> string +// strign -> string +// swithc -> switch +// swtich -> switch +// thresold -> threshold +// udpate -> update +// widht -> width + +#define AUTOCORRECTION_MIN_LENGTH 5 // ":ture" +#define AUTOCORRECTION_MAX_LENGTH 10 // "accomodate" + +static const uint8_t autocorrection_data[1120] 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, 32, 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, 116, 89, 3, 10, 102, 3, 11, 112, + 3, 15, 134, 3, 17, 145, 3, 22, 234, 3, 24, 248, 3, 0, 17, 8, 22, 18, 7, 0, + 132, 101, 115, 110, 39, 116, 0, 11, 24, 4, 6, 0, 130, 103, 104, 116, 0, 71, + 119, 3, 10, 126, 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, 155, 3, 8, 166, 3, + 22, 226, 3, 0, 21, 4, 19, 19, 4, 0, 130, 101, 110, 116, 0, 85, 173, 3, 25, + 216, 3, 0, 68, 180, 3, 21, 191, 3, 0, 19, 4, 0, 132, 112, 97, 114, 101, 110, + 116, 0, 4, 19, 0, 68, 201, 3, 19, 209, 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, 255, 3, 23, 22, 4, 0, 87, 6, 4, 24, 14, 4, 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, 45, 4, 8, 57, 4, 11, 67, 4, 21, 85, 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}; + diff --git a/users/gourdo1/autocorrect/autocorrection_dict.txt b/users/gourdo1/autocorrect/autocorrection_dict.txt new file mode 100644 index 0000000000..b5f293d96c --- /dev/null +++ b/users/gourdo1/autocorrect/autocorrection_dict.txt @@ -0,0 +1,473 @@ +# Copyright 2021 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. +# +# +# This is a larger example typo dictionary containing 400 entries. It builds to +# a table of about 6000 bytes, so you'll need a keyboard with a generous +# amount of free firmware space to use the full dictionary. Alternatively, pick +# out a subset of entries to a separate file, then build a table from that. +# +# 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. +# +# For documentation about how to use this dictionary, see +# https://getreuer.info/posts/keyboards/autocorrection +# +# Further resources: +# * Wikipedia has a large list of common typos at +# https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines +# +# * EmacsWiki has another list of typos at +# https://www.emacswiki.org/emacs/autocorrection_abbrev_defs +# +# * You can find data on English word frequencies at +# https://www.wordfrequency.info/samples.asp + + +## 10 most common words. +# The words "there", "about", "their", "would", "people", "which", "could", +# "think", "other", and "because" are among the most common words in English +# that are 5 letters or longer. (We don't include entries for words shorter than +# that to avoid false triggering.) +: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 + +## Common words, 11-20. +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 + +## Common words, 21-30. +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 + + +## Words especially susceptible to skipping or transposing a letter. +# These entries are for words that are easy enough to spell, but not necessarily +# easy to press the keys in the right order. +# Catch misspellings of "achieves", "achieving", etc. +:acheiv -> achiev +almsot -> almost +alomst -> almost +chnage -> change +chekc -> check +childen -> children +claer -> clear +comapny -> company +contian -> contain +elasped -> elapsed +feild -> field +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 + + +## Words with tricky spelling. +# If you are a good speller, you could drop this section. +aberation -> aberration +accross -> across +adviced -> advised +aledge -> allege +alledge -> allege +amature -> amateur +anomolous -> anomalous +anomoly -> anomaly +aparent -> apparent +aparrent -> apparent +apparant -> apparent +apparrent -> apparent +asthetic -> aesthetic +auxilary -> auxiliary +auxillary -> auxiliary +auxilliary -> auxiliary +bankrupcy -> bankruptcy +busness -> business +bussiness -> business +calander -> calendar +commitee -> committee +comittee -> committee +competance -> competence +competant -> competent +concensus -> consensus +cognizent -> cognizant +copywrite: -> copyright +choosen -> chosen +collegue -> colleague +excercise -> exercise +:grammer -> grammar +:guage -> gauge +govement -> government +govenment -> government +goverment -> government +governmnet -> government +govorment -> government +govornment -> government +guaratee -> guarantee +garantee -> guarantee +gaurantee -> guarantee +heirarchy -> hierarchy +hygeine -> hygiene +hypocracy -> hypocrisy +hypocrasy -> hypocrisy +hypocricy -> hypocrisy +hypocrit: -> hypocrite +looses: -> loses +maintence -> maintenance +morgage -> mortgage +neccesary -> necessary +necesary -> necessary +pallete -> palette +paralel -> parallel +parralel -> parallel +parrallel -> parallel +priviledge -> privilege +probablly -> probably +prominant -> prominent +propogate -> propagate +proove -> prove +psuedo -> pseudo +reciept -> receipt +# Catch misspellings of "receives", "receiving", etc. +receiev -> receiv +reciev -> receiv +recepient -> recipient +recipiant -> recipient +relevent -> relevant +repitition -> repetition +safty -> safety +saftey -> safety +# Catch misspellings of "separate", "separating", etc. +seperat -> separat +spectogram -> spectrogram +symetric -> symmetric +tolerence -> tolerance + + +## Words particularly for coding. +# Entries for common code keywords ("const") and terminology ("lookup"). +cacheing -> caching +complier -> compiler +doulbe -> double +dyanmic -> dynamic +# As in "execute", "executable", "executing", ... +excecut -> execut +failse -> false +fales -> false +fasle -> false +flase -> false +indeces -> indices +indecies -> indices +indicies -> indices +interator -> iterator +looup -> lookup +namesapce -> namespace +namespcae -> namespace +nulltpr -> nullptr +operaotr -> operator +overide -> override +ovveride -> override +poitner -> pointer +:rference -> reference +referece -> reference +singed -> signed +stirng -> string +strign -> string +swithc -> switch +swtich -> switch +teamplate -> template +tempalte -> template +:ture -> true +retrun -> return +retun -> return +reutrn -> return +cosnt -> const +virutal -> virtual +vitual -> virtual +yeild -> yield + + +## 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 + + +## Various additional entries. +:agred -> agreed +:ajust -> adjust +:anual -> annual +:asign -> assign +:aslo: -> also +:casue -> cause +:choses -> chooses +:gaurd -> guard +:haev -> have +:hapen -> happen +:idaes -> ideas +:jsut: -> just +:jstu: -> just +:knwo -> know +:konw -> know +:kwno -> know +:ocuntry -> country +:ocur -> occur +:socre -> score +:szie -> size +:the:the: -> the +:turth -> truth +:uesd: -> used +:usally -> usually +abilties -> abilities +abilty -> ability +abvove -> above +accesories -> accessories +accomodate -> accommodate +acommodate -> accommodate +acomplish -> accomplish +actualy -> actually +acurate -> accurate +acutally -> actually +addtion -> addition +againnst -> against +aganist -> against +aggreed -> agreed +agianst -> against +ahppn -> happen +allign -> align +anytying -> anything +aquire -> acquire +availabe -> available +availaible -> available +availalbe -> available +availble -> available +availiable -> available +avalable -> available +avaliable -> available +avilable -> available +bandwith -> bandwidth +begginer -> beginner +beleif -> belief +beleive -> believe +belive -> believe +breif -> brief +burried -> buried +caluclate -> calculate +caluculate -> calculate +calulate -> calculate +catagory -> category +cauhgt -> caught +ceratin -> certain +certian -> certain +cheif -> chief +cieling -> ceiling +circut -> circuit +clasic -> classic +cmoputer -> computer +coform -> conform +comming: -> coming +considerd -> considered +dervied -> derived +desicion -> decision +diferent -> different +diferrent -> different +differnt -> different +diffrent -> different +divison -> division +effecient -> efficient +eligable -> eligible +elpased -> elapsed +embarass -> embarrass +embeded -> embedded +encypt -> encrypt +finaly -> finally +foriegn -> foreign +foward -> forward +fraciton -> fraction +fucntion -> function +fufill -> fulfill +fullfill -> fulfill +futher -> further +ganerate -> generate +generaly -> generally +greatful -> grateful +heigher -> higher +higest -> highest +howver -> however +hydogen -> hydrogen +importamt -> important +inclued -> include +insted -> instead +intrest -> interest +invliad -> invalid +largst -> largest +learnign -> learning +liasion -> liaison +likly -> likely +lisense -> license +listner -> listener +macthing -> matching +manefist -> manifest +mesage -> message +naturual -> natural +occassion -> occasion +occured -> occurred +particualr -> particular +paticular -> particular +peice -> piece +perhasp -> perhaps +perheaps -> perhaps +perhpas -> perhaps +perphas -> perhaps +persue -> pursue +posess -> possess +postion -> position +preiod -> period +primarly -> primarily +privte -> private +proccess -> process +proeprty -> property +propery -> property +realtion -> relation +reasearch -> research +recuring -> recurring +refered -> referred +regluar -> regular +releated -> related +resutl -> result +reuslt -> result +reveiw -> review +satisifed -> satisfied +scheduel -> schedule +sequnce -> sequence +similiar -> similar +simmilar -> similar +slighly -> slightly +somehwat -> somewhat +statment -> statement +sucess -> success +succsess -> success +sugest -> suggest +sumary -> summary +supress -> suppress +surpress -> suppress +thresold -> threshold +tongiht -> tonight +tranpose -> transpose +typcial -> typical +udpate -> update +ususally -> usually +verticies -> vertices +whereever -> wherever +wherre -> where +wierd -> weird + diff --git a/users/gourdo1/autocorrect/make_autocorrection_data.py b/users/gourdo1/autocorrect/make_autocorrection_data.py new file mode 100644 index 0000000000..8e0bcf9e8e --- /dev/null +++ b/users/gourdo1/autocorrect/make_autocorrection_data.py @@ -0,0 +1,303 @@ +# 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. + +"""Python program to make autocorrection_data.h. + +This program reads "autocorrection_dict.txt" 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 to read from a different typo dict file, pass it as the first argument like + +$ python3 make_autocorrection_data.py dict.txt + +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 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 main(argv): + dict_file = argv[1] if len(argv) > 1 else 'autocorrection_dict.txt' + 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, 'autocorrection_data.h') + + +if __name__ == '__main__': + main(sys.argv) diff --git a/users/gourdo1/custom_double_taps.h b/users/gourdo1/custom_double_taps.h new file mode 100644 index 0000000000..fe97b8cd1f --- /dev/null +++ b/users/gourdo1/custom_double_taps.h @@ -0,0 +1,101 @@ +// Copyright 2022 Google LLC +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include "gourdo1.h" + +static bool process_capsnum(uint16_t keycode, keyrecord_t * record) { + static bool toggled = false; + static bool tapped = false; + static uint16_t tap_timer = 0; + + if (keycode == CAPSNUM) { + if (user_config.double_tap_shift_for_capslock) { + // Act as TT(_NUMPADMOUSE) + if (record -> event.pressed) { // CAPSNUM key was pressed + // Check whether the key was recently tapped + if (tapped && !timer_expired(record -> event.time, tap_timer)) { + // This is a double tap (or possibly a triple tap or more) + // Toggle the layer on. + toggled = true; + } else if (toggled) { + // Otherwise if currently toggled, turn it off + toggled = false; + tapped = false; + layer_off(_NUMPADMOUSE); + } + // Set that the first tap occurred in a potential double tap + tapped = true; + tap_timer = record -> event.time + TAPPING_TERM; + layer_on(_NUMPADMOUSE); + } else if (!toggled) { + // If not currently toggled, turn off on key release + layer_off(_NUMPADMOUSE); + return false; + } + } else { // When double_tap_shift_for_capslock == false + // Act as KC_CAPS + if (record -> event.pressed) { + register_code(KC_CAPS); + } else { + unregister_code(KC_CAPS); + } + } + return false; + } else { + // On an event with any other key, reset the double tap state + tapped = false; + } + return true; +} + +static bool process_esc_to_base(uint16_t keycode, keyrecord_t * record) { + static bool tapped = false; + static uint16_t tap_timer = 0; + + if (keycode == KC_ESC) { + if (user_config.esc_double_tap_to_baselyr) { + if (record -> event.pressed) { + if (tapped && !timer_expired(record -> event.time, tap_timer)) { + // The key was double tapped. + layer_clear(); + } + tapped = true; + tap_timer = record -> event.time + TAPPING_TERM; + } + } + } else { + // On an event with any other key, reset the double tap state. + tapped = false; + } + return true; +} + +static bool process_lsft_for_caps(uint16_t keycode, keyrecord_t * record) { + static bool tapped = false; + static uint16_t tap_timer = 0; + + if (keycode == KC_LSFT) { + if (user_config.double_tap_shift_for_capslock) { + if (!keymap_config.no_gui) { + if (record->event.pressed) { + if (tapped && !timer_expired(record->event.time, tap_timer)) { + // The key was double tapped. + //clear_mods(); // If needed, clear the mods. + // Do something interesting... + register_code(KC_CAPS); + } + tapped = true; + tap_timer = record->event.time + TAPPING_TERM; + } else { + unregister_code(KC_CAPS); + } + } + } + } else { + // On an event with any other key, reset the double tap state. + tapped = false; + } + return true; +} diff --git a/users/gourdo1/gourdo1.c b/users/gourdo1/gourdo1.c index b964729be9..26ecd8c1c0 100644 --- a/users/gourdo1/gourdo1.c +++ b/users/gourdo1/gourdo1.c @@ -1,6 +1,6 @@ /* Copyright 2021 Jonavin Eng @Jonavin - Copyright 2022 gourdo1 <jcblake@outlook.com> - + Copyright 2022 gourdo1 <gourdo1@outlook.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 @@ -19,35 +19,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "gourdo1.h" -#include "caps_word.h" - -#ifdef TD_LSFT_CAPSLOCK_ENABLE -// Tap once for shift, twice for Caps Lock but only if Win Key in not disabled -void dance_LSFT_each_tap(qk_tap_dance_state_t * state, void * user_data) { - if (state -> count == 1 || keymap_config.no_gui) { - register_code16(KC_LSFT); - } else { - register_code(KC_CAPS); - } -} +#include "custom_double_taps.h" -void dance_LSFT_reset(qk_tap_dance_state_t * state, void * user_data) { - if (state -> count == 1 || keymap_config.no_gui) { - unregister_code16(KC_LSFT); - } else { - unregister_code(KC_CAPS); - unregister_code16(KC_LSFT); - } -} -// Tap Dance definitions -qk_tap_dance_action_t tap_dance_actions[] = { - // Tap once for shift, twice for Caps Lock - [TD_LSFT_CAPSLOCK] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS), - [TD_LSFT_CAPS_WIN] = ACTION_TAP_DANCE_FN_ADVANCED(dance_LSFT_each_tap, NULL, dance_LSFT_reset), - // Tap once for Escape, twice to reset to base layer - [TD_ESC_BASELYR] = ACTION_TAP_DANCE_DUAL_ROLE(KC_ESC, _BASE), -}; -#endif // TD_LSFT_CAPSLOCK_ENABLE +#include "autocorrect/autocorrection.h" // RGB NIGHT MODE #ifdef RGB_MATRIX_ENABLE @@ -126,209 +100,398 @@ __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t * bool process_record_user(uint16_t keycode, keyrecord_t * record) { mod_state = get_mods(); - if (!process_record_keymap(keycode, record)) { - return false; - } + if (!process_record_keymap(keycode, record)) { return false; } + if (!process_capsnum(keycode, record)) { return false; } + if (!process_esc_to_base(keycode, record)) { return false; } + if (!process_lsft_for_caps(keycode, record)) { return false; } + if (!process_autocorrection(keycode, record)) { return false; } - if (!process_caps_word(keycode, record)) { - return false; - } - - // Your macros ... + // Key macros ... switch (keycode) { - // DotCom domain macros + // User configuration toggles + case PRNCONF: // Print verbose status of all user_config toggles (open a text editor before engaging!!) + if (record->event.pressed) { + send_string("\n"SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)"#########"); + send_string(" gourdo1" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_3)SS_TAP(X_KP_9))"s GMMK Pro User Settings "); + send_string("#########"SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)"\n"); + send_string("Hold "SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"Fn"SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))" and the number corresponding to a setting below to toggle.\n"); + send_string("Re"SS_TAP(X_KP_MINUS)"print this screen with "SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"Fn" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3)) SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"`" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))" to see your changes reflected.\n"); + send_string("Config also visible as RGB under number keys by holding "SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"Fn" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))".\n"); + send_string(SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)); + send_string(SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)); + send_string(SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)); + send_string(SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)SS_TAP(X_KP_MINUS)"\n"); + send_string("1. CapsLock RGB highlight alpha keys................ "); + if (user_config.rgb_hilite_caps) { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"ON" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } else { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"OFF" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } + send_string("2. Numpad RGB highlight layer keys.................. "); + if (user_config.rgb_hilite_numpad) { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"ON" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } else { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"OFF" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } + send_string("3. Double tap ESC to revert to BASE layer........... "); + if (user_config.esc_double_tap_to_baselyr) { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"ON" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } else { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"OFF" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } + send_string("4. DEL "SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_3)SS_TAP(X_KP_8))" HOME key locations......................... "); + if (user_config.del_right_home_top) { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"HOME on F13"SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_5)SS_TAP(X_KP_9))" DEL right of BKSPC" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } else { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"DEL on F13"SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_5)SS_TAP(X_KP_9))" HOME right of BKSPC" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } + send_string("5. Numpad on CapsLock"SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_5)SS_TAP(X_KP_9))" double tap LSHIFT for Caps... "); + if (user_config.double_tap_shift_for_capslock) { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"ON" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } else { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"OFF" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } + send_string("6. Encoder button function.......................... "); + if (user_config.encoder_press_mute_or_media) { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"MUTE" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } else { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"MEDIA PLAY"SS_TAP(X_KP_SLASH) "PAUSE" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } + send_string("7. Insert function accessed with.................... "); + if (user_config.ins_on_shft_bkspc_or_del) { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"SHIFT"SS_TAP(X_KP_MINUS)"BKSPC"SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } else { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"SHIFT"SS_TAP(X_KP_MINUS)"DEL"SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } + send_string("8. Force SHIFT "SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_3)SS_TAP(X_KP_8))" CTRL"SS_TAP(X_KP_MINUS)"SPACE to function like SPACE.. "); + if (user_config.disable_space_mods) { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"ON"SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } else { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"OFF"SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } + send_string("9. AutoCorrect...................................... "); + if (user_config.autocorrect) { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"ON"SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } else { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"OFF"SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } + send_string("0. CapsLock highlights extended alphas "SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_4)SS_TAP(X_KP_0))"ISO"SS_TAP(X_KP_MINUS)"only"SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_4)SS_TAP(X_KP_1))"... "); + if (user_config.rgb_english_caps) { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"OFF"SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } else { + send_string(SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_1))"ON"SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_9)SS_TAP(X_KP_3))"\n"); + } + send_string("\nThe latest firmware updates are always here"SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_5)SS_TAP(X_KP_8))" https" SS_LALT(SS_TAP(X_KP_0)SS_TAP(X_KP_0)SS_TAP(X_KP_5)SS_TAP(X_KP_8))SS_TAP(X_KP_SLASH)SS_TAP(X_KP_SLASH) "github.com"SS_TAP(X_KP_SLASH) "gourdo1"SS_TAP(X_KP_SLASH)"gmmkpro"SS_TAP(X_KP_MINUS)"media\n"); + } + break; + + case TG_CAPS: // Toggle RGB highlighting of Capslock state + if (record->event.pressed) { + user_config.rgb_hilite_caps ^= 1; // Toggles the status + eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM + } + break; + case TG_PAD: // Toggle RGB highlighting of Numpad state + if (record->event.pressed) { + user_config.rgb_hilite_numpad ^= 1; // Toggles the status + eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM + } + break; + case TG_ESC: // Toggle alternate ESC functionality + if (record->event.pressed) { + user_config.esc_double_tap_to_baselyr ^= 1; // Toggles the status + eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM + } + break; + case TG_DEL: // Toggle alternate placement of DEL and HOME keys + if (record->event.pressed) { + user_config.del_right_home_top ^= 1; // Toggles the status + eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM + } + break; + case TG_TDCAP: // Toggle alternate Capslock/Numpad functionality + if (record->event.pressed) { + user_config.double_tap_shift_for_capslock ^= 1; // Toggles the status + eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM + } + break; + case TG_ENC: // Toggle Encoder function + if (record->event.pressed) { + user_config.encoder_press_mute_or_media ^= 1; // Toggles the status + eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM + } + break; + case TG_INS: // Toggle Encoder function + if (record->event.pressed) { + user_config.ins_on_shft_bkspc_or_del ^= 1; // Toggles the status + eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM + } + break; + case TG_SPCMOD: // Toggle forcing SHIFT&CTRL-SPACE to function like SPACE + if (record->event.pressed) { + user_config.disable_space_mods ^= 1; // Toggles the status + eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM + } + break; + case TG_AUTOCR: // Toggle AutoCorrect + if (record->event.pressed) { + user_config.autocorrect ^= 1; // Toggles the status + eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM + } + break; + case TG_ENGCAP: // Toggle highlighting Non-English letters during CAPSLOCK + if (record->event.pressed) { + user_config.rgb_english_caps ^= 1; // Toggles the status + eeconfig_update_user(user_config.raw); // Writes the new status to EEPROM + } + break; + //return false; + + // Key to the left of encoder function (default HOME) + case LEFTOFENC: + if (!(user_config.del_right_home_top)) { + if (!(user_config.ins_on_shft_bkspc_or_del)) { + static bool inskey_registered; + if (record -> event.pressed) { + // Detect the activation of either shift keys + if (mod_state & MOD_MASK_SHIFT) { + // First temporarily canceling both shifts so that + // shift isn't applied to the KC_INS keycode + del_mods(MOD_MASK_SHIFT); + register_code(KC_INS); + // Update the boolean variable to reflect the status of KC_INS + inskey_registered = true; + // Reapplying modifier state so that the held shift key(s) + // still work even after having tapped the key. + set_mods(mod_state); + return false; + } else { + register_code(KC_DEL); + return false; + } + } else { // on release of KC_DEL + // In case KC_INS is still being sent even after the release of KC_DEL + if (inskey_registered) { + unregister_code(KC_INS); + inskey_registered = false; + return false; + } else { + unregister_code(KC_DEL); + return false; + } + } + } else { + if (record -> event.pressed) { + register_code(KC_DEL); + return false; + } else { + unregister_code(KC_DEL); + return false; + } + } + } else { + if (record -> event.pressed) { + register_code(KC_HOME); + return false; + } else { + unregister_code(KC_HOME); + return false; + } + } + break; + + // Key below encoder function (default DEL) + case BELOWENC: + if (user_config.del_right_home_top) { + if (!(user_config.ins_on_shft_bkspc_or_del)) { + static bool inskey_registered; + if (record -> event.pressed) { + // Detect the activation of either shift keys + if (mod_state & MOD_MASK_SHIFT) { + // First temporarily canceling both shifts so that + // shift isn't applied to the KC_INS keycode + del_mods(MOD_MASK_SHIFT); + register_code(KC_INS); + // Update the boolean variable to reflect the status of KC_INS + inskey_registered = true; + // Reapplying modifier state so that the held shift key(s) + // still work even after having tapped the key. + set_mods(mod_state); + return false; + } else { + register_code(KC_DEL); + return false; + } + } else { // on release of KC_DEL + // In case KC_INS is still being sent even after the release of KC_DEL + if (inskey_registered) { + unregister_code(KC_INS); + inskey_registered = false; + return false; + } else { + unregister_code(KC_DEL); + return false; + } + } + } else { + if (record -> event.pressed) { + register_code(KC_DEL); + return false; + } else { + unregister_code(KC_DEL); + return false; + } + } + } else { + if (record -> event.pressed) { + register_code(KC_HOME); + return false; + } else { + unregister_code(KC_HOME); + return false; + } + } + break; + + // Encoder button function + case ENCFUNC: + if (user_config.encoder_press_mute_or_media) { + if (record -> event.pressed) { + register_code(KC_MUTE); + } else unregister_code16(keycode); + } + else { + if (record -> event.pressed) { + register_code(KC_MPLY); + } else unregister_code16(keycode); + } + break; + + // DotCom domain macros case DOTCOM: if (record -> event.pressed) { - SEND_STRING(".com"); + send_string(".com"); } else { // when keycode is released } break; case YAHOO: if (record -> event.pressed) { - SEND_STRING("yahoo.com"); + send_string("yahoo.com"); } else { // when keycode is released } break; case OUTLOOK: if (record -> event.pressed) { - SEND_STRING("outlook.com"); + send_string("outlook.com"); } else { // when keycode is released } break; case GMAIL: if (record -> event.pressed) { - SEND_STRING("gmail.com"); + send_string("gmail.com"); } else { // when keycode is released } break; case HOTMAIL: if (record -> event.pressed) { - SEND_STRING("hotmail.com"); + send_string("hotmail.com"); } else { // when keycode is released } break; - -/* - case YAHOO: - if (record -> event.pressed) SEND_STRING("yahoo.com"); - else unregister_code16(keycode); - break; - case OUTLOOK: - if (record -> event.pressed) SEND_STRING("outlook.com"); - else unregister_code16(keycode); - break; - case GMAIL: - if (record -> event.pressed) SEND_STRING("gmail.com"); - else unregister_code16(keycode); - break; - case HOTMAIL: - if (record -> event.pressed) { - SEND_STRING("hotmail.com"); - } else unregister_code16(keycode); - break; - case DOTCOM: - if (record -> event.pressed) SEND_STRING(".com"); - else unregister_code16(keycode); - break; -*/ - // Windows key lock - case KC_WINLCK: + // Windows Key lockout + case WINLOCK: if (record -> event.pressed) { keymap_config.no_gui = !keymap_config.no_gui; //toggle status } else unregister_code16(keycode); break; - // Double Zero + // Double Zero case KC_00: if (record -> event.pressed) { // when keycode KC_00 is pressed - SEND_STRING("00"); + send_string(SS_TAP(X_KP_0)SS_TAP(X_KP_0)); } else unregister_code16(keycode); break; - // Treat Control+Space as if regular Space - case KC_SPC: { - // Initialize a boolean variable that keeps track of the space key status: registered or not? - static bool spckey_registered; - if (record -> event.pressed) { - // Detect the activation of either ctrl keys - if (mod_state & MOD_MASK_CTRL) { - // First temporarily canceling both ctrls so that - // ctrl isn't applied to the KC_SPC keycode - del_mods(MOD_MASK_CTRL); - register_code(KC_SPC); - // Update the boolean variable to reflect the status of KC_SPC - spckey_registered = true; - // Reapplying modifier state so that the held ctrl key(s) - // still work even after having tapped the Space key. - set_mods(mod_state); - return false; - } - } else { // on release of KC_SPC - // In case KC_SPC is still being sent even after the release of KC_SPC - if (spckey_registered) { - unregister_code(KC_SPC); - spckey_registered = false; - return false; + // Treat Control & Shift-Space as if regular Space + case KC_SPC: + if (user_config.disable_space_mods) { + // Initialize a boolean variable that keeps track of the space key status: registered or not? + static bool spckey_registered; + if (record -> event.pressed) { + // Detect the activation of either ctrl keys + if (mod_state & MOD_MASK_CTRL) { + // First temporarily canceling both ctrls so that + // ctrl isn't applied to the KC_SPC keycode + del_mods(MOD_MASK_CTRL); + register_code(KC_SPC); + // Update the boolean variable to reflect the status of KC_SPC + spckey_registered = true; + // Reapplying modifier state so that the held ctrl key(s) + // still work even after having tapped the Space key. + set_mods(mod_state); + return false; + } + else if (mod_state & MOD_MASK_SHIFT) { + // First temporarily canceling both shifts so that + // shift isn't applied to the KC_SPC keycode + del_mods(MOD_MASK_SHIFT); + register_code(KC_SPC); + // Update the boolean variable to reflect the status of KC_SPC + spckey_registered = true; + // Reapplying modifier state so that the held shift key(s) + // still work even after having tapped the Space key. + set_mods(mod_state); + return false; + } + } else { // on release of KC_SPC + // In case KC_SPC is still being sent even after the release of KC_SPC + if (spckey_registered) { + unregister_code(KC_SPC); + spckey_registered = false; + return false; + } } } - } break; - // Treat Shift+Space as if regular Space - case KC_SHIFTSPC: { - // Initialize a boolean variable that keeps track of the space key status: registered or not? - static bool spc2key_registered; - if (record -> event.pressed) { - // Detect the activation of either shift keys - if (mod_state & MOD_MASK_SHIFT) { - // First temporarily canceling both shifts so that - // shift isn't applied to the KC_SPC keycode - del_mods(MOD_MASK_SHIFT); - register_code(KC_SPC); - // Update the boolean variable to reflect the status of KC_SPC - spc2key_registered = true; - // Reapplying modifier state so that the held shift key(s) - // still work even after having tapped the Space key. - set_mods(mod_state); - return false; - } - } else { // on release of KC_SPC - // In case KC_SPC is still being sent even after the release of KC_SPC - if (spc2key_registered) { - unregister_code(KC_SPC); - spc2key_registered = false; - return false; - } - } - } - break; - - // Add INS as SHIFT-modified BackSpace key + // INS as SHIFT-modified BackSpace key case KC_BSPC: { - // Initialize a boolean variable that keeps track of the delete key status: registered or not? - static bool inskey_registered; - if (record -> event.pressed) { - // Detect the activation of either shift keys - if (mod_state & MOD_MASK_SHIFT) { - // First temporarily canceling both shifts so that - // shift isn't applied to the KC_INS keycode - del_mods(MOD_MASK_SHIFT); - register_code(KC_INS); - // Update the boolean variable to reflect the status of KC_INS - inskey_registered = true; - // Reapplying modifier state so that the held shift key(s) - // still work even after having tapped the Delete/Insert key. - set_mods(mod_state); - return false; - } - } else { // on release of KC_BSPC - // In case KC_INS is still being sent even after the release of KC_BSPC - if (inskey_registered) { - unregister_code(KC_INS); - inskey_registered = false; - return false; + if (user_config.ins_on_shft_bkspc_or_del) { + // Initialize a boolean variable that keeps track of the ins key status: registered or not? + static bool inskey_registered; + if (record -> event.pressed) { + // Detect the activation of either shift keys + if (mod_state & MOD_MASK_SHIFT) { + // First temporarily canceling both shifts so that + // shift isn't applied to the KC_INS keycode + del_mods(MOD_MASK_SHIFT); + register_code(KC_INS); + // Update the boolean variable to reflect the status of KC_INS + inskey_registered = true; + // Reapplying modifier state so that the held shift key(s) + // still work even after having tapped the key. + set_mods(mod_state); + return false; + } + } else { // on release of KC_BSPC + // In case KC_INS is still being sent even after the release of KC_BSPC + if (inskey_registered) { + unregister_code(KC_INS); + inskey_registered = false; + return false; + } } } - } - break; - - /* Add INS as SHIFT-modified DEL key - case KC_DEL: { - // Initialize a boolean variable that keeps track of the delete key status: registered or not? - static bool inskey_registered; - if (record->event.pressed) { - // Detect the activation of either shift keys - if (mod_state & MOD_MASK_SHIFT) { - // First temporarily canceling both shifts so that - // shift isn't applied to the KC_INS keycode - del_mods(MOD_MASK_SHIFT); - register_code(KC_INS); - // Update the boolean variable to reflect the status of KC_INS - inskey_registered = true; - // Reapplying modifier state so that the held shift key(s) - // still work even after having tapped the Delete/Insert key. - set_mods(mod_state); - return false; - } - } else { // on release of KC_DEL - // In case KC_INS is still being sent even after the release of KC_DEL - if (inskey_registered) { - unregister_code(KC_INS); - inskey_registered = false; - return false; - } - } - } - break; - */ + } + break; #ifdef IDLE_TIMEOUT_ENABLE case RGB_TOI: @@ -352,27 +515,27 @@ bool process_record_user(uint16_t keycode, keyrecord_t * record) { #ifdef EMOTICON_ENABLE case EMO_SHRUG: - if (record -> event.pressed) SEND_STRING("`\\_(\"/)_/`"); + if (record -> event.pressed) send_string("`\\_(\"/)_/`"); else unregister_code16(keycode); break; case EMO_CONFUSE: - if (record -> event.pressed) SEND_STRING("(*_*)"); + if (record -> event.pressed) send_string("(*_*)"); else unregister_code16(keycode); break; case EMO_TEARS: - if (record -> event.pressed) SEND_STRING("(T_T)"); + if (record -> event.pressed) send_string("(T_T)"); else unregister_code16(keycode); break; case EMO_NERVOUS: - if (record -> event.pressed) SEND_STRING("(~_~;)"); + if (record -> event.pressed) send_string("(~_~;)"); else unregister_code16(keycode); break; case EMO_JOY: - if (record -> event.pressed) SEND_STRING("(^o^)"); + if (record -> event.pressed) send_string("(^o^)"); else unregister_code16(keycode); break; case EMO_SAD: - if (record -> event.pressed) SEND_STRING(":'-("); + if (record -> event.pressed) send_string(":'-("); else unregister_code16(keycode); break; #endif // EMOTICON_ENABLE @@ -398,15 +561,32 @@ bool process_record_user(uint16_t keycode, keyrecord_t * record) { return true; }; -uint16_t get_tapping_term(uint16_t keycode, keyrecord_t * record) { +// Define custom Caps Word continuity characters +bool caps_word_press_user(uint16_t keycode) { switch (keycode) { - case KC_SFTUP: - return 300; - case KC_RAISESPC: - case KC_LOWERSPC: - return 450; - default: - return TAPPING_TERM; + // Keycodes that continue Caps Word, with shift applied. + case KC_A ... KC_Z: + case KC_TILD: + case KC_UNDS: + case KC_DQT: + case KC_COLN: + case KC_RSFT: + case KC_LSFT: + add_weak_mods(MOD_BIT(KC_LSFT)); // Apply shift to next key. + return true; + + // Keycodes that continue Caps Word, without shifting. + case KC_1 ... KC_0: + case KC_GRV: + case KC_MINS: + case KC_QUOT: + case KC_SCLN: + case KC_BSPC: + case KC_DEL: + return true; + + default: + return false; // Deactivate Caps Word. } } @@ -418,15 +598,34 @@ void activate_numlock(bool turn_on) { } // INITIAL STARTUP - -__attribute__((weak)) void keyboard_post_init_keymap(void) {} +__attribute__((weak)) void keyboard_post_init_keymap(void) { +} void keyboard_post_init_user(void) { + // Read the user config from EEPROM + user_config.raw = eeconfig_read_user(); keyboard_post_init_keymap(); #ifdef STARTUP_NUMLOCK_ON activate_numlock(true); // turn on Num lock by default so that the numpad layer always has predictable results - #endif // STARTUP_NUMLOC_ON + #endif // STARTUP_NUMLOCK_ON #ifdef IDLE_TIMEOUT_ENABLE - timeout_timer = timer_read(); // set inital time for ide timeout + timeout_timer = timer_read(); // set initial time for idle timeout #endif -}
\ No newline at end of file +} + +/* Set defaults for EEPROM user configuration variables */ +void eeconfig_init_user(void) { + user_config.raw = 0; + user_config.rgb_hilite_caps = true; + user_config.rgb_hilite_numpad = true; + user_config.double_tap_shift_for_capslock = true; + user_config.del_right_home_top = true; + user_config.encoder_press_mute_or_media = true; + user_config.esc_double_tap_to_baselyr = true; + user_config.ins_on_shft_bkspc_or_del = true; + user_config.disable_space_mods = true; + user_config.autocorrect = true; + user_config.rgb_english_caps = true; + + eeconfig_update_user(user_config.raw); +} diff --git a/users/gourdo1/gourdo1.h b/users/gourdo1/gourdo1.h index c6861ca0ca..ecf6eaf25d 100644 --- a/users/gourdo1/gourdo1.h +++ b/users/gourdo1/gourdo1.h @@ -1,5 +1,5 @@ /* Copyright 2021 Jonavin Eng @Jonavin - Copyright 2022 gourdo1 <jcblake@outlook.com> + Copyright 2022 gourdo1 <gourdo1@outlook.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 @@ -20,36 +20,51 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // DEFINE MACROS #define ARRAYSIZE(arr) sizeof(arr) / sizeof(arr[0]) -// LAYERS +// LAYERS -- Note: to avoid compile problems, make sure total layers matches DYNAMIC_KEYMAP_LAYER_COUNT defined in config.h (where _COLEMAK layer is defined) enum custom_user_layers { _BASE, _FN1, _NUMPADMOUSE, _MOUSEKEY, + #ifdef GAME_ENABLE + _GAME + #endif //GAME_ENABLE }; #define KC_CAD LALT(LCTL(KC_DEL)) +#define LOCKPC LGUI(KC_L) #define KC_AF4 LALT(KC_F4) #define KC_TASK LCTL(LSFT(KC_ESC)) #define CT_PGUP RCTL(KC_PGUP) #define CT_PGDN RCTL(KC_PGDN) #define CT_HOME RCTL(KC_HOME) #define CT_END RCTL(KC_END) -#define KC_SFTUP RSFT_T(KC_UP) // Shift when held, Up arrow when tapped -#define KC_RAISESPC LT(_MOUSEKEY, KC_SPC) // _MOUSEKEY layer mod when held, space when tapped -#define KC_LOWERSPC LT(_NUMPADMOUSE, KC_SPC) // _NUMPAD-MOUSE layer mod when held, space when tapped -#define KC_SHIFTSPC LSFT(KC_SPC) -#define SWAP_L SGUI(KC_LEFT) // Swap application to left display -#define SWAP_R SGUI(KC_RGHT) // Swap application to right display +#define SWAP_L SGUI(KC_LEFT) // Swap application to left display +#define SWAP_R SGUI(KC_RGHT) // Swap application to right display // KEYCODES enum custom_user_keycodes { KC_00 = SAFE_RANGE, - ENCFUNC, - KC_WINLCK, // Toggles Win key on and off + ENCFUNC, // Encoder function + CAPSNUM, // Capslock key function + LEFTOFENC, // Key to the left of the encoder (i.e. F13) + BELOWENC, // Key below encoder + PRNCONF, // Print verbose statuses of all user_config toggles + WINLOCK, // Toggles Windows key on and off RGB_TOI, // Timeout idle time up RGB_TOD, // Timeout idle time down - RGB_NITE, // Turns off all rgb but allow rgb indicators to work + RGB_NITE, // Disables RGB backlighting effects but allows RGB indicators to still work + + TG_CAPS, // Toggles RGB highlighting of alphas during capslock + TG_PAD, // Toggles RGB highlighting of keys on numpad+mousekeys layer + TG_TDCAP, // Toggles double tap shift for CapsLock + TG_DEL, // Swaps DEL and HOME key locations + TG_ENC, // Toggle Encoder button functionality + TG_ESC, // Toggle ESC double tap for _BASE layer + TG_INS, // Toggle location of INS + TG_SPCMOD, // Toggle disabling of modded-SPACE functions + TG_AUTOCR, // Toggle AutoCorrect + TG_ENGCAP, // Toggle highlighting Non-English letters during CAPSLOCK on ISO boards YAHOO, // yahoo.com OUTLOOK, // outlook.com @@ -66,24 +81,29 @@ enum custom_user_keycodes { KC_TSTOG, // Tab Scroll Toggle - NEW_SAFE_RANGE // new safe range for keymap level custom keycodes + NEW_SAFE_RANGE // New safe range for keymap level custom keycodes }; -#ifdef TD_LSFT_CAPSLOCK_ENABLE -// Tap Dance Definitions -enum custom_tapdance { - TD_LSFT_CAPSLOCK, - TD_LSFT_CAPS_WIN, - TD_ESC_BASELYR -}; -#define KC_LSFTCAPS TD(TD_LSFT_CAPSLOCK) -#define KC_LSFTCAPSWIN TD(TD_LSFT_CAPS_WIN) -#define KC_ESCLYR TD(TD_ESC_BASELYR) -#else // regular Shift -#define KC_LSFTCAPS KC_LSFT -// regular Escape -#define KC_ESCLYR KC_ESC -#endif // TD_LSFT_CAPSLOCK_ENABLE +// Set up boolean variables to track user customizable configuration options +typedef union { + uint32_t raw; + struct { + bool rgb_hilite_caps :1; + bool rgb_hilite_numpad :1; + bool esc_double_tap_to_baselyr :1; + bool del_right_home_top :1; + bool double_tap_shift_for_capslock :1; + bool encoder_press_mute_or_media :1; + bool ins_on_shft_bkspc_or_del :1; + bool disable_space_mods :1; + bool autocorrect :1; + bool rgb_english_caps :1; + }; +} user_config_t; + +user_config_t user_config; + +//#define LSFTCAPSWIN TD(TD_LSFT_CAPS_WIN) // ENCODER ACTIONS #ifdef ENCODER_ENABLE diff --git a/users/gourdo1/gourdo1_encoder.c b/users/gourdo1/gourdo1_encoder.c index 72f8c3c354..5a19b63c6e 100644 --- a/users/gourdo1/gourdo1_encoder.c +++ b/users/gourdo1/gourdo1_encoder.c @@ -1,5 +1,5 @@ /* Copyright 2021 Jonavin Eng @Jonavin - Copyright 2022 gourdo1 <jcblake@outlook.com> + Copyright 2022 gourdo1 <gourdo1@outlook.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 @@ -15,8 +15,8 @@ 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 QMK_KEYBOARD_H + #include "gourdo1.h" #ifdef ENCODER_ENABLE diff --git a/users/gourdo1/rules.mk b/users/gourdo1/rules.mk index e02f9e8e08..0a3a9ba426 100644 --- a/users/gourdo1/rules.mk +++ b/users/gourdo1/rules.mk @@ -1,4 +1,6 @@ SRC += gourdo1.c +SRC += autocorrect/autocorrection.c + ifdef ENCODER_ENABLE # include encoder related code when enabled ifeq ($(strip $(ENCODER_DEFAULTACTIONS_ENABLE)), yes) diff --git a/users/hvp/config.h b/users/hvp/config.h index 68dd8b4828..b7d0443bbc 100644 --- a/users/hvp/config.h +++ b/users/hvp/config.h @@ -15,4 +15,5 @@ */ #pragma once -#define LONG_TAPPING_TERM 1000
\ No newline at end of file +#define LONG_TAPPING_TERM 1000 +#define PERMISSIVE_HOLD diff --git a/users/ishtob/config.h b/users/ishtob/config.h index 6c07d2f2fd..695077528c 100755 --- a/users/ishtob/config.h +++ b/users/ishtob/config.h @@ -16,7 +16,6 @@ //#define LEADER_TIMEOUT 300 //#define BACKLIGHT_BREATHING //#define PERMISSIVE_HOLD -// #define QMK_KEYS_PER_SCAN 4 //audio clicky //#define AUDIO_CLICKY diff --git a/users/issmirnov/config.h b/users/issmirnov/config.h index 664ebfe8a3..5fe78f7a53 100644 --- a/users/issmirnov/config.h +++ b/users/issmirnov/config.h @@ -1,8 +1,5 @@ #pragma once -// Allows sending more than one key per scan. Useful for chords. -#define QMK_KEYS_PER_SCAN 4 - // how long before a tap becomes a hold #undef TAPPING_TERM #define TAPPING_TERM 100 diff --git a/users/jonavin/jonavin.h b/users/jonavin/jonavin.h index ab2ce0dff2..3ebd3fe9f2 100644 --- a/users/jonavin/jonavin.h +++ b/users/jonavin/jonavin.h @@ -18,7 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once // DEFINE MACROS +#ifndef ARRAYSIZE #define ARRAYSIZE(arr) sizeof(arr)/sizeof(arr[0]) +#endif // !ARRAYSIZE // LAYERS diff --git a/users/kuchosauronad0/config.h b/users/kuchosauronad0/config.h index 58542dc184..8502031f02 100644 --- a/users/kuchosauronad0/config.h +++ b/users/kuchosauronad0/config.h @@ -41,10 +41,6 @@ # define ONESHOT_TIMEOUT 3000 #endif// !ONESHOT_TIMEOUT -#ifndef QMK_KEYS_PER_SCAN -# define QMK_KEYS_PER_SCAN 4 -#endif // !QMK_KEYS_PER_SCAN - #if defined(LEADER_ENABLE) # define LEADER_PER_KEY_TIMING # define LEADER_TIMEOUT 250 diff --git a/users/kuchosauronad0/kuchosauronad0.c b/users/kuchosauronad0/kuchosauronad0.c index a8f17b08ee..820d84daad 100644 --- a/users/kuchosauronad0/kuchosauronad0.c +++ b/users/kuchosauronad0/kuchosauronad0.c @@ -117,7 +117,7 @@ void matrix_scan_user(void){ } __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } @@ -133,12 +133,12 @@ layer_state_t layer_state_set_user(layer_state_t state) { __attribute__ ((weak)) -uint32_t default_layer_state_set_keymap (uint32_t state) { +layer_state_t default_layer_state_set_keymap (layer_state_t state) { return state; } // Runs state check and changes underglow color and animation -uint32_t default_layer_state_set_user(uint32_t state) { +layer_state_t default_layer_state_set_user(layer_state_t state) { state = default_layer_state_set_keymap(state); #if 0 #ifdef RGBLIGHT_ENABLE diff --git a/users/kuchosauronad0/kuchosauronad0.h b/users/kuchosauronad0/kuchosauronad0.h index da996457c6..5cbd517d67 100644 --- a/users/kuchosauronad0/kuchosauronad0.h +++ b/users/kuchosauronad0/kuchosauronad0.h @@ -65,8 +65,8 @@ void shutdown_keymap(void); void suspend_power_down_keymap(void); void suspend_wakeup_init_keymap(void); void matrix_scan_keymap(void); -uint32_t layer_state_set_keymap (uint32_t state); -uint32_t default_layer_state_set_keymap (uint32_t state); +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); diff --git a/users/kuchosauronad0/rgblight_user.c b/users/kuchosauronad0/rgblight_user.c index 63e412c557..feea0c412f 100644 --- a/users/kuchosauronad0/rgblight_user.c +++ b/users/kuchosauronad0/rgblight_user.c @@ -84,7 +84,7 @@ void matrix_scan_rgb(void) { layer_state_t layer_state_set_rgb(layer_state_t state) { # ifdef RGBLIGHT_ENABLE if (userspace_config.rgb_layer_change) { - switch (biton32(state)) { // _RAISE, _LOWER and _ADJUST use a custom color and the breathing effect + switch (get_highest_layer(state)) { // _RAISE, _LOWER and _ADJUST use a custom color and the breathing effect case _RAISE: rgblight_sethsv_noeeprom_green(); rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 3); @@ -98,7 +98,7 @@ layer_state_t layer_state_set_rgb(layer_state_t state) { rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING + 2); break; default: // Use a solid color for normal layers - switch (biton32(default_layer_state)) { + switch (get_highest_layer(default_layer_state)) { case _QWERTY: rgblight_sethsv_noeeprom_magenta(); break; @@ -118,7 +118,7 @@ layer_state_t layer_state_set_rgb(layer_state_t state) { rgblight_sethsv_noeeprom_white(); break; } - biton32(state) == _MODS ? rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING) : rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it + get_highest_layer(state) == _MODS ? rgblight_mode_noeeprom(RGBLIGHT_MODE_BREATHING) : rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // if _MODS layer is on, then breath to denote it break; } } @@ -135,7 +135,7 @@ void matrix_scan_indicator(void) { #endif // !INDICATOR_LIGHTS void rgblight_fade_helper(bool direction){ - // true: increase val = fade in + // true: increase val = fade in // false: decrease val = fade out for (uint8_t index = 0; index < RGBLIGHT_VAL_STEP ; index++) { direction ? rgblight_increase_val() : rgblight_decrease_val(); @@ -147,10 +147,10 @@ void fadeflash_leds(uint8_t hue, uint8_t sat, uint8_t val){ // fade out, set new hue and saturation, fade in, fade out, set old color, fade in // this is used in leader.c // TODO: come up with a better name maybe - rgblight_fade_helper(false); - rgblight_sethsv_noeeprom(hue, sat, 0); - rgblight_fade_helper(true); - rgblight_fade_helper(false); - rgblight_sethsv_noeeprom(base_hue, base_sat, 0); - rgblight_fade_helper(true); + rgblight_fade_helper(false); + rgblight_sethsv_noeeprom(hue, sat, 0); + rgblight_fade_helper(true); + rgblight_fade_helper(false); + rgblight_sethsv_noeeprom(base_hue, base_sat, 0); + rgblight_fade_helper(true); } diff --git a/users/kuchosauronad0/template.c b/users/kuchosauronad0/template.c index 475e45d391..76cc572be3 100644 --- a/users/kuchosauronad0/template.c +++ b/users/kuchosauronad0/template.c @@ -63,11 +63,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } -uint32_t layer_state_set_user (uint32_t state) { +layer_state_t layer_state_set_user (layer_state_t state) { return layer_state_set_keymap (state); } diff --git a/users/manna-harbour_miryoku/config.h b/users/manna-harbour_miryoku/config.h index d24f52edae..c4538ee304 100644 --- a/users/manna-harbour_miryoku/config.h +++ b/users/manna-harbour_miryoku/config.h @@ -1,6 +1,5 @@ // Copyright 2019 Manna Harbour // https://github.com/manna-harbour/miryoku -// generated -*- buffer-read-only: t -*- // 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/>. @@ -21,9 +20,6 @@ #define AUTO_SHIFT_TIMEOUT TAPPING_TERM #define AUTO_SHIFT_NO_SETUP -// Recommended for heavy chording. -#define QMK_KEYS_PER_SCAN 4 - // Mouse key speed and acceleration. #undef MOUSEKEY_DELAY #define MOUSEKEY_DELAY 0 @@ -35,3 +31,13 @@ #define MOUSEKEY_MAX_SPEED 6 #undef MOUSEKEY_TIME_TO_MAX #define MOUSEKEY_TIME_TO_MAX 64 + +// Thumb Combos +#if defined (MIRYOKU_KLUDGE_THUMBCOMBOS) + #define COMBO_COUNT 8 + #define COMBO_TERM 200 + #define EXTRA_SHORT_COMBOS +#endif + +#include "custom_config.h" + diff --git a/users/manna-harbour_miryoku/custom_config.h b/users/manna-harbour_miryoku/custom_config.h new file mode 100644 index 0000000000..f5ba5ab1b1 --- /dev/null +++ b/users/manna-harbour_miryoku/custom_config.h @@ -0,0 +1,7 @@ +// Copyright 2019 Manna Harbour +// https://github.com/manna-harbour/miryoku + +// 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 + diff --git a/users/manna-harbour_miryoku/custom_rules.mk b/users/manna-harbour_miryoku/custom_rules.mk new file mode 100644 index 0000000000..6e222bb11c --- /dev/null +++ b/users/manna-harbour_miryoku/custom_rules.mk @@ -0,0 +1,3 @@ +# Copyright 2019 Manna Harbour +# https://github.com/manna-harbour/miryoku + diff --git a/users/manna-harbour_miryoku/manna-harbour_miryoku.c b/users/manna-harbour_miryoku/manna-harbour_miryoku.c index 6347183417..28ad18d1aa 100644 --- a/users/manna-harbour_miryoku/manna-harbour_miryoku.c +++ b/users/manna-harbour_miryoku/manna-harbour_miryoku.c @@ -1,229 +1,50 @@ // Copyright 2019 Manna Harbour // https://github.com/manna-harbour/miryoku -// generated -*- buffer-read-only: t -*- // 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 QMK_KEYBOARD_H + #include "manna-harbour_miryoku.h" +enum layers { MIRYOKU_LAYER_NAMES }; + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -#if defined MIRYOKU_LAYERS_FLIP - [BASE] = LAYOUT_miryoku( - #if defined MIRYOKU_ALPHAS_AZERTY - KC_A, KC_Z, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, - LGUI_T(KC_Q), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, LSFT_T(KC_J), LCTL_T(KC_K), LALT_T(KC_L), LGUI_T(KC_M), - LT(BUTTON, KC_W), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_N, KC_COMM, KC_DOT, ALGR_T(KC_SLSH), LT(BUTTON, KC_QUOT), - U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP - #elif defined MIRYOKU_ALPHAS_COLEMAK - KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, - LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_D, KC_H, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), - LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), - U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP - #elif defined MIRYOKU_ALPHAS_COLEMAKDHK - KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, - LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_G, KC_K, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), - LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_D, KC_V, KC_M, KC_H, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), - U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP - #elif defined MIRYOKU_ALPHAS_DVORAK - KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, - LGUI_T(KC_A), LALT_T(KC_O), LCTL_T(KC_E), LSFT_T(KC_U), KC_I, KC_D, LSFT_T(KC_H), LCTL_T(KC_T), LALT_T(KC_N), LGUI_T(KC_S), - LT(BUTTON, KC_SLSH), ALGR_T(KC_Q), KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, ALGR_T(KC_V), LT(BUTTON, KC_Z), - U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP - #elif defined MIRYOKU_ALPHAS_HALMAK - KC_W, KC_L, KC_R, KC_B, KC_Z, KC_QUOT, KC_Q, KC_U, KC_D, KC_J, - LGUI_T(KC_S), LALT_T(KC_H), LCTL_T(KC_N), LSFT_T(KC_T), KC_COMM, KC_DOT, LSFT_T(KC_A), LCTL_T(KC_E), LALT_T(KC_O), LGUI_T(KC_I), - LT(BUTTON, KC_F), ALGR_T(KC_M), KC_V, KC_C, KC_SLSH, KC_G, KC_P, KC_X, ALGR_T(KC_K), LT(BUTTON, KC_Y), - U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP - #elif defined MIRYOKU_ALPHAS_WORKMAN - KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_QUOT, - LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_H), LSFT_T(KC_T), KC_G, KC_Y, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_O), LGUI_T(KC_I), - LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), - U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP - #elif defined MIRYOKU_ALPHAS_QWERTY - KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, - LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, LSFT_T(KC_J), LCTL_T(KC_K), LALT_T(KC_L), LGUI_T(KC_QUOT), - LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), - U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP - #elif defined MIRYOKU_ALPHAS_QWERTZ - KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Z, KC_U, KC_I, KC_O, KC_P, - LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, LSFT_T(KC_J), LCTL_T(KC_K), LALT_T(KC_L), LGUI_T(KC_QUOT), - LT(BUTTON, KC_Y), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), - U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP - #else - KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, - LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_G, KC_M, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), - LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), - U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP - #endif - ), - #if defined MIRYOKU_NAV_INVERTEDT - [NAV] = LAYOUT_miryoku( - KC_PGUP, KC_HOME, KC_UP, KC_END, KC_INS, U_NA, U_NA, U_NA, U_NA, RESET, - KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_CAPS, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, - U_UND, U_CUT, U_CPY, U_PST, U_RDO, U_NA, U_NA, U_NA, KC_ALGR, U_NA, - U_NP, U_NP, KC_DEL, KC_BSPC, KC_ENT, U_NA, U_NA, U_NA, U_NP, U_NP - ), - [MOUSE] = LAYOUT_miryoku( - KC_WH_U, KC_WH_L, KC_MS_U, KC_WH_R, U_NU, U_NA, U_NA, U_NA, U_NA, RESET, - KC_WH_D, KC_MS_L, KC_MS_D, KC_MS_R, U_NU, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, - U_UND, U_CUT, U_CPY, U_PST, U_RDO, U_NA, U_NA, U_NA, KC_ALGR, U_NA, - U_NP, U_NP, KC_BTN2, KC_BTN3, KC_BTN1, U_NA, U_NA, U_NA, U_NP, U_NP - ), - [MEDIA] = LAYOUT_miryoku( - U_NU, U_NU, KC_VOLU, U_NU, U_NU, U_NA, U_NA, U_NA, U_NA, RESET, - U_NU, KC_MPRV, KC_VOLD, KC_MNXT, U_NU, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, - RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, U_NA, U_NA, U_NA, KC_ALGR, U_NA, - U_NP, U_NP, KC_MUTE, KC_MPLY, KC_MSTP, U_NA, U_NA, U_NA, U_NP, U_NP - ), - #else - [NAV] = LAYOUT_miryoku( - KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_INS, U_NA, U_NA, U_NA, U_NA, RESET, - KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_CAPS, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, - U_UND, U_CUT, U_CPY, U_PST, U_RDO, U_NA, U_NA, U_NA, KC_ALGR, U_NA, - U_NP, U_NP, KC_DEL, KC_BSPC, KC_ENT, U_NA, U_NA, U_NA, U_NP, U_NP - ), - [MOUSE] = LAYOUT_miryoku( - KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, U_NU, U_NA, U_NA, U_NA, U_NA, RESET, - KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, U_NU, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, - U_UND, U_CUT, U_CPY, U_PST, U_RDO, U_NA, U_NA, U_NA, KC_ALGR, U_NA, - U_NP, U_NP, KC_BTN2, KC_BTN3, KC_BTN1, U_NA, U_NA, U_NA, U_NP, U_NP - ), - [MEDIA] = LAYOUT_miryoku( - RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, U_NA, U_NA, U_NA, U_NA, RESET, - KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, U_NU, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, - U_NU, U_NU, U_NU, U_NU, U_NU, U_NA, U_NA, U_NA, KC_ALGR, U_NA, - U_NP, U_NP, KC_MUTE, KC_MPLY, KC_MSTP, U_NA, U_NA, U_NA, U_NP, U_NP - ), - #endif - [NUM] = LAYOUT_miryoku( - RESET, U_NA, U_NA, U_NA, U_NA, KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, - KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_EQL, KC_4, KC_5, KC_6, KC_SCLN, - U_NA, KC_ALGR, U_NA, U_NA, U_NA, KC_BSLS, KC_1, KC_2, KC_3, KC_GRV, - U_NP, U_NP, U_NA, U_NA, U_NA, KC_MINS, KC_0, KC_DOT, U_NP, U_NP - ), - [SYM] = LAYOUT_miryoku( - RESET, U_NA, U_NA, U_NA, U_NA, KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR, - KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_PLUS, KC_DLR, KC_PERC, KC_CIRC, KC_COLN, - U_NA, KC_ALGR, U_NA, U_NA, U_NA, KC_PIPE, KC_EXLM, KC_AT, KC_HASH, KC_TILD, - U_NP, U_NP, U_NA, U_NA, U_NA, KC_UNDS, KC_LPRN, KC_RPRN, U_NP, U_NP - ), - [FUN] = LAYOUT_miryoku( - RESET, U_NA, U_NA, U_NA, U_NA, KC_PSCR, KC_F7, KC_F8, KC_F9, KC_F12, - KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_SLCK, KC_F4, KC_F5, KC_F6, KC_F11, - U_NA, KC_ALGR, U_NA, U_NA, U_NA, KC_PAUS, KC_F1, KC_F2, KC_F3, KC_F10, - U_NP, U_NP, U_NA, U_NA, U_NA, KC_TAB, KC_SPC, KC_APP, U_NP, U_NP - ), -#else - [BASE] = LAYOUT_miryoku( - #if defined MIRYOKU_ALPHAS_AZERTY - KC_A, KC_Z, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, - LGUI_T(KC_Q), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, LSFT_T(KC_J), LCTL_T(KC_K), LALT_T(KC_L), LGUI_T(KC_M), - LT(BUTTON, KC_W), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_N, KC_COMM, KC_DOT, ALGR_T(KC_SLSH), LT(BUTTON, KC_QUOT), - U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP - #elif defined MIRYOKU_ALPHAS_COLEMAK - KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, - LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_D, KC_H, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), - LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), - U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP - #elif defined MIRYOKU_ALPHAS_COLEMAKDHK - KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, - LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_G, KC_K, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), - LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_D, KC_V, KC_M, KC_H, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), - U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP - #elif defined MIRYOKU_ALPHAS_DVORAK - KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, - LGUI_T(KC_A), LALT_T(KC_O), LCTL_T(KC_E), LSFT_T(KC_U), KC_I, KC_D, LSFT_T(KC_H), LCTL_T(KC_T), LALT_T(KC_N), LGUI_T(KC_S), - LT(BUTTON, KC_SLSH), ALGR_T(KC_Q), KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, ALGR_T(KC_V), LT(BUTTON, KC_Z), - U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP - #elif defined MIRYOKU_ALPHAS_HALMAK - KC_W, KC_L, KC_R, KC_B, KC_Z, KC_QUOT, KC_Q, KC_U, KC_D, KC_J, - LGUI_T(KC_S), LALT_T(KC_H), LCTL_T(KC_N), LSFT_T(KC_T), KC_COMM, KC_DOT, LSFT_T(KC_A), LCTL_T(KC_E), LALT_T(KC_O), LGUI_T(KC_I), - LT(BUTTON, KC_F), ALGR_T(KC_M), KC_V, KC_C, KC_SLSH, KC_G, KC_P, KC_X, ALGR_T(KC_K), LT(BUTTON, KC_Y), - U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP - #elif defined MIRYOKU_ALPHAS_WORKMAN - KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_QUOT, - LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_H), LSFT_T(KC_T), KC_G, KC_Y, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_O), LGUI_T(KC_I), - LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), - U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP - #elif defined MIRYOKU_ALPHAS_QWERTY - KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, - LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, LSFT_T(KC_J), LCTL_T(KC_K), LALT_T(KC_L), LGUI_T(KC_QUOT), - LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), - U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP - #elif defined MIRYOKU_ALPHAS_QWERTZ - KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Z, KC_U, KC_I, KC_O, KC_P, - LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, LSFT_T(KC_J), LCTL_T(KC_K), LALT_T(KC_L), LGUI_T(KC_QUOT), - LT(BUTTON, KC_Y), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), - U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP + [BASE] = U_MACRO_VA_ARGS(LAYOUT_miryoku, MIRYOKU_LAYER_BASE), + [NAV] = U_MACRO_VA_ARGS(LAYOUT_miryoku, MIRYOKU_LAYER_NAV), + [MOUSE] = U_MACRO_VA_ARGS(LAYOUT_miryoku, MIRYOKU_LAYER_MOUSE), + [MEDIA] = U_MACRO_VA_ARGS(LAYOUT_miryoku, MIRYOKU_LAYER_MEDIA), + [NUM] = U_MACRO_VA_ARGS(LAYOUT_miryoku, MIRYOKU_LAYER_NUM), + [SYM] = U_MACRO_VA_ARGS(LAYOUT_miryoku, MIRYOKU_LAYER_SYM), + [FUN] = U_MACRO_VA_ARGS(LAYOUT_miryoku, MIRYOKU_LAYER_FUN), + [BUTTON] = U_MACRO_VA_ARGS(LAYOUT_miryoku, MIRYOKU_LAYER_BUTTON) +}; + +#if defined (MIRYOKU_KLUDGE_THUMBCOMBOS) +const uint16_t PROGMEM thumbcombos_base_right[] = {LT(SYM, KC_ENT), LT(NUM, KC_BSPC), COMBO_END}; +const uint16_t PROGMEM thumbcombos_base_left[] = {LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), COMBO_END}; +const uint16_t PROGMEM thumbcombos_nav[] = {KC_ENT, KC_BSPC, COMBO_END}; +const uint16_t PROGMEM thumbcombos_mouse[] = {KC_BTN1, KC_BTN3, COMBO_END}; +const uint16_t PROGMEM thumbcombos_media[] = {KC_MSTP, KC_MPLY, COMBO_END}; +const uint16_t PROGMEM thumbcombos_num[] = {KC_0, KC_MINS, COMBO_END}; + #if defined (MIRYOKU_LAYERS_FLIP) +const uint16_t PROGMEM thumbcombos_sym[] = {KC_UNDS, KC_LPRN, COMBO_END}; #else - KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, - LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_G, KC_M, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), - LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), - U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP +const uint16_t PROGMEM thumbcombos_sym[] = {KC_RPRN, KC_UNDS, COMBO_END}; #endif - ), - #if defined MIRYOKU_NAV_VI - [NAV] = LAYOUT_miryoku( - RESET, U_NA, U_NA, U_NA, U_NA, U_RDO, U_PST, U_CPY, U_CUT, U_UND, - KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_CAPS, - U_NA, KC_ALGR, U_NA, U_NA, U_NA, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_INS, - U_NP, U_NP, U_NA, U_NA, U_NA, KC_ENT, KC_BSPC, KC_DEL, U_NP, U_NP - ), - [MOUSE] = LAYOUT_miryoku( - RESET, U_NA, U_NA, U_NA, U_NA, U_RDO, U_PST, U_CPY, U_CUT, U_UND, - KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, U_NU, - U_NA, KC_ALGR, U_NA, U_NA, U_NA, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, U_NU, - U_NP, U_NP, U_NA, U_NA, U_NA, KC_BTN1, KC_BTN3, KC_BTN2, U_NP, U_NP - ), - [MEDIA] = LAYOUT_miryoku( - RESET, U_NA, U_NA, U_NA, U_NA, RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, - KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, U_NU, - U_NA, KC_ALGR, U_NA, U_NA, U_NA, U_NU, U_NU, U_NU, U_NU, U_NU, - U_NP, U_NP, U_NA, U_NA, U_NA, KC_MSTP, KC_MPLY, KC_MUTE, U_NP, U_NP - ), +const uint16_t PROGMEM thumbcombos_fun[] = {KC_SPC, KC_TAB, COMBO_END}; +combo_t key_combos[COMBO_COUNT] = { + COMBO(thumbcombos_base_right, LT(FUN, KC_DEL)), + COMBO(thumbcombos_base_left, LT(MEDIA, KC_ESC)), + COMBO(thumbcombos_nav, KC_DEL), + COMBO(thumbcombos_mouse, KC_BTN2), + COMBO(thumbcombos_media, KC_MUTE), + COMBO(thumbcombos_num, KC_DOT), + #if defined (MIRYOKU_LAYERS_FLIP) + COMBO(thumbcombos_sym, KC_RPRN), #else - [NAV] = LAYOUT_miryoku( - RESET, U_NA, U_NA, U_NA, U_NA, U_RDO, U_PST, U_CPY, U_CUT, U_UND, - KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_CAPS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, - U_NA, KC_ALGR, U_NA, U_NA, U_NA, KC_INS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, - U_NP, U_NP, U_NA, U_NA, U_NA, KC_ENT, KC_BSPC, KC_DEL, U_NP, U_NP - ), - [MOUSE] = LAYOUT_miryoku( - RESET, U_NA, U_NA, U_NA, U_NA, U_RDO, U_PST, U_CPY, U_CUT, U_UND, - KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, U_NU, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, - U_NA, KC_ALGR, U_NA, U_NA, U_NA, U_NU, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, - U_NP, U_NP, U_NA, U_NA, U_NA, KC_BTN1, KC_BTN3, KC_BTN2, U_NP, U_NP - ), - [MEDIA] = LAYOUT_miryoku( - RESET, U_NA, U_NA, U_NA, U_NA, RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, - KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, U_NU, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, - U_NA, KC_ALGR, U_NA, U_NA, U_NA, U_NU, U_NU, U_NU, U_NU, U_NU, - U_NP, U_NP, U_NA, U_NA, U_NA, KC_MSTP, KC_MPLY, KC_MUTE, U_NP, U_NP - ), + COMBO(thumbcombos_sym, KC_LPRN), #endif - [NUM] = LAYOUT_miryoku( - KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, U_NA, U_NA, U_NA, U_NA, RESET, - KC_SCLN, KC_4, KC_5, KC_6, KC_EQL, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, - KC_GRV, KC_1, KC_2, KC_3, KC_BSLS, U_NA, U_NA, U_NA, KC_ALGR, U_NA, - U_NP, U_NP, KC_DOT, KC_0, KC_MINS, U_NA, U_NA, U_NA, U_NP, U_NP - ), - [SYM] = LAYOUT_miryoku( - KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR, U_NA, U_NA, U_NA, U_NA, RESET, - KC_COLN, KC_DLR, KC_PERC, KC_CIRC, KC_PLUS, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, - KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, U_NA, U_NA, U_NA, KC_ALGR, U_NA, - U_NP, U_NP, KC_LPRN, KC_RPRN, KC_UNDS, U_NA, U_NA, U_NA, U_NP, U_NP - ), - [FUN] = LAYOUT_miryoku( - KC_F12, KC_F7, KC_F8, KC_F9, KC_PSCR, U_NA, U_NA, U_NA, U_NA, RESET, - KC_F11, KC_F4, KC_F5, KC_F6, KC_SLCK, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, - KC_F10, KC_F1, KC_F2, KC_F3, KC_PAUS, U_NA, U_NA, U_NA, KC_ALGR, U_NA, - U_NP, U_NP, KC_APP, KC_SPC, KC_TAB, U_NA, U_NA, U_NA, U_NP, U_NP - ), -#endif - [BUTTON] = LAYOUT_miryoku( - U_UND, U_CUT, U_CPY, U_PST, U_RDO, U_RDO, U_PST, U_CPY, U_CUT, U_UND, - KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, KC_TRNS, KC_TRNS, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, - U_UND, U_CUT, U_CPY, U_PST, U_RDO, U_RDO, U_PST, U_CPY, U_CUT, U_UND, - U_NP, U_NP, KC_BTN2, KC_BTN3, KC_BTN1, KC_BTN1, KC_BTN3, KC_BTN2, U_NP, U_NP - ) + COMBO(thumbcombos_fun, KC_APP) }; +#endif diff --git a/users/manna-harbour_miryoku/manna-harbour_miryoku.h b/users/manna-harbour_miryoku/manna-harbour_miryoku.h index 1d14f61710..f6ef63c360 100644 --- a/users/manna-harbour_miryoku/manna-harbour_miryoku.h +++ b/users/manna-harbour_miryoku/manna-harbour_miryoku.h @@ -1,41 +1,41 @@ // Copyright 2019 Manna Harbour // https://github.com/manna-harbour/miryoku -// generated -*- buffer-read-only: t -*- // 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 QMK_KEYBOARD_H +#include "miryoku_babel/miryoku_layer_names.h" +#include "miryoku_babel/miryoku_layer.h" + +#define U_MACRO_VA_ARGS(macro, ...) macro(__VA_ARGS__) #define U_NP KC_NO // key is not present #define U_NA KC_NO // present but not available for use #define U_NU KC_NO // available but not used -enum layers { BASE, BUTTON, MEDIA, NAV, MOUSE, SYM, NUM, FUN }; - -#if defined MIRYOKU_CLIPBOARD_FUN -#define U_RDO KC_AGIN -#define U_PST KC_PSTE -#define U_CPY KC_COPY -#define U_CUT KC_CUT -#define U_UND KC_UNDO -#elif defined MIRYOKU_CLIPBOARD_MAC -#define U_RDO SCMD(KC_Z) -#define U_PST LCMD(KC_V) -#define U_CPY LCMD(KC_C) -#define U_CUT LCMD(KC_X) -#define U_UND LCMD(KC_Z) -#elif defined MIRYOKU_CLIPBOARD_WIN -#define U_RDO C(KC_Y) -#define U_PST C(KC_V) -#define U_CPY C(KC_C) -#define U_CUT C(KC_X) -#define U_UND C(KC_Z) +#if defined (MIRYOKU_CLIPBOARD_FUN) + #define U_RDO KC_AGIN + #define U_PST KC_PSTE + #define U_CPY KC_COPY + #define U_CUT KC_CUT + #define U_UND KC_UNDO +#elif defined (MIRYOKU_CLIPBOARD_MAC) + #define U_RDO SCMD(KC_Z) + #define U_PST LCMD(KC_V) + #define U_CPY LCMD(KC_C) + #define U_CUT LCMD(KC_X) + #define U_UND LCMD(KC_Z) +#elif defined (MIRYOKU_CLIPBOARD_WIN) + #define U_RDO C(KC_Y) + #define U_PST C(KC_V) + #define U_CPY C(KC_C) + #define U_CUT C(KC_X) + #define U_UND C(KC_Z) #else -#define U_RDO KC_AGIN -#define U_PST S(KC_INS) -#define U_CPY C(KC_INS) -#define U_CUT S(KC_DEL) -#define U_UND KC_UNDO + #define U_RDO KC_AGIN + #define U_PST S(KC_INS) + #define U_CPY C(KC_INS) + #define U_CUT S(KC_DEL) + #define U_UND KC_UNDO #endif diff --git a/users/manna-harbour_miryoku/miryoku_babel/miryoku_alternatives.h b/users/manna-harbour_miryoku/miryoku_babel/miryoku_alternatives.h new file mode 100644 index 0000000000..8a0e70a6b5 --- /dev/null +++ b/users/manna-harbour_miryoku/miryoku_babel/miryoku_alternatives.h @@ -0,0 +1,267 @@ +// Copyright 2019 Manna Harbour +// https://github.com/manna-harbour/miryoku +// generated -*- buffer-read-only: t -*- +// target: 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 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 + +#define MIRYOKU_ALTERNATIVES_BASE_AZERTY_FLIP \ +KC_A, KC_Z, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \ +LGUI_T(KC_Q), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, LSFT_T(KC_J), LCTL_T(KC_K), LALT_T(KC_L), LGUI_T(KC_M), \ +LT(BUTTON, KC_W), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_N, KC_COMM, KC_DOT, ALGR_T(KC_SLSH), LT(BUTTON, KC_QUOT), \ +U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_BEAKL15_FLIP \ +KC_Q, KC_H, KC_O, KC_U, KC_X, KC_G, KC_C, KC_R, KC_F, KC_Z, \ +LGUI_T(KC_Y), LALT_T(KC_I), LCTL_T(KC_E), LSFT_T(KC_A), KC_DOT, KC_D, LSFT_T(KC_S), LCTL_T(KC_T), LALT_T(KC_N), LGUI_T(KC_B), \ +LT(BUTTON, KC_J), ALGR_T(KC_SLSH), KC_COMM, KC_K, KC_QUOT, KC_W, KC_M, KC_L, ALGR_T(KC_P), LT(BUTTON, KC_V), \ +U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_COLEMAK_FLIP \ +KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, \ +LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_D, KC_H, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), \ +LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), \ +U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_COLEMAKDH_FLIP \ +KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, \ +LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_G, KC_M, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), \ +LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), \ +U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_COLEMAKDHK_FLIP \ +KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, \ +LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_G, KC_K, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), \ +LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_D, KC_V, KC_M, KC_H, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), \ +U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_DVORAK_FLIP \ +KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, \ +LGUI_T(KC_A), LALT_T(KC_O), LCTL_T(KC_E), LSFT_T(KC_U), KC_I, KC_D, LSFT_T(KC_H), LCTL_T(KC_T), LALT_T(KC_N), LGUI_T(KC_S), \ +LT(BUTTON, KC_SLSH), ALGR_T(KC_Q), KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, ALGR_T(KC_V), LT(BUTTON, KC_Z), \ +U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_HALMAK_FLIP \ +KC_W, KC_L, KC_R, KC_B, KC_Z, KC_QUOT, KC_Q, KC_U, KC_D, KC_J, \ +LGUI_T(KC_S), LALT_T(KC_H), LCTL_T(KC_N), LSFT_T(KC_T), KC_COMM, KC_DOT, LSFT_T(KC_A), LCTL_T(KC_E), LALT_T(KC_O), LGUI_T(KC_I), \ +LT(BUTTON, KC_F), ALGR_T(KC_M), KC_V, KC_C, KC_SLSH, KC_G, KC_P, KC_X, ALGR_T(KC_K), LT(BUTTON, KC_Y), \ +U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_WORKMAN_FLIP \ +KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_QUOT, \ +LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_H), LSFT_T(KC_T), KC_G, KC_Y, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_O), LGUI_T(KC_I), \ +LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), \ +U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_QWERTY_FLIP \ +KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \ +LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, LSFT_T(KC_J), LCTL_T(KC_K), LALT_T(KC_L), LGUI_T(KC_QUOT), \ +LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), \ +U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_QWERTZ_FLIP \ +KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Z, KC_U, KC_I, KC_O, KC_P, \ +LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, LSFT_T(KC_J), LCTL_T(KC_K), LALT_T(KC_L), LGUI_T(KC_QUOT), \ +LT(BUTTON, KC_Y), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), \ +U_NP, U_NP, LT(FUN, KC_DEL), LT(NUM, KC_BSPC), LT(SYM, KC_ENT), LT(MOUSE, KC_TAB), LT(NAV, KC_SPC), LT(MEDIA, KC_ESC), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_AZERTY \ +KC_A, KC_Z, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \ +LGUI_T(KC_Q), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, LSFT_T(KC_J), LCTL_T(KC_K), LALT_T(KC_L), LGUI_T(KC_M), \ +LT(BUTTON, KC_W), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_N, KC_COMM, KC_DOT, ALGR_T(KC_SLSH), LT(BUTTON, KC_QUOT), \ +U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_BEAKL15 \ +KC_Q, KC_H, KC_O, KC_U, KC_X, KC_G, KC_C, KC_R, KC_F, KC_Z, \ +LGUI_T(KC_Y), LALT_T(KC_I), LCTL_T(KC_E), LSFT_T(KC_A), KC_DOT, KC_D, LSFT_T(KC_S), LCTL_T(KC_T), LALT_T(KC_N), LGUI_T(KC_B), \ +LT(BUTTON, KC_J), ALGR_T(KC_SLSH), KC_COMM, KC_K, KC_QUOT, KC_W, KC_M, KC_L, ALGR_T(KC_P), LT(BUTTON, KC_V), \ +U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_COLEMAK \ +KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, \ +LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_D, KC_H, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), \ +LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), \ +U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_COLEMAKDH \ +KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, \ +LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_G, KC_M, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), \ +LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), \ +U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_COLEMAKDHK \ +KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, \ +LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_G, KC_K, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), \ +LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_D, KC_V, KC_M, KC_H, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), \ +U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_DVORAK \ +KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, \ +LGUI_T(KC_A), LALT_T(KC_O), LCTL_T(KC_E), LSFT_T(KC_U), KC_I, KC_D, LSFT_T(KC_H), LCTL_T(KC_T), LALT_T(KC_N), LGUI_T(KC_S), \ +LT(BUTTON, KC_SLSH), ALGR_T(KC_Q), KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, ALGR_T(KC_V), LT(BUTTON, KC_Z), \ +U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_HALMAK \ +KC_W, KC_L, KC_R, KC_B, KC_Z, KC_QUOT, KC_Q, KC_U, KC_D, KC_J, \ +LGUI_T(KC_S), LALT_T(KC_H), LCTL_T(KC_N), LSFT_T(KC_T), KC_COMM, KC_DOT, LSFT_T(KC_A), LCTL_T(KC_E), LALT_T(KC_O), LGUI_T(KC_I), \ +LT(BUTTON, KC_F), ALGR_T(KC_M), KC_V, KC_C, KC_SLSH, KC_G, KC_P, KC_X, ALGR_T(KC_K), LT(BUTTON, KC_Y), \ +U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_WORKMAN \ +KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_QUOT, \ +LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_H), LSFT_T(KC_T), KC_G, KC_Y, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_O), LGUI_T(KC_I), \ +LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), \ +U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_QWERTY \ +KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \ +LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, LSFT_T(KC_J), LCTL_T(KC_K), LALT_T(KC_L), LGUI_T(KC_QUOT), \ +LT(BUTTON, KC_Z), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), \ +U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_BASE_QWERTZ \ +KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Z, KC_U, KC_I, KC_O, KC_P, \ +LGUI_T(KC_A), LALT_T(KC_S), LCTL_T(KC_D), LSFT_T(KC_F), KC_G, KC_H, LSFT_T(KC_J), LCTL_T(KC_K), LALT_T(KC_L), LGUI_T(KC_QUOT), \ +LT(BUTTON, KC_Y), ALGR_T(KC_X), KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, ALGR_T(KC_DOT), LT(BUTTON, KC_SLSH), \ +U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP + + +#define MIRYOKU_ALTERNATIVES_NAV_INVERTEDT_FLIP \ +KC_PGUP, KC_HOME, KC_UP, KC_END, KC_INS, U_NA, U_NA, U_NA, U_NA, RESET, \ +KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_CAPS, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, \ +U_UND, U_CUT, U_CPY, U_PST, U_RDO, U_NA, U_NA, U_NA, KC_ALGR, U_NA, \ +U_NP, U_NP, KC_DEL, KC_BSPC, KC_ENT, U_NA, U_NA, U_NA, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_NAV_FLIP \ +KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_INS, U_NA, U_NA, U_NA, U_NA, RESET, \ +KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_CAPS, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, \ +U_UND, U_CUT, U_CPY, U_PST, U_RDO, U_NA, U_NA, U_NA, KC_ALGR, U_NA, \ +U_NP, U_NP, KC_DEL, KC_BSPC, KC_ENT, U_NA, U_NA, U_NA, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_NAV_INVERTEDT \ +RESET, U_NA, U_NA, U_NA, U_NA, KC_INS, KC_HOME, KC_UP, KC_END, KC_PGUP, \ +KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_CAPS, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, \ +U_NA, KC_ALGR, U_NA, U_NA, U_NA, U_RDO, U_PST, U_CPY, U_CUT, U_UND, \ +U_NP, U_NP, U_NA, U_NA, U_NA, KC_ENT, KC_BSPC, KC_DEL, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_NAV_VI \ +RESET, U_NA, U_NA, U_NA, U_NA, U_RDO, U_PST, U_CPY, U_CUT, U_UND, \ +KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_CAPS, \ +U_NA, KC_ALGR, U_NA, U_NA, U_NA, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_INS, \ +U_NP, U_NP, U_NA, U_NA, U_NA, KC_ENT, KC_BSPC, KC_DEL, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_NAV \ +RESET, U_NA, U_NA, U_NA, U_NA, U_RDO, U_PST, U_CPY, U_CUT, U_UND, \ +KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_CAPS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, \ +U_NA, KC_ALGR, U_NA, U_NA, U_NA, KC_INS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, \ +U_NP, U_NP, U_NA, U_NA, U_NA, KC_ENT, KC_BSPC, KC_DEL, U_NP, U_NP + + +#define MIRYOKU_ALTERNATIVES_MOUSE_INVERTEDT_FLIP \ +KC_WH_U, KC_WH_L, KC_MS_U, KC_WH_R, U_NU, U_NA, U_NA, U_NA, U_NA, RESET, \ +KC_WH_D, KC_MS_L, KC_MS_D, KC_MS_R, U_NU, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, \ +U_UND, U_CUT, U_CPY, U_PST, U_RDO, U_NA, U_NA, U_NA, KC_ALGR, U_NA, \ +U_NP, U_NP, KC_BTN2, KC_BTN3, KC_BTN1, U_NA, U_NA, U_NA, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_MOUSE_FLIP \ +KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, U_NU, U_NA, U_NA, U_NA, U_NA, RESET, \ +KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, U_NU, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, \ +U_UND, U_CUT, U_CPY, U_PST, U_RDO, U_NA, U_NA, U_NA, KC_ALGR, U_NA, \ +U_NP, U_NP, KC_BTN2, KC_BTN3, KC_BTN1, U_NA, U_NA, U_NA, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_MOUSE_INVERTEDT \ +RESET, U_NA, U_NA, U_NA, U_NA, U_NU, KC_WH_L, KC_MS_U, KC_WH_R, KC_WH_U, \ +KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, U_NU, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_D, \ +U_NA, KC_ALGR, U_NA, U_NA, U_NA, U_RDO, U_PST, U_CPY, U_CUT, U_UND, \ +U_NP, U_NP, U_NA, U_NA, U_NA, KC_BTN1, KC_BTN3, KC_BTN2, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_MOUSE_VI \ +RESET, U_NA, U_NA, U_NA, U_NA, U_RDO, U_PST, U_CPY, U_CUT, U_UND, \ +KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, U_NU, \ +U_NA, KC_ALGR, U_NA, U_NA, U_NA, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, U_NU, \ +U_NP, U_NP, U_NA, U_NA, U_NA, KC_BTN1, KC_BTN3, KC_BTN2, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_MOUSE \ +RESET, U_NA, U_NA, U_NA, U_NA, U_RDO, U_PST, U_CPY, U_CUT, U_UND, \ +KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, U_NU, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, \ +U_NA, KC_ALGR, U_NA, U_NA, U_NA, U_NU, KC_WH_L, KC_WH_D, KC_WH_U, KC_WH_R, \ +U_NP, U_NP, U_NA, U_NA, U_NA, KC_BTN1, KC_BTN3, KC_BTN2, U_NP, U_NP + + +#define MIRYOKU_ALTERNATIVES_MEDIA_INVERTEDT_FLIP \ +RGB_SAI, RGB_HUI, KC_VOLU, RGB_MOD, RGB_TOG, U_NA, U_NA, U_NA, U_NA, RESET, \ +RGB_VAI, KC_MPRV, KC_VOLD, KC_MNXT, OUT_AUTO, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, \ +U_NU, U_NU, U_NU, U_NU, U_NU, U_NA, U_NA, U_NA, KC_ALGR, U_NA, \ +U_NP, U_NP, KC_MUTE, KC_MPLY, KC_MSTP, U_NA, U_NA, U_NA, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_MEDIA_FLIP \ +RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, U_NA, U_NA, U_NA, U_NA, RESET, \ +KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, OUT_AUTO, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, \ +U_NU, U_NU, U_NU, U_NU, U_NU, U_NA, U_NA, U_NA, KC_ALGR, U_NA, \ +U_NP, U_NP, KC_MUTE, KC_MPLY, KC_MSTP, U_NA, U_NA, U_NA, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_MEDIA_INVERTEDT \ +RESET, U_NA, U_NA, U_NA, U_NA, RGB_TOG, RGB_MOD, KC_VOLU, RGB_HUI, RGB_SAI, \ +KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, OUT_AUTO, KC_MPRV, KC_VOLD, KC_MNXT, RGB_VAI, \ +U_NA, KC_ALGR, U_NA, U_NA, U_NA, U_NU, U_NU, U_NU, U_NU, U_NU, \ +U_NP, U_NP, U_NA, U_NA, U_NA, KC_MSTP, KC_MPLY, KC_MUTE, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_MEDIA_VI \ +RESET, U_NA, U_NA, U_NA, U_NA, RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, \ +KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, OUT_AUTO, \ +U_NA, KC_ALGR, U_NA, U_NA, U_NA, U_NU, U_NU, U_NU, U_NU, U_NU, \ +U_NP, U_NP, U_NA, U_NA, U_NA, KC_MSTP, KC_MPLY, KC_MUTE, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_MEDIA \ +RESET, U_NA, U_NA, U_NA, U_NA, RGB_TOG, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, \ +KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, OUT_AUTO, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT, \ +U_NA, KC_ALGR, U_NA, U_NA, U_NA, U_NU, U_NU, U_NU, U_NU, U_NU, \ +U_NP, U_NP, U_NA, U_NA, U_NA, KC_MSTP, KC_MPLY, KC_MUTE, U_NP, U_NP + + +#define MIRYOKU_ALTERNATIVES_NUM_FLIP \ +RESET, U_NA, U_NA, U_NA, U_NA, KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, \ +KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_EQL, KC_4, KC_5, KC_6, KC_SCLN, \ +U_NA, KC_ALGR, U_NA, U_NA, U_NA, KC_BSLS, KC_1, KC_2, KC_3, KC_GRV, \ +U_NP, U_NP, U_NA, U_NA, U_NA, KC_MINS, KC_0, KC_DOT, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_NUM \ +KC_LBRC, KC_7, KC_8, KC_9, KC_RBRC, U_NA, U_NA, U_NA, U_NA, RESET, \ +KC_SCLN, KC_4, KC_5, KC_6, KC_EQL, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, \ +KC_GRV, KC_1, KC_2, KC_3, KC_BSLS, U_NA, U_NA, U_NA, KC_ALGR, U_NA, \ +U_NP, U_NP, KC_DOT, KC_0, KC_MINS, U_NA, U_NA, U_NA, U_NP, U_NP + + +#define MIRYOKU_ALTERNATIVES_SYM_FLIP \ +RESET, U_NA, U_NA, U_NA, U_NA, KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR, \ +KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_PLUS, KC_DLR, KC_PERC, KC_CIRC, KC_COLN, \ +U_NA, KC_ALGR, U_NA, U_NA, U_NA, KC_PIPE, KC_EXLM, KC_AT, KC_HASH, KC_TILD, \ +U_NP, U_NP, U_NA, U_NA, U_NA, KC_UNDS, KC_LPRN, KC_RPRN, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_SYM \ +KC_LCBR, KC_AMPR, KC_ASTR, KC_LPRN, KC_RCBR, U_NA, U_NA, U_NA, U_NA, RESET, \ +KC_COLN, KC_DLR, KC_PERC, KC_CIRC, KC_PLUS, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, \ +KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_PIPE, U_NA, U_NA, U_NA, KC_ALGR, U_NA, \ +U_NP, U_NP, KC_LPRN, KC_RPRN, KC_UNDS, U_NA, U_NA, U_NA, U_NP, U_NP + + +#define MIRYOKU_ALTERNATIVES_FUN_FLIP \ +RESET, U_NA, U_NA, U_NA, U_NA, KC_PSCR, KC_F7, KC_F8, KC_F9, KC_F12, \ +KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_SLCK, KC_F4, KC_F5, KC_F6, KC_F11, \ +U_NA, KC_ALGR, U_NA, U_NA, U_NA, KC_PAUS, KC_F1, KC_F2, KC_F3, KC_F10, \ +U_NP, U_NP, U_NA, U_NA, U_NA, KC_TAB, KC_SPC, KC_APP, U_NP, U_NP + +#define MIRYOKU_ALTERNATIVES_FUN \ +KC_F12, KC_F7, KC_F8, KC_F9, KC_PSCR, U_NA, U_NA, U_NA, U_NA, RESET, \ +KC_F11, KC_F4, KC_F5, KC_F6, KC_SLCK, U_NA, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, \ +KC_F10, KC_F1, KC_F2, KC_F3, KC_PAUS, U_NA, U_NA, U_NA, KC_ALGR, U_NA, \ +U_NP, U_NP, KC_APP, KC_SPC, KC_TAB, U_NA, U_NA, U_NA, U_NP, U_NP + + +#define MIRYOKU_ALTERNATIVES_BUTTON \ +U_UND, U_CUT, U_CPY, U_PST, U_RDO, U_RDO, U_PST, U_CPY, U_CUT, U_UND, \ +KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, KC_NO, KC_NO, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, \ +U_UND, U_CUT, U_CPY, U_PST, U_RDO, U_RDO, U_PST, U_CPY, U_CUT, U_UND, \ +U_NP, U_NP, KC_BTN2, KC_BTN3, KC_BTN1, KC_BTN1, KC_BTN3, KC_BTN2, U_NP, U_NP diff --git a/users/manna-harbour_miryoku/miryoku_babel/miryoku_layer.h b/users/manna-harbour_miryoku/miryoku_babel/miryoku_layer.h new file mode 100644 index 0000000000..025bf3914c --- /dev/null +++ b/users/manna-harbour_miryoku/miryoku_babel/miryoku_layer.h @@ -0,0 +1,139 @@ +// Copyright 2019 Manna Harbour +// https://github.com/manna-harbour/miryoku +// generated -*- buffer-read-only: t -*- + +// 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 "miryoku_alternatives.h" + +#if !defined(MIRYOKU_LAYER_BASE) + #if defined (MIRYOKU_LAYERS_FLIP) + #if defined (MIRYOKU_ALPHAS_AZERTY) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_AZERTY_FLIP + #elif defined (MIRYOKU_ALPHAS_BEAKL15) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_BEAKL15_FLIP + #elif defined (MIRYOKU_ALPHAS_COLEMAK) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_COLEMAK_FLIP + #elif defined (MIRYOKU_ALPHAS_COLEMAKDHK) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_COLEMAKDHK_FLIP + #elif defined (MIRYOKU_ALPHAS_DVORAK) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_DVORAK_FLIP + #elif defined (MIRYOKU_ALPHAS_HALMAK) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_HALMAK_FLIP + #elif defined (MIRYOKU_ALPHAS_WORKMAN) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_WORKMAN_FLIP + #elif defined (MIRYOKU_ALPHAS_QWERTY) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_QWERTY_FLIP + #elif defined (MIRYOKU_ALPHAS_QWERTZ) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_QWERTZ_FLIP + #else + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_COLEMAKDH_FLIP + #endif + #else + #if defined (MIRYOKU_ALPHAS_AZERTY) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_AZERTY + #elif defined (MIRYOKU_ALPHAS_BEAKL15) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_BEAKL15 + #elif defined (MIRYOKU_ALPHAS_COLEMAK) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_COLEMAK + #elif defined (MIRYOKU_ALPHAS_COLEMAKDHK) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_COLEMAKDHK + #elif defined (MIRYOKU_ALPHAS_DVORAK) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_DVORAK + #elif defined (MIRYOKU_ALPHAS_HALMAK) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_HALMAK + #elif defined (MIRYOKU_ALPHAS_WORKMAN) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_WORKMAN + #elif defined (MIRYOKU_ALPHAS_QWERTY) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_QWERTY + #elif defined (MIRYOKU_ALPHAS_QWERTZ) + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_QWERTZ + #else + #define MIRYOKU_LAYER_BASE MIRYOKU_ALTERNATIVES_BASE_COLEMAKDH + #endif + #endif +#endif + +#if !defined(MIRYOKU_LAYER_NAV) + #if defined (MIRYOKU_LAYERS_FLIP) + #if defined (MIRYOKU_NAV_INVERTEDT) + #define MIRYOKU_LAYER_NAV MIRYOKU_ALTERNATIVES_NAV_INVERTEDT_FLIP + #else + #define MIRYOKU_LAYER_NAV MIRYOKU_ALTERNATIVES_NAV_FLIP + #endif + #else + #if defined (MIRYOKU_NAV_INVERTEDT) + #define MIRYOKU_LAYER_NAV MIRYOKU_ALTERNATIVES_NAV_INVERTEDT + #elif defined (MIRYOKU_NAV_VI) + #define MIRYOKU_LAYER_NAV MIRYOKU_ALTERNATIVES_NAV_VI + #else + #define MIRYOKU_LAYER_NAV MIRYOKU_ALTERNATIVES_NAV + #endif + #endif +#endif + +#if !defined(MIRYOKU_LAYER_MOUSE) + #if defined (MIRYOKU_LAYERS_FLIP) + #if defined (MIRYOKU_NAV_INVERTEDT) + #define MIRYOKU_LAYER_MOUSE MIRYOKU_ALTERNATIVES_MOUSE_INVERTEDT_FLIP + #else + #define MIRYOKU_LAYER_MOUSE MIRYOKU_ALTERNATIVES_MOUSE_FLIP + #endif + #else + #if defined (MIRYOKU_NAV_INVERTEDT) + #define MIRYOKU_LAYER_MOUSE MIRYOKU_ALTERNATIVES_MOUSE_INVERTEDT + #elif defined (MIRYOKU_NAV_VI) + #define MIRYOKU_LAYER_MOUSE MIRYOKU_ALTERNATIVES_MOUSE_VI + #else + #define MIRYOKU_LAYER_MOUSE MIRYOKU_ALTERNATIVES_MOUSE + #endif + #endif +#endif + +#if !defined(MIRYOKU_LAYER_MEDIA) + #if defined (MIRYOKU_LAYERS_FLIP) + #if defined (MIRYOKU_NAV_INVERTEDT) + #define MIRYOKU_LAYER_MEDIA MIRYOKU_ALTERNATIVES_MEDIA_INVERTEDT_FLIP + #else + #define MIRYOKU_LAYER_MEDIA MIRYOKU_ALTERNATIVES_MEDIA_FLIP + #endif + #else + #if defined (MIRYOKU_NAV_INVERTEDT) + #define MIRYOKU_LAYER_MEDIA MIRYOKU_ALTERNATIVES_MEDIA_INVERTEDT + #elif defined (MIRYOKU_NAV_VI) + #define MIRYOKU_LAYER_MEDIA MIRYOKU_ALTERNATIVES_MEDIA_VI + #else + #define MIRYOKU_LAYER_MEDIA MIRYOKU_ALTERNATIVES_MEDIA + #endif + #endif +#endif + +#if !defined(MIRYOKU_LAYER_NUM) + #if defined (MIRYOKU_LAYERS_FLIP) + #define MIRYOKU_LAYER_NUM MIRYOKU_ALTERNATIVES_NUM_FLIP + #else + #define MIRYOKU_LAYER_NUM MIRYOKU_ALTERNATIVES_NUM + #endif +#endif + +#if !defined(MIRYOKU_LAYER_SYM) + #if defined (MIRYOKU_LAYERS_FLIP) + #define MIRYOKU_LAYER_SYM MIRYOKU_ALTERNATIVES_SYM_FLIP + #else + #define MIRYOKU_LAYER_SYM MIRYOKU_ALTERNATIVES_SYM + #endif +#endif + +#if !defined(MIRYOKU_LAYER_FUN) + #if defined (MIRYOKU_LAYERS_FLIP) + #define MIRYOKU_LAYER_FUN MIRYOKU_ALTERNATIVES_FUN_FLIP + #else + #define MIRYOKU_LAYER_FUN MIRYOKU_ALTERNATIVES_FUN + #endif +#endif + +#if !defined(MIRYOKU_LAYER_BUTTON) + #define MIRYOKU_LAYER_BUTTON MIRYOKU_ALTERNATIVES_BUTTON +#endif diff --git a/users/manna-harbour_miryoku/miryoku_babel/miryoku_layer_names.h b/users/manna-harbour_miryoku/miryoku_babel/miryoku_layer_names.h new file mode 100644 index 0000000000..87e1f18d8c --- /dev/null +++ b/users/manna-harbour_miryoku/miryoku_babel/miryoku_layer_names.h @@ -0,0 +1,9 @@ +// Copyright 2019 Manna Harbour +// https://github.com/manna-harbour/miryoku +// generated -*- buffer-read-only: t -*- + +// 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/>. + +#if !defined (MIRYOKU_LAYER_NAMES) + #define MIRYOKU_LAYER_NAMES BASE, BUTTON, NAV, MOUSE, MEDIA, NUM, SYM, FUN +#endif diff --git a/users/manna-harbour_miryoku/post_rules.mk b/users/manna-harbour_miryoku/post_rules.mk new file mode 100644 index 0000000000..8fece85e66 --- /dev/null +++ b/users/manna-harbour_miryoku/post_rules.mk @@ -0,0 +1,37 @@ +# Copyright 2019 Manna Harbour +# https://github.com/manna-harbour/miryoku + +# alternative layouts: + +# alphas +ifneq ($(strip $(MIRYOKU_ALPHAS)),) + OPT_DEFS += -DMIRYOKU_ALPHAS_$(MIRYOKU_ALPHAS) +endif + +# nav +ifneq ($(strip $(MIRYOKU_NAV)),) + OPT_DEFS += -DMIRYOKU_NAV_$(MIRYOKU_NAV) +endif + +# clipboard +ifneq ($(strip $(MIRYOKU_CLIPBOARD)),) + OPT_DEFS += -DMIRYOKU_CLIPBOARD_$(MIRYOKU_CLIPBOARD) +endif + +# layers +ifneq ($(strip $(MIRYOKU_LAYERS)),) + OPT_DEFS += -DMIRYOKU_LAYERS_$(MIRYOKU_LAYERS) +endif + +# subset mappings +ifneq ($(strip $(MIRYOKU_MAPPING)),) + OPT_DEFS += -DMIRYOKU_MAPPING_$(MIRYOKU_MAPPING) +endif + +# kludges: + +# thumb combos +ifeq ($(strip $(MIRYOKU_KLUDGE_THUMBCOMBOS)),yes) + COMBO_ENABLE = yes + OPT_DEFS += -DMIRYOKU_KLUDGE_THUMBCOMBOS +endif diff --git a/users/manna-harbour_miryoku/readme.org b/users/manna-harbour_miryoku/readme.org index b904738a67..9e3e587240 100644 --- a/users/manna-harbour_miryoku/readme.org +++ b/users/manna-harbour_miryoku/readme.org @@ -1,10 +1,11 @@ -# After making changes to code or tables call org-babel-tangle (C-c C-v t). +# Copyright 2022 Manna Harbour +# https://github.com/manna-harbour/miryoku * Miryoku QMK [[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/logos/miryoku-roa-32.png]] [[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/cover/miryoku-kle-cover.png]] -[[https://github.com/manna-harbour/miryoku/][Miryoku]] is an ergonomic, minimal, orthogonal, and universal keyboard layout. This is the Miryoku implementation for [[https://qmk.fm][QMK]]. +[[https://github.com/manna-harbour/miryoku/][Miryoku]] is an ergonomic, minimal, orthogonal, and universal keyboard layout. [[https://github.com/manna-harbour/miryoku_qmk/tree/miryoku/users/manna-harbour_miryoku][Miryoku QMK]] is the Miryoku implementation for [[https://qmk.fm][QMK]]. ** Branches @@ -33,833 +34,77 @@ git checkout --track miryoku_qmk/miryoku #+END_SRC -** Layout +** Building -*** General Principles -- Use layers instead of reaching. -- Use both hands instead of contortions. -- Use the home positions as much as possible. -- Make full use of the thumbs. -- Avoid unnecessary complication. +*** Local Builds +First [[https://docs.qmk.fm/#/newbs_getting_started][set up the QMK build environment and build the default keymap for your keyboard]]. -*** Details +Build with ~manna-harbour_miryoku~ as the keymap name. Customised defaults for [[https://github.com/manna-harbour/miryoku/tree/master/docs/reference#alternative-layouts][alternative layout]] options can be set in [[#userspace][custom_rules.mk]]. Options can also be set or overridden at build time. -- 5 columns, 3 rows, 3 thumb keys, 2 hands. -- Can be used on almost any split or non-split ergo or ortho keyboard. -- Includes all keys found on a US layout TKL keyboard, plus media keys and mouse - emulation. -- Home row is the middle row, home thumb key is the middle thumb key. -- Maximum 1-u movement from home position for fingers and thumbs, and only along - one axis (except for the inner index finger column which is deprioritised - compared with the home columns). -- Dual-function modifiers on home row, mirrored on both hands. -- Dual-function layer change on thumbs. -- Layers are designed orthogonally with a single purpose per hand and are - accessed by holding a thumb key on the opposite hand. -- All layers on the same hand are based on the same basic key arrangement. -- Holding layer change and modifiers on one hand combined with a single key - press on the other hand can produce any combination of modifiers and single - keys without any finger contortions. -- Single function mods are also defined on layers on the same hand as the layer - change thumb key so layer change and mods can be held in any order or - simultaneously without race conditions. -- As mods are only enabled on the opposite hand, auto-repeat is available on the - home row on layers for use with cursor and mouse keys. -- Tap-hold auto-repeat is disabled to permit faster tap-hold switching on - thumbs, but thumb tap keys are mirrored onto some layers for use with - auto-repeat. On other layers thumb keys are redefined with important - functions for that layer. -- Auto Shift for numbers and symbols. +**** qmk -*** Layers +Build with the ~qmk~ command. E.g. -[[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/layers/miryoku-kle-reference.png]] - -The layers are maintained in tables. ~U_NP~ indicates the key is not present -and is used to fill in the table around the thumb keys. The grid arrangement of -the tables does not imply a particular physical layout. - -Basic keycodes are entered without the ~KC_~ prefix. Symbols can be entered -as-is, except for '-' (~MINS~), '.' (~DOT~), '|' (~PIPE~), and '"' (~DQUO~). -Empty cells are unused. - -The base layer is maintained as separate tables for tap alphas, tap thumbs, and -hold. Other layers are specified as a single hand including thumbs. Tables are -combined to produce the keymap for each layer. - -Mods (and reset) will be available on sub layers on the same hand as the layer -change thumb key. Unknown names are considered to be layer names. - - -**** Base - -[[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/layers/miryoku-kle-base.png]] - -The base layer alphas are Colemak Mod-DH. Dot, comma, slash, and apostrophe are -included with the alphas. The primary, secondary, and tertiary thumb keys are -backspace, enter, delete on the right and space, tab, escape on the left. - -Alternative alpha arrangements are also available. - - -***** Tap - - -****** Alphas - -#+NAME: colemakdh -| Q | W | F | P | B | J | L | U | Y | ' | -| A | R | S | T | G | M | N | E | I | O | -| Z | X | C | D | V | K | H | , | DOT | / | - - -****** Thumbs - -#+NAME: thumbs -| U_NP | U_NP | ESC | SPC | TAB | ENT | BSPC | DEL | U_NP | U_NP | - - -***** Hold - -#+NAME: hold -| RESET | | | | | | | | | RESET | -| LGUI | LALT | LCTL | LSFT | | | LSFT | LCTL | LALT | LGUI | -| BUTTON | ALGR | | | | | | | ALGR | BUTTON | -| U_NP | U_NP | MEDIA | NAV | MOUSE | SYM | NUM | FUN | U_NP | U_NP | - - -**** Nav - -[[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/layers/miryoku-kle-nav.png]] - -Primary right-hand layer (left home thumb) is navigation and editing. Cursor -keys are on the home position, line and page movement below, clipboard above, -caps lock and insert on the inner column. Thumb keys are duplicated from the -base layer to avoid having to layer change mid edit and to enable auto-repeat. - -Alternative clipboard key mappings and navigation key arrangements are -available. - -#+NAME: nav-r -| U_RDO | U_PST | U_CPY | U_CUT | U_UND | -| CAPS | LEFT | DOWN | UP | RGHT | -| INS | HOME | PGDN | PGUP | END | -| ENT | BSPC | DEL | U_NP | U_NP | - - -**** Mouse - -[[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/layers/miryoku-kle-mouse.png]] - -Secondary right-hand layer is mouse emulation. Mouse movement mirrors cursor -navigation on home and wheel mirrors line / page movement below. Buttons are on -the thumbs (L, M, R). Mouse movement, click, and drag, with modifiers, can be -performed from the home position. Clipboard keys are duplicated from the Nav -layer. - -#+NAME: mouse-r -| U_RDO | U_PST | U_CPY | U_CUT | U_UND | -| | MS_L | MS_D | MS_U | MS_R | -| | WH_L | WH_D | WH_U | WH_R | -| BTN1 | BTN3 | BTN2 | U_NP | U_NP | - - -**** Button - -[[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/layers/miryoku-kle-button.png]] - -Provides mouse buttons, mods, and clipboard keys for use with integrated or -external pointing devices, used with either hand. The layer is available for -automatic activation depending on hardware and configuration. It can also be -activated manually by holding a bottom row pinkie key (however GUI and Undo will -be unavailable). - -#+NAME: button -| U_UND | U_CUT | U_CPY | U_PST | U_RDO | U_RDO | U_PST | U_CPY | U_CUT | U_UND | -| LGUI | LALT | LCTL | LSFT | | | LSFT | LCTL | LALT | LGUI | -| U_UND | U_CUT | U_CPY | U_PST | U_RDO | U_RDO | U_PST | U_CPY | U_CUT | U_UND | -| U_NP | U_NP | BTN2 | BTN3 | BTN1 | BTN1 | BTN3 | BTN2 | U_NP | U_NP | - - -**** Media - -[[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/layers/miryoku-kle-media.png]] - -Tertiary right-hand layer is media control, with volume up / down and next / -prev mirroring the navigation keys. Pause, stop and mute are on thumbs. RGB -control is on the top row (combine with shift to invert). Unused keys are -available for other related functions. - -#+NAME: media-r -| RGB_TOG | RGB_MOD | RGB_HUI | RGB_SAI | RGB_VAI | -| | MPRV | VOLD | VOLU | MNXT | -| | | | | | -| MSTP | MPLY | MUTE | U_NP | U_NP | - - -**** Num - -[[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/layers/miryoku-kle-num.png]] - -Primary left-hand layer (right home thumb) is numerals and symbols. Numerals -are in the standard numpad locations with symbols in the remaining positions. -Dot is duplicated from the base layer. - -#+NAME: num-l -| [ | 7 | 8 | 9 | ] | -| ; | 4 | 5 | 6 | = | -| ` | 1 | 2 | 3 | \ | -| U_NP | U_NP | DOT | 0 | MINS | - - -**** Sym - -[[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/layers/miryoku-kle-sym.png]] - -Secondary left-hand layer has shifted symbols in the same locations to reduce -chording when using mods with shifted symbols. Open parenthesis is duplicated -next to close parenthesis. - -#+NAME: sym-l -| { | & | * | ( | } | -| : | $ | % | ^ | + | -| ~ | ! | @ | # | PIPE | -| U_NP | U_NP | ( | ) | _ | - - -**** Fun - -[[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/layers/miryoku-kle-fun.png]] - -Tertiary left-hand layer has function keys mirroring the numerals on the primary -layer with extras on the pinkie column, plus system keys on the inner column. -App (menu) is on the tertiary thumb key and other thumb keys are duplicated from -the base layer to enable auto-repeat. - - -#+NAME: fun-l -| F12 | F7 | F8 | F9 | PSCR | -| F11 | F4 | F5 | F6 | SLCK | -| F10 | F1 | F2 | F3 | PAUS | -| U_NP | U_NP | APP | SPC | TAB | - - -**** Alternative Layouts - -The defaults are recommended, but alternative layouts are provided to -accommodate existing muscle memory and platform differences. - - -***** Alphas - -To select, append the corresponding option to the ~make~ command line when -building, e.g. ~MIRYOKU_ALPHAS=QWERTY~. - - -****** AZERTY - -~MIRYOKU_ALPHAS=AZERTY~ - -#+NAME: azerty -| A | Z | E | R | T | Y | U | I | O | P | -| Q | S | D | F | G | H | J | K | L | M | -| W | X | C | V | B | N | , | DOT | / | ' | - - -****** Colemak - -~MIRYOKU_ALPHAS=COLEMAK~ - -#+NAME: colemak -| Q | W | F | P | G | J | L | U | Y | ' | -| A | R | S | T | D | H | N | E | I | O | -| Z | X | C | V | B | K | M | , | DOT | / | - - -****** Colemak Mod-DHk - -~MIRYOKU_ALPHAS=COLEMAKDHK~ - -#+NAME: colemakdhk -| Q | W | F | P | B | J | L | U | Y | ' | -| A | R | S | T | G | K | N | E | I | O | -| Z | X | C | D | V | M | H | , | DOT | / | - - -****** Dvorak - -~MIRYOKU_ALPHAS=DVORAK~ - -#+NAME: dvorak -| ' | , | DOT | P | Y | F | G | C | R | L | -| A | O | E | U | I | D | H | T | N | S | -| / | Q | J | K | X | B | M | W | V | Z | - - -****** Halmak - -~MIRYOKU_ALPHAS=HALMAK~ - -#+NAME: halmak -| W | L | R | B | Z | ' | Q | U | D | J | -| S | H | N | T | , | DOT | A | E | O | I | -| F | M | V | C | / | G | P | X | K | Y | - - -****** Workman - -~MIRYOKU_ALPHAS=WORKMAN~ - -#+NAME: workman -| Q | D | R | W | B | J | F | U | P | ' | -| A | S | H | T | G | Y | N | E | O | I | -| Z | X | M | C | V | K | L | , | DOT | / | - - -****** QWERTY - -~MIRYOKU_ALPHAS=QWERTY~ - -#+NAME: qwerty -| Q | W | E | R | T | Y | U | I | O | P | -| A | S | D | F | G | H | J | K | L | ' | -| Z | X | C | V | B | N | M | , | DOT | / | - - -****** QWERTZ - -~MIRYOKU_ALPHAS=QWERTZ~ - -#+NAME: qwertz -| Q | W | E | R | T | Z | U | I | O | P | -| A | S | D | F | G | H | J | K | L | ' | -| Y | X | C | V | B | N | M | , | DOT | / | - - -***** Nav - - -****** vi-Style - -To select, append ~MIRYOKU_NAV=VI~ to the ~make~ command line when building. -Not available with ~MIRYOKU_LAYERS=FLIP~. - - -******* Nav - -#+NAME: nav-r-vi -| U_RDO | U_PST | U_CPY | U_CUT | U_UND | -| LEFT | DOWN | UP | RGHT | CAPS | -| HOME | PGDN | PGUP | END | INS | -| ENT | BSPC | DEL | U_NP | U_NP | - - -******* Mouse - -#+NAME: mouse-r-vi -| U_RDO | U_PST | U_CPY | U_CUT | U_UND | -| MS_L | MS_D | MS_U | MS_R | | -| WH_L | WH_D | WH_U | WH_R | | -| BTN1 | BTN3 | BTN2 | U_NP | U_NP | - - -******* Media - -#+NAME: media-r-vi -| RGB_TOG | RGB_MOD | RGB_HUI | RGB_SAI | RGB_VAI | -| MPRV | VOLD | VOLU | MNXT | | -| | | | | | -| MSTP | MPLY | MUTE | U_NP | U_NP | - - -****** Inverted-T - -[[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/layers/miryoku-kle-reference-flip-invertedt.png]] - -To select, append ~MIRYOKU_NAV=INVERTEDT~ to the ~make~ command line when -building. Only available with ~MIRYOKU_LAYERS=FLIP~. - - -******* Nav - -#+NAME: nav-l-invertedt -| PGUP | HOME | UP | END | INS | -| PGDN | LEFT | DOWN | RGHT | CAPS | -| U_UND | U_CUT | U_CPY | U_PST | U_RDO | -| U_NP | U_NP | DEL | BSPC | ENT | - - -******* Mouse - -#+NAME: mouse-l-invertedt -| WH_U | WH_L | MS_U | WH_R | | -| WH_D | MS_L | MS_D | MS_R | | -| U_UND | U_CUT | U_CPY | U_PST | U_RDO | -| U_NP | U_NP | BTN2 | BTN3 | BTN1 | - - -******* Media - -#+NAME: media-l-invertedt -| | | VOLU | | | -| | MPRV | VOLD | MNXT | | -| RGB_MOD | RGB_HUI | RGB_SAI | RGB_VAI | RGB_TOG | -| U_NP | U_NP | MUTE | MPLY | MSTP | - - -***** Clipboard - -Keycodes are translated according to the following tables. - -By default, the main clipboard keys (cut, copy, and paste) use the CUA bindings -and should work in general unix and windows applications, emacs, and terminal -emulators. The additional keys (undo, redo) usually require rebinding in the -application. - -To select, append the corresponding option to the ~make~ command line when -building, e.g. ~MIRYOKU_CLIPBOARD=WIN~. - - -****** Default - -#+NAME: clipboard -| U_RDO | AGIN | -| U_PST | S(KC_INS) | -| U_CPY | C(KC_INS) | -| U_CUT | S(KC_DEL) | -| U_UND | UNDO | - - -****** Fun Cluster - -~MIRYOKU_CLIPBOARD=FUN~ - -#+NAME: clipboard-fun -| U_RDO | AGIN | -| U_PST | PSTE | -| U_CPY | COPY | -| U_CUT | CUT | -| U_UND | UNDO | - - -****** Mac - -~MIRYOKU_CLIPBOARD=MAC~ - -#+NAME: clipboard-mac -| U_RDO | SCMD(KC_Z) | -| U_PST | LCMD(KC_V) | -| U_CPY | LCMD(KC_C) | -| U_CUT | LCMD(KC_X) | -| U_UND | LCMD(KC_Z) | - - -****** Windows - -~MIRYOKU_CLIPBOARD=WIN~ - -#+NAME: clipboard-win -| U_RDO | C(KC_Y) | -| U_PST | C(KC_V) | -| U_CPY | C(KC_C) | -| U_CUT | C(KC_X) | -| U_UND | C(KC_Z) | - - -***** Layers - - -****** Flip - -Flip base layer thumb keys and sub layers between right and left hands. - -To select, append ~MIRYOKU_LAYERS=FLIP~ to the ~make~ command line when building. - - -******* Thumbs - -#+NAME: thumbs-flip -| U_NP | U_NP | DEL | BSPC | ENT | TAB | SPC | ESC | U_NP | U_NP | - - -******* Hold - -#+NAME: hold-flip -| RESET | | | | | | | | | RESET | -| LGUI | LALT | LCTL | LSFT | | | LSFT | LCTL | LALT | LGUI | -| BUTTON | ALGR | | | | | | | ALGR | BUTTON | -| U_NP | U_NP | FUN | NUM | SYM | MOUSE | NAV | MEDIA | U_NP | U_NP | - - -******* Nav - -#+NAME: nav-l -| HOME | PGDN | PGUP | END | INS | -| LEFT | DOWN | UP | RGHT | CAPS | -| U_UND | U_CUT | U_CPY | U_PST | U_RDO | -| U_NP | U_NP | DEL | BSPC | ENT | - - -******* Mouse - -#+NAME: mouse-l -| WH_L | WH_D | WH_U | WH_R | | -| MS_L | MS_D | MS_U | MS_R | | -| U_UND | U_CUT | U_CPY | U_PST | U_RDO | -| U_NP | U_NP | BTN2 | BTN3 | BTN1 | - - -******* Media - -#+NAME: media-l -| RGB_MOD | RGB_HUI | RGB_SAI | RGB_VAI | RGB_TOG | -| MPRV | VOLD | VOLU | MNXT | | -| | | | | | -| U_NP | U_NP | MUTE | MPLY | MSTP | - - -******* Num - -#+NAME: num-r -| [ | 7 | 8 | 9 | ] | -| = | 4 | 5 | 6 | ; | -| \ | 1 | 2 | 3 | ` | -| MINS | 0 | DOT | U_NP | U_NP | - - -******* Sym - -#+NAME: sym-r -| { | & | * | ( | } | -| + | $ | % | ^ | : | -| PIPE | ! | @ | # | ~ | -| _ | ( | ) | U_NP | U_NP | - - -******* Fun - -#+NAME: fun-r -| PSCR | F7 | F8 | F9 | F12 | -| SLCK | F4 | F5 | F6 | F11 | -| PAUS | F1 | F2 | F3 | F10 | -| TAB | SPC | APP | U_NP | U_NP | - - -**** COMMENT Templates - -#+NAME: tem -| <l4> | <l4> | <l4> | <l4> | <l4> | <l4> | <l4> | <l4> | <l4> | <l4> | -|------+------+------+------+------+------+------+------+------+------| -| | | | | | | | | | | -| | | | | | | | | | | -| | | | | | | | | | | -| U_NP | U_NP | | | | | | | U_NP | U_NP | - - -Duplicate base layer tap keys on thumbs rather than trans to enable auto-repeat. - -#+NAME: tem-r -| <l4> | <l4> | <l4> | <l4> | <l4> | -|------+------+------+------+------| -| | | | | | -| | | | | | -| | | | | | -| ENT | BSPC | DEL | U_NP | U_NP | - -#+NAME: tem-l -| <l4> | <l4> | <l4> | <l4> | <l4> | -|------+------+------+------+------| -| | | | | | -| | | | | | -| | | | | | -| U_NP | U_NP | ESC | SPC | TAB | - - -** Code Generation - -The layout is maintained in emacs org-mode tables and converted to QMK keymap -data structures using embedded python scripts. - - -*** Table Conversion Scripts - - -**** table-layout-taphold - -Produce base layer from separate tap and hold tables. - -#+NAME: table-layout-taphold -#+BEGIN_SRC python :var alphas_table=colemakdh :var thumbs_table=thumbs :var hold_table=hold :var symbol_names_table=symbol-names :var mods_table=mods :var nonkc_table=nonkc :tangle no :results verbatim -width = 19 -mods_dict = dict.fromkeys(mods_table[0]) -nonkc_tuple = tuple(nonkc_table[0]) -symbol_names_dict = {} -for symbol, name, shifted_symbol, shifted_name in symbol_names_table: - symbol_names_dict[symbol] = name - symbol_names_dict[shifted_symbol] = shifted_name -results = '' -for tap_row, hold_row in zip(alphas_table + thumbs_table, hold_table): - results += ' ' - for tap, hold in zip(tap_row, hold_row): - if tap == '': - code = 'U_NU' - elif tap in symbol_names_dict: - code = symbol_names_dict[tap] - else: - code = tap - if not str(code).startswith(nonkc_tuple): - code = 'KC_' + str(code) - if hold in mods_dict: - code = str(hold) + '_T(' + code + ')' - elif hold != '' and hold != 'U_NP' and hold != 'RESET': - code = 'LT(' + str(hold) + ', ' + code + ')' - results += (code + ', ').ljust(width) - results = results.rstrip(' ') + '\n' -results = results.rstrip('\n, ') -return results -#+END_SRC - -#+RESULTS: table-layout-taphold -: KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_QUOT, -: LGUI_T(KC_A), LALT_T(KC_R), LCTL_T(KC_S), LSFT_T(KC_T), KC_G, KC_M, LSFT_T(KC_N), LCTL_T(KC_E), LALT_T(KC_I), LGUI_T(KC_O), -: KC_Z, ALGR_T(KC_X), KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, ALGR_T(KC_DOT), KC_SLSH, -: U_NP, U_NP, LT(MEDIA, KC_ESC), LT(NAV, KC_SPC), LT(MOUSE, KC_TAB), LT(SYM, KC_ENT), LT(NUM, KC_BSPC), LT(FUN, KC_DEL), U_NP, U_NP - - -**** table-layout-half - -Produce sub layers given layer name and corresponding table for single hand and -incorporating mods and reset from base layer. Layer names must end with 'R' or -'L'. A layer with shifted symbols can also be generated. - -#+NAME: table-layout-half -#+BEGIN_SRC python :var hold_table=hold :var mode="r" :var half_table=nav-r :var symbol_names_table=symbol-names :var mods_table=mods :var nonkc_table=nonkc :var shift="false" :tangle no :results verbatim -width = 9 -mods_dict = dict.fromkeys(mods_table[0]) -nonkc_tuple = tuple(nonkc_table[0]) -symbol_names_dict = {} -shifted_symbol_names_dict = {} -for symbol, name, shifted_symbol, shifted_name in symbol_names_table: - symbol_names_dict[symbol] = name - symbol_names_dict[shifted_symbol] = shifted_name - shifted_symbol_names_dict[symbol] = shifted_name -length = len(half_table[0]) -results = '' -for half_row, hold_row in zip(half_table, hold_table): - results += ' ' - hold_row_l, hold_row_r = hold_row[:length], hold_row[length:] - for lr, hold_row_lr in ('l', hold_row_l), ('r', hold_row_r): - if lr == mode: - for half in half_row: - if half == '': - code = 'U_NU' - elif shift == "true" and half in shifted_symbol_names_dict: - code = shifted_symbol_names_dict[half] - elif half in symbol_names_dict: - code = symbol_names_dict[half] - else: - code = half - if not str(code).startswith(nonkc_tuple): - code = 'KC_' + str(code) - results += (str(code) + ', ').ljust(width) - else: - for hold in hold_row_lr: - if hold == '' or hold != 'U_NP' and hold != 'RESET' and hold not in mods_dict: - code = 'U_NA' - else: - code = hold - if not str(code).startswith(nonkc_tuple): - code = 'KC_' + str(code) - results += (str(code) + ', ').ljust(width) - results = results.rstrip(' ') + '\n' -results = results.rstrip('\n, ') -return results -#+END_SRC - -#+RESULTS: table-layout-half -: RESET, U_NA, U_NA, U_NA, U_NA, U_RDO, U_PST, U_CPY, U_CUT, U_UND, -: KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, U_NA, KC_CAPS, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, -: U_NA, KC_ALGR, U_NA, U_NA, U_NA, KC_INS, KC_HOME, KC_PGDN, KC_PGUP, KC_END, -: U_NP, U_NP, U_NA, U_NA, U_NA, KC_ENT, KC_BSPC, KC_DEL, U_NP, U_NP - - -**** table-layout-full - -Produce full layer from single table. Fill for unused keys is configurable. - -#+NAME: table-layout-full -#+BEGIN_SRC python :var table=button :var fill="TRNS" :var symbol_names_table=symbol-names :var nonkc_table=nonkc :tangle no :results verbatim -width = 9 -symbol_names_dict = {} -nonkc_tuple = tuple(nonkc_table[0]) -for symbol, name, shifted_symbol, shifted_name in symbol_names_table: - symbol_names_dict[symbol] = name - symbol_names_dict[shifted_symbol] = shifted_name -results = '' -for row in table: - results += ' ' - for key in row: - if key == '': - code = fill - elif key in symbol_names_dict: - code = symbol_names_dict[key] - else: - code = key - if not str(code).startswith(nonkc_tuple): - code = 'KC_' + str(code) - results += (code + ', ').ljust(width) - results = results.rstrip(' ') + '\n' -results = results.rstrip('\n, ') -return results -#+END_SRC - -#+RESULTS: table-layout-full -: U_UND, U_CUT, U_CPY, U_PST, U_RDO, U_RDO, U_PST, U_CPY, U_CUT, U_UND, -: KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, KC_TRNS, KC_TRNS, KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, -: U_UND, U_CUT, U_CPY, U_PST, U_RDO, U_RDO, U_PST, U_CPY, U_CUT, U_UND, -: U_NP, U_NP, KC_BTN2, KC_BTN3, KC_BTN1, KC_BTN1, KC_BTN3, KC_BTN2, U_NP, U_NP - - -**** table-enums - -Produce layer enums from layer names in hold table. - -#+NAME: table-enums -#+BEGIN_SRC python :var hold_table=hold :var mods_table=mods :tangle no -mods_dict = dict.fromkeys(mods_table[0]) -layers = [ 'BASE', 'BUTTON' ] -for hold_row in hold_table: - for hold in hold_row: - if hold not in mods_dict and hold != '' and hold != 'U_NP' and hold != 'RESET' and hold not in layers: - layers.append(hold) -results = 'enum layers { ' + ', '.join(layers) + ' };' -return results -#+END_SRC - -#+RESULTS: table-enums -: enum layers { BASE, BUTTON, MEDIA, NAV, MOUSE, SYM, NUM, FUN }; - - -**** table-keycode-mappings - -Produce keycode mappings according to the provided table. - -#+NAME: table-keycode-mappings -#+BEGIN_SRC python :var table=clipboard :var symbol_names_table=symbol-names :var nonkc_table=nonkc :tangle no -nonkc_tuple = tuple(nonkc_table[0]) -symbol_names_dict = {} -for symbol, name, shifted_symbol, shifted_name in symbol_names_table: - symbol_names_dict[symbol] = name - symbol_names_dict[shifted_symbol] = shifted_name -results = '' -for f,t in table: - if t == '': - code = 'U_NU' - elif t in symbol_names_dict: - code = symbol_names_dict[t] - else: - code = t - if not str(code).startswith(nonkc_tuple): - code = 'KC_' + str(code) - results += '#define ' + f + ' ' + code + '\n' -return results +#+BEGIN_SRC sh :tangle no +qmk compile -c -kb crkbd -km manna-harbour_miryoku # build for crkbd +qmk flash -c -kb crkbd -km manna-harbour_miryoku # build for crkbd and flash +qmk compile -c -kb crkbd -km manna-harbour_miryoku -e MIRYOKU_ALPHAS=QWERTY -e MIRYOKU_NAV=INVERTEDT -e MIRYOKU_CLIPBOARD=WIN -e MIRYOKU_LAYERS=FLIP # build for crkbd with alternative layouts #+END_SRC -#+RESULTS: table-keycode-mappings -: #define U_RDO KC_AGIN -: #define U_PST S(KC_INS) -: #define U_CPY C(KC_INS) -: #define U_CUT S(KC_DEL) -: #define U_UND KC_UNDO +**** make -**** COMMENT python-version +First ~cd~ to the repository root. Then build with ~make~. E.g. -C-c C-c in code block to update - -#+NAME: python-version -#+BEGIN_SRC python :tangle no -import sys -return sys.version +#+BEGIN_SRC sh :tangle no +make clean crkbd:manna-harbour_miryoku # build for crkbd +make clean crkbd:manna-harbour_miryoku:flash # build for crkbd and flash +make clean crkbd:manna-harbour_miryoku MIRYOKU_ALPHAS=QWERTY MIRYOKU_NAV=INVERTEDT MIRYOKU_CLIPBOARD=WIN MIRYOKU_LAYERS=FLIP # build for crkbd with alternative layouts #+END_SRC -#+RESULTS: python-version -: 3.9.4 (default, Apr 9 2021, 01:15:05) -: [GCC 5.4.0 20160609] - - -*** Data +*** Workflow Builds -**** symbol-names +Firmware can be built via GitHub Actions workflows without use of a local build environment. Local tools are still required for [[https://docs.qmk.fm/#/newbs_flashing][flashing]]. -Symbol, name, and shifted symbol mappings for use in tables. +First log in to GitHub, fork the [[#miryoku-qmk-development-branch][Miryoku QMK development branch]] repository, and enable workflows. -#+NAME: symbol-names -| ` | GRV | ~ | TILD | -| "-" | MINS | _ | UNDS | -| = | EQL | + | PLUS | -| [ | LBRC | { | LCBR | -| ] | RBRC | } | RCBR | -| \ | BSLS | PIPE | PIPE | -| ; | SCLN | : | COLN | -| ' | QUOT | DQUO | DQUO | -| , | COMM | < | LT | -| "." | DOT | > | GT | -| / | SLSH | ? | QUES | -| 1 | 1 | ! | EXLM | -| 2 | 2 | @ | AT | -| 3 | 3 | # | HASH | -| 4 | 4 | $ | DLR | -| 5 | 5 | % | PERC | -| 6 | 6 | ^ | CIRC | -| 7 | 7 | & | AMPR | -| 8 | 8 | * | ASTR | -| 9 | 9 | ( | LPRN | -| 0 | 0 | ) | RPRN | +To access a workflow, visit the Actions tab and select the workflow. To download the firmware from a workflow run, select the workflow, select the workflow run, select the desired Artifacts, and unzip the downloaded zip file. +Workflow files are in [[../../.github/workflows]]. -**** mods -Modifiers usable in hold table. Need to have the same name for ~KC_~ and ~_T~ -versions. +**** Build Examples -#+NAME: mods -| LSFT | LCTL | LALT | LGUI | ALGR | +Copy one of the included Build Example workflow files, edit the ~name~ value, and edit and add options and values as desired. Select Run workflow, select the Branch if desired, and activate Run workflow. +Options are specified in the ~with~ section and are of the following form. +: option: '["value"]' -**** nonkc +For multiple values per option use the following form, and a matrix build will be performed for each combination of values across all options. +: option: '["value1","value2"]' -Keycodes that match any of these prefixes will not have ~KC_~ automatically -prepended. +The ~keyboard~ option specifies the keyboard and is required. All other options are optional. -#+NAME: nonkc -| U_ | RGB_ | RESET | S( | C( | SCMD( | LCMD( | +The ~alphas~, ~nav~, ~clipboard~, and ~layers~ options correspond to the [[https://github.com/manna-harbour/miryoku/tree/master/docs/reference#alternative-layouts][alternative layout]] options. The ~mapping~ option corresponds to the alternative [[#subset-mapping][mapping]] options. Alternative layout and mapping options are given in the documentation in the form ~MIRYOKU_OPTION=VALUE~. To use here, convert to the form specified above. Use ~default~ to represent the default value. Values for these five options are case-insensitive. See the [[../../.github/workflows/test-all-configs.yml][Test All Configs workflow file]] for all supported values. +The ~rules~ and ~config~ options can be used to specify values to be appended to ~custom_rules.mk~ and ~custom_config.h~, respectively. Separate multiple lines with ~\n~. -**** header -Header for tangled files. +**** Build Inputs -#+NAME: header -#+BEGIN_SRC C :main no :tangle no -Copyright 2019 Manna Harbour -https://github.com/manna-harbour/miryoku -generated -*- buffer-read-only: t -*- -#+END_SRC +The Build Inputs workflow can be used without editing workflow files. Select Run workflow, select the Branch and fill out the form as desired, and activate Run workflow. +Options are specified by entering values directly in the corresponding field. Multiple comma separated values can be entered per option and a matrix build will be performed for each combination of values across all options. -**** license-qmk +The ~Keyboard~ option specifies the keyboard and is required. All other options are optional. -License for tangled QMK C source files. +The ~Miryoku Alphas~, ~Miryoku Nav~, ~Miryoku Clipboard~, and ~Miryoku Layers~ options correspond to the [[https://github.com/manna-harbour/miryoku/tree/master/docs/reference#alternative-layouts][alternative layout]] options. The ~Miryoku Mapping~ option corresponds to the alternative [[#subset-mapping][mapping]] options. Alternative layout and mapping options are given in the documentation in the form ~MIRYOKU_OPTION=VALUE~. To use here, enter the ~value~ in the corresponding ~Miryoku Option~ field. Use ~default~ to represent the default value. Values for these five options are case-insensitive. -#+NAME: license-qmk -#+BEGIN_SRC C :main no :tangle no -// 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/>. -#+END_SRC +The ~custom_rules.mk~ and ~custom_config.h~ options can be used to specify values to be appended to the corresponding files. Join multiple lines with ~\n~. ** Subset Mapping @@ -875,255 +120,26 @@ The keymap is defined for ~LAYOUT_miryoku~ which is 10x4, with the outer 2 positions on the bottom row unused and the rest of the bottom row being the thumb keys. +- [[./rules.mk]] :: Build options. Automatically included. -**** [[./rules.mk][users/manna-harbour_miryoku/rules.mk]] - -Build options. Automatically included. - -#+BEGIN_SRC makefile :noweb yes :padline no :tangle rules.mk -# <<header>> +- [[./custom_rules.mk]] :: Custom ~make~ options including customised defaults for alternative layout options, for local builds. Included from ~rules.mk~. -MOUSEKEY_ENABLE = yes # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -AUTO_SHIFT_ENABLE = yes # Auto Shift +- [[./post_rules.mk]] :: Handles Miryoku ~make~ options. Included from ~rules.mk~. -SRC += manna-harbour_miryoku.c # keymap +- [[./config.h]] :: Config options. Automatically included. -# alternative layouts: +- [[./custom_config.h]] :: Custom config options for local builds. Included from ~config.h~. -# alphas -ifneq ($(strip $(MIRYOKU_ALPHAS)),) - OPT_DEFS += -DMIRYOKU_ALPHAS_$(MIRYOKU_ALPHAS) -endif +- [[./manna-harbour_miryoku.h]] :: Keymap-related definitions. Included from ~manna-harbour_miryoku.c~. Layer data is generated by [[https://github.com/manna-harbour/miryoku_babel][Miryoku Babel]] and is included from files in the [[miryoku_babel]] directory. -# nav -ifneq ($(strip $(MIRYOKU_NAV)),) - OPT_DEFS += -DMIRYOKU_NAV_$(MIRYOKU_NAV) -endif +- [[./manna-harbour_miryoku.c]] :: Contains the keymap. Added from ~rules.mk~. -# clipboard -ifneq ($(strip $(MIRYOKU_CLIPBOARD)),) - OPT_DEFS += -DMIRYOKU_CLIPBOARD_$(MIRYOKU_CLIPBOARD) -endif -# layers -ifneq ($(strip $(MIRYOKU_LAYERS)),) - OPT_DEFS += -DMIRYOKU_LAYERS_$(MIRYOKU_LAYERS) -endif +*** Community Layouts -# subset mappings -ifneq ($(strip $(MIRYOKU_MAPPING)),) - OPT_DEFS += -DMIRYOKU_MAPPING_$(MIRYOKU_MAPPING) -endif -#+END_SRC - - -**** [[./config.h][users/manna-harbour_miryoku/config.h]] - -Config options. Automatically included. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -// default but used in macros -#undef TAPPING_TERM -#define TAPPING_TERM 200 - -// Prevent normal rollover on alphas from accidentally triggering mods. -#define IGNORE_MOD_TAP_INTERRUPT - -// Enable rapid switch from tap to hold, disables double tap hold auto-repeat. -#define TAPPING_FORCE_HOLD - -// Auto Shift -#define NO_AUTO_SHIFT_ALPHA -#define AUTO_SHIFT_TIMEOUT TAPPING_TERM -#define AUTO_SHIFT_NO_SETUP - -// Recommended for heavy chording. -#define QMK_KEYS_PER_SCAN 4 - -// Mouse key speed and acceleration. -#undef MOUSEKEY_DELAY -#define MOUSEKEY_DELAY 0 -#undef MOUSEKEY_INTERVAL -#define MOUSEKEY_INTERVAL 16 -#undef MOUSEKEY_WHEEL_DELAY -#define MOUSEKEY_WHEEL_DELAY 0 -#undef MOUSEKEY_MAX_SPEED -#define MOUSEKEY_MAX_SPEED 6 -#undef MOUSEKEY_TIME_TO_MAX -#define MOUSEKEY_TIME_TO_MAX 64 -#+END_SRC - - -**** [[./manna-harbour_miryoku.h][users/manna-harbour_miryoku/manna-harbour_miryoku.h]] - -Keymap-related definitions. Included from ~manna-harbour_miryoku.c~. Can be -included from keymap or layout ~keymap.c~ if needed. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle manna-harbour_miryoku.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#include QMK_KEYBOARD_H - -#define U_NP KC_NO // key is not present -#define U_NA KC_NO // present but not available for use -#define U_NU KC_NO // available but not used - -<<table-enums()>> - -#if defined MIRYOKU_CLIPBOARD_FUN -<<table-keycode-mappings(table=clipboard-fun)>> -#elif defined MIRYOKU_CLIPBOARD_MAC -<<table-keycode-mappings(table=clipboard-mac)>> -#elif defined MIRYOKU_CLIPBOARD_WIN -<<table-keycode-mappings(table=clipboard-win)>> -#else -<<table-keycode-mappings(table=clipboard)>> -#endif - - -#+END_SRC - - -**** [[./manna-harbour_miryoku.c][users/manna-harbour_miryoku/manna-harbour_miryoku.c]] - -Contains the keymap. Added from ~rules.mk~. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle manna-harbour_miryoku.c -// <<header>> - -<<license-qmk>> - -#include "manna-harbour_miryoku.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -#if defined MIRYOKU_LAYERS_FLIP - [BASE] = LAYOUT_miryoku( - #if defined MIRYOKU_ALPHAS_AZERTY -<<table-layout-taphold(alphas_table=azerty, thumbs_table=thumbs-flip, hold_table=hold-flip)>> - #elif defined MIRYOKU_ALPHAS_COLEMAK -<<table-layout-taphold(alphas_table=colemak, thumbs_table=thumbs-flip, hold_table=hold-flip)>> - #elif defined MIRYOKU_ALPHAS_COLEMAKDHK -<<table-layout-taphold(alphas_table=colemakdhk, thumbs_table=thumbs-flip, hold_table=hold-flip)>> - #elif defined MIRYOKU_ALPHAS_DVORAK -<<table-layout-taphold(alphas_table=dvorak, thumbs_table=thumbs-flip, hold_table=hold-flip)>> - #elif defined MIRYOKU_ALPHAS_HALMAK -<<table-layout-taphold(alphas_table=halmak, thumbs_table=thumbs-flip, hold_table=hold-flip)>> - #elif defined MIRYOKU_ALPHAS_WORKMAN -<<table-layout-taphold(alphas_table=workman, thumbs_table=thumbs-flip, hold_table=hold-flip)>> - #elif defined MIRYOKU_ALPHAS_QWERTY -<<table-layout-taphold(alphas_table=qwerty, thumbs_table=thumbs-flip, hold_table=hold-flip)>> - #elif defined MIRYOKU_ALPHAS_QWERTZ -<<table-layout-taphold(alphas_table=qwertz, thumbs_table=thumbs-flip, hold_table=hold-flip)>> - #else -<<table-layout-taphold(alphas_table=colemakdh, thumbs_table=thumbs-flip, hold_table=hold-flip)>> - #endif - ), - #if defined MIRYOKU_NAV_INVERTEDT - [NAV] = LAYOUT_miryoku( -<<table-layout-half(half_table=nav-l-invertedt, mode="l", hold_table=hold-flip)>> - ), - [MOUSE] = LAYOUT_miryoku( -<<table-layout-half(half_table=mouse-l-invertedt, mode="l", hold_table=hold-flip)>> - ), - [MEDIA] = LAYOUT_miryoku( -<<table-layout-half(half_table=media-l-invertedt, mode="l", hold_table=hold-flip)>> - ), - #else - [NAV] = LAYOUT_miryoku( -<<table-layout-half(half_table=nav-l, mode="l", hold_table=hold-flip)>> - ), - [MOUSE] = LAYOUT_miryoku( -<<table-layout-half(half_table=mouse-l, mode="l", hold_table=hold-flip)>> - ), - [MEDIA] = LAYOUT_miryoku( -<<table-layout-half(half_table=media-l, mode="l", hold_table=hold-flip)>> - ), - #endif - [NUM] = LAYOUT_miryoku( -<<table-layout-half(half_table=num-r, mode="r", hold_table=hold-flip)>> - ), - [SYM] = LAYOUT_miryoku( -<<table-layout-half(half_table=sym-r, mode="r", hold_table=hold-flip)>> - ), - [FUN] = LAYOUT_miryoku( -<<table-layout-half(half_table=fun-r, mode="r", hold_table=hold-flip)>> - ), -#else - [BASE] = LAYOUT_miryoku( - #if defined MIRYOKU_ALPHAS_AZERTY -<<table-layout-taphold(alphas_table=azerty)>> - #elif defined MIRYOKU_ALPHAS_COLEMAK -<<table-layout-taphold(alphas_table=colemak)>> - #elif defined MIRYOKU_ALPHAS_COLEMAKDHK -<<table-layout-taphold(alphas_table=colemakdhk)>> - #elif defined MIRYOKU_ALPHAS_DVORAK -<<table-layout-taphold(alphas_table=dvorak)>> - #elif defined MIRYOKU_ALPHAS_HALMAK -<<table-layout-taphold(alphas_table=halmak)>> - #elif defined MIRYOKU_ALPHAS_WORKMAN -<<table-layout-taphold(alphas_table=workman)>> - #elif defined MIRYOKU_ALPHAS_QWERTY -<<table-layout-taphold(alphas_table=qwerty)>> - #elif defined MIRYOKU_ALPHAS_QWERTZ -<<table-layout-taphold(alphas_table=qwertz)>> - #else -<<table-layout-taphold(alphas_table=colemakdh)>> - #endif - ), - #if defined MIRYOKU_NAV_VI - [NAV] = LAYOUT_miryoku( -<<table-layout-half(half_table=nav-r-vi, mode="r")>> - ), - [MOUSE] = LAYOUT_miryoku( -<<table-layout-half(half_table=mouse-r-vi, mode="r")>> - ), - [MEDIA] = LAYOUT_miryoku( -<<table-layout-half(half_table=media-r-vi, mode="r")>> - ), - #else - [NAV] = LAYOUT_miryoku( -<<table-layout-half(half_table=nav-r, mode="r")>> - ), - [MOUSE] = LAYOUT_miryoku( -<<table-layout-half(half_table=mouse-r, mode="r")>> - ), - [MEDIA] = LAYOUT_miryoku( -<<table-layout-half(half_table=media-r, mode="r")>> - ), - #endif - [NUM] = LAYOUT_miryoku( -<<table-layout-half(half_table=num-l, mode="l")>> - ), - [SYM] = LAYOUT_miryoku( -<<table-layout-half(half_table=sym-l, mode="l")>> - ), - [FUN] = LAYOUT_miryoku( -<<table-layout-half(half_table=fun-l, mode="l")>> - ), -#endif - [BUTTON] = LAYOUT_miryoku( -<<table-layout-full(table=button)>> - ) -}; -#+END_SRC - - -*** Layouts - -To use the keymap on a keyboard supporting the layouts feature, ~LAYOUT_miryoku~ -is defined as a macro mapping onto the layout's own ~LAYOUT~ macro, leaving the -unused keys as ~KC_NO~. +To use the keymap on a keyboard supporting the community layouts feature, +~LAYOUT_miryoku~ is defined as a macro mapping onto the layout's own ~LAYOUT~ +macro, leaving the unused keys as ~KC_NO~. For keyboards supporting multiple layouts for which subset mappings are available, select the layout with ~FORCE_LAYOUT~ in the ~make~ command line when @@ -1166,90 +182,18 @@ make dz60:manna-harbour_miryoku:flash MIRYOKU_MAPPING=LITE # dz60, with lite ma #+END_SRC -***** [[../../layouts/community/60_ansi/manna-harbour_miryoku/config.h][layouts/community/60_ansi/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/60_ansi/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#if defined MIRYOKU_MAPPING_NOREVERSEANGLE - #define LAYOUT_miryoku(\ -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,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_60_ansi(\ -K00, K01, K02, K03, K04, XXX, XXX, XXX, K05, K06, K07, K08, K09, XXX,\ - K10, K11, K12, K13, K14, XXX, XXX, XXX, K15, K16, K17, K18, K19, XXX,\ - K20, K21, K22, K23, K24, XXX, XXX, XXX, K25, K26, K27, K28, K29,\ - XXX, K32, K33, K34, XXX, XXX, XXX, XXX, K35, K36, K37, XXX,\ - XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX\ -) -#elif defined MIRYOKU_MAPPING_LITE - #if defined MIRYOKU_LAYERS_FLIP - #define LAYOUT_miryoku( \ - 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, \ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39 \ -) \ -LAYOUT_60_ansi( \ -KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ -KC_TAB, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, KC_LBRC, KC_RBRC, KC_BSLS, \ -KC_CAPS, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, KC_SCLN, KC_ENT, \ -KC_LSFT, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, KC_RSFT, \ -KC_LCTL, KC_LGUI, KC_LALT, K36, KC_RALT, KC_RGUI, KC_APP, KC_RCTL \ -) - #else - #define LAYOUT_miryoku( \ - 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, \ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39 \ -) \ -LAYOUT_60_ansi( \ -KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ -KC_TAB, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, KC_LBRC, KC_RBRC, KC_BSLS, \ -KC_CAPS, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, KC_SCLN, KC_ENT, \ -KC_LSFT, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, KC_RSFT, \ -KC_LCTL, KC_LGUI, KC_LALT, K33, KC_RALT, KC_RGUI, KC_APP, KC_RCTL \ -) - #endif -#else - #define LAYOUT_miryoku(\ - 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,\ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_60_ansi(\ -XXX, XXX, K00, K01, K02, K03, K04, XXX, K05, K06, K07, K08, K09, XXX,\ - XXX, K10, K11, K12, K13, K14, XXX, XXX, K15, K16, K17, K18, K19, XXX,\ - K20, K21, K22, K23, K24, XXX, XXX, XXX, K25, K26, K27, K28, K29,\ - XXX, XXX, K32, K33, K34, XXX, XXX, XXX, K35, K36, K37, XXX,\ - XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX\ -) -#endif -#+END_SRC +**** alice +This is a hybrid mapping. Only the 3x10 alphas plus spacebars as primary thumb keys are mapped. The remaining keys are the same as the default keymap but with semicolon in place of quote. The keys adjacent to the spacebars are also mapped as corresponding thumb keys but may not be usable as such. -***** [[../../layouts/community/60_ansi/manna-harbour_miryoku/keymap.c][layouts/community/60_ansi/manna-harbour_miryoku/keymap.c]] +Keyboards supporting this layout: cheshire/curiosity, handwired/owlet60, mechlovin/adelais, projectkb/alice, sck/osa, axolstudio/yeti, coarse/cordillera, edda, evyd13/wonderland, fallacy, kb_elmo/sesame, keebsforall/coarse60, ramonimbao/aelith, sneakbox/aliceclone, tkc/osav2, zoo/wampus. -Required by the build system. -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/60_ansi/manna-harbour_miryoku/keymap.c -// <<header>> +**** alice_split_bs -<<license-qmk>> -#+END_SRC +This is a hybrid mapping. Only the 3x10 alphas plus spacebars as primary thumb keys are mapped. The remaining keys are the same as the default keymap but with semicolon in place of quote. The keys adjacent to the spacebars are also mapped as corresponding thumb keys but may not be usable as such. + +Keyboards supporting this layout: cheshire/curiosity, ergosaurus, handwired/colorlice, handwired/owlet60, mechlovin/adelais, projectkb/alice, sck/osa, tgr/alice, xelus/valor/rev1, xelus/valor/rev2, axolstudio/yeti, coarse/cordillera, edda, evyd13/wonderland, fallacy, kb_elmo/sesame, keebsforall/coarse60, nightly_boards/alter/rev1, ramonimbao/aelith, seigaiha, sneakbox/aliceclone, tkc/osav2, zoo/wampus. **** ergodox @@ -1261,56 +205,29 @@ are unused. [[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/mapping/miryoku-kle-mapping-ergodox.png]] -Keyboards supporting this layout: ergodone, ergodox_ez, ergodox_infinity, hotdox. - -Example build command lines: +An alternative subset mapping is provided with all keys shifted up one row creating thumb keys in the original alpha area. To select this mapping, append ~MIRYOKU_MAPPING=SHIFTED_ROWS~ to the ~make~ command line when building. -#+BEGIN_SRC sh :tangle no -make ergodox_infinity:manna-harbour_miryoku:flash # ergodox_infinity -make ergodox_ez:manna-harbour_miryoku:flash # ergodox_ez -#+END_SRC +[[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/mapping/miryoku-kle-mapping-ergodox-shifted_rows.png]] +Another alternative subset mapping is provided as for ~MIRYOKU_MAPPING=SHIFTED_ROWS~ but with the thumb keys shifted one position in the direction of thumb extension. To select this mapping, append ~MIRYOKU_MAPPING=SHIFTED_ROWS_EXTENDED_THUMBS~ to the ~make~ command line when building. -***** [[../../layouts/community/ergodox/manna-harbour_miryoku/config.h][layouts/community/ergodox/manna-harbour_miryoku/config.h]] +[[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/mapping/miryoku-kle-mapping-ergodox-shifted_rows-extended_thumbs.png]] -Contains subset mapping. +Another alternative subset mapping is provided as for ~MIRYOKU_MAPPING=SHIFTED_ROWS_EXTENDED_THUMBS~ but with the pinkie column moved down one row. To select this mapping, append ~MIRYOKU_MAPPING=SHIFTED_ROWS_EXTENDED_THUMBS_PINKIE_STAGGER~ to the ~make~ command line when building. -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/ergodox/manna-harbour_miryoku/config.h -// <<header>> +[[https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/mapping/miryoku-kle-mapping-ergodox-shifted_rows-extended_thumbs-pinkie_stagger.png]] -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#define LAYOUT_miryoku(\ - 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,\ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_ergodox_pretty(\ -XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX,\ -XXX, K00, K01, K02, K03, K04, XXX, XXX, K05, K06, K07, K08, K09, XXX,\ -XXX, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, XXX,\ -XXX, K20, K21, K22, K23, K24, XXX, XXX, K25, K26, K27, K28, K29, XXX,\ -XXX, XXX, XXX, XXX, K32, K37, XXX, XXX, XXX, XXX,\ - XXX, XXX, XXX, XXX,\ - XXX, XXX,\ - K33, K34, XXX, XXX, K35, K36\ -) -#+END_SRC - - -***** [[../../layouts/community/ergodox/manna-harbour_miryoku/keymap.c][layouts/community/ergodox/manna-harbour_miryoku/keymap.c]] +Keyboards supporting this layout: ergodone, ergodox_ez, ergodox_infinity, hotdox. -Required by the build system. +Example build command lines: -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/ergodox/manna-harbour_miryoku/keymap.c -// <<header>> +#+BEGIN_SRC sh :tangle no +make ergodox_infinity:manna-harbour_miryoku:flash # ergodox_infinity +make ergodox_ez:manna-harbour_miryoku:flash # ergodox_ez +make ergodox_ez:manna-harbour_miryoku:flash MIRYOKU_MAPPING=SHIFTED_ROWS # ergodox_ez, shifted rows +make ergodox_ez:manna-harbour_miryoku:flash MIRYOKU_MAPPING=SHIFTED_ROWS_EXTENDED_THUMBS # ergodox_ez, shifted rows, extended thumbs +make ergodox_ez:manna-harbour_miryoku:flash MIRYOKU_MAPPING=SHIFTED_ROWS_EXTENDED_THUMBS_PINKIE_STAGGER # ergodox_ez, shifted rows, extended thumbs, pinkie stagger -<<license-qmk>> #+END_SRC @@ -1328,60 +245,6 @@ make pabile/p40:manna-harbour_miryoku:flash MIRYOKU_MAPPING=ROTATE # pabile/p40, #+END_SRC -***** [[../../layouts/community/ortho_4x10/manna-harbour_miryoku/config.h][layouts/community/ortho_4x10/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/ortho_4x10/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#if defined MIRYOKU_MAPPING_ROTATE -#define LAYOUT_miryoku( \ -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, \ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39 \ -) \ -LAYOUT_ortho_4x10( \ -XXX, XXX, K37, K36, K35, K34, K33, K32, XXX, XXX, \ -K29, K28, K27, K26, K25, K24, K23, K22, K21, K20, \ -K19, K18, K17, K16, K15, K14, K13, K12, K11, K10, \ -K09, K08, K07, K06, K05, K04, K03, K02, K01, K00 \ -) -#else -#define LAYOUT_miryoku(\ -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, \ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39 \ -) \ -LAYOUT_ortho_4x10( \ -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, \ -XXX, XXX, K32, K33, K34, K35, K36, K37, XXX, XXX \ -) -#endif -#+END_SRC - - -***** [[../../layouts/community/ortho_4x10/manna-harbour_miryoku/keymap.c][layouts/community/ortho_4x10/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/ortho_4x10/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - - **** ortho_4x12 For the ortho_4x12 layout, the middle two columns, and the 2 keys on each end of @@ -1419,71 +282,6 @@ make keebio/levinson:manna-harbour_miryoku:flash MIRYOKU_MAPPING=EXTENDED_THUMBS #+END_SRC -***** [[../../layouts/community/ortho_4x12/manna-harbour_miryoku/config.h][layouts/community/ortho_4x12/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/ortho_4x12/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#if defined MIRYOKU_MAPPING_SPLIT -#define LAYOUT_miryoku(\ -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,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_ortho_4x12(\ -KC_NO, K01, K02, K03, K04, KC_NO, KC_NO, K05, K06, K07, K08, KC_NO,\ -K00, K11, K12, K13, K14, KC_NO, KC_NO, K15, K16, K17, K18, K09,\ -K10, K21, K22, K23, K24, KC_NO, KC_NO, K25, K26, K27, K28, K19,\ -K20, KC_NO, KC_NO, K32, K33, K34, K35, K36, K37, KC_NO, KC_NO, K29\ -) -#elif defined MIRYOKU_MAPPING_EXTENDED_THUMBS -#define LAYOUT_miryoku(\ -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,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_ortho_4x12(\ -K00, K01, K02, K03, K04, KC_NO, KC_NO, K05, K06, K07, K08, K09,\ -K10, K11, K12, K13, K14, KC_NO, KC_NO, K15, K16, K17, K18, K19,\ -K20, K21, K22, K23, K24, KC_NO, KC_NO, K25, K26, K27, K28, K29,\ -KC_NO, KC_NO, KC_NO, K32, K33, K34, K35, K36, K37, KC_NO, KC_NO, KC_NO\ -) -#else -#define LAYOUT_miryoku(\ -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,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_ortho_4x12(\ -K00, K01, K02, K03, K04, KC_NO, KC_NO, K05, K06, K07, K08, K09,\ -K10, K11, K12, K13, K14, KC_NO, KC_NO, K15, K16, K17, K18, K19,\ -K20, K21, K22, K23, K24, KC_NO, KC_NO, K25, K26, K27, K28, K29,\ -KC_NO, KC_NO, K32, K33, K34, KC_NO, KC_NO, K35, K36, K37, KC_NO, KC_NO\ -) -#endif -#+END_SRC - - -***** [[../../layouts/community/ortho_4x12/manna-harbour_miryoku/keymap.c][layouts/community/ortho_4x12/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/ortho_4x12/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - - **** ortho_5x12 As per ortho_4x12 but the top row is unused. @@ -1501,74 +299,6 @@ make keebio/nyquist/rev3:manna-harbour_miryoku:flash MIRYOKU_MAPPING=EXTENDED_TH #+END_SRC -***** [[../../layouts/community/ortho_5x12/manna-harbour_miryoku/config.h][layouts/community/ortho_5x12/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/ortho_5x12/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#if defined MIRYOKU_MAPPING_SPLIT -#define LAYOUT_miryoku(\ -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,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_ortho_5x12(\ -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, K01, K02, K03, K04, KC_NO, KC_NO, K05, K06, K07, K08, KC_NO,\ -K00, K11, K12, K13, K14, KC_NO, KC_NO, K15, K16, K17, K18, K09,\ -K10, K21, K22, K23, K24, KC_NO, KC_NO, K25, K26, K27, K28, K19,\ -K20, KC_NO, KC_NO, K32, K33, K34, K35, K36, K37, KC_NO, KC_NO, K29\ -) -#elif defined MIRYOKU_MAPPING_EXTENDED_THUMBS -#define LAYOUT_miryoku(\ -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,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_ortho_5x12(\ -KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\ -K00, K01, K02, K03, K04, KC_NO, KC_NO, K05, K06, K07, K08, K09,\ -K10, K11, K12, K13, K14, KC_NO, KC_NO, K15, K16, K17, K18, K19,\ -K20, K21, K22, K23, K24, KC_NO, KC_NO, K25, K26, K27, K28, K29,\ -KC_NO, KC_NO, KC_NO, K32, K33, K34, K35, K36, K37, KC_NO, KC_NO, KC_NO\ -) -#else -#define LAYOUT_miryoku(\ -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,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_ortho_5x12(\ -KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO,\ -K00, K01, K02, K03, K04, KC_NO, KC_NO, K05, K06, K07, K08, K09,\ -K10, K11, K12, K13, K14, KC_NO, KC_NO, K15, K16, K17, K18, K19,\ -K20, K21, K22, K23, K24, KC_NO, KC_NO, K25, K26, K27, K28, K29,\ -KC_NO, KC_NO, K32, K33, K34, KC_NO, KC_NO, K35, K36, K37, KC_NO, KC_NO\ -) -#endif -#+END_SRC - - -***** [[../../layouts/community/ortho_5x12/manna-harbour_miryoku/keymap.c][layouts/community/ortho_5x12/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/ortho_5x12/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - - **** ortho_5x15 For the ortho_5x15 layout, the top row, middle 5 columns, and the 2 keys on each @@ -1595,64 +325,6 @@ make idobo:manna-harbour_miryoku:flash # idobo #+END_SRC -***** [[../../layouts/community/ortho_5x15/manna-harbour_miryoku/config.h][layouts/community/ortho_5x15/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/ortho_5x15/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#if defined MIRYOKU_MAPPING_EXTENDED_THUMBS -#define LAYOUT_miryoku(\ -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,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_ortho_5x15(\ -XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX,\ -K00, K01, K02, K03, K04, XXX, XXX, XXX, XXX, XXX, K05, K06, K07, K08, K09,\ -K10, K11, K12, K13, K14, XXX, XXX, XXX, XXX, XXX, K15, K16, K17, K18, K19,\ -K20, K21, K22, K23, K24, XXX, XXX, XXX, XXX, XXX, K25, K26, K27, K28, K29,\ -XXX, XXX, XXX, K32, K33, K34, XXX, XXX, XXX, K35, K36, K37, XXX, XXX, XXX\ -) -#else -#define LAYOUT_miryoku(\ -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,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_ortho_5x15(\ -XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX,\ -K00, K01, K02, K03, K04, XXX, XXX, XXX, XXX, XXX, K05, K06, K07, K08, K09,\ -K10, K11, K12, K13, K14, XXX, XXX, XXX, XXX, XXX, K15, K16, K17, K18, K19,\ -K20, K21, K22, K23, K24, XXX, XXX, XXX, XXX, XXX, K25, K26, K27, K28, K29,\ -XXX, XXX, K32, K33, K34, XXX, XXX, XXX, XXX, XXX, K35, K36, K37, XXX, XXX\ -) -#endif -#+END_SRC - -#+RESULTS: - - -***** [[../../layouts/community/ortho_5x15/manna-harbour_miryoku/keymap.c][layouts/community/ortho_5x15/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/ortho_5x15/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - - **** planck_mit The middle two columns including the middle 2u key, and the 2 keys on each end @@ -1668,42 +340,6 @@ make planck/rev6:manna-harbour_miryoku:flash FORCE_LAYOUT=planck_mit # planck re #+END_SRC -***** [[../../layouts/community/planck_mit/manna-harbour_miryoku/config.h][layouts/community/planck_mit/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/planck_mit/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define LAYOUT_miryoku(\ -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,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_planck_mit(\ -K00, K01, K02, K03, K04, KC_NO, KC_NO, K05, K06, K07, K08, K09,\ -K10, K11, K12, K13, K14, KC_NO, KC_NO, K15, K16, K17, K18, K19,\ -K20, K21, K22, K23, K24, KC_NO, KC_NO, K25, K26, K27, K28, K29,\ -KC_NO, KC_NO, K32, K33, K34, KC_NO, K35, K36, K37, KC_NO, KC_NO\ -) -#+END_SRC - - -***** [[../../layouts/community/planck_mit/manna-harbour_miryoku/keymap.c][layouts/community/planck_mit/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/planck_mit/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - **** split_3x5_3 @@ -1717,43 +353,6 @@ make minidox:manna-harbour_miryoku:flash # minidox #+END_SRC -***** [[../../layouts/community/split_3x5_3/manna-harbour_miryoku/config.h][layouts/community/split_3x5_3/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/split_3x5_3/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define LAYOUT_miryoku(\ -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,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_split_3x5_3(\ -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,\ - K32, K33, K34, K35, K36, K37\ -) -#+END_SRC - - -***** [[../../layouts/community/split_3x5_3/manna-harbour_miryoku/keymap.c][layouts/community/split_3x5_3/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/split_3x5_3/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - - **** split_3x6_3 The outer columns are unused. @@ -1768,50 +367,25 @@ make crkbd:manna-harbour_miryoku:flash # crkbd #+END_SRC -***** [[../../layouts/community/split_3x6_3/manna-harbour_miryoku/config.h][layouts/community/split_3x6_3/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/split_3x6_3/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> -#pragma once +*** Keyboards -#define LAYOUT_miryoku(\ - 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,\ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_split_3x6_3(\ -KC_NO, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, KC_NO,\ -KC_NO, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, KC_NO,\ -KC_NO, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, KC_NO,\ - K32, K33, K34, K35, K36, K37\ -) -#+END_SRC +To use the keymap on a keyboard which does not support the layouts feature, +~LAYOUT_miryoku~ is defined as a macro mapping onto the keyboard's own ~LAYOUT~ +macro, leaving the unused keys as ~KC_NO~. -***** [[../../layouts/community/split_3x6_3/manna-harbour_miryoku/keymap.c][layouts/community/split_3x6_3/manna-harbour_miryoku/keymap.c]] +**** a_dux -Required by the build system. +[[#thumb-combos][Thumb combos]] are enabled automatically for this keyboard. -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../layouts/community/split_3x6_3/manna-harbour_miryoku/keymap.c -// <<header>> +To build for this keyboard, -<<license-qmk>> +#+BEGIN_SRC sh :tangle no +make a_dux:manna-harbour_miryoku:flash #+END_SRC -*** Keyboards - -To use the keymap on a keyboard which does not support the layouts feature, -~LAYOUT_miryoku~ is defined as a macro mapping onto the keyboard's own ~LAYOUT~ -macro, leaving the unused keys as ~KC_NO~. - - **** atreus Only the main 5x3 alphas and the inner 3 thumb keys are used. @@ -1823,42 +397,25 @@ make atreus:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/atreus/keymaps/manna-harbour_miryoku/config.h][keyboards/atreus/keymaps/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/atreus/keymaps/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> +**** bastardkb/charybdis/3x5 -#pragma once +[[#thumb-combos][Thumb combos]] are enabled automatically for this keyboard. -#define XXX KC_NO +To build for this keyboard, -#define LAYOUT_miryoku(\ -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,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -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,\ -XXX, XXX, XXX, K32, K33, K34, K35, K36, K37, XXX, XXX, XXX\ -) +#+BEGIN_SRC sh :tangle no +make bastardkb/charybdis/3x5:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/atreus/keymaps/manna-harbour_miryoku/keymap.c][keyboards/atreus/keymaps/manna-harbour_miryoku/keymap.c]] +**** bastardkb/charybdis/4x6 -Required by the build system. +On the trackball side the bottom row thumb key is used as the tertiary thumb key. Additionally, [[#thumb-combos][thumb combos]] are enabled automatically for this keyboard. -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/atreus/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> +To build for this keyboard, -<<license-qmk>> +#+BEGIN_SRC sh :tangle no +make bastardkb/charybdis/4x6:manna-harbour_miryoku:flash #+END_SRC @@ -1871,44 +428,12 @@ make bastardkb/scylla:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/bastardkb/scylla/keymaps/manna-harbour_miryoku/config.h][keyboards/bastardkb/scylla/keymaps/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/bastardkb/scylla/keymaps/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#define LAYOUT_miryoku( \ - 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, \ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39 \ -) \ -LAYOUT_split_4x6_5( \ -XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, \ -XXX, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, XXX, \ -XXX, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, XXX, \ -XXX, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, XXX, \ - K32, K33, K34, K35, K36, K37, \ - XXX, XXX, XXX, XXX \ -) -#+END_SRC - - -***** [[../../keyboards/bastardkb/scylla/keymaps/manna-harbour_miryoku/keymap.c][keyboards/bastardkb/scylla/keymaps/manna-harbour_miryoku/keymap.c]] - -Required by the build system. +**** draculad -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/bastardkb/scylla/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> +To build for this keyboard, -<<license-qmk>> +#+BEGIN_SRC sh :tangle no +make draculad:manna-harbour_miryoku:flash #+END_SRC @@ -1921,42 +446,15 @@ make ergotravel:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/ergotravel/keymaps/manna-harbour_miryoku/config.h][keyboards/ergotravel/keymaps/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/ergotravel/keymaps/manna-harbour_miryoku/config.h -// <<header>> +**** ferris -<<license-qmk>> +[[#thumb-combos][Thumb combos]] are enabled automatically for this keyboard. -#pragma once - -#define XXX KC_NO - -#define LAYOUT_miryoku( \ - 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, \ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39 \ -) \ -LAYOUT( \ -XXX, K00, K01, K02, K03, K04, XXX, XXX, K05, K06, K07, K08, K09, XXX, \ -XXX, K10, K11, K12, K13, K14, XXX, XXX, K15, K16, K17, K18, K19, XXX, \ -XXX, K20, K21, K22, K23, K24, XXX, XXX, K25, K26, K27, K28, K29, XXX, \ -XXX, XXX, XXX, K32, K33, K34, K35, K36, K37, XXX, XXX, XXX \ -) -#+END_SRC - - -***** [[../../keyboards/ergotravel/keymaps/manna-harbour_miryoku/keymap.c][keyboards/ergotravel/keymaps/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/ergotravel/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> +To build for this keyboard, -<<license-qmk>> +#+BEGIN_SRC sh :tangle no +make ferris/0_2:manna-harbour_miryoku:flash # 0_2 +make ferris/sweep:manna-harbour_miryoku:flash # sweep #+END_SRC @@ -1971,43 +469,12 @@ make for_science:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/for_science/keymaps/manna-harbour_miryoku/config.h][keyboards/for_science/keymaps/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/for_science/keymaps/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#define LAYOUT_miryoku(\ -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,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT(\ -XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX,\ -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,\ - K32, K33, K34, K35, K36, K37\ -) -#+END_SRC - +**** fortitude60 -***** [[../../keyboards/for_science/keymaps/manna-harbour_miryoku/keymap.c][keyboards/for_science/keymaps/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/for_science/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> +To build for this keyboard, -<<license-qmk>> +#+BEGIN_SRC sh :tangle no +make fortitude60:manna-harbour_miryoku:flash #+END_SRC @@ -2022,45 +489,6 @@ make gergo:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/gergo/keymaps/manna-harbour_miryoku/config.h][keyboards/gergo/keymaps/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/gergo/keymaps/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#define LAYOUT_miryoku(\ - 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,\ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_gergo(\ -XXX, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, XXX,\ -XXX, K10, K11, K12, K13, K14, XXX, XXX, K15, K16, K17, K18, K19, XXX,\ -XXX, K20, K21, K22, K23, K24, XXX, XXX, XXX, XXX, K25, K26, K27, K28, K29, XXX,\ - K32, K33, K34, XXX, XXX, K35, K36, K37\ -) -#+END_SRC - - -***** [[../../keyboards/gergo/keymaps/manna-harbour_miryoku/keymap.c][keyboards/gergo/keymaps/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/gergo/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - - **** handwired/dactyl_manuform/4x5 Only the main 5x3 alphas and the main 3 thumb keys are used. @@ -2072,48 +500,6 @@ make handwired/dactyl_manuform/4x5:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/handwired/dactyl_manuform/4x5/keymaps/manna-harbour_miryoku/config.h][keyboards/handwired/dactyl_manuform/4x5/keymaps/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/handwired/dactyl_manuform/4x5/keymaps/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#define LAYOUT_miryoku(\ -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,\ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -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,\ - XXX, XXX, XXX, XXX, \ - K32, K33, K36, K37, \ - K34, XXX, XXX, K35, \ - XXX, XXX, XXX, XXX \ -) -#+END_SRC - - -***** [[../../keyboards/handwired/dactyl_manuform/4x5/keymaps/manna-harbour_miryoku/keymap.c][keyboards/handwired/dactyl_manuform/4x5/keymaps/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/handwired/dactyl_manuform/4x5/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - - **** handwired/dactyl_manuform/5x6 Only the main 5x3 alphas and the main 3 thumb keys are used. @@ -2125,46 +511,12 @@ make handwired/dactyl_manuform/5x6:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/handwired/dactyl_manuform/5x6/keymaps/manna-harbour_miryoku/config.h][keyboards/handwired/dactyl_manuform/5x6/keymaps/manna-harbour_miryoku/config.h]] +**** jorne -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/handwired/dactyl_manuform/5x6/keymaps/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#define LAYOUT_miryoku(\ - 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, \ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39 \ -) \ -LAYOUT_5x6( \ -XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, \ -XXX, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, XXX, \ -XXX, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, XXX, \ -XXX, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, XXX, \ - XXX, XXX, XXX, XXX, \ - K32, K33, K36, K37, \ - K34, XXX, XXX, K35, \ - XXX, XXX, XXX, XXX \ -) -#+END_SRC - - -***** [[../../keyboards/handwired/dactyl_manuform/5x6/keymaps/manna-harbour_miryoku/keymap.c][keyboards/handwired/dactyl_manuform/5x6/keymaps/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/handwired/dactyl_manuform/5x6/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> +To build for this keyboard, -<<license-qmk>> +#+BEGIN_SRC sh :tangle no +make jorne:manna-harbour_miryoku:flash #+END_SRC @@ -2179,46 +531,6 @@ make keebio/iris/rev4:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/keebio/iris/keymaps/manna-harbour_miryoku/config.h][keyboards/keebio/iris/keymaps/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/keebio/iris/keymaps/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#define LAYOUT_miryoku(\ - 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,\ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT(\ -XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX,\ -XXX, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, XXX,\ -XXX, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, XXX,\ -XXX, K20, K21, K22, K23, K24, XXX, XXX, K25, K26, K27, K28, K29, XXX,\ - K32, K33, K34, K35, K36, K37\ -) -#+END_SRC - - -***** [[../../keyboards/keebio/iris/keymaps/manna-harbour_miryoku/keymap.c][keyboards/keebio/iris/keymaps/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/keebio/iris/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - - **** keyboardio/atreus Only the main 5x3 alphas and the inner 3 thumb keys are used. @@ -2230,45 +542,6 @@ make keyboardio/atreus:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/keyboardio/atreus/keymaps/manna-harbour_miryoku/config.h][keyboards/keyboardio/atreus/keymaps/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/keyboardio/atreus/keymaps/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#define LAYOUT_miryoku( \ -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, \ -N30, N31, K32, K33, K34, K35, K36, K37, N38, N39 \ -) \ -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, XXX, XXX, K25, K26, K27, K28, K29, \ -XXX, XXX, XXX, K32, K33, K34, K35, K36, K37, XXX, XXX, XXX \ -) -#+END_SRC - - -***** [[../../keyboards/keyboardio/atreus/keymaps/manna-harbour_miryoku/keymap.c][keyboards/keyboardio/atreus/keymaps/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/keyboardio/atreus/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - - **** lily58 Only the main 5x3 alphas and the inner 3 thumb keys are used. @@ -2280,46 +553,6 @@ make lily58:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/lily58/keymaps/manna-harbour_miryoku/config.h][keyboards/lily58/keymaps/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/lily58/keymaps/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#define LAYOUT_miryoku(\ - 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,\ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT(\ -XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX,\ -XXX, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, XXX,\ -XXX, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, XXX,\ -XXX, K20, K21, K22, K23, K24, XXX, XXX, K25, K26, K27, K28, K29, XXX,\ - XXX, K32, K33, K34, K35, K36, K37, XXX\ -) -#+END_SRC - - -***** [[../../keyboards/lily58/keymaps/manna-harbour_miryoku/keymap.c][keyboards/lily58/keymaps/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/lily58/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - - **** moonlander The main 5x3 alphas are used as usual. The primary, secondary, and tertiary @@ -2333,44 +566,14 @@ make moonlander:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/moonlander/keymaps/manna-harbour_miryoku/config.h][keyboards/moonlander/keymaps/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/moonlander/keymaps/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once +**** pluckey -#define XXX KC_NO - -#define LAYOUT_miryoku(\ - 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,\ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT_moonlander(\ -XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX,\ -XXX, K00, K01, K02, K03, K04, XXX, XXX, K05, K06, K07, K08, K09, XXX,\ -XXX, K10, K11, K12, K13, K14, XXX, XXX, K15, K16, K17, K18, K19, XXX,\ -XXX, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, XXX,\ -XXX, XXX, XXX, XXX, K32, XXX, XXX, K37, XXX, XXX, XXX, XXX,\ - K33, K34, XXX, XXX, K35, K36\ -) -#+END_SRC - - -***** [[../../keyboards/moonlander/keymaps/manna-harbour_miryoku/keymap.c][keyboards/moonlander/keymaps/manna-harbour_miryoku/keymap.c]] - -Required by the build system. +Only the main 5x3 alphas and the main 3 thumb keys are used. -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/moonlander/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> +To build for this keyboard, -<<license-qmk>> +#+BEGIN_SRC sh :tangle no +make pluckey:manna-harbour_miryoku:flash #+END_SRC @@ -2385,48 +588,6 @@ make redox_w:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/redox_w/keymaps/manna-harbour_miryoku/config.h][keyboards/redox_w/keymaps/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/redox_w/keymaps/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#define LAYOUT_miryoku(\ - 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,\ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT(\ -XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX,\ -XXX, K00, K01, K02, K03, K04, XXX, XXX, K05, K06, K07, K08, K09, XXX,\ -XXX, K10, K11, K12, K13, K14, XXX, XXX, K15, K16, K17, K18, K19, XXX,\ -XXX, K20, K21, K22, K23, K24, XXX, XXX, XXX, XXX, K25, K26, K27, K28, K29, XXX,\ -XXX, XXX, XXX, XXX, K32, K33, K34, K35, K36, K37, XXX, XXX, XXX, XXX\ -) -#+END_SRC - -#+RESULTS: - - -***** [[../../keyboards/redox_w/keymaps/manna-harbour_miryoku/keymap.c][keyboards/redox_w/keymaps/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/redox_w/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - - **** sofle To build for this keyboard, @@ -2436,46 +597,6 @@ make sofle:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/sofle/keymaps/manna-harbour_miryoku/config.h][keyboards/sofle/keymaps/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/sofle/keymaps/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#define LAYOUT_miryoku(\ - 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,\ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39\ -)\ -LAYOUT(\ -XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX,\ -XXX, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, XXX,\ -XXX, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, XXX,\ -XXX, K20, K21, K22, K23, K24, XXX, XXX, K25, K26, K27, K28, K29, XXX,\ - XXX, XXX, K32, K33, K34, K35, K36, K37, XXX, XXX\ -) -#+END_SRC - - -***** [[../../keyboards/sofle/keymaps/manna-harbour_miryoku/keymap.c][keyboards/sofle/keymaps/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/sofle/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - - **** splitkb/kyria Only the main 5x3 alphas and the middle 3 lower thumb keys are used. @@ -2497,60 +618,6 @@ make splitkb/kyria:manna-harbour_miryoku:flash MIRYOKU_MAPPING=EXTENDED_THUMBS # #+END_SRC -***** [[../../keyboards/splitkb/kyria/keymaps/manna-harbour_miryoku/config.h][keyboards/splitkb/kyria/keymaps/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/splitkb/kyria/keymaps/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define XXX KC_NO - -#if defined MIRYOKU_MAPPING_EXTENDED_THUMBS -#define LAYOUT_miryoku( \ - 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, \ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39 \ -) \ -LAYOUT( \ -XXX, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, XXX, \ -XXX, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, XXX, \ -XXX, K20, K21, K22, K23, K24, XXX, XXX, XXX, XXX, K25, K26, K27, K28, K29, XXX, \ - XXX, XXX, K32, K33, K34, K35, K36, K37, XXX, XXX \ -) -#else -#define LAYOUT_miryoku( \ - 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, \ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39 \ -) \ -LAYOUT( \ -XXX, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, XXX, \ -XXX, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, XXX, \ -XXX, K20, K21, K22, K23, K24, XXX, XXX, XXX, XXX, K25, K26, K27, K28, K29, XXX, \ - XXX, K32, K33, K34, XXX, XXX, K35, K36, K37, XXX \ -) -#endif -#+END_SRC - - -***** [[../../keyboards/splitkb/kyria/keymaps/manna-harbour_miryoku/keymap.c][keyboards/splitkb/kyria/keymaps/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/splitkb/kyria/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - - **** torn To build for this keyboard, @@ -2560,73 +627,14 @@ make torn:manna-harbour_miryoku:flash #+END_SRC -***** [[../../keyboards/torn/keymaps/manna-harbour_miryoku/config.h][keyboards/torn/keymaps/manna-harbour_miryoku/config.h]] - -Contains subset mapping. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/torn/keymaps/manna-harbour_miryoku/config.h -// <<header>> - -<<license-qmk>> - -#pragma once - -#define LAYOUT_miryoku( \ - 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, \ - N30, N31, K32, K33, K34, K35, K36, K37, N38, N39 \ -) \ -LAYOUT_split_3x6_4( \ -KC_NO, K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, KC_NO, \ -KC_NO, K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, KC_NO, \ -KC_NO, K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, KC_NO, \ - KC_NO, K32, K33, K34, K35, K36, K37, KC_NO \ -) -#+END_SRC - -#+RESULTS: - - -***** [[../../keyboards/torn/keymaps/manna-harbour_miryoku/keymap.c][keyboards/torn/keymaps/manna-harbour_miryoku/keymap.c]] - -Required by the build system. - -#+BEGIN_SRC C :main no :noweb yes :padline no :tangle ../../keyboards/torn/keymaps/manna-harbour_miryoku/keymap.c -// <<header>> - -<<license-qmk>> -#+END_SRC - - -*** Customisation - -To add customisations to a keyboard or layout while importing the miryoku -keymap, copy ~config.h~ and ~keymap.c~ from the keyboard or layout's -~manna-harbour_miryoku/~ directory to a new directory, and create ~rules.mk~ -containing ~USER_NAME := manna-harbour_miryoku~. The miryoku keymap will be -imported and customisations can be added to those files as usual. Keycodes can -be added to unused keys by editing ~LAYOUT_miryoku~ in ~config.h~. - -For an unsupported keyboard or layout, do as above with a similar keyboard or -layout and modify ~LAYOUT_miryoku~ in ~config.h~ referring to the keyboard or -layout's ~LAYOUT~ macro. - - -**** Examples - -To use any of the examples, create a new branch from the miryoku development -branch and follow the same steps as seen in the commit messages and code changes -in the examples, making the appropriate changes for your keyboard and desired -customisations. - +** Additional and Experimental Features -***** Add Layers -- https://github.com/manna-harbour/qmk_firmware/commits/miryoku-examples-add-layers/keyboards/crkbd/keymaps/miryoku-examples-add-layers +*** Thumb Combos +~MIRYOKU_KLUDGE_THUMBCOMBOS=yes~ -** Experimental Features +Combo the primary and secondary thumb keys to emulate the tertiary thumb key. Can be used on keyboards with missing or hard to reach tertiary thumb keys or for compatibility with same. Requires suitable keycaps to enable the thumb to press both keys simultaneously. *** Bilateral Combinations @@ -2639,33 +647,6 @@ customisations. - [[https://github.com/manna-harbour/qmk_firmware/issues/33][Retro Shift]] -** Documentation - - -*** QMK - -- https://docs.qmk.fm/ -- https://docs.qmk.fm/#/config_options -- https://docs.qmk.fm/#/feature_advanced_keycodes -- https://docs.qmk.fm/#/feature_auto_shift -- https://docs.qmk.fm/#/feature_layers -- https://docs.qmk.fm/#/feature_layouts -- https://docs.qmk.fm/#/feature_mouse_keys -- https://docs.qmk.fm/#/feature_userspace -- https://docs.qmk.fm/#/getting_started_introduction -- https://docs.qmk.fm/#/getting_started_make_guide -- https://docs.qmk.fm/#/keycodes -- https://docs.qmk.fm/#/mod_tap -- https://docs.qmk.fm/#/tap_hold - - -*** Org Mode - -- https://orgmode.org/ -- https://orgmode.org/manual/Tables.html -- https://orgmode.org/manual/Working-with-Source-Code.html - - ** [[https://github.com/manna-harbour][https://raw.githubusercontent.com/manna-harbour/miryoku/master/data/logos/manna-harbour-boa-32.png]] diff --git a/users/manna-harbour_miryoku/rules.mk b/users/manna-harbour_miryoku/rules.mk index 085f0b5019..ea226c4a3d 100644 --- a/users/manna-harbour_miryoku/rules.mk +++ b/users/manna-harbour_miryoku/rules.mk @@ -1,36 +1,12 @@ # Copyright 2019 Manna Harbour # https://github.com/manna-harbour/miryoku -# generated -*- buffer-read-only: t -*- MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control AUTO_SHIFT_ENABLE = yes # Auto Shift -SRC += manna-harbour_miryoku.c # keymap +INTROSPECTION_KEYMAP_C = manna-harbour_miryoku.c # keymaps -# alternative layouts: +include users/manna-harbour_miryoku/custom_rules.mk -# alphas -ifneq ($(strip $(MIRYOKU_ALPHAS)),) - OPT_DEFS += -DMIRYOKU_ALPHAS_$(MIRYOKU_ALPHAS) -endif - -# nav -ifneq ($(strip $(MIRYOKU_NAV)),) - OPT_DEFS += -DMIRYOKU_NAV_$(MIRYOKU_NAV) -endif - -# clipboard -ifneq ($(strip $(MIRYOKU_CLIPBOARD)),) - OPT_DEFS += -DMIRYOKU_CLIPBOARD_$(MIRYOKU_CLIPBOARD) -endif - -# layers -ifneq ($(strip $(MIRYOKU_LAYERS)),) - OPT_DEFS += -DMIRYOKU_LAYERS_$(MIRYOKU_LAYERS) -endif - -# subset mappings -ifneq ($(strip $(MIRYOKU_MAPPING)),) - OPT_DEFS += -DMIRYOKU_MAPPING_$(MIRYOKU_MAPPING) -endif +include users/manna-harbour_miryoku/post_rules.mk diff --git a/users/miles2go/config.h b/users/miles2go/config.h index a704df4b55..2a1d6504d6 100644 --- a/users/miles2go/config.h +++ b/users/miles2go/config.h @@ -6,10 +6,6 @@ #define RGBLIGHT_EFFECT_BREATHING #endif // RGBLIGHT_ENABLE -#ifndef QMK_KEYS_PER_SCAN -#define QMK_KEYS_PER_SCAN 4 -#endif // !QMK_KEYS_PER_SCAN - #undef FORCE_NKRO #ifndef TAPPING_TOGGLE diff --git a/users/mnil/config.h b/users/mnil/config.h index 3547785ff7..b471b9a818 100644 --- a/users/mnil/config.h +++ b/users/mnil/config.h @@ -19,3 +19,4 @@ #define MK_3_SPEED #define MK_MOMENTARY_ACCEL #define PERMISSIVE_HOLD +#define TAPPING_TERM 250 diff --git a/users/mnil/mnil.c b/users/mnil/mnil.c index d5bd0ef0bb..00da6086ef 100644 --- a/users/mnil/mnil.c +++ b/users/mnil/mnil.c @@ -140,7 +140,7 @@ void aa_reset(qk_tap_dance_state_t *state, void *user_data) { // clang-format off qk_tap_dance_action_t tap_dance_actions[] = { - [AAE] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, ae_finished, ae_reset, 250), - [OAA] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, aa_finished, aa_reset, 250) + [AAE] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ae_finished, ae_reset), + [OAA] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, aa_finished, aa_reset) }; // clang-format on diff --git a/users/mtdjr/mtdjr.c b/users/mtdjr/mtdjr.c index 9c6c26bc86..cd67bf3b5f 100644 --- a/users/mtdjr/mtdjr.c +++ b/users/mtdjr/mtdjr.c @@ -137,7 +137,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { }; layer_state_t layer_state_set_user(layer_state_t state) { - switch (biton32(state)) { + switch (get_highest_layer(state)) { case _RAISE: #ifdef RGBLIGHT_ENABLE rgblight_sethsv_noeeprom (240, 255, 255); diff --git a/users/muppetjones/.clang-format b/users/muppetjones/.clang-format new file mode 100644 index 0000000000..df3dbd17b4 --- /dev/null +++ b/users/muppetjones/.clang-format @@ -0,0 +1,26 @@ +--- +BasedOnStyle: Google +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: 'true' +AlignConsecutiveDeclarations: 'true' +AlignOperands: 'true' +AllowAllParametersOfDeclarationOnNextLine: 'false' +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: 'false' +BinPackArguments: 'true' +BinPackParameters: 'true' +ColumnLimit: '160' +IndentCaseLabels: 'true' +IndentPPDirectives: AfterHash +IndentWidth: '4' +MaxEmptyLinesToKeep: '1' +PointerAlignment: Right +SortIncludes: 'false' +SpaceBeforeAssignmentOperators: 'true' +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: 'false' +TabWidth: '4' +UseTab: Never + +... diff --git a/users/muppetjones/config.h b/users/muppetjones/config.h new file mode 100644 index 0000000000..e8afa9d8c5 --- /dev/null +++ b/users/muppetjones/config.h @@ -0,0 +1,44 @@ +/* Copyright 2020 Stephen J. Bush @muppetjones + * + * 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 + +#ifdef RGBLIGHT_ENABLE +// # define RGBLIGHT_ANIMATIONS +# define RGBLIGHT_HUE_STEP 8 +# define RGBLIGHT_SAT_STEP 16 +# define RGBLIGHT_VAL_STEP 16 +# define RGBLIGHT_LIMIT_VAL 150 +# define RGBLIGHT_SLEEP +// # define RGBLIGHT_LAYERS +#endif + +#ifdef TAP_DANCE_ENABLE +// Change "hold" time (default is 200 ms) +// -- used for tap dance and other tap mods +# define TAPPING_TERM 175 + +// Prevent normal rollover on alphas from accidentally triggering mods. +# define IGNORE_MOD_TAP_INTERRUPT + +// Enable rapid switch from tap to hold, disables double tap hold auto-repeat. +# define TAPPING_FORCE_HOLD + +#endif + + +#define COMBO_COUNT 3 +#define COMBO_TERM 40 diff --git a/users/muppetjones/features/casemodes.c b/users/muppetjones/features/casemodes.c new file mode 100644 index 0000000000..da7c5e8fa9 --- /dev/null +++ b/users/muppetjones/features/casemodes.c @@ -0,0 +1,247 @@ +/* Copyright 2021 Andrew Rae ajrae.nv@gmail.com @andrewjrae + * + * 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 "casemodes.h" + +/* The caps word concept started with me @iaap on splitkb.com discord. + * However it has been implemented and extended by many splitkb.com users: + * - @theol0403 made many improvements to initial implementation + * - @precondition used caps lock rather than shifting + * - @dnaq his own implementation which also used caps lock + * - @sevanteri added underscores on spaces + * - @metheon extended on @sevanteri's work and added specific modes for + * snake_case and SCREAMING_SNAKE_CASE + * - @baffalop came up with the idea for xcase, which he implements in his own + * repo, however this is implemented by @iaap with support also for one-shot-shift. + * - @sevanteri + * - fixed xcase waiting mode to allow more modified keys and keys from other layers. + * - Added @baffalop's separator defaulting on first keypress, with a + * configurable default separator and overrideable function to determine + * if the default should be used. + */ + +#ifndef DEFAULT_XCASE_SEPARATOR +# define DEFAULT_XCASE_SEPARATOR KC_UNDS +#endif + +#define IS_OSM(keycode) (keycode >= QK_ONE_SHOT_MOD && keycode <= QK_ONE_SHOT_MOD_MAX) + +// bool to keep track of the caps word state +static bool caps_word_on = false; + +// enum to keep track of the xcase state +static enum xcase_state xcase_state = XCASE_OFF; +// the keycode of the xcase delimiter +static uint16_t xcase_delimiter; +// the number of keys to the last delimiter +static int8_t distance_to_last_delim = -1; + +// Check whether caps word is on +bool caps_word_enabled(void) { return caps_word_on; } + +// Enable caps word +void enable_caps_word(void) { + caps_word_on = true; +#ifndef CAPSWORD_USE_SHIFT + if (!host_keyboard_led_state().caps_lock) { + tap_code(KC_CAPS); + } +#endif +} + +// Disable caps word +void disable_caps_word(void) { + caps_word_on = false; +#ifndef CAPSWORD_USE_SHIFT + if (host_keyboard_led_state().caps_lock) { + tap_code(KC_CAPS); + } +#else + unregister_mods(MOD_LSFT); +#endif +} + +// Toggle caps word +void toggle_caps_word(void) { + if (caps_word_on) { + disable_caps_word(); + } else { + enable_caps_word(); + } +} + +// Get xcase state +enum xcase_state get_xcase_state(void) { return xcase_state; } + +// Enable xcase and pickup the next keystroke as the delimiter +void enable_xcase(void) { xcase_state = XCASE_WAIT; } + +// Enable xcase with the specified delimiter +void enable_xcase_with(uint16_t delimiter) { + xcase_state = XCASE_ON; + xcase_delimiter = delimiter; + distance_to_last_delim = -1; +} + +// Disable xcase +void disable_xcase(void) { xcase_state = XCASE_OFF; } + +// Place the current xcase delimiter +static void place_delimiter(void) { + if (IS_OSM(xcase_delimiter)) { + // apparently set_oneshot_mods() is dumb and doesn't deal with handedness for you + uint8_t mods = xcase_delimiter & 0x10 ? (xcase_delimiter & 0x0F) << 4 : xcase_delimiter & 0xFF; + set_oneshot_mods(mods); + } else { + tap_code16(xcase_delimiter); + } +} + +// Removes a delimiter, used for double tap space exit +static void remove_delimiter(void) { + if (IS_OSM(xcase_delimiter)) { + clear_oneshot_mods(); + } else { + tap_code(KC_BSPC); + } +} + +// overrideable function to determine whether the case mode should stop +__attribute__((weak)) bool terminate_case_modes(uint16_t keycode, const keyrecord_t *record) { + switch (keycode) { + // Keycodes to ignore (don't disable caps word) + case KC_A ... KC_Z: + case KC_1 ... KC_0: + case KC_MINS: + case KC_BSPC: + // If mod chording disable the mods + if (record->event.pressed && (get_mods() != 0)) { + return true; + } + break; + case KC_UNDS: + // Allow to be pressed with or without a modifier (prob w/ shift) + break; + default: + if (record->event.pressed) { + return true; + } + break; + } + return false; +} + +/* overrideable function to determine whether to use the default separator on + * first keypress when waiting for the separator. */ +__attribute__((weak)) bool use_default_xcase_separator(uint16_t keycode, const keyrecord_t *record) { + // for example: + /* switch (keycode) { */ + /* case KC_A ... KC_Z: */ + /* case KC_1 ... KC_0: */ + /* return true; */ + /* } */ + return false; +} + +bool process_case_modes(uint16_t keycode, const keyrecord_t *record) { + if (caps_word_on || xcase_state) { + if ((QK_MOD_TAP <= keycode && keycode <= QK_MOD_TAP_MAX) || (QK_LAYER_TAP <= keycode && keycode <= QK_LAYER_TAP_MAX)) { + // Earlier return if this has not been considered tapped yet + if (record->tap.count == 0) return true; + keycode = keycode & 0xFF; + } + + if (keycode >= QK_LAYER_TAP && keycode <= QK_ONE_SHOT_LAYER_MAX) { + // let special keys and normal modifiers go through + return true; + } + + if (xcase_state == XCASE_WAIT) { + // grab the next input to be the delimiter + if (use_default_xcase_separator(keycode, record)) { + enable_xcase_with(DEFAULT_XCASE_SEPARATOR); + } else if (record->event.pressed) { + // factor in mods + if (get_mods() & MOD_MASK_SHIFT) { + keycode = LSFT(keycode); + } else if (get_mods() & MOD_BIT(KC_RALT)) { + keycode = RALT(keycode); + } + enable_xcase_with(keycode); + return false; + } else { + if (IS_OSM(keycode)) { + // this catches the OSM release if no other key was pressed + set_oneshot_mods(0); + enable_xcase_with(keycode); + return false; + } + // let other special keys go through + return true; + } + } + + if (record->event.pressed) { + // handle xcase mode + if (xcase_state == XCASE_ON) { + // place the delimiter if space is tapped + if (keycode == KC_SPACE) { + if (distance_to_last_delim != 0) { + place_delimiter(); + distance_to_last_delim = 0; + return false; + } + // remove the delimiter and disable modes + else { + remove_delimiter(); + disable_xcase(); + disable_caps_word(); + return true; + } + } + // decrement distance to delimiter on back space + else if (keycode == KC_BSPC) { + --distance_to_last_delim; + } + // don't increment distance to last delim if negative + else if (distance_to_last_delim >= 0) { + // puts back a one shot delimiter if you we're back to the delimiter pos + if (distance_to_last_delim == 0 && (IS_OSM(xcase_delimiter))) { + place_delimiter(); + } + ++distance_to_last_delim; + } + + } // end XCASE_ON + + // check if the case modes have been terminated + if (terminate_case_modes(keycode, record)) { + disable_caps_word(); + disable_xcase(); + } +#ifdef CAPSWORD_USE_SHIFT + else if (keycode >= KC_A && keycode <= KC_Z) { + tap_code16(LSFT(keycode)); + return false; + } +#endif + + } // end if event.pressed + + return true; + } + return true; +} diff --git a/users/muppetjones/features/casemodes.h b/users/muppetjones/features/casemodes.h new file mode 100644 index 0000000000..4a8c00b3d2 --- /dev/null +++ b/users/muppetjones/features/casemodes.h @@ -0,0 +1,47 @@ +/* Copyright 2021 Andrew Rae ajrae.nv@gmail.com @andrewjrae + * + * 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 QMK_KEYBOARD_H + +// Check whether caps word is on +bool caps_word_enabled(void); +// Enable caps word +void enable_caps_word(void); +// Disable caps word +void disable_caps_word(void); +// Toggle caps word +void toggle_caps_word(void); + +// enum for the xcase states +enum xcase_state { + XCASE_OFF = 0, // xcase is off + XCASE_ON, // xcase is actively on + XCASE_WAIT, // xcase is waiting for the delimiter input +}; + +// Get xcase state +enum xcase_state get_xcase_state(void); +// Enable xcase and pickup the next keystroke as the delimiter +void enable_xcase(void); +// Enable xcase with the specified delimiter +void enable_xcase_with(uint16_t delimiter); +// Disable xcase +void disable_xcase(void); + +// Function to be put in process user +bool process_case_modes(uint16_t keycode, const keyrecord_t *record); diff --git a/users/muppetjones/features/combos.c b/users/muppetjones/features/combos.c new file mode 100644 index 0000000000..a6d14bb25c --- /dev/null +++ b/users/muppetjones/features/combos.c @@ -0,0 +1,36 @@ +/* Copyright 2020 Stephen J. Bush + * + * 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/>. + */ + +#ifdef COMBO_ENABLE +# include QMK_KEYBOARD_H + +enum combos { + H_COMM_TAB, + L_U_SCLN, + J_M_CAPS, +}; + +const uint16_t PROGMEM h_comm_tab[] = {KC_H, KC_COMM, COMBO_END}; +const uint16_t PROGMEM l_u_scln[] = {KC_L, KC_U, COMBO_END}; +const uint16_t PROGMEM j_m_caps[] = {KC_J, KC_M, COMBO_END}; + +// COMBO_COUNT defined in config.h +combo_t key_combos[COMBO_COUNT] = { + [H_COMM_TAB] = COMBO(h_comm_tab, KC_TAB), + [L_U_SCLN] = COMBO(l_u_scln, KC_SCLN), + [J_M_CAPS] = COMBO(j_m_caps, KC_CAPS), +}; +#endif diff --git a/users/muppetjones/features/combos.h b/users/muppetjones/features/combos.h new file mode 100644 index 0000000000..af092904e4 --- /dev/null +++ b/users/muppetjones/features/combos.h @@ -0,0 +1,17 @@ +/* Copyright 2020 Stephen J. Bush + * + * 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 diff --git a/users/muppetjones/features/dancelayers.c b/users/muppetjones/features/dancelayers.c new file mode 100644 index 0000000000..e7e5f2a6f2 --- /dev/null +++ b/users/muppetjones/features/dancelayers.c @@ -0,0 +1,98 @@ +/* Copyright 2020 Stephen J. Bush + * + * 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/>. + */ + +#ifdef TAP_DANCE_ENABLE + +# include QMK_KEYBOARD_H +# include "muppetjones.h" +# include "dancelayers.h" + +// Initialize tap structure associated with example tap dance key +static td_tap_t lyr_tap_state = {.is_press_action = true, .state = TD_NONE}; + +/* @brief Determine the current tap dance state + * @param A tap dance state struct. + * @return A struct. + */ +td_state_t cur_dance(qk_tap_dance_state_t *state) { + switch (state->count) { + case 1: + if (!state->pressed) + return TD_1X_TAP; + else + return TD_1X_HOLD; + case 2: + return TD_2X_TAP; + break; + case 3: + return TD_3X_TAP; + break; + case 4: + return TD_4X_TAP; + break; + default: + return TD_UNKNOWN; + } +} + +// Functions that control what our tap dance key does +__attribute__((weak)) void td_layer_finished(qk_tap_dance_state_t *state, void *user_data) { + lyr_tap_state.state = cur_dance(state); + switch (lyr_tap_state.state) { + case TD_1X_TAP: + if (layer_state_is(_MOUSE)) + layer_off(_MOUSE); + else + layer_on(_MOUSE); + break; + case TD_1X_HOLD: + layer_on(_ADJUST); + break; + case TD_2X_TAP: + // Toggle lower layer + if (layer_state_is(_LOWER)) + layer_off(_LOWER); + else + layer_on(_LOWER); + break; + case TD_3X_TAP: + // Toggle lower layer + if (layer_state_is(_RAISE)) + layer_off(_RAISE); + else + layer_on(_RAISE); + break; + case TD_4X_TAP: + // Toggle lower layer + if (layer_state_is(_ADJUST)) + layer_off(_ADJUST); + else + layer_on(_ADJUST); + break; + default: + break; + } +} + +__attribute__((weak)) void td_layer_reset(qk_tap_dance_state_t *state, void *user_data) { + // If the key was held down and now is released then switch off the layer + if (lyr_tap_state.state == TD_1X_HOLD) { + layer_off(_ADJUST); + } + lyr_tap_state.state = TD_NONE; +} + +#endif diff --git a/users/muppetjones/features/dancelayers.h b/users/muppetjones/features/dancelayers.h new file mode 100644 index 0000000000..23defcca92 --- /dev/null +++ b/users/muppetjones/features/dancelayers.h @@ -0,0 +1,82 @@ +/* Copyright 2020 Stephen J. Bush + * + * 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 +#ifdef TAP_DANCE_ENABLE +# include QMK_KEYBOARD_H + +/* + * TAP DANCE + * https://docs.qmk.fm/#/feature_tap_dance + */ + +// Define a type for as many tap dance states as you need +typedef enum { + TD_NONE = 0, + TD_UNKNOWN, + TD_1X_TAP, + TD_1X_HOLD, + TD_2X_TAP, + TD_3X_TAP, + TD_4X_TAP, +} td_state_t; + +// Our custom tap dance key; add any other tap dance keys to this enum +enum { + TD_LAYERS = 0, // NOTE: Start at 0 as this is also an array index +}; +# define TD_LAYR TD(TD_LAYERS) + +typedef struct { + bool is_press_action; + td_state_t state; +} td_tap_t; + +// Declare the functions to be used with your tap dance key(s) + +/* @brief Determine the current tap dance state + * @param A tap dance state struct. + * @return A struct. + */ +td_state_t cur_dance(qk_tap_dance_state_t *state); + +// Functions associated with individual tap dances + +/* @brief Associate tap actions with layers. + * + * NOTE: Weak attribute. Can (and should) be defined in keymap.c + * + * @param state Pointer to a tap dance state object. + * @param user_data Pointer to user data. + * @return None. + */ +void td_layer_finished(qk_tap_dance_state_t *state, void *user_data); + +/* @brief Reset tap dance actions. + * + * NOTE: Weak attribute. Can (and should) be defined in keymap.c + * + * @param state Pointer to a tap dance state object. + * @param user_data Pointer to user data. + * @return None. + */ +void td_layer_reset(qk_tap_dance_state_t *state, void *user_data); + +/* Define tap dance actions. + */ +__attribute__((weak)) +qk_tap_dance_action_t tap_dance_actions[1] = {[TD_LAYERS] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, td_layer_finished, td_layer_reset, 275)}; +#endif diff --git a/users/muppetjones/features/etchamouse.c b/users/muppetjones/features/etchamouse.c new file mode 100644 index 0000000000..e1d4c38e81 --- /dev/null +++ b/users/muppetjones/features/etchamouse.c @@ -0,0 +1,101 @@ +/* Copyright 2020 Stephen J. Bush + * + * 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 QMK_KEYBOARD_H +#include "etchamouse.h" +#include "pointing_device.h" + +#if defined(POINTING_DEVICE_ENABLE) && defined(ENCODER_ENABLE) + +/** Track movement separately in both directions. This will allow us to + * smooth out the movement along diagonals + */ +typedef struct { + bool clockwise : 1; + uint8_t count : 7; + uint16_t timer : 16; + uint16_t elapsed : 16; +} key_tracker_t; + +static key_tracker_t tracker_x = {false, 0, 0, 0}; +static key_tracker_t tracker_y = {false, 0, 0, 0}; + +/** + * @brief Calculate the mouse move units for the given tracker. + * + * By using a key tracker rederence, we can minimize the amount of space + * required on the stack. As we will have the tracker object, we will also + * take the clockwise direction into account, which completely internalizes + * the movement unit logic within this single function. + * + * @param tracker: Pointer to a key tracker object. + * @return A integer from -127 to 127 + */ +static int8_t move_unit(key_tracker_t *tracker) { + if (0 == tracker->count) return 0; + + const uint16_t modifier = TAPPING_TERM_MOUSE_ENCODER < tracker->elapsed ? 1 : (TAPPING_TERM_MOUSE_ENCODER - tracker->elapsed) >> 1; + uint16_t speed = MOUSEKEY_INITIAL_SPEED + MOUSEKEY_MOVE_DELTA * modifier * (tracker->count >> 1); + + /* convert speed to USB mouse speed 1 to 127 */ + speed = (uint8_t)(speed / (1000.0f / MOUSEKEY_INTERVAL)); + speed = speed < 1 ? 1 : speed; + + return (tracker->clockwise ? 1 : -1) * (speed > MOUSEKEY_MOVE_MAX ? MOUSEKEY_MOVE_MAX : speed); +} + +/** + * @brief Update key press tracker + * + * Update the time elapsed since the last keypress. + * If the key has not been pressed since the tapping term, then reset the count to zero. + * If the key was pressed, update the timer and increment the count. + * Number of keypresses will degrade based on tapping term and zero out based + * on the persistenc term. + * + * @param tracker: The object to update + * @param pressed: A boolean indicating whether or not the key was pressed + * @return None. + */ +static void update_tracker(key_tracker_t *tracker, bool pressed, bool clockwise) { + tracker->elapsed = timer_elapsed(tracker->timer); + if (pressed) { + tracker->timer = timer_read(); + tracker->count += 1; + tracker->clockwise = clockwise; + } else if (TAPPING_TERM_PERSISTENCE < tracker->elapsed) { + tracker->count = 0; + } else if (TAPPING_TERM_MOUSE_ENCODER < tracker->elapsed) { + tracker->count >>= 1; + } +} + +bool encoder_update_mouse(uint8_t index, bool clockwise) { + report_mouse_t curr_report = pointing_device_get_report(); + + update_tracker(&tracker_x, 0 == index, clockwise); + update_tracker(&tracker_y, 1 == index, clockwise); + + curr_report.x += move_unit(&tracker_x); + curr_report.y += move_unit(&tracker_y); + + pointing_device_set_report(curr_report); + pointing_device_send(); + + return true; +} + +#endif diff --git a/users/muppetjones/features/etchamouse.h b/users/muppetjones/features/etchamouse.h new file mode 100644 index 0000000000..86b0d03c6e --- /dev/null +++ b/users/muppetjones/features/etchamouse.h @@ -0,0 +1,59 @@ +/* Copyright 2020 Stephen J. Bush + * + * 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 + +#if defined(POINTING_DEVICE_ENABLE) && defined(ENCODER_ENABLE) + +/* max value on report descriptor */ +# ifndef MOUSEKEY_MOVE_MAX +# define MOUSEKEY_MOVE_MAX 127 +# elif MOUSEKEY_MOVE_MAX > 127 +# error MOUSEKEY_MOVE_MAX needs to be smaller than 127 +# endif +# ifndef MOUSEKEY_MOVE_DELTA +# define MOUSEKEY_MOVE_DELTA 25 +# endif +# ifndef MOUSEKEY_INITIAL_SPEED +# define MOUSEKEY_INITIAL_SPEED 100 +# endif +# ifndef MOUSEKEY_INTERVAL +# define MOUSEKEY_INTERVAL 75 +# endif + +/** Amount of time (ms) before zeroing out the count. + * A higher value will result in smoother curves but may lower accuracy + */ +# ifndef TAPPING_TERM_PERSISTENCE +# define TAPPING_TERM_PERSISTENCE 150 +# endif + +/** Amount of time (ms) to register consecutive key presses + * A higher value will smooth out mouse movement and increase speed for + * consecutive presses. + */ +# ifndef TAPPING_TERM_MOUSE_ENCODER +# define TAPPING_TERM_MOUSE_ENCODER 50 +# endif + +/** @brief Update mouse position based on encoder movement. + * @param index The encoder index. 0 controls x-axis; 1 controls y-axis. + * @param clockwise Indicates direction encoder was turned. + * @returns None. + */ +bool encoder_update_mouse(uint8_t index, bool clockwise); + +#endif diff --git a/users/muppetjones/features/rgblayers.c b/users/muppetjones/features/rgblayers.c new file mode 100644 index 0000000000..46858ae671 --- /dev/null +++ b/users/muppetjones/features/rgblayers.c @@ -0,0 +1,69 @@ +/* Copyright 2020 Stephen J. Bush + * + * 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/>. + */ + +#ifdef RGBLIGHT_ENABLE +# include QMK_KEYBOARD_H +# include "rgblayers.h" + +static rgblight_config_t home_rgb; + +__attribute__((weak)) void set_layer_hsv(layer_state_t state, HSV* offset) {} + +/* Placeholder function + * If defined in a keymap.c, this will be ignored. + */ +__attribute__((weak)) void post_process_record_keymap(uint16_t keycode, keyrecord_t* record) { return; } + +void post_process_record_user(uint16_t keycode, keyrecord_t* record) { + // Regular user keycode case statement + switch (keycode) { +# ifdef RGBLIGHT_ENABLE + case RGB_HUD: + case RGB_HUI: + case RGB_SAD: + case RGB_SAI: + case RGB_VAD: + case RGB_VAI: + set_rgb_home(); + break; +# endif + default: + break; + } +} + +void set_rgb_home(void) { + home_rgb.raw = eeconfig_read_rgblight(); + // these get the current -- not eeprom + // home_rgb.hue = rgblight_get_hue(); + // home_rgb.sat = rgblight_get_sat(); + // home_rgb.val = rgblight_get_val(); +} + +void set_rgb_by_layer(layer_state_t state) { + if (!rgblight_is_enabled()) { + return; // lighting not enabled + } + + HSV layer_color = {home_rgb.hue, home_rgb.sat, home_rgb.val}; + set_layer_hsv(state, &layer_color); + rgblight_sethsv_noeeprom( // + layer_color.h, // all 3 MUST be btwn 0 and 255 + layer_color.s, // + layer_color.v // + ); +} +#endif diff --git a/users/muppetjones/features/rgblayers.h b/users/muppetjones/features/rgblayers.h new file mode 100644 index 0000000000..35be7d7fe4 --- /dev/null +++ b/users/muppetjones/features/rgblayers.h @@ -0,0 +1,22 @@ +/* Copyright 2020 Stephen J. Bush + * + * 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 +#ifdef RGBLIGHT_ENABLE + +void set_rgb_by_layer(layer_state_t); +void set_rgb_home(void); +#endif diff --git a/users/muppetjones/muppetjones.c b/users/muppetjones/muppetjones.c new file mode 100644 index 0000000000..55051bdbcd --- /dev/null +++ b/users/muppetjones/muppetjones.c @@ -0,0 +1,57 @@ +/* Copyright 2020 Stephen J. Bush @muppetjones + * + * 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 QMK_KEYBOARD_H +#include "muppetjones.h" +#include "tapmods.h" +#include "features/casemodes.h" + +/* Placeholder function + * If defined in a keymap.c, this will be ignored. + */ +__attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } + +/* Handle keypresses + */ +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!process_case_modes(keycode, record)) { + return false; + } + // Regular user keycode case statement + switch (keycode) { + case CLMK_DH: + if (record->event.pressed) { + set_single_persistent_default_layer(_CLMK_DH); + } + return false; + break; + case QWERTY: + if (record->event.pressed) { + // print("mode just switched to qwerty and this is a huge string\n"); + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case CAPSWRD: + if (record->event.pressed) { + toggle_caps_word(); + } + return false; + default: + break; + } + return process_record_keymap(keycode, record); +} diff --git a/users/muppetjones/muppetjones.h b/users/muppetjones/muppetjones.h new file mode 100644 index 0000000000..f5b2a3a465 --- /dev/null +++ b/users/muppetjones/muppetjones.h @@ -0,0 +1,56 @@ +/* Copyright 2020 Stephen J. Bush @muppetjones + * + * 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 QMK_KEYBOARD_H + +#include "tapmods.h" +#include "wrappers.h" +#include "features/casemodes.h" + +#ifdef COMBO_ENABLE +# include "features/combos.h" +#endif + +#ifdef ENCODER_ENABLE +# include "features/etchamouse.h" +#endif + +#ifdef RGBLIGHT_ENABLE +# include "features/rgblayers.h" +#endif + +#ifdef TAP_DANCE_ENABLE +# include "features/dancelayers.h" +#endif + +/* Define layer names */ +enum userspace_layers { + _CLMK_DH = 0, + _QWERTY, + _MOUSE, // Intended for encoders. Mostly pass through. + _LOWER, + _RAISE, + _NAV, + _ADJUST, +}; + +// for casemodes +enum custom_keycodes { + CLMK_DH = SAFE_RANGE, + QWERTY, + CAPSWRD, +}; diff --git a/users/muppetjones/readme.md b/users/muppetjones/readme.md new file mode 100644 index 0000000000..6569c01d95 --- /dev/null +++ b/users/muppetjones/readme.md @@ -0,0 +1,23 @@ +# License + +Copyright 2020 Stephen J. Bush @muppetjones + +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/>. + +# FEATURES + +- [Etch-a-sketch Encoders](readme/etchamouse.md) +- [RGB Layers](readme/rgblayers.md) +- [Tap Dance Layers](readme/dancelayers.md) +- [Tap Mods](readme/tapmods.md) diff --git a/users/muppetjones/readme/dancelayers.md b/users/muppetjones/readme/dancelayers.md new file mode 100644 index 0000000000..85c4b7cad9 --- /dev/null +++ b/users/muppetjones/readme/dancelayers.md @@ -0,0 +1,73 @@ +# Tap Dance Layers + +This feature creates a key that changes the current layer via tap dance. By +default, this assumes that you have the following layers defined: + +- `_ADJUST` +- `_LOWER` +- `_RAISE` +- `_MOUSE` + +And sets up the following tap dance: + +| Count | Action | Layer | +| ----- | ------ | --------- | +| 1x | hold | `_ADJUST` | +| 1x | tap | `_MOUSE` | +| 2x | tap | `_LOWER` | +| 3x | tap | `_RAISE` | +| 4x | tap | `_ADJUST` | + +## Usage + +> NOTE: If you use other tap-dance functions, you may require additonal setup. + +1. Copy `features/dancelayers.{c,h}` into your keymap or userspace directory. +2. Add the following to your `rules.mk` + + ``` + TAP_DANCE_ENABLE = yes + + SRC += ./features/dancelayers.c + ``` + +3. Add the following to your `keymap.c`: + + ``` + #ifdef TAP_DANCE_ENABLE + # include "features/dancelayers.h" + # define TD_LAYR TD(TD_LAYERS) + #else + # define TD_LAYR XXXXXXX + #endif + ``` + +4. Add `TD_LYR` to your keymap. + +## Functions and Enumerations + +The following functions are available for use: + +- `cur_dance` + +The following tap dance enumerations are defined: + +- `TD_1X_HOLD` +- `TD_1X_TAP` +- `TD_2X_TAP` +- `TD_3X_TAP` +- `TD_4X_TAP` + +## Overriding the Defaults + +If you want to define different layers to tap dance actions, you'll need to +define two additional functions in your `keymap.c`: + +- `td_lyr_finished` +- `td_lyr_reset` + +Both of these functions are necessary and require a certain pattern for each +layer. "Tap" actions are handled in `*_finished` while "hold" actions are +resolved in `*_finished` and `*_reset`. + +See the implementation in `dancelayers.c` for an example. diff --git a/users/muppetjones/readme/etchamouse.md b/users/muppetjones/readme/etchamouse.md new file mode 100644 index 0000000000..efcf718b22 --- /dev/null +++ b/users/muppetjones/readme/etchamouse.md @@ -0,0 +1,69 @@ +# Etch-a-Mouse + +Encoder-based mouse movement with acceleration! + +## Usage + +- Add the following to your rules.mk + + ``` + ENCODER_ENABLE = yes + POINTING_DEVICE_ENABLE = yes + ``` + +- Add the following block to your keymap.c + + ``` + #ifdef ENCODER_ENABLE + void encoder_update_user(uint8_t index, bool clockwise) { + # ifdef POINTING_DEVICE_ENABLE + encoder_update_mouse(index, clockwise); + # endif + return; + #endif + ``` + +> NOTE: I use the mousekey keycodes to add button one and two into my keymap. + +## How It Works + +> This implementation uses the pointing device library, but it reuses several +> of the same parameters from the mouse key acceleration. + +> The PD library is very light weight, but it does not animate cursor movement. +> tl;dr: The mouse movement will not be smooth! + +The acceleration has four parts: + +``` +initial speed + (delta * time * count) +``` + +1. **Initial Speed**. Uses the `MOUSEKEY_INITIAL_SPEED` parameter. +2. **Delta**. Uses the `MOUSEKEY_MOVE_DELTA` parameter. +3. **Time**. The faster you turn, the faster you move. + + Subtract the time elapsed since the last actuation from a tapping term, + defined by `TAPPING_TERM_MOUSE_ENCODER`†, with a minimum value of 1. + +4. **Count**. The more you turn, the faster you move. + + Count of the total number of actuations. This value will decay over time. + +† _I probably could and will eventually use `TAPPING_TERM`, but I did not want +to mess up my tap mods while experimenting with acceleration._ + +## Diagonal Movement + +Counting the number of actuations for a given axis allows us to persist movement +along a given axis to give us some diagonal movement when moving both axes, +which also helps with the acceleration a bit and makes the movement less blocky. + +## Time-based Decay (a.k.a., Deceleration) + +Originally, the actuation count zeroed out once the tapping term elapsed, but +this made the movement very choppy. Instead, the count will degrade on every +refresh after the tapping term has been exceeded; unfortunately, a refresh only +occurs on an actuation on either axis, so once the time elapsed exceeds the +persistence term, the count is cleared, which also removes any movement in that +axis. diff --git a/users/muppetjones/readme/rgblayers.md b/users/muppetjones/readme/rgblayers.md new file mode 100644 index 0000000000..fb69800177 --- /dev/null +++ b/users/muppetjones/readme/rgblayers.md @@ -0,0 +1,60 @@ +# Dynamic Underglow Lighting Per-Layer + +This bit of code allows you to define layer lighting that respects your current eeprom settings, e.g., brightness. It does this by storing the base state rgb + +## Setup + +1. Enable RGB underglow in your `rules.mk` + + ``` + RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow + ``` + +2. (Optional) Add RGB configuration to your `config.h` + + ``` + #ifdef RGBLIGHT_ENABLE + // # define RGBLIGHT_ANIMATIONS + # define RGBLIGHT_HUE_STEP 8 + # define RGBLIGHT_SAT_STEP 16 + # define RGBLIGHT_VAL_STEP 16 + # define RGBLIGHT_LIMIT_VAL 150 + # define RGBLIGHT_SLEEP + // # define RGBLIGHT_LAYERS + #endif + ``` + +3. Add `set_layer_hsv` function. This is where you define your layer-specific colors by setting the HSV properties on the `layer_color` pointer. This example uses the QMK RGB configuration parameters to keep the layer colors offset based on the current EEPROM HSV. + + > NOTE: The HSV values should be between 0 and 255, but setting the modulus on saturation causes the lights to go white on my board. I _think_ this is due to overflow, but I haven't had the chance to try and resolve it yet. + + + ``` + #ifdef RGBLIGHT_ENABLE + void set_layer_hsv(layer_state_t state, HSV* layer_color) { + int32_t h = layer_color->h, s = layer_color->s, v = layer_color->v; + switch (get_highest_layer(state)) { + case _RAISE: + h += 2 * RGBLIGHT_HUE_STEP; + break; + case _LOWER: + h += -2 * RGBLIGHT_HUE_STEP; + break; + case _NAV: + h += 1 * RGBLIGHT_HUE_STEP; + break; + case _MOUSE: + h += -7 * RGBLIGHT_HUE_STEP; + break; + default: + break; + } + layer_color->h = h % 255; + layer_color->s = s; + layer_color->v = v % 255; + return; + } + #endif + ``` + +4. (Optional) If you're using `post_process_record_user`, you'll need to change the name in your keymap to `post_process_record_keymap`. We use the user function to update the HSV state after one of the RGB keycodes is pressed. diff --git a/users/muppetjones/readme/tapmods.md b/users/muppetjones/readme/tapmods.md new file mode 100644 index 0000000000..eb707e05d9 --- /dev/null +++ b/users/muppetjones/readme/tapmods.md @@ -0,0 +1,25 @@ +# Tap Mods + +## Standard Keys + +| Keycode | Tap | Hold | Description | +| -------- | ------- | ----- | ---------------------------------------------------- | +| `HY_ESC` | Esc | Hyper | Esc on tap; hyper when held | +| `HR_*` | A, O | LGUI | Home-row for Colemak mod-DH and right-handed numpad. | +| \'\' | R, I, 6 | LALT | Home-row for Colemak mod-DH and right-handed numpad. | +| \'\' | S, E, 5 | LCTL | Home-row for Colemak mod-DH and right-handed numpad. | +| \'\' | T, N, 4 | LSFT | Home-row for Colemak mod-DH and right-handed numpad. | + +## Layers + +| Keycode | Tap | Hold | Description | +| ------- | ----- | ----- | --------------------------- | +| LOWER | -- | Lower | Temporarily activate layer. | +| RAISE | -- | Raise | Temporarily activate layer. | +| NAV | -- | Nav | Temporarily activate layer. | +| LOW_ENT | Enter | Lower | | +| LOW_SPC | Space | Lower | | +| NAV_SPC | Space | Nav | | +| RAI_ENT | Enter | Raise | | +| RAI_SPC | Space | Raise | | +| RAI_TAB | Tab | Raise | | diff --git a/users/muppetjones/readme/wrappers.md b/users/muppetjones/readme/wrappers.md new file mode 100644 index 0000000000..e8365ab7ad --- /dev/null +++ b/users/muppetjones/readme/wrappers.md @@ -0,0 +1,153 @@ +# Keymap Wrappers + +> Pattern adapted from users/drashna/wrapper.h + +Defines several object macros for common keycode sets. Each macro typically +covers 5 keycodes with a left- or right-hand orientation, and macros are +generally grouped into rows of three or four. + +> TODO: Use keymap builder to generate images. + +## Example + +``` +#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +// clang-format off +[_MODS] = LAYOUT_wrapper( + _______, ___________________BLANK___________________, ... + ... +), +//clang-format on +} +``` + +Substitute the appropriate `LAYOUT` function, e.g., `LAYOUT_planck_grid` for your board. + +## Wrappers + +> **How to Read the Tables** +> +> - Headers are numbered when wrapper is not hand-specific +> - Headers use `L` and `R` to indicate handedness +> - Headers use `P`, `R`, `M`, and `I` to indicate pinky, ring, middle, and index, respectively +> - Wrappers define a maximum of **five** keycodes -- hands are shown on the same row for readability + +### Alpha: Colemak mod-DH + +| # | LP | LR | LM | LI | LI+ | RI+ | RI | RM | RR | RP | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| 1 | Q | W | F | P | B | J | L | U | Y | ;ˆ | +| 2 | A° | R° | S° | T° | G | M | N° | E° | I° | O° | +| 3 | Z | X | C | D | V˜ | K | H | , | . | / | + +- **ˆ:** (Optional) Replace `;` with `'` (top-right) +- **°:** (Optional) Home row modifiers on tap-hold (GACS, SCAG) +- **˜:** (Optional) Tap-hold `shift` on `v` + +### Alpha: QWERTY + +| # | LP | LR | LM | LI | LI+ | RI+ | RI | RM | RR | RP | +| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | +| 1 | Q | W | E | R | T | Y | U | I | O | P | +| 2 | A | S | D | F | G | H | J | K | L | ; | +| 3 | Z | X | C | V | B | N | M | , | . | / | + +### Blank(-ish) + +Defines macros for common filler. + +| 1 | 2 | 3 | 4 | 5 | +| ---- | ---- | ---- | ---- | ---- | +| TRNS | TRNS | TRNS | TRNS | TRNS | +| xxxx | xxxx | xxxx | xxxx | xxxx | + +| LP | LR | LM | LI | LI+ | RI+ | RI | RM | RR | RP | +| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | +| LGUI | LALT | LCTL | LSFT | TRNS | TRNS | RSFT | RCTL | LALT | RGUI | + +### Adjust + +| # | LP | LR | LM | LI | LI+ | RI+ | RI | RM | RR | RP | +| --- | ------ | ----- | ---- | ----- | ------ | ---- | ------ | ------ | ---- | ---- | +| 1 | Reset | Debug | xxxx | Term+ | Term- | xxxx | AGNORM | AGSWAP | xxxx | xxxx | +| 2 | RgbTog | Hue+ | Sat+ | Val+ | RgbMod | xxxx | CLMKDH | QWERTY | xxxx | xxxx | +| 3 | xxxx | Hue- | Sat- | Val- | xxxx | xxxx | xxxx | xxxx | xxxx | xxxx | + +> Recommend: Define Right side per-board + +### Function + +| # | 1 | 2 | 3 | 4 | +| --- | --- | --- | --- | --- | +| 1 | F1 | F2 | F3 | F4 | +| 2 | F5 | F6 | F7 | F8 | +| 3 | F9 | F10 | F11 | F12 | + +### Media + +| # | 1 | 2 | 3 | 4 | 5 | +| --- | ----- | ----- | ----- | ---- | ---- | +| 1 | AuOn | MiOn | MuOn | Brm+ | Vol+ | +| 2 | AuOff | MiOff | MuOff | Brm- | Vol- | +| 3 | Play | Stop | Next | Prev | Mute | + +### Nav + +| # | RI+ | RI | RM | RR | RP | +| --- | ----- | ---- | ----- | ----- | ----- | +| 1 | Pg Up | Home | Wh Dn | Wh Up | End | +| 2 | Pg Dn | Left | Down | Up | Right | +| 3 | xxxx | xxxx | xxxx | xxxx | xxxx | + +### Numpad + +- `X Y` indicates the character `X` on keypress and character `Y` on `shift` keypress +- Second table shows characters with `alt` keypress + +| # | RI+ | RI | RM | RR | RP | +| --- | ----- | ----- | ----- | ----- | ----- | +| 1 | Del | `7 &` | `8 _` | `9 (` | | +| 2 | `- _` | `4 $` | `5 %` | `6 ^` | `*` | +| 3 | `= +` | `1 !` | `2 @` | `3 #` | `, <` | +| 4 | | `0 )` | `. >` | | | + +| # | RI+ | RI | RM | RR | RP | +| --- | ----- | ----- | ----- | ----- | ----- | +| 1 | | `¶ ‡` | `• °` | `ª ·` | `« »` | +| 2 | `– —` | `¢ ›` | `∞ fi` | `§ fl` | `° °` | +| 3 | `≠ ±` | `¡ ⁄` | `™ €` | `£ ‹` | `≤ ¯` | +| 4 | | | `º ‚` | | | + +### Symbols + +| # | LP | LR | LM | LI | LI+ | +| --- | ---- | ---- | ---- | ---- | ---- | +| 1 | ~ | \` | ( | ) | | +| 2 | LGUI | LALT | \[ ° | \] ° | \_ - | +| 3 | xxxx | xxxx | { | } | LSFT | + +- **°:** Home row modifiers on tap-hold (GACS, SCAG) + +### VIM + +| # | LP | LR | LM | LI | LI+ | +| --- | --- | --- | --- | --- | --- | +| 1 | Q° | W° | : | | | + +- **°:** Via transparency + +## Typical Layers + +My keymaps typically use the following layers. + +| # | Name | Via | Left | Right | +| --- | ---------- | ------------- | --------- | ------ | +| 0 | Colemak DH | Adjust | | | +| 1 | QWERTY | Adjust | | | +| 2 | Mouse | tap-dance | n/a | n/a | +| 3 | Lower | L home thumb | symbols | numpad | +| 4 | Raise | L outer thumb | | | +| 5 | Nav | R home thumb | home mods | nav | +| 6 | Adjust | tap-dance | RGB | MEDIA | diff --git a/users/muppetjones/rules.mk b/users/muppetjones/rules.mk new file mode 100644 index 0000000000..1decc2ed98 --- /dev/null +++ b/users/muppetjones/rules.mk @@ -0,0 +1,25 @@ +# Reduce firmware size +# https://thomasbaart.nl/2018/12/01/reducing-firmware-size-in-qmk/ +# also requires in config.h +# NO_ACTION_MACRO +# NO_ACTION_FUNCTION +LTO_ENABLE = yes + +SRC += muppetjones.c +SRC += features/casemodes.c + +ifdef COMBO_ENABLE + SRC += ./features/combos.c +endif + +ifdef ENCODER_ENABLE + SRC += ./features/etchamouse.c +endif + +ifdef RGBLIGHT_ENABLE + SRC += ./features/rgblayers.c +endif + +ifdef TAP_DANCE_ENABLE + SRC += ./features/dancelayers.c +endif diff --git a/users/muppetjones/tapmods.h b/users/muppetjones/tapmods.h new file mode 100644 index 0000000000..af3d160c5b --- /dev/null +++ b/users/muppetjones/tapmods.h @@ -0,0 +1,77 @@ +/* Copyright 2020 Stephen Bush + * + * 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 QMK_KEYBOARD_H + +/* Define a stand-in from dancelayers.h in case tap-dance isn't enabled */ +#ifndef TAP_DANCE_ENABLE +# define TD_LAYR XXXXXXX +#endif + +/* Misc */ + +#define HY_ESC HYPR_T(KC_ESC) +#define HY_BSPC HYPR_T(KC_BSPC) + +/* Tap Mod Layers */ + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) +#define NAV MO(_NAV) + +#define ADJ_DEL LT(_ADJUST, KC_DEL) +#define LOW_ENT LT(_LOWER, KC_ENT) +#define LOW_SPC LT(_LOWER, KC_SPC) +#define LOW_BSP LT(_LOWER, KC_BSPC) +#define NAV_SPC LT(_NAV, KC_SPC) +#define RAI_BSP LT(_RAISE, KC_BSPC) +#define RAI_ENT LT(_RAISE, KC_ENT) +#define RAI_SPC LT(_RAISE, KC_SPC) +#define RAI_TAB LT(_RAISE, KC_TAB) + +/* Miryoku Home-row Mods + +NOTE: Uses GACS. +*/ + +// Left-hand home row mods (colemak) +#define HR_A LGUI_T(KC_A) +#define HR_R LALT_T(KC_R) +#define HR_S LCTL_T(KC_S) +#define HR_T LSFT_T(KC_T) + +// Right-hand home row mods (colemak) +#define HR_N RSFT_T(KC_N) +#define HR_E RCTL_T(KC_E) +#define HR_I LALT_T(KC_I) +#define HR_O RGUI_T(KC_O) + +// Right-hand Numpad +#define HR_4 RSFT_T(KC_4) +#define HR_5 RCTL_T(KC_5) +#define HR_6 LALT_T(KC_6) + +// Layout-specific mods +#define TM_VSFT LSFT_T(KC_V) // For Using V in layer combos (e.g., planck) + +// GACS (Lower) +#define HR_LBRC LCTL_T(KC_LBRC) +#define HR_RBRC LSFT_T(KC_RBRC) + +// Left-hand home row mods (lower)--- +// #define HOME_UND LCTL_T(KC_UNDS) // NOTE: Mod-tap restricted to basic keycodes +#define HOME_MIN LSFT_T(KC_MINS) diff --git a/users/muppetjones/wrappers.h b/users/muppetjones/wrappers.h new file mode 100644 index 0000000000..301554f5d5 --- /dev/null +++ b/users/muppetjones/wrappers.h @@ -0,0 +1,249 @@ +/* Copyright 2020 Stephen Bush + * + * 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 "muppetjones.h" +#include "tapmods.h" + +/* Pattern adapted from users/drashna/wrapper.h + Define per-layout keymap sections. Also requires a wrapper. + + Example: + + #define LAYOUT_:name_wrapper(...) LAYOUT_:name(__VA_ARGS__) + + const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_MODS] = LAYOUT_:name _wrapper( + _______, ___________________BLANK___________________, ... + ... + ), + } +*/ + +#ifdef MOUSEKEY_ENABLE +# define MK_WH_D KC_WH_D +# define MK_WH_U KC_WH_U +#else +# define MK_WH_D XXXXXXX +# define MK_WH_U XXXXXXX +#endif + +// clang-format off +/* Blank-ish + * ,----------------------------------. * ,----------------------------------. + * | TRNS | TRNS | TRNS | TRNS | TRNS | * | xxxx | xxxx | xxxx | xxxx | xxxx | + * `----------------------------------' * `----------------------------------' + * ,----------------------------------. * ,----------------------------------. + * | LGUI | LALT | LCTL | LSFT | TRNS | * | TRNS | RSFT | RCTL | LALT | RGUI | + * `----------------------------------' * `----------------------------------' +*/ +#define __BLANK____________________________________ _______, _______, _______, _______, _______ +#define __BLANK_NOOP_______________________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX +#define __BLANK_W_GACS_____________________________ KC_LGUI, KC_LALT, KC_LCTL, KC_LSFT, _______ +#define __BLANK_W_SCAG_____________________________ _______, KC_RSFT, KC_RCTL, KC_LALT, KC_RGUI + +/* Adjust LH + * ,----------------------------------. ,----------------------------------. + * |Reset |Debug | xxxx |Term+ |Term- | | xxxx |AGNORM|AGSWAP| xxxx | xxxx | + * |------+------+------+------+------| |------+------+------+------+------| + * |RgbTog| Hue+ | Sat+ | Val+ |RgbMod| | xxxx |CLMKDH|QWERTY| xxxx | xxxx | + * |------+------+------+------+------| |------+------+------+------+------| + * | xxxx | Hue- | Sat- | Val- | xxxx | | xxxx | xxxx | xxxx | xxxx | xxxx | + * `----------------------------------' `----------------------------------' + */ + // NOTE: The "BACKLIT" keycode is planck specific +#define __ADJUST_L1________________________________ RESET, DEBUG, XXXXXXX, TERM_ON, TERM_OFF +#define __ADJUST_L2________________________________ RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, RGB_MOD +#define __ADJUST_L3________________________________ XXXXXXX, RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX + +#define __ADJUST_R1________________________________ XXXXXXX, AG_NORM, AG_SWAP, XXXXXXX, XXXXXXX +#define __ADJUST_R2________________________________ XXXXXXX, CLMK_DH, QWERTY, XXXXXXX, XXXXXXX +#define __ADJUST_R3________________________________ __BLANK_NOOP_______________________________ + +/* Colemak mod-DH + * ,----------------------------------. ,----------------------------------. + * | Q | W | F | P | B | | J | L | U | Y | ;ˆ | + * |------+------+------+------+------| |------+------+------+------+------| + * | A | R | S | T | G | | M | N | E | I | O | + * |------+------+------+------+------| |------+------+------+------+------| + * | Z | X | C | D | V˜ | | K | H | , | . | / | + * `----------------------------------' `----------------------------------' + * ˆ Alternate: KC_QUOT + * ° Alternate: Home row mods (GASC, SCAG) + * ˜ Alternate: Hold for shift + * + * Colemak mod-DH (alt and alt+shift) + * ,----------------------------------. ,----------------------------------. + * | œ Œ | ∑ „ | | π ∏ | ı | | ∆ Ô | | | ¥ Á | æ Æ | + * |------+------+------+------+------| |------+------+------+------+------| + * | å Å | ® ‰ | ß Í | † ˇ | © ˝ | | µ  | ˜ ˜ | ´ ´ | ˆ ˆ | Ø | + * |------+------+------+------+------| |------+------+------+------+------| + * | Ω ¸ | ≈ ˛ | ç Ç | Î | √ ◊ | | ˚ | Ó | ≤ ¯ | ≥ ˘ | ÷ ¿ | + * `----------------------------------' `----------------------------------' + */ +#define __COLEMAK_MOD_DH_L1________________________ KC_Q, KC_W, KC_F, KC_P, KC_B +#define __COLEMAK_MOD_DH_L2_W_GACS_________________ HR_A, HR_R, HR_S, HR_T, KC_G +#define __COLEMAK_MOD_DH_L3________________________ KC_Z, KC_X, KC_C, KC_D, KC_V +#define __COLEMAK_MOD_DH_L3_W_SFTV_________________ KC_Z, KC_X, KC_C, KC_D, TM_VSFT + +#define __COLEMAK_MOD_DH_R1_W_QUOT_________________ KC_J, KC_L, KC_U, KC_Y, KC_QUOT +#define __COLEMAK_MOD_DH_R1________________________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN +#define __COLEMAK_MOD_DH_R2_W_SCAG_________________ KC_M, HR_N, HR_E, HR_I, HR_O +#define __COLEMAK_MOD_DH_R3________________________ KC_K, KC_H, KC_COMM, KC_DOT, KC_SLASH + +/* Function (4 columns) + * ,---------------------------. + * | F1 | F2 | F3 | F4 | + * |------+------+------+------| + * | F5 | F6 | F7 | F8 | + * |------+------+------+------| + * | F9 | F10 | F11 | F12 | + * `---------------------------' + */ +#define __FUNC_X1_________________________ KC_F1, KC_F2, KC_F3, KC_F4 +#define __FUNC_X2_________________________ KC_F5, KC_F6, KC_F7, KC_F8 +#define __FUNC_X3_________________________ KC_F9, KC_F10, KC_F11, KC_F12 + +/* Game + */ +#define __GAME_L1__________________________________ KC_BTN3, KC_BTN2, KC_UP, KC_BTN1, KC_BTN5 +#define __GAME_L2__________________________________ KC_BTN4, KC_LEFT, KC_DOWN, KC_RIGHT,XXXXXXX +#define __GAME_L3__________________________________ XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + +#define __GAME_R1__________________________________ KC_Q, KC_1, KC_2, KC_3, XXXXXXX +#define __GAME_R2__________________________________ XXXXXXX, KC_4, KC_5, KC_6, XXXXXXX +#define __GAME_R3__________________________________ XXXXXXX, KC_7, KC_8, KC_9, XXXXXXX + + +/* Guitar + * ,----------------------------------. ,----------------------------------. + * | E | F |• F♯ | G |• G♯ | | A |• A♯ | B |• C | C♯ | + * | A | A♯ |• B | C |• C♯ | | D |• D♯ | E |• F | F♯ | + * | D | D♯ |• E | F |• F♯ | | G |• G♯ | A |• A♯ | B | + * | G | G♯ |• A | A♯ |• B | | C |• C♯ | D |• D♯ | E | + * | B | C |• C♯ | D |• D♯ | | E |• F | F♯ |• G | G♯ | + * | E | F |• F♯ | G |• G♯ | | A |• A♯ | B |• C | C♯ | + * `----------------------------------' `----------------------------------' + */ +// Not sure why, but this does not work (possibly due to the lowercase 's'?) +// #ifdef MIDI_ADVANCED +// #define __GUITAR_1E_L______________________________ MI_E_1, MI_F_1, MI_Fs_1, MI_G_1, MI_Gs_1 +// #define __GUITAR_2A_L______________________________ MI_A_1, MI_As_1, MI_B_1, MI_C_2, MI_Cs_2 +// #define __GUITAR_3D_L______________________________ MI_D_2, MI_Ds_2, MI_E_2, MI_F_2, MI_Fs_2 +// #define __GUITAR_4G_L______________________________ MI_G_2, MI_Gs_2, MI_A_2, MI_As_2, MI_B_2 +// #define __GUITAR_5B_L______________________________ MI_B_2, MI_C_3, MI_Cs_3, MI_D_3, MI_Ds_3 +// #define __GUITAR_6E_L______________________________ MI_E_3, MI_F_3, MI_Fs_3, MI_G_3, MI_Gs_3 +// +// #define __GUITAR_1E_R______________________________ MI_A_1, MI_As_1, MI_B_1, MI_C_2, MI_Cs_2 +// #define __GUITAR_2A_R______________________________ MI_D_2, MI_Ds_2, MI_E_2, MI_F_2, MI_Fs_2 +// #define __GUITAR_3D_R______________________________ MI_G_2, MI_Gs_2, MI_A_2, MI_As_2, MI_B_2 +// #define __GUITAR_4G_R______________________________ MI_C_3, MI_Cs_3, MI_D_3, MI_Ds_3, MI_E_3 +// #define __GUITAR_5B_R______________________________ MI_E_3, MI_F_3, MI_Fs_3, MI_G_3, MI_Gs_3 +// #define __GUITAR_6E_R______________________________ MI_A_3, MI_As_3, MI_B_3, MI_C_4, MI_Cs_4 +// #endif + + +/* MEDIA + * ,----------------------------------. + * | AuOn | MiOn | MuOn | Brm+ | Vol+ | + * |------+------+------+------+------| + * | AuOff| MiOff| MuOff| Brm- | Vol- | + * |------+------+------+------+------| + * | Play | Stop | Next | Prev | Mute | + * `----------------------------------' + */ +// What it MUV_IN and MUV_DE (5C2A and B)? +// https://github.com/qmk/qmk_firmware/blob/7e832e46de26989b81f2fbf58a0f391b2b0c1aaf/quantum/quantum_keycodes.h#L135 +#define __MEDIA_R1_________________________________ AU_ON, MI_ON, MU_ON, KC_BRMU, KC_VOLU +#define __MEDIA_R2_________________________________ AU_OFF, MI_OFF, MU_OFF, KC_BRMD, KC_VOLD +#define __MEDIA_R3_________________________________ KC_MPLY, KC_MSTP, KC_MNXT, KC_MPRV, KC_MUTE + + +/* NAV + * ,----------------------------------. + * | Pg Up| Home | Wh Dn| Wh Up| End | + * |------+------+------+------+------| + * | Pg Dn| Left | Down | Up | Right| + * |------+------+------+------+------| + * | xxxx | xxxx | xxxx | xxxx | xxxx | + * `----------------------------------' + */ +#define __NAV_R1___________________________________ KC_PGUP, KC_HOME, KC_WH_D, KC_WH_U, KC_END +#define __NAV_R2___________________________________ KC_PGDN, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT +#define __NAV_R3___________________________________ __BLANK_NOOP_______________________________ + +/* NUMPAD * (alt, alt+shift) + * ,----------------------------------. * ,----------------------------------. + * | Del | 7 & | 8 * | 9 ( | \ | | * | | ¶ ‡ | • ° | ª · | « » | + * |------+------+------+------+------| * |------+------+------+------+------| + * | - _ | 4 $ | 5 % | 6 ^ | * | * | – — | ¢ › | ∞ fi | § fl | ° ° | + * |------+------+------+------+------| * |------+------+------+------+------| + * | = + | 1 ! | 2 @ | 3 # | , | * | ≠ ± | ¡ ⁄ | ™ € | £ ‹ | ≤ ¯ | + * |------+------+------+------+------| * |------+------+------+------+------| + * | | 0 ) | . > | | | * | | | º ‚ | | | + * `----------------------------------' * `----------------------------------' + */ +#define __NUMPAD_R1________________________________ KC_GRV, KC_7, KC_8, KC_9, KC_BSLS +#define __NUMPAD_R2________________________________ KC_MINS, HR_4, HR_5, HR_6, KC_COMM +#define __NUMPAD_R3________________________________ KC_EQL, KC_1, KC_2, KC_3, KC_DOT +#define __NUMPAD_R4________________________________ _______, KC_0, KC_DOT, _______, _______ + +#define __NUMPAD_R3_ALT____________________________ KC_0, KC_1, KC_2, KC_3, KC_EQ + +/* Qwerty + * ,----------------------------------. ,----------------------------------. + * | Q | W | E | R | T | | Y | U | I | O | P | + * |------+------+------+------+------| |------+------+------+------+------| + * | A | S | D | F | G | | H | J | K | L | ; | + * |------+------+------+------+------| |------+------+------+------+------| + * | Z | X | C | V | B | | N | M | , | . | / | + * `----------------------------------' `----------------------------------' + */ +#define __QWERTY_L1________________________________ KC_Q, KC_W, KC_E, KC_R, KC_T +#define __QWERTY_L2________________________________ KC_A, KC_S, KC_D, KC_F, KC_G +#define __QWERTY_L3________________________________ KC_Z, KC_X, KC_C, KC_V, KC_B + +#define __QWERTY_R1________________________________ KC_Y, KC_U, KC_I, KC_O, KC_P +#define __QWERTY_R2________________________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN +#define __QWERTY_R3________________________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLASH + +/* SYMBOLS + * ,----------------------------------. + * | ~ | ` | ( | ) | | + * |------+------+------+------+------| + * | LGUI | LALT |LCTL [|LSFT ]| _ - | + * |------+------+------+------+------| + * | xxxx | xxxx | { | } | LSFT | + * `----------------------------------' + */ +#define __SYMBOLS_L1_______________________________ KC_TILD, KC_GRV, KC_LPRN, KC_RPRN, XXXXXXX +#define __SYMBOLS_L2_______________________________ KC_LGUI, KC_LALT, HR_LBRC, HR_RBRC, KC_UNDS +#define __SYMBOLS_L3_______________________________ XXXXXXX, XXXXXXX, KC_LCBR, KC_RCBR, KC_LSFT + +#define __SYMBOLS_R1_______________________________ KC_TILD, KC_LPRN, KC_RPRN, XXXXXXX, XXXXXXX +#define __SYMBOLS_R2_______________________________ KC_UNDS, HR_LBRC, HR_RBRC, XXXXXXX, XXXXXXX +#define __SYMBOLS_R3_______________________________ KC_PLUS, KC_LCBR, KC_RCBR, XXXXXXX, XXXXXXX + +/* VIM + * -- Roll through ":wq" via transparency + * ,----------------------------------. + * | Q | W | : | | | + * `----------------------------------' + */ +#define __VIM_L1___________________________________ _______, _______, KC_COLN, _______, _______ + +// clang-format on +// __END__ diff --git a/users/ninjonas/config.h b/users/ninjonas/config.h index 025dbb541a..565e40e841 100644 --- a/users/ninjonas/config.h +++ b/users/ninjonas/config.h @@ -2,6 +2,7 @@ #undef TAPPING_TERM #define TAPPING_TERM 200 #endif +#define TAPPING_TERM_PER_KEY // Mouse Settings: Smoothing out mouse movement on keypress #ifndef MOUSEKEY_INTERVAL @@ -18,4 +19,4 @@ #undef COMBO_TERM #define COMBO_COUNT 5 #define COMBO_TERM 60 -#endif
\ No newline at end of file +#endif diff --git a/users/ninjonas/oled.c b/users/ninjonas/oled.c index 55eaf88ccb..73cd50fb8c 100644 --- a/users/ninjonas/oled.c +++ b/users/ninjonas/oled.c @@ -23,7 +23,7 @@ bool process_record_oled(uint16_t keycode, keyrecord_t *record) { void render_layout_state(void) { oled_write_P(PSTR("Layout: "), false); - switch (biton32(default_layer_state)) { + switch (get_highest_layer(default_layer_state)) { case _COLEMAK: oled_write_P(PSTR("Colemak"), false); break; @@ -93,7 +93,7 @@ static void render_logo(void) { bool oled_task_user(void) { if (timer_elapsed32(oled_timer) > 15000) { oled_off(); - return; + return false; } #ifndef SPLIT_KEYBOARD else { oled_on(); } diff --git a/users/ninjonas/tap_dances.c b/users/ninjonas/tap_dances.c index 63e4d3ba47..3e4cec9133 100644 --- a/users/ninjonas/tap_dances.c +++ b/users/ninjonas/tap_dances.c @@ -107,6 +107,16 @@ qk_tap_dance_action_t tap_dance_actions[] = { [TD_GUI_GUISPC] = ACTION_TAP_DANCE_DOUBLE(KC_LGUI, LGUI(KC_SPC)), // Advanced Tap Dances - [TD_COPY_PASTE_APP] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, copy_paste_app_finished, copy_paste_app_reset, 300), - [TD_Y_NUMPAD] = ACTION_TAP_DANCE_FN_ADVANCED_TIME(NULL, y_numpad_finished, y_numpad_reset, 300), -};
\ No newline at end of file + [TD_COPY_PASTE_APP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, copy_paste_app_finished, copy_paste_app_reset), + [TD_Y_NUMPAD] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, y_numpad_finished, y_numpad_reset), +}; + +uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case TD(TD_COPY_PASTE_APP): + case TD(TD_Y_NUMPAD): + return 300; + default: + return TAPPING_TERM; + } +} diff --git a/users/noroadsleft/noroadsleft.c b/users/noroadsleft/noroadsleft.c index 28bfa9e6c6..80d18f4026 100644 --- a/users/noroadsleft/noroadsleft.c +++ b/users/noroadsleft/noroadsleft.c @@ -1,4 +1,4 @@ -/* Copyright 2020-2021 James Young (@noroadsleft) +/* Copyright 2020-2022 James Young (@noroadsleft) * * 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 @@ -66,6 +66,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } }; return false; + case G_PWD: + if (record->event.pressed) { + clear_mods(); + SEND_STRING("$( pwd | sed -e 's;^.*/keyboards/;;' -e 's;/;_;g')"); + }; + return false; case M_SALL: if (record->event.pressed) { tap_code16(C(KC_A)); diff --git a/users/noroadsleft/noroadsleft.h b/users/noroadsleft/noroadsleft.h index 12bb5b465a..1d1a547562 100644 --- a/users/noroadsleft/noroadsleft.h +++ b/users/noroadsleft/noroadsleft.h @@ -1,4 +1,4 @@ -/* Copyright 2020-2021 James Young (@noroadsleft) +/* Copyright 2020-2022 James Young (@noroadsleft) * * 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 @@ -25,6 +25,7 @@ enum userspace_keycodes { G_PUSH, G_FTCH, G_BRCH, + G_PWD, M_SALL, M_UNDO, M_CUT, diff --git a/users/noroadsleft/readme.md b/users/noroadsleft/readme.md index e8279c0333..d32e66917f 100644 --- a/users/noroadsleft/readme.md +++ b/users/noroadsleft/readme.md @@ -19,25 +19,28 @@ Outputs a string that tells me the Git commit from which my flashed firmware was Some frequently used Git commands. -| Keycode | Output | Output with <kbd>Shift</kbd> | -| :---------------------------------- | :--------------------- | :--------------------------- | -| [`G_PUSH`](./noroadsleft.c#L44-L48) | `git push origin ` | `git push origin ` | -| [`G_FTCH`](./noroadsleft.c#L49-L58) | `git fetch upstream ` | `git pull upstream ` | -| [`G_BRCH`](./noroadsleft.c#L59-L68) | `master` | `$(git branch-name)` | +| Keycode | Output | Output with <kbd>Shift</kbd> | +| :---------------------------------- | :---------------------------------------------------- | :---------------------------------------------------- | +| [`G_PUSH`](./noroadsleft.c#L44-L48) | `git push origin ` | `git push origin ` | +| [`G_FTCH`](./noroadsleft.c#L49-L58) | `git fetch upstream ` | `git pull upstream ` | +| [`G_BRCH`](./noroadsleft.c#L59-L68) | `master` | `$(git branch-name)` | +| [`G_PWD`](./noroadsleft.c#L69-L74) | `$( pwd \| sed -e 's;^.*/keyboards/;;' -e 's;/;_;g')` | `$( pwd \| sed -e 's;^.*/keyboards/;;' -e 's;/;_;g')` | `$(git branch-name)` is an alias for `git rev-parse --abbrev-ref HEAD`, which normally returns the name of the current branch. +The `G_PWD` macro outputs a shell expansion that returns the current working directory in relation to `qmk_firmware/keyboards/`, and with the slashes replaced with underscores. I do a lot of keyboard refactoring in QMK, and this is a string I use regularly. + ### Customized Keycodes I used to have a boolean variable that changed the functionality of these keycodes, but I no longer work in the environment that I wrote the functionality for, so I took it out. The keycodes still exist because all my `keymap.c` files reference the custom keycodes I defined. | Keycode | Action | | :------------------------------------ | :-------- | -| [`M_SALL`](./noroadsleft.c#L69-L73) | `Ctrl+A` | -| [`M_UNDO`](./noroadsleft.c#L74-L82) | `Ctrl+Z` | -| [`M_CUT`](./noroadsleft.c#L83-L87) | `Ctrl+X` | -| [`M_COPY`](./noroadsleft.c#L88-L92) | `Ctrl+C` | -| [`M_PASTE`](./noroadsleft.c#L93-L101) | `Ctrl+V` | +| [`M_SALL`](./noroadsleft.c#L75-L79) | `Ctrl+A` | +| [`M_UNDO`](./noroadsleft.c#L80-L88) | `Ctrl+Z` | +| [`M_CUT`](./noroadsleft.c#L89-L93) | `Ctrl+X` | +| [`M_COPY`](./noroadsleft.c#L94-L98) | `Ctrl+C` | +| [`M_PASTE`](./noroadsleft.c#L99-L107) | `Ctrl+V` | ### [Emulated Non-US Backslash](./noroadsleft.c#L27-L37) @@ -47,18 +50,18 @@ This macro simulates the Non-US Backslash key if I hold Right Alt and tap the ke Requires defining `ANSI_NUBS_ROW` and `ANSI_NUBS_COL` in `config.h` at the keymap level.[<sup>1</sup>](#footnotes) -### [Emulated Numeric Keypad](./noroadsleft.c#L102-L116) +### [Emulated Numeric Keypad](./noroadsleft.c#L108-L122) If I hold the Right Alt key, the number row (`KC_1` through `KC_0`) will output numpad keycodes instead of number row keycodes, enabling quicker access to characters like ™ and °. -### [Emulated Extended Function Keys](./noroadsleft.c#L117-L131) +### [Emulated Extended Function Keys](./noroadsleft.c#L123-L137) Similar to the emulated numpad, if I hold the Right Alt key with the Fn key, the function row (`KC_F1` through `KC_F12`) will output keycodes `KC_F13` throught `KC_F24`. ## License -Copyright 2020-2021 James Young (@noroadsleft) +Copyright 2020-2022 James Young (@noroadsleft) 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 diff --git a/users/ollyhayes/ollyhayes.c b/users/ollyhayes/ollyhayes.c new file mode 100644 index 0000000000..6dfd61b263 --- /dev/null +++ b/users/ollyhayes/ollyhayes.c @@ -0,0 +1,153 @@ +/* Copyright 2022 Olly Hayes (@ollyhayes) + * + * 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 "ollyhayes.h" + +#ifdef VIRTSER_ENABLE +# include "virtser.h" +#endif + +layer_state_t default_layer_state_set_kb(layer_state_t state) { + if (layer_state_cmp(state, BASE)) { + rgb_matrix_mode(3); + } else if (layer_state_cmp(state, GAMES)) { + rgb_matrix_mode(1); + } + return state; +} + +uint16_t key_presses = 0; +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + // for tab/number layer switch + static bool key_pressed_since_switch = false; + static uint16_t switch_down_time = 0; + + // for alt-tab on punc layer + static bool alt_tab_used = false; + + // for capital umlauts + static bool shift_held = false; + +#ifdef VIRTSER_ENABLE + if (record->event.pressed) { + uint8_t key_index = 40 + record->event.key.col + record->event.key.row * 6; + virtser_send(key_index); + } else { + uint8_t key_index = 90 + record->event.key.col + record->event.key.row * 6; + virtser_send(key_index); + } +#endif + + if (record->event.pressed) { + key_pressed_since_switch = true; + key_presses++; + } + + switch (keycode) { + case UP4: + if (record->event.pressed) { + tap_code(KC_UP); + tap_code(KC_UP); + tap_code(KC_UP); + tap_code(KC_UP); + return false; + } + break; + + case DOWN4: + if (record->event.pressed) { + tap_code(KC_DOWN); + tap_code(KC_DOWN); + tap_code(KC_DOWN); + tap_code(KC_DOWN); + return false; + } + break; + + case NUM_SWITCH: + if (record->event.pressed) { + layer_on(NUM); + key_pressed_since_switch = false; + switch_down_time = timer_read(); + } else { + layer_off(NUM); + + if (!key_pressed_since_switch && timer_elapsed(switch_down_time) < 200) { + tap_code(KC_TAB); + } + } + return false; + + case MO(PUNC): + if (!record->event.pressed) { + if (alt_tab_used) { + unregister_code(KC_LALT); + alt_tab_used = false; + } + } + return true; + + case MO(FUNCTIONS): + if (!record->event.pressed) { + // if NUM_SWITCH has been lifted first, toggle to that layer + // (4 = 2^NUM) + if ((layer_state & 4) != 0) { + layer_on(FUNCTIONS); + return false; + } + } + return true; + + case ALTTAB: + if (record->event.pressed) { + alt_tab_used = true; + register_code(KC_LALT); + tap_code(KC_TAB); + } + return false; + + case KC_LSFT: + case KC_RSFT: + shift_held = record->event.pressed; + break; + + case A_UMLAUT: + if (record->event.pressed) { + if (shift_held) + register_unicode(0x00c4); + else + register_unicode(0x00e4); + } + break; + case O_UMLAUT: + if (record->event.pressed) { + if (shift_held) + register_unicode(0x00d6); + else + register_unicode(0x00f6); + } + break; + case U_UMLAUT: + if (record->event.pressed) { + if (shift_held) + register_unicode(0x00dc); + else + register_unicode(0x00fc); + } + break; + } + return true; +} diff --git a/users/ollyhayes/ollyhayes.h b/users/ollyhayes/ollyhayes.h new file mode 100644 index 0000000000..c65422937c --- /dev/null +++ b/users/ollyhayes/ollyhayes.h @@ -0,0 +1,41 @@ +/* Copyright 2022 Olly Hayes (@ollyhayes) + * + * 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 QMK_KEYBOARD_H + +enum layers { + BASE, + QWERTY, + GAMES, + NUM, + FUNCTIONS, + ARR, + PUNC, + DUBPUNC, + MEDIA, +}; + +enum custom_keycodes { + DOWN4 = SAFE_RANGE, + UP4, + NUM_SWITCH, + ALTTAB, + A_UMLAUT, + O_UMLAUT, + U_UMLAUT, +}; + +extern uint16_t key_presses; diff --git a/users/ollyhayes/rules.mk b/users/ollyhayes/rules.mk new file mode 100644 index 0000000000..27752a5dee --- /dev/null +++ b/users/ollyhayes/rules.mk @@ -0,0 +1 @@ +SRC += ollyhayes.c diff --git a/users/pcewing/README.md b/users/pcewing/README.md new file mode 100644 index 0000000000..0073b4f492 --- /dev/null +++ b/users/pcewing/README.md @@ -0,0 +1,85 @@ +# User Space Code for Paul Ewing + +This folder contains my user space code. + +## Key Repeater + +I've implemented a key repeater utility in [./key_repeater.h](./key_repeater.h) +and [./key_repeater.c](./key_repeater.c) that is similar in concept to the +"rapid fire" feature many game controllers come with. The intent behind this is +that the user can hold down a key and while it is pressed, a keycode will be +repeatedly sent. I have found this useful in certain games and during game +development. + +The duration of the key press as well as the time between key presses is +slightly randomized by design. This is to simulate more realistic human +behavior. By setting the minimum and maximum duration fields to the same value +in the configuration, this randomization can be disabled. + +**Note:** Please be aware that this might be against the terms of service in +certain games so use your own discretion before using this feature. + +### How to Use + +Define the repeater and then configure and allocate it in your keymap's +initialization process: + +```c +static struct key_repeater_t* click_repeater = NULL; + +void keyboard_post_init_user(void) { + // Seed the random number generator which is used by the key repeater + srand(timer_read32()); + + // Configure and instantiate a key repeater for mouse button 1 "rapid fire" + struct key_repeater_config_t cfg = { + .key = KC_BTN1, // Press mouse button 1 (Left click) + .key_duration_min = 20, // Press key for 20 to 50 milliseconds + .key_duration_max = 50, + .wait_duration_min = 90, // Wait for 90 to 140 milliseconds before pressing again + .wait_duration_max = 140, + }; + + click_repeater = kr_new(&cfg); +} +``` + +Make sure the key repeater is polled during matrix scanning: + +```c +void matrix_scan_user(void) { + kr_poll(click_repeater); +} +``` + +Define a custom keycode that will enable/disable the repeater: + +```c +enum { + RP_BTN1 = SAFE_RANGE, // Click repeatedly while key is held +}; +``` + +Assign the keycode to a key in your `LAYOUT(...)` macro. + +Define the logic to enable/disable the repeater when the custom keycode is +pressed or released: + +```c +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case RP_BTN1: + if (record->event.pressed) { + kr_enable(click_repeater); + } else { + kr_disable(click_repeater); + } + return false; + default: + return true; + } +} +``` + +For a full working example in own of my own keymaps, see: +[keyboards/cozykeys/speedo/v3/keymaps/pcewing/keymap.c](../../keyboards/cozykeys/speedo/v3/keymaps/pcewing/keymap.c) diff --git a/users/pcewing/key_repeater.c b/users/pcewing/key_repeater.c new file mode 100644 index 0000000000..6c77d45b5f --- /dev/null +++ b/users/pcewing/key_repeater.c @@ -0,0 +1,168 @@ +/* + * Copyright 2022 Paul Ewing + * + * 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 "key_repeater.h" +#include <stdlib.h> +#include QMK_KEYBOARD_H + +enum key_repeater_state { + KR_DISABLED, + KR_WAITING, + KR_BUTTON_DOWN, + + __KR_STATE_COUNT +}; + +struct key_repeater_t { + int key; + uint32_t key_duration_min; + uint32_t key_duration_max; + uint32_t wait_duration_min; + uint32_t wait_duration_max; + + enum key_repeater_state state; + uint32_t previous_button_down; + uint32_t previous_button_up; + uint32_t key_duration; + uint32_t wait_duration; +}; + +// Utility functions +uint32_t get_rand(uint32_t min, uint32_t max); + +// State handler function table +void kr_waiting(struct key_repeater_t *kr); +void kr_button_down(struct key_repeater_t *kr); + +typedef void (*kr_state_handler)(struct key_repeater_t *kr); +static kr_state_handler kr_state_handlers[] = { + [KR_DISABLED] = NULL, + [KR_WAITING] = kr_waiting, + [KR_BUTTON_DOWN] = kr_button_down, +}; + +struct key_repeater_t* kr_new(struct key_repeater_config_t* cfg) { + struct key_repeater_t* kr = (struct key_repeater_t*)malloc(sizeof(struct key_repeater_t)); + + if (cfg) { + kr->key = cfg->key; + kr->key_duration_min = cfg->key_duration_min; + kr->key_duration_max = cfg->key_duration_max; + kr->wait_duration_min = cfg->wait_duration_min; + kr->wait_duration_max = cfg->wait_duration_max; + } else { + kr->key = KC_NO; + kr->key_duration_min = 0; + kr->key_duration_max = 0; + kr->wait_duration_min = 0; + kr->wait_duration_max = 0; + } + + kr->state = KR_DISABLED; + kr->previous_button_down = 0; + kr->previous_button_up = 0; + kr->key_duration = 0; + kr->wait_duration = 0; + + return kr; +} + +void kr_free(struct key_repeater_t **kr) { + if (kr && *kr) { + free(*kr); + *kr = NULL; + } +} + +void kr_enable(struct key_repeater_t *kr) { + if (!kr || kr->key == KC_NO) { + return; + } + + if (kr->state != KR_DISABLED) { + return; + } + kr->state = KR_WAITING; + kr->previous_button_down = 0; + kr->previous_button_up = 0; + kr->key_duration = 0; + kr->wait_duration = 0; +} + +void kr_disable(struct key_repeater_t *kr) { + if (!kr || kr->key == KC_NO) { + return; + } + + if (kr->state == KR_BUTTON_DOWN) { + unregister_code(kr->key); + } + kr->state = KR_DISABLED; +} + +void kr_poll(struct key_repeater_t *kr) { + if (!kr || kr->key == KC_NO) { + return; + } + + kr_state_handler handler = kr_state_handlers[kr->state]; + if (handler) { + (handler)(kr); + } +} + +void kr_waiting(struct key_repeater_t *kr) { + if (!kr || kr->key == KC_NO) { + return; + } + + uint32_t now = timer_read32(); + if (now > (kr->previous_button_up + kr->wait_duration)) { + kr->state = KR_BUTTON_DOWN; + kr->previous_button_down = now; + if (kr->key_duration_min == kr->key_duration_max) { + kr->key_duration = kr->key_duration_min; + } else { + kr->key_duration = get_rand(kr->key_duration_min, kr->key_duration_max); + } + register_code(kr->key); + } +} + +void kr_button_down(struct key_repeater_t *kr) { + if (!kr || kr->key == KC_NO) { + return; + } + + uint32_t now = timer_read32(); + if (now > (kr->previous_button_down + kr->key_duration)) { + kr->state = KR_WAITING; + kr->previous_button_up = now; + if (kr->wait_duration_min == kr->wait_duration_max) { + kr->wait_duration = kr->wait_duration_min; + } else { + kr->wait_duration = get_rand(kr->wait_duration_min, kr->wait_duration_max); + } + unregister_code(kr->key); + } +} + +// Return a random number between min and max; assumes that the random number +// generator has already been seeded +uint32_t get_rand(uint32_t min, uint32_t max) { + return (rand() % (max - min)) + min; +} diff --git a/users/pcewing/key_repeater.h b/users/pcewing/key_repeater.h new file mode 100644 index 0000000000..30b7f748ff --- /dev/null +++ b/users/pcewing/key_repeater.h @@ -0,0 +1,68 @@ +/* + * Copyright 2022 Paul Ewing + * + * 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 + +// The key_repeater_config_t type holds user configurable options set when +// allocating a new key repeater. +struct key_repeater_config_t { + // The key code that will be repeatedly registered + int key; + + // The minimum amount of time to press down the key when registered + const uint32_t key_duration_min; + + // The maximum amount of time to press down the key when registered + const uint32_t key_duration_max; + + // The minimum amount of time to wait between registering key presses + const uint32_t wait_duration_min; + + // The maximum amount of time to wait between registering key presses + const uint32_t wait_duration_max; +}; + +// The key_repeater_t type represents a key repeater. This is similar to the +// "Rapid fire" feature on many game controllers. The intention behind this is +// to periodically send a key code while the user is pressing a key. +// +// The duration of the key press as well as the time between key presses is +// slightly randomized by design. This is to simulate more realistic human +// behavior. By setting the minimum and maximum duration fields to the same +// value in the configuration, this randomization can be disabled. +// +// This type is intentionally opaque to avoid the user setting internal fields +// directly. It must be allocated and destroyed using the kr_new() and +// kr_free() functions respectively. +struct key_repeater_t; + +// Allocate a new key repeater. +struct key_repeater_t* kr_new(struct key_repeater_config_t* cfg); + +// Release an allocated key repeater. +void kr_free(struct key_repeater_t** kr); + +// Enable the key repeater such that it will start periodically registering the +// configured key code. +void kr_enable(struct key_repeater_t* kr); + +// Disable the key repeater such that it will stop periodically registering the +// configured key code. +void kr_disable(struct key_repeater_t* kr); + +// Poll the key repeater to execute, tyically called from matrix_scan_user(). +void kr_poll(struct key_repeater_t* kr); diff --git a/users/pcewing/rules.mk b/users/pcewing/rules.mk new file mode 100644 index 0000000000..35d0bc3ab7 --- /dev/null +++ b/users/pcewing/rules.mk @@ -0,0 +1 @@ +SRC += key_repeater.c diff --git a/users/pvinis/pvinis.c b/users/pvinis/pvinis.c index 71f9210aec..96b01bb461 100644 --- a/users/pvinis/pvinis.c +++ b/users/pvinis/pvinis.c @@ -95,4 +95,4 @@ void keyboard_post_init_user(void) { // Default functions. __attribute__((weak)) void keyboard_post_init_user_keymap(void) {} -__attribute__((weak)) uint32_t layer_state_set_user_keymap(uint32_t state) { return state; } +__attribute__((weak)) layer_state_t layer_state_set_user_keymap(layer_state_t state) { return state; } diff --git a/users/pvinis/pvinis.h b/users/pvinis/pvinis.h index c50033a440..5a11a6cb6f 100644 --- a/users/pvinis/pvinis.h +++ b/users/pvinis/pvinis.h @@ -169,4 +169,4 @@ enum { // Extra stuff that might be needed. void keyboard_post_init_user_keymap(void); -uint32_t layer_state_set_user_keymap(uint32_t state); +layer_state_t layer_state_set_user_keymap(layer_state_t state); diff --git a/users/romus/romus.c b/users/romus/romus.c index f707bb8843..a41a6df578 100644 --- a/users/romus/romus.c +++ b/users/romus/romus.c @@ -59,7 +59,7 @@ __attribute__ ((weak)) void matrix_scan_keymap(void) { } __attribute__ ((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } -__attribute__ ((weak)) uint32_t layer_state_set_keymap (uint32_t state) { +__attribute__ ((weak)) layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } __attribute__ ((weak)) void led_set_keymap(uint8_t usb_led) { } @@ -551,7 +551,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { state = layer_state_set_keymap (state); #ifdef RGBLIGHT_ENABLE // Change RGB lighting depending on the last layer activated - rgblight_change( biton32(state) ); + rgblight_change( get_highest_layer(state) ); #endif return state; } diff --git a/users/sigma/sigma.c b/users/sigma/sigma.c index 527925a63f..8470060a53 100644 --- a/users/sigma/sigma.c +++ b/users/sigma/sigma.c @@ -49,12 +49,12 @@ bool process_record_secrets(uint16_t keycode, keyrecord_t *record) { __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } __attribute__ ((weak)) -uint32_t default_layer_state_set_keymap (uint32_t state) { +layer_state_t default_layer_state_set_keymap (layer_state_t state) { return state; } diff --git a/users/spidey3/config.h b/users/spidey3/config.h index f5f5e07f0f..91bcf910ee 100644 --- a/users/spidey3/config.h +++ b/users/spidey3/config.h @@ -1,26 +1,51 @@ +// Copyright 2022 Joshua Diamond josh@windowoffire.com (@spidey3) +// SPDX-License-Identifier: GPL-2.0-or-later + #pragma once #define LED_DISABLE_WHEN_USB_SUSPENDED #define RGB_DISABLE_WHEN_USB_SUSPENDED -#define RGBLIGHT_LAYERS -#define RGBLIGHT_MAX_LAYERS 17 -#define RGBLIGHT_LAYER_BLINK -#define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF -#define RGBLIGHT_STARTUP_ANIMATION - -#undef RGBLIGHT_ANIMATIONS -#define RGBLIGHT_EFFECT_BREATHING -#define RGBLIGHT_EFFECT_RAINBOW_MOOD -#define RGBLIGHT_EFFECT_RAINBOW_SWIRL -#define RGBLIGHT_EFFECT_SNAKE -#define RGBLIGHT_EFFECT_KNIGHT -#define RGBLIGHT_EFFECT_STATIC_GRADIENT -#define RGBLIGHT_EFFECT_ALTERNATING -#define RGBLIGHT_EFFECT_TWINKLE - -#define UNICODE_SELECTED_MODES UC_MAC, UC_LNX, UC_WINC + +#ifdef RGBLIGHT_ENABLE + +# define RGBLIGHT_LAYERS +# define RGBLIGHT_MAX_LAYERS 18 +# define RGBLIGHT_LAYER_BLINK +# define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF +# define RGBLIGHT_STARTUP_ANIMATION + +# undef RGBLIGHT_ANIMATIONS +# define RGBLIGHT_EFFECT_BREATHING +# define RGBLIGHT_EFFECT_RAINBOW_MOOD +# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +# define RGBLIGHT_EFFECT_SNAKE +# define RGBLIGHT_EFFECT_KNIGHT +# define RGBLIGHT_EFFECT_STATIC_GRADIENT +# define RGBLIGHT_EFFECT_TWINKLE + +# define RGBLIGHT_DEFAULT_HUE 213 +# define RGBLIGHT_DEFAULT_SAT UINT8_MAX +# define RGBLIGHT_DEFAULT_VAL RGBLIGHT_LIMIT_VAL / 2 + +# if defined(RGBLIGHT_EFFECT_TWINKLE) +# define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_TWINKLE +# elif defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) +# define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_RAINBOW_MOOD +# else +# define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_LIGHT +# endif + +#endif + +#define UNICODE_SELECTED_MODES UC_MAC, UC_LNX, UC_WINC, UC_EMACS #define SPI_DEBUG_SCAN_RATE #undef MANUFACTURER #define MANUFACTURER Window of Fire + +// Some keyboards enable BACKLIGHT_CAPS_LOCK without checking if backlight is enabled. +// Undef as appropriate to avoid compiler warnings in that case. +#ifndef BACKLIGHT_ENABLE +#undef BACKLIGHT_CAPS_LOCK +#endif diff --git a/users/spidey3/init.c b/users/spidey3/init.c index 8db41a5f4c..bd6ea5cac9 100644 --- a/users/spidey3/init.c +++ b/users/spidey3/init.c @@ -1,3 +1,6 @@ +// Copyright 2022 Joshua Diamond josh@windowoffire.com (@spidey3) +// SPDX-License-Identifier: GPL-2.0-or-later + #include "spidey3.h" void keyboard_post_init_user(void) { @@ -7,15 +10,10 @@ void keyboard_post_init_user(void) { } void eeconfig_init_user(void) { - print("eeconfig_init_user\n"); set_single_persistent_default_layer(_BASE); #ifdef UNICODEMAP_ENABLE eeconfig_init_user_unicode(); #endif - -#ifdef RGBLIGHT_ENABLE - eeconfig_init_user_rgb(); -#endif } #ifdef RGBLIGHT_ENABLE diff --git a/users/spidey3/layer_rgb.c b/users/spidey3/layer_rgb.c index 37e59579cf..c867468194 100644 --- a/users/spidey3/layer_rgb.c +++ b/users/spidey3/layer_rgb.c @@ -1,3 +1,6 @@ +// Copyright 2022 Joshua Diamond josh@windowoffire.com (@spidey3) +// SPDX-License-Identifier: GPL-2.0-or-later + #include QMK_KEYBOARD_H #include "spidey3.h" @@ -13,21 +16,15 @@ bool rgb_saved = 0; extern bool spi_gflock; extern uint16_t spi_replace_mode; -void spidey_glow(void) { +static void set_rgb_default(void) { rgblight_enable(); - rgblight_sethsv(213, 255, 128); - if ((RGBLIGHT_MODE_TWINKLE <= rgblight_get_mode()) && (rgblight_get_mode() < RGBLIGHT_MODE_TWINKLE_end)) { - rgblight_step(); - } else { - rgblight_mode(RGBLIGHT_MODE_TWINKLE); - } + rgblight_sethsv(RGBLIGHT_DEFAULT_HUE, RGBLIGHT_DEFAULT_SAT, RGBLIGHT_DEFAULT_VAL); + rgblight_mode(RGBLIGHT_DEFAULT_MODE); #ifdef VELOCIKEY_ENABLE if (velocikey_enabled()) velocikey_toggle(); #endif } -void eeconfig_init_user_rgb(void) { spidey_glow(); } - // clang-format off // Convenience macros @@ -68,6 +65,7 @@ const rgblight_segment_t PROGMEM _uc_mac_layer[] = RGBLIGHT_LAYER_SEGMENTS(CORN // UC_WIN disabled in config.h // UC_BSD not implemented const rgblight_segment_t PROGMEM _uc_winc_layer[] = RGBLIGHT_LAYER_SEGMENTS(CORNER_BR(HSV_CYAN)); +const rgblight_segment_t PROGMEM _uc_emacs_layer[] = RGBLIGHT_LAYER_SEGMENTS(CORNER_BR(HSV_GREEN)); // Now define the array of layers. Higher numbered layers take precedence. const rgblight_segment_t *const PROGMEM _rgb_layers[] = { @@ -92,6 +90,7 @@ const rgblight_segment_t *const PROGMEM _rgb_layers[] = { [UNICODE_OFFSET + UC_WIN] = _none, [UNICODE_OFFSET + UC_BSD] = _none, [UNICODE_OFFSET + UC_WINC] = _uc_winc_layer, + [UNICODE_OFFSET + UC_EMACS] = _uc_emacs_layer, [UNICODE_OFFSET + UC__COUNT] = NULL }; @@ -101,7 +100,6 @@ const rgblight_segment_t *const PROGMEM _rgb_layers[] = { const uint8_t PROGMEM _n_rgb_layers = sizeof(_rgb_layers) / sizeof(_rgb_layers[0]) - 1; void clear_rgb_layers() { - dprint("clear_rgb_layers()\n"); for (uint8_t i = 0; i < _n_rgb_layers; i++) { rgblight_set_layer_state(i, false); } @@ -110,7 +108,6 @@ void clear_rgb_layers() { void do_rgb_layers(layer_state_t state, uint8_t start, uint8_t end) { for (uint8_t i = start; i < end; i++) { bool is_on = layer_state_cmp(state, i); - dprintf("layer[%u]=rl[%u]=%u\n", i, LAYER_OFFSET + i, is_on); rgblight_set_layer_state(LAYER_OFFSET + i, is_on); } } @@ -119,7 +116,6 @@ void do_rgb_unicode(void) { uint8_t uc_mode = get_unicode_input_mode(); for (uint8_t i = 0; i < UC__COUNT; i++) { bool is_on = i == uc_mode; - dprintf("unicode[%u]=rl[%u]=%u\n", i, UNICODE_OFFSET + i, is_on); rgblight_set_layer_state(UNICODE_OFFSET + i, is_on); } } @@ -138,7 +134,7 @@ int8_t change_sat = 0; int8_t change_val = 0; // timer to control color change speed -uint16_t change_timer = 0; +uint16_t change_timer = 0; const uint16_t change_tick = 15; extern rgblight_config_t rgblight_config; @@ -146,14 +142,15 @@ extern rgblight_status_t rgblight_status; #if defined(RGBLIGHT_STARTUP_ANIMATION) -#define STARTUP_ANIMATION_SATURATION 200 -#define STARTUP_ANIMATION_VALUE 255 -#define STARTUP_ANIMATION_FADE_STEP 5 -#define STARTUP_ANIMATION_CYCLE_STEP 2 -#define STARTUP_ANIMATION_RAMP_TO_STEPS 70 -#define STARTUP_ANIMATION_STEP_TIME 10 -#define STARTUP_ANIMATION_INITIAL_DELAY 0 // milliseconds, must be < 255 * STEP_TIME +# define STARTUP_ANIMATION_SATURATION 200 +# define STARTUP_ANIMATION_VALUE 255 +# define STARTUP_ANIMATION_FADE_STEP 5 +# define STARTUP_ANIMATION_CYCLE_STEP 2 +# define STARTUP_ANIMATION_RAMP_TO_STEPS 70 +# define STARTUP_ANIMATION_STEP_TIME 10 +# define STARTUP_ANIMATION_INITIAL_DELAY 0 // milliseconds, must be < 255 * STEP_TIME +// clang-format off typedef enum { DISABLED, WAITING, @@ -167,18 +164,18 @@ typedef enum { CLEAN_UP, DONE } startup_animation_state_t; +// clang-format on -static rgblight_config_t old_config; -static uint8_t old_base_mode; +static rgblight_config_t old_config; +static uint8_t old_base_mode; static startup_animation_state_t startup_animation_state = DISABLED; -static uint16_t rgblight_startup_loop_timer; +static uint16_t rgblight_startup_loop_timer; void startup_animation_init(void) { old_config.raw = rgblight_config.raw; old_base_mode = rgblight_status.base_mode; - if (!old_config.enable) - rgblight_enable_noeeprom(); + if (!old_config.enable) rgblight_enable_noeeprom(); } #endif @@ -202,9 +199,9 @@ void matrix_scan_user_rgb(void) { switch (startup_animation_state) { case WAITING: -#ifdef STARTUP_ANIMATION_DEBUG +# ifdef STARTUP_ANIMATION_DEBUG dprintf("sua WAITING counter=%u\n", counter); -#endif +# endif if (counter < STARTUP_ANIMATION_INITIAL_DELAY / STARTUP_ANIMATION_STEP_TIME) { counter++; } else { @@ -213,83 +210,87 @@ void matrix_scan_user_rgb(void) { break; case RESTART: +# ifdef STARTUP_ANIMATION_DEBUG dprintln("sua RESTART"); +# endif startup_animation_init(); case START: +# ifdef STARTUP_ANIMATION_DEBUG dprintln("sua START"); +# endif startup_animation_state = FADE_OLD; - counter = old_config.val; + counter = old_config.val; // No break! Just roll into FADE_OLD in the same iteration... case FADE_OLD: -#ifdef STARTUP_ANIMATION_DEBUG +# ifdef STARTUP_ANIMATION_DEBUG dprintf("sua FADE_OLD counter=%u\n", counter); -#endif +# endif if (counter >= STARTUP_ANIMATION_FADE_STEP) { rgblight_sethsv_noeeprom(old_config.hue, old_config.sat, counter); counter -= STARTUP_ANIMATION_FADE_STEP; } else { - counter = 0; + counter = 0; startup_animation_state = FADE_IN; rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); } break; case FADE_IN: -#ifdef STARTUP_ANIMATION_DEBUG +# ifdef STARTUP_ANIMATION_DEBUG dprintf("sua FADE_IN counter=%u\n", counter); -#endif +# endif if (counter < STARTUP_ANIMATION_VALUE) { rgblight_sethsv_noeeprom(old_config.hue, STARTUP_ANIMATION_SATURATION, counter); counter += STARTUP_ANIMATION_FADE_STEP; } else { - counter = 255; + counter = 255; startup_animation_state = CYCLE; } break; case CYCLE: -#ifdef STARTUP_ANIMATION_DEBUG +# ifdef STARTUP_ANIMATION_DEBUG dprintf("sua CYCLE counter=%u\n", counter); -#endif +# endif if (counter >= STARTUP_ANIMATION_CYCLE_STEP) { rgblight_sethsv_noeeprom((counter + old_config.hue) % 255, STARTUP_ANIMATION_SATURATION, STARTUP_ANIMATION_VALUE); counter -= STARTUP_ANIMATION_CYCLE_STEP; } else { if ( -#ifdef RGBLIGHT_EFFECT_BREATHING +# ifdef RGBLIGHT_EFFECT_BREATHING (old_base_mode == RGBLIGHT_MODE_BREATHING) || -#endif -#ifdef RGBLIGHT_EFFECT_SNAKE +# endif +# ifdef RGBLIGHT_EFFECT_SNAKE (old_base_mode == RGBLIGHT_MODE_SNAKE) || -#endif -#ifdef RGBLIGHT_EFFECT_KNIGHT +# endif +# ifdef RGBLIGHT_EFFECT_KNIGHT (old_base_mode == RGBLIGHT_MODE_KNIGHT) || -#endif -#ifdef RGBLIGHT_EFFECT_TWINKLE +# endif +# ifdef RGBLIGHT_EFFECT_TWINKLE (old_base_mode == RGBLIGHT_MODE_TWINKLE) || -#endif +# endif !old_config.enable) { - counter = STARTUP_ANIMATION_VALUE; + counter = STARTUP_ANIMATION_VALUE; startup_animation_state = RAMP_DOWN; } else if ( -#ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT +# ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT (old_base_mode == RGBLIGHT_MODE_STATIC_GRADIENT) || -#endif -#ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD +# endif +# ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD (old_base_mode == RGBLIGHT_MODE_RAINBOW_MOOD) || -#endif -#ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL +# endif +# ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL (old_base_mode == RGBLIGHT_MODE_RAINBOW_SWIRL) || -#endif -#ifdef RGBLIGHT_EFFECT_RAINBOW_CHRISTMAS +# endif +# ifdef RGBLIGHT_EFFECT_RAINBOW_CHRISTMAS (old_base_mode == RGBLIGHT_MODE_CHRISTMAS) || -#endif -#ifdef RGBLIGHT_EFFECT_RAINBOW_RGB_TEST_ +# endif +# ifdef RGBLIGHT_EFFECT_RAINBOW_RGB_TEST (old_base_mode == RGBLIGHT_MODE_RGB_TEST) || -#endif +# endif (old_base_mode == RGBLIGHT_MODE_STATIC_LIGHT)) { - counter = 0; + counter = 0; startup_animation_state = RAMP_TO; } else { startup_animation_state = CLEAN_UP; @@ -298,39 +299,41 @@ void matrix_scan_user_rgb(void) { break; case RAMP_DOWN: -#ifdef STARTUP_ANIMATION_DEBUG +# ifdef STARTUP_ANIMATION_DEBUG dprintf("sua RAMP_DOWN counter=%u\n", counter); -#endif +# endif + rgblight_sethsv_noeeprom(old_config.hue, STARTUP_ANIMATION_SATURATION, counter); if (counter >= STARTUP_ANIMATION_FADE_STEP) { - rgblight_sethsv_noeeprom(old_config.hue, STARTUP_ANIMATION_SATURATION, counter); counter -= STARTUP_ANIMATION_FADE_STEP; } else { startup_animation_state = CLEAN_UP; } break; - case RAMP_TO: - { -#ifdef STARTUP_ANIMATION_DEBUG - dprintf("sua RAMP_TO s=%u, v=%u, counter=%u\n", old_config.sat, old_config.val, counter); -#endif - uint8_t steps = STARTUP_ANIMATION_RAMP_TO_STEPS; - if (counter < steps) { - uint8_t s = STARTUP_ANIMATION_SATURATION + counter * (((float)old_config.sat - STARTUP_ANIMATION_SATURATION) / (float)steps); - uint8_t v = STARTUP_ANIMATION_VALUE + counter * (((float)old_config.val - STARTUP_ANIMATION_VALUE) / (float)steps); - rgblight_sethsv_noeeprom(old_config.hue, s, v); - counter++; - } else { - startup_animation_state = CLEAN_UP; - } + case RAMP_TO: { +# ifdef STARTUP_ANIMATION_DEBUG + dprintf("sua RAMP_TO s=%u, v=%u, counter=%u\n", old_config.sat, old_config.val, counter); +# endif + uint8_t steps = STARTUP_ANIMATION_RAMP_TO_STEPS; + if (counter < steps) { + uint8_t s = STARTUP_ANIMATION_SATURATION + counter * (((float)old_config.sat - STARTUP_ANIMATION_SATURATION) / (float)steps); + uint8_t v = STARTUP_ANIMATION_VALUE + counter * (((float)old_config.val - STARTUP_ANIMATION_VALUE) / (float)steps); + rgblight_sethsv_noeeprom(old_config.hue, s, v); + counter++; + } else { + startup_animation_state = CLEAN_UP; } - break; + } break; case CLEAN_UP: +# ifdef STARTUP_ANIMATION_DEBUG dprintln("sua CLEAN_UP"); +# endif rgblight_reload_from_eeprom(); startup_animation_state = DONE; +# ifdef STARTUP_ANIMATION_DEBUG dprintln("sua DONE"); +# endif break; default: @@ -344,8 +347,8 @@ void matrix_scan_user_rgb(void) { if (timer_elapsed(change_timer) > change_tick) { HSV hsv = rgblight_get_hsv(); hsv.h += change_hue; - hsv.s = change_sat > 0 ? qadd8(hsv.s, (uint8_t) change_sat) : qsub8(hsv.s, (uint8_t) -change_sat); - hsv.v = change_val > 0 ? qadd8(hsv.v, (uint8_t) change_val) : qsub8(hsv.v, (uint8_t) -change_val); + hsv.s = change_sat > 0 ? qadd8(hsv.s, (uint8_t)change_sat) : qsub8(hsv.s, (uint8_t)-change_sat); + hsv.v = change_val > 0 ? qadd8(hsv.v, (uint8_t)change_val) : qsub8(hsv.v, (uint8_t)-change_val); rgblight_sethsv_noeeprom(hsv.h, hsv.s, hsv.v); change_timer = timer_read(); } @@ -372,8 +375,6 @@ layer_state_t layer_state_set_user_rgb(layer_state_t state) { } bool led_update_user_rgb(led_t led_state) { - dprintf("num=%u, cap=%u, scl=%u, cmp=%u, kan=%u\n", led_state.num_lock, led_state.caps_lock, led_state.scroll_lock, led_state.compose, led_state.kana); - rgblight_set_layer_state(LOCK_OFFSET + USB_LED_NUM_LOCK, led_state.num_lock); rgblight_set_layer_state(LOCK_OFFSET + USB_LED_CAPS_LOCK, led_state.caps_lock); rgblight_set_layer_state(LOCK_OFFSET + USB_LED_SCROLL_LOCK, led_state.scroll_lock); @@ -385,7 +386,6 @@ void rgb_layer_ack_yn(bool yn) { rgb_layer_ack(yn ? ACK_YES : ACK_NO); } void rgb_layer_ack(layer_ack_t n) { uint8_t layer = ACK_OFFSET + n; - dprintf("rgb_layer_ack(%u) ==> %u\n", n, layer); rgblight_blink_layer(layer, RGB_LAYER_ACK_DURATION); } @@ -395,11 +395,9 @@ extern rgblight_config_t rgblight_config; bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { switch (keycode) { - case SPI_GLO: - spidey_glow(); - return false; - // clang-format off + case SPI_GLO: set_rgb_default(); return false; + case RGB_HUI: change_timer = timer_read(); change_hue = 1; return false; case RGB_HUD: change_timer = timer_read(); change_hue = -1; return false; case RGB_SAI: change_timer = timer_read(); change_sat = 1; return false; @@ -460,7 +458,9 @@ void post_process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { break; case RGB_TOG: - rgb_layer_ack_yn(rgblight_config.enable); + // Hack - we only get called on the press for RGB_TOG, + // but the flag is only flipped on the release... + rgb_layer_ack_yn(!rgblight_config.enable); break; #ifdef VELOCIKEY_ENABLE @@ -477,10 +477,14 @@ void post_process_record_user_rgb(uint16_t keycode, keyrecord_t *record) { break; #endif -#if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) - case SPI_LNX: - case SPI_OSX: - case SPI_WIN: +#if defined(UNICODE_COMMON_ENABLE) + case UC_M_MA: + case UC_M_LN: + case UC_M_WI: + case UC_M_BS: + case UC_M_WC: + case UC_M_EM: + case UC_MOD: case UC_RMOD: rgb_layer_ack(ACK_MEH); diff --git a/users/spidey3/rules.mk b/users/spidey3/rules.mk index de8ed113e7..c95582e176 100644 --- a/users/spidey3/rules.mk +++ b/users/spidey3/rules.mk @@ -1,6 +1,7 @@ BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite CONSOLE_ENABLE = yes # Console for debug BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +NKRO_ENABLE = yes LTO_ENABLE = yes SRC += init.c diff --git a/users/spidey3/spidey3.c b/users/spidey3/spidey3.c index df73c903d0..842bb465f7 100644 --- a/users/spidey3/spidey3.c +++ b/users/spidey3/spidey3.c @@ -1,3 +1,6 @@ +// Copyright 2022 Joshua Diamond josh@windowoffire.com (@spidey3) +// SPDX-License-Identifier: GPL-2.0-or-later + #include QMK_KEYBOARD_H #include "spidey3.h" @@ -18,7 +21,7 @@ static uint32_t matrix_timer = 0; # endif void report_version(void) { - uprintln(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE); + uprintln(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " - " QMK_BUILDDATE); reported_version = true; } #endif @@ -51,8 +54,42 @@ void matrix_scan_user(void) { #endif } -bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uint32_t baseAlphaLower, uint32_t baseAlphaUpper, uint32_t zeroGlyph, uint32_t baseNumberOne, uint32_t spaceGlyph, uint8_t temp_mod, uint8_t temp_osm) { +static uint32_t math_glyph_exceptions(const uint16_t keycode, const bool shifted) { + bool caps = host_keyboard_led_state().caps_lock; + if (shifted != caps) { + switch (keycode) { + // clang-format off + case KC_C: return 0x2102; + case KC_H: return 0x210D; + case KC_N: return 0x2115; + case KC_P: return 0x2119; + case KC_Q: return 0x211A; + case KC_R: return 0x211D; + case KC_Z: return 0x2124; + // clang-format on + } + } + return 0; +} + +bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uint32_t baseAlphaLower, uint32_t baseAlphaUpper, uint32_t zeroGlyph, uint32_t baseNumberOne, uint32_t spaceGlyph, uint32_t (*exceptions)(const uint16_t keycode, const bool shifted), uint8_t temp_mod, uint8_t temp_osm) { + void _register(uint32_t codepoint) { + unicode_input_start(); + register_hex32(codepoint); + unicode_input_finish(); + } + if ((((temp_mod | temp_osm) & (MOD_MASK_CTRL | MOD_MASK_ALT | MOD_MASK_GUI))) == 0) { + bool shifted = ((temp_mod | temp_osm) & MOD_MASK_SHIFT); + if (exceptions) { + uint32_t res = exceptions(keycode, shifted); + if (res) { + if (record->event.pressed) { + _register(res); + } + return false; + } + } switch (keycode) { case KC_A ... KC_Z: if (record->event.pressed) { @@ -61,39 +98,31 @@ bool process_record_glyph_replacement(uint16_t keycode, keyrecord_t *record, uin clear_oneshot_mods(); #endif - unicode_input_start(); - uint32_t base = ((temp_mod | temp_osm) & MOD_MASK_SHIFT) ? baseAlphaUpper : baseAlphaLower; - register_hex32(base + (keycode - KC_A)); - unicode_input_finish(); - + bool caps = host_keyboard_led_state().caps_lock; + uint32_t base = ((shifted == caps) ? baseAlphaLower : baseAlphaUpper); + _register(base + (keycode - KC_A)); set_mods(temp_mod); } return false; case KC_0: - if ((temp_mod | temp_osm) & MOD_MASK_SHIFT) { // skip shifted numbers, so that we can still use symbols etc. + if (shifted) { // skip shifted numbers, so that we can still use symbols etc. return true; } if (record->event.pressed) { - unicode_input_start(); - register_hex32(zeroGlyph); - unicode_input_finish(); + _register(zeroGlyph); } return false; case KC_1 ... KC_9: - if ((temp_mod | temp_osm) & MOD_MASK_SHIFT) { // skip shifted numbers, so that we can still use symbols etc. + if (shifted) { // skip shifted numbers, so that we can still use symbols etc. return true; } if (record->event.pressed) { - unicode_input_start(); - register_hex32(baseNumberOne + (keycode - KC_1)); - unicode_input_finish(); + _register(baseNumberOne + (keycode - KC_1)); } return false; case KC_SPACE: if (record->event.pressed) { - unicode_input_start(); - register_hex32(spaceGlyph); // em space - unicode_input_finish(); + _register(spaceGlyph); // em space } return false; } @@ -163,7 +192,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { debug_keyboard = 0; debug_matrix = 0; } - uprintf("DEBUG: enable=%u, keyboard=%u, matrix=%u\n", debug_enable, debug_keyboard, debug_matrix); + uprintf("DEBUG: enable=%u, kb=%u, matrix=%u\n", debug_enable, debug_keyboard, debug_matrix); eeconfig_update_debug(debug_config.raw); return false; #endif @@ -174,21 +203,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case CH_ASST: host_consumer_send(AL_ASSISTANT); return false; case CH_SUSP: tap_code16(LGUI(LSFT(KC_L))); return true; -#if defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) - case SPI_LNX: set_unicode_input_mode(UC_LNX); break; - case SPI_OSX: set_unicode_input_mode(UC_OSX); break; - case SPI_WIN: set_unicode_input_mode(UC_WINC); break; -#endif // clang-format on - case SPI_NORMAL ... SPI_FRAKTR: + case SPI_NORMAL ... SPI_MATH: spi_replace_mode = (spi_replace_mode == keycode) ? SPI_NORMAL : keycode; - dprintf("spi_replace_mode = %u\n", spi_replace_mode); break; case SPI_GFLOCK: spi_gflock = !spi_gflock; - dprintf("spi_gflock = %u\n", spi_gflock); break; case SPI_KP_00: @@ -279,19 +301,23 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { case KC_SPACE: switch (spi_replace_mode) { case SPI_WIDE: - return process_record_glyph_replacement(keycode, record, 0xFF41, 0xFF21, 0xFF10, 0xFF11, 0x2003, mods, osm); + return process_record_glyph_replacement(keycode, record, 0xFF41, 0xFF21, 0xFF10, 0xFF11, 0x2003, NULL, mods, osm); case SPI_SCRIPT: - return process_record_glyph_replacement(keycode, record, 0x1D4EA, 0x1D4D0, 0x1D7CE, 0x1D7CF, 0x2002, mods, osm); + return process_record_glyph_replacement(keycode, record, 0x1D4EA, 0x1D4D0, 0x1D7CE, 0x1D7CF, 0x2002, NULL, mods, osm); case SPI_BLOCKS: - return process_record_glyph_replacement(keycode, record, 0x1F170, 0x1F170, '0', '1', 0x2002, mods, osm); + return process_record_glyph_replacement(keycode, record, 0x1F170, 0x1F170, '0', '1', 0x2002, NULL, mods, osm); case SPI_CIRCLE: - return process_record_glyph_replacement(keycode, record, 0x1F150, 0x1F150, '0', '1', 0x2002, mods, osm); + return process_record_glyph_replacement(keycode, record, 0x1F150, 0x1F150, '0', '1', 0x2002, NULL, mods, osm); case SPI_SQUARE: - return process_record_glyph_replacement(keycode, record, 0x1F130, 0x1F130, '0', '1', 0x2002, mods, osm); + return process_record_glyph_replacement(keycode, record, 0x1F130, 0x1F130, '0', '1', 0x2002, NULL, mods, osm); case SPI_PARENS: - return process_record_glyph_replacement(keycode, record, 0x1F110, 0x1F110, '0', '1', 0x2002, mods, osm); + return process_record_glyph_replacement(keycode, record, 0x1F110, 0x1F110, '0', '1', 0x2002, NULL, mods, osm); case SPI_FRAKTR: - return process_record_glyph_replacement(keycode, record, 0x1D586, 0x1D56C, '0', '1', 0x2002, mods, osm); + return process_record_glyph_replacement(keycode, record, 0x1D586, 0x1D56C, '0', '1', 0x2002, NULL, mods, osm); + case SPI_BOLD: + return process_record_glyph_replacement(keycode, record, 0x1D41A, 0x1D400, '0', '1', 0x2002, NULL, mods, osm); + case SPI_MATH: + return process_record_glyph_replacement(keycode, record, 0x1D552, 0x1D538, '0', '1', 0x2002, &math_glyph_exceptions, mods, osm); } break; @@ -304,9 +330,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { if ((mods | osm) & MOD_MASK_SHIFT) { del_mods(MOD_MASK_SHIFT); -#ifndef NO_ACTION_ONESHOT +# ifndef NO_ACTION_ONESHOT clear_oneshot_mods(); -#endif +# endif register_code(KC_DEL); delkey_registered = true; set_mods(mods); diff --git a/users/spidey3/spidey3.h b/users/spidey3/spidey3.h index d018e5defb..e91b299e55 100644 --- a/users/spidey3/spidey3.h +++ b/users/spidey3/spidey3.h @@ -1,3 +1,6 @@ +// Copyright 2022 Joshua Diamond josh@windowoffire.com (@spidey3) +// SPDX-License-Identifier: GPL-2.0-or-later + #pragma once #include QMK_KEYBOARD_H @@ -10,16 +13,13 @@ enum userspace_layers { _BASE = 0, _NUMPAD, _FN, + _GLYPH, }; enum custom_keycodes { - SPI_GLO = SAFE_RANGE, - SPI_LNX, // Mode: Linux - SPI_OSX, // Mode: Mac - SPI_WIN, // Mode: Windows - CH_CPNL, // AL Control Panel - CH_ASST, // AL Context-aware Desktop Assistant - CH_SUSP, // Suspend + CH_CPNL = SAFE_RANGE, // AL Control Panel + CH_ASST, // AL Context-aware Desktop Assistant + CH_SUSP, // Suspend SPI_NORMAL, SPI_WIDE, @@ -29,8 +29,11 @@ enum custom_keycodes { SPI_SQUARE, SPI_PARENS, SPI_FRAKTR, + SPI_BOLD, + SPI_MATH, SPI_GFLOCK, SPI_KP_00, + SPI_GLO, }; #ifdef RGBLIGHT_ENABLE @@ -50,7 +53,6 @@ typedef enum layer_ack { # define RGB_LAYER_ACK_DURATION 500 -void eeconfig_init_user_rgb(void); void matrix_init_user_rgb(void); void matrix_scan_user_rgb(void); void keyboard_post_init_user_rgb(void); diff --git a/users/spidey3/unicode.c b/users/spidey3/unicode.c index 39a990674c..5292b0809b 100644 --- a/users/spidey3/unicode.c +++ b/users/spidey3/unicode.c @@ -1,3 +1,6 @@ +// Copyright 2022 Joshua Diamond josh@windowoffire.com (@spidey3) +// SPDX-License-Identifier: GPL-2.0-or-later + #include "unicode.h" diff --git a/users/spidey3/unicode.h b/users/spidey3/unicode.h index 6182669fb0..ee8e00056c 100644 --- a/users/spidey3/unicode.h +++ b/users/spidey3/unicode.h @@ -1,3 +1,6 @@ +// Copyright 2022 Joshua Diamond josh@windowoffire.com (@spidey3) +// SPDX-License-Identifier: GPL-2.0-or-later + #pragma once #include QMK_KEYBOARD_H diff --git a/users/stanrc85/config.h b/users/stanrc85/config.h index e12beedb90..d9600b8b3c 100644 --- a/users/stanrc85/config.h +++ b/users/stanrc85/config.h @@ -15,7 +15,7 @@ #define INDICATOR_PIN_2 D4 #endif -#ifdef KEYBOARD_mechlovin_adelais_standard_led_arm_rev4_stm32f303 +#if defined(KEYBOARD_mechlovin_adelais_standard_led_arm_rev4_stm32f303) || defined(KEYBOARD_mechlovin_adelais_standard_led_arm_rev4_apm32f103) #define INDICATOR_PIN_0 B2 #define INDICATOR_PIN_1 C15 #define INDICATOR_PIN_2 B9 @@ -30,3 +30,9 @@ #define ENABLE_RGB_MATRIX_MULTISPLASH #define ENABLE_RGB_MATRIX_TYPING_HEATMAP #endif + +#ifdef KEYBOARD_nasu + #define INDICATOR_PIN_0 B1 + #define INDICATOR_PIN_1 B0 + #define INDICATOR_PIN_2 A7 +#endif diff --git a/users/stanrc85/layer_rgb.c b/users/stanrc85/layer_rgb.c index 6d57198f3b..ad30c2ee65 100644 --- a/users/stanrc85/layer_rgb.c +++ b/users/stanrc85/layer_rgb.c @@ -5,7 +5,7 @@ void matrix_init_user(void) { }; layer_state_t layer_state_set_user(layer_state_t state) { - switch (biton32(state)) { + switch (get_highest_layer(state)) { case 0: rgblight_setrgb (0xFF, 0x00, 0x00); break; diff --git a/users/stanrc85/rules.mk b/users/stanrc85/rules.mk index 94f4027b96..141b4581a4 100644 --- a/users/stanrc85/rules.mk +++ b/users/stanrc85/rules.mk @@ -43,3 +43,13 @@ ifeq ($(strip $(KEYBOARD)), mechlovin/adelais/standard_led/arm/rev4/stm32f303) SRC += rgb_timeout.c SRC += indicator_layers_sneakbox.c endif +ifeq ($(strip $(KEYBOARD)), nasu) + SRC += indicator_layers_sneakbox.c + SRC += startup_fanfare.c + OPT_DEFS += -DHAS_INDICATORS +endif +ifeq ($(strip $(KEYBOARD)), mechlovin/adelais/standard_led/arm/rev4/apm32f103) + OPT_DEFS += -DHAS_INDICATORS + SRC += rgb_timeout.c + SRC += indicator_layers_sneakbox.c +endif diff --git a/users/talljoe/config.h b/users/talljoe/config.h index 8a5fd50cb7..dcdbbd89f4 100644 --- a/users/talljoe/config.h +++ b/users/talljoe/config.h @@ -19,9 +19,5 @@ #define RESET_LAYER 15 -#define BOOTMAGIC_KEY_SALT KC_ESC -#define BOOTMAGIC_KEY_SKIP KC_I -#define BOOTMAGIC_KEY_EEPROM_CLEAR KC_E - #define COMBO_COUNT 2 #define COMBO_TERM 250 diff --git a/users/talljoe/talljoe.c b/users/talljoe/talljoe.c index 517f712ec8..6655170d4a 100644 --- a/users/talljoe/talljoe.c +++ b/users/talljoe/talljoe.c @@ -138,7 +138,7 @@ void matrix_init_user(void) { } } -uint32_t default_layer_state_set_kb(uint32_t state) { +layer_state_t default_layer_state_set_kb(layer_state_t state) { // persist changes to default layers eeconfig_update_default_layer(state); return state; diff --git a/users/tominabox1/config.h b/users/tominabox1/config.h index 4a2433eb0b..f853e18605 100644 --- a/users/tominabox1/config.h +++ b/users/tominabox1/config.h @@ -3,8 +3,6 @@ // Tapping term settings #define TAPPING_TERM_PER_KEY #define TAP_HOLD_CAPS_DELAY 350 -#define BOOTMAGIC_KEY_SALT KC_BSPACE -#define BOOTMAGIC_KEY_EEPROM_CLEAR KC_Q // OLED settings #define OLED_FONT_H "users/tominabox1/doug.c" diff --git a/users/tominabox1/tominabox1.c b/users/tominabox1/tominabox1.c index 7322ead0dc..b4ec224d07 100644 --- a/users/tominabox1/tominabox1.c +++ b/users/tominabox1/tominabox1.c @@ -128,7 +128,7 @@ layer_state_t layer_state_set_keymap (layer_state_t state) { layer_state_t layer_state_set_user(layer_state_t state) { state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); - switch (biton32(state)) { + switch (get_highest_layer(state)) { case _LOWER: break; case _RAISE: @@ -231,7 +231,7 @@ void render_status_main(void) { // Host Keyboard Layer Status oled_write_P(PSTR("Layer: "), false); - switch (biton32(layer_state)) { + switch (get_highest_layer(layer_state)) { case _BASE: oled_write_P(PSTR("Colemak\n"), false); break; diff --git a/users/turbomech/backupturbomech.c b/users/turbomech/backupturbomech.c index aaea05df96..3671d27ab4 100644 --- a/users/turbomech/backupturbomech.c +++ b/users/turbomech/backupturbomech.c @@ -31,7 +31,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } __attribute__ ((weak)) @@ -300,7 +300,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { #ifdef RGBLIGHT_ENABLE uint8_t default_layer = eeconfig_read_default_layer(); if (rgb_layer_change) { - switch (biton32(state)) { + switch (get_highest_layer(state)) { case _FUNCTION: rgblight_set_blue; rgblight_mode(1); @@ -377,7 +377,7 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { return true; } __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } __attribute__ ((weak)) diff --git a/users/xulkal/custom_oled.c b/users/xulkal/custom_oled.c index 7fe8040927..fd03033ad6 100644 --- a/users/xulkal/custom_oled.c +++ b/users/xulkal/custom_oled.c @@ -37,7 +37,7 @@ static void render_icon(void) static void render_layer(void) { - uint8_t layer = layer_state ? biton(layer_state) : biton32(default_layer_state); + uint8_t layer = layer_state ? get_highest_layer(layer_state) : get_highest_layer(default_layer_state); #ifdef OLED_90ROTATION oled_write_P(PSTR("Layer"), false); #else diff --git a/users/yet-another-developer/config.h b/users/yet-another-developer/config.h index d46d487fe3..6d1bf83f0b 100644 --- a/users/yet-another-developer/config.h +++ b/users/yet-another-developer/config.h @@ -11,10 +11,6 @@ #define ONESHOT_TIMEOUT 2000 #endif // !ONESHOT_TIMEOUT -#ifndef QMK_KEYS_PER_SCAN - #define QMK_KEYS_PER_SCAN 4 -#endif // !QMK_KEYS_PER_SCAN - #if defined(LEADER_ENABLE) #define LEADER_PER_KEY_TIMING #define LEADER_TIMEOUT 250 diff --git a/users/zer09/config.h b/users/zer09/config.h index c5ab32f8d4..0324aaa7d3 100644 --- a/users/zer09/config.h +++ b/users/zer09/config.h @@ -1,10 +1,6 @@ #ifndef USERSPACE_CONFIG_H #define USERSPACE_CONFIG_H -#ifndef QMK_KEYS_PER_SCAN -#define QMK_KEYS_PER_SCAN 4 -#endif // !QMK_KEYS_PER_SCAN - // this makes it possible to do rolling combos (zx) 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 diff --git a/users/zer09/zer09.c b/users/zer09/zer09.c index a6768f0a1a..78433b4c20 100644 --- a/users/zer09/zer09.c +++ b/users/zer09/zer09.c @@ -43,7 +43,7 @@ void matrix_init_user(void) { void matrix_scan_user(void) { static uint8_t is_leds_changes = 1; - c_lyr = biton32(layer_state); + c_lyr = get_highest_layer(layer_state); is_leds_changes = is_leds_changes << set_layer_led(c_lyr); is_leds_changes = is_leds_changes << shifted_layer(); |