diff options
| author | Reibl János Dániel <jani.reibl3@gmail.com> | 2020-10-05 00:35:28 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-04 15:35:28 -0700 |
| commit | 661f4aaa8a4c25655007a238226d5d14549d083a (patch) | |
| tree | 4326d4d55854465d0b7bd599669004b8eda2b30a /users/riblee | |
| parent | 27f9f3196d39ab0ce1b72665ea4b57ff741e6dd8 (diff) | |
| download | qmk_firmware-661f4aaa8a4c25655007a238226d5d14549d083a.tar.gz qmk_firmware-661f4aaa8a4c25655007a238226d5d14549d083a.zip | |
[Keymap] Move my custom functions and keymaps to userspace (#10502)
* Move my custom functions and keymaps to userspace to be able to add the STM32F411 variant of my keyboard with mostly the same functionality
* Move keymaps to community layouts
* Remove keymaps from userspace readme.md
Co-authored-by: Janos Daniel Reibl <janos.daniel.reibl@protonmail.com>
Diffstat (limited to 'users/riblee')
| -rw-r--r-- | users/riblee/readme.md | 14 | ||||
| -rw-r--r-- | users/riblee/riblee.c | 166 | ||||
| -rw-r--r-- | users/riblee/riblee.h | 56 | ||||
| -rw-r--r-- | users/riblee/rules.mk | 1 |
4 files changed, 237 insertions, 0 deletions
diff --git a/users/riblee/readme.md b/users/riblee/readme.md new file mode 100644 index 000000000..54f5cc8bb --- /dev/null +++ b/users/riblee/readme.md | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | Copyright 2020 Janos Daniel Reibl <janos.daniel.reibl@protonmail.com> @riblee | ||
| 2 | |||
| 3 | This program is free software: you can redistribute it and/or modify | ||
| 4 | it under the terms of the GNU General Public License as published by | ||
| 5 | the Free Software Foundation, either version 2 of the License, or | ||
| 6 | (at your option) any later version. | ||
| 7 | |||
| 8 | This program is distributed in the hope that it will be useful, | ||
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | GNU General Public License for more details. | ||
| 12 | |||
| 13 | You should have received a copy of the GNU General Public License | ||
| 14 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
diff --git a/users/riblee/riblee.c b/users/riblee/riblee.c new file mode 100644 index 000000000..e1fe607ef --- /dev/null +++ b/users/riblee/riblee.c | |||
| @@ -0,0 +1,166 @@ | |||
| 1 | /* Copyright 2020 Janos Daniel Reibl <janos.daniel.reibl@protonmail.com> @riblee | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "riblee.h" | ||
| 18 | |||
| 19 | const uint8_t shift = MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT); | ||
| 20 | |||
| 21 | // Tap Dance functions | ||
| 22 | void dance_key_a (qk_tap_dance_state_t *state, void *user_data) { | ||
| 23 | if (state->count == 1) { | ||
| 24 | SEND_STRING("a"); | ||
| 25 | reset_tap_dance(state); | ||
| 26 | } else if (state->count == 2) { | ||
| 27 | if (!(keyboard_report->mods & shift)) { | ||
| 28 | send_unicode_string("á"); | ||
| 29 | } else { | ||
| 30 | send_unicode_string("Á"); | ||
| 31 | } | ||
| 32 | |||
| 33 | reset_tap_dance(state); | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 | void dance_key_e (qk_tap_dance_state_t *state, void *user_data) { | ||
| 38 | if (state->count == 1) { | ||
| 39 | SEND_STRING("e"); | ||
| 40 | reset_tap_dance(state); | ||
| 41 | } else if (state->count == 2) { | ||
| 42 | if (!(keyboard_report->mods & shift)) { | ||
| 43 | send_unicode_string("é"); | ||
| 44 | } else { | ||
| 45 | send_unicode_string("É"); | ||
| 46 | } | ||
| 47 | |||
| 48 | reset_tap_dance(state); | ||
| 49 | } | ||
| 50 | } | ||
| 51 | |||
| 52 | void dance_key_i (qk_tap_dance_state_t *state, void *user_data) { | ||
| 53 | if (state->count == 1) { | ||
| 54 | SEND_STRING("i"); | ||
| 55 | reset_tap_dance(state); | ||
| 56 | } else if (state->count == 2) { | ||
| 57 | if (!(keyboard_report->mods & shift)) { | ||
| 58 | send_unicode_string("í"); | ||
| 59 | } else { | ||
| 60 | send_unicode_string("Í"); | ||
| 61 | } | ||
| 62 | |||
| 63 | reset_tap_dance(state); | ||
| 64 | } | ||
| 65 | } | ||
| 66 | |||
| 67 | void dance_key_o (qk_tap_dance_state_t *state, void *user_data) { | ||
| 68 | if (state->count == 1) { | ||
| 69 | SEND_STRING("o"); | ||
| 70 | reset_tap_dance(state); | ||
| 71 | } else if (state->count == 2) { | ||
| 72 | if (!(keyboard_report->mods & shift)) { | ||
| 73 | send_unicode_string("ó"); | ||
| 74 | } else { | ||
| 75 | send_unicode_string("Ó"); | ||
| 76 | } | ||
| 77 | |||
| 78 | reset_tap_dance(state); | ||
| 79 | } else if (state->count == 3) { | ||
| 80 | if (!(keyboard_report->mods & shift)) { | ||
| 81 | send_unicode_string("ö"); | ||
| 82 | } else { | ||
| 83 | send_unicode_string("Ö"); | ||
| 84 | } | ||
| 85 | |||
| 86 | reset_tap_dance(state); | ||
| 87 | } else if (state->count == 4) { | ||
| 88 | if (!(keyboard_report->mods & shift)) { | ||
| 89 | send_unicode_string("ő"); | ||
| 90 | } else { | ||
| 91 | send_unicode_string("Ő"); | ||
| 92 | } | ||
| 93 | |||
| 94 | reset_tap_dance(state); | ||
| 95 | } | ||
| 96 | } | ||
| 97 | |||
| 98 | void dance_key_u (qk_tap_dance_state_t *state, void *user_data) { | ||
| 99 | if (state->count == 1) { | ||
| 100 | SEND_STRING("u"); | ||
| 101 | reset_tap_dance(state); | ||
| 102 | } else if (state->count == 2) { | ||
| 103 | if (!(keyboard_report->mods & shift)) { | ||
| 104 | send_unicode_string("ú"); | ||
| 105 | } else { | ||
| 106 | send_unicode_string("Ú"); | ||
| 107 | } | ||
| 108 | |||
| 109 | reset_tap_dance(state); | ||
| 110 | } else if (state->count == 3) { | ||
| 111 | if (!(keyboard_report->mods & shift)) { | ||
| 112 | send_unicode_string("ü"); | ||
| 113 | } else { | ||
| 114 | send_unicode_string("Ü"); | ||
| 115 | } | ||
| 116 | |||
| 117 | reset_tap_dance(state); | ||
| 118 | } else if (state->count == 4) { | ||
| 119 | if (!(keyboard_report->mods & shift)) { | ||
| 120 | send_unicode_string("ű"); | ||
| 121 | } else { | ||
| 122 | send_unicode_string("Ű"); | ||
| 123 | } | ||
| 124 | |||
| 125 | reset_tap_dance(state); | ||
| 126 | } | ||
| 127 | } | ||
| 128 | |||
| 129 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
| 130 | return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); | ||
| 131 | } | ||
| 132 | |||
| 133 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 134 | switch (keycode) { | ||
| 135 | case QWERTY: | ||
| 136 | if (record->event.pressed) { | ||
| 137 | set_single_persistent_default_layer(_QWERTY); | ||
| 138 | } | ||
| 139 | return false; | ||
| 140 | break; | ||
| 141 | case COLEMAK: | ||
| 142 | if (record->event.pressed) { | ||
| 143 | set_single_persistent_default_layer(_COLEMAK); | ||
| 144 | } | ||
| 145 | return false; | ||
| 146 | break; | ||
| 147 | case DVORAK: | ||
| 148 | if (record->event.pressed) { | ||
| 149 | set_single_persistent_default_layer(_DVORAK); | ||
| 150 | } | ||
| 151 | return false; | ||
| 152 | break; | ||
| 153 | case BACKLIT: | ||
| 154 | if (record->event.pressed) { | ||
| 155 | register_code(keycode_config(KC_LGUI)); | ||
| 156 | #ifdef BACKLIGHT_ENABLE | ||
| 157 | backlight_step(); | ||
| 158 | #endif | ||
| 159 | } else { | ||
| 160 | unregister_code(keycode_config(KC_LGUI)); | ||
| 161 | } | ||
| 162 | return false; | ||
| 163 | break; | ||
| 164 | } | ||
| 165 | return true; | ||
| 166 | }; | ||
diff --git a/users/riblee/riblee.h b/users/riblee/riblee.h new file mode 100644 index 000000000..bdaa9f321 --- /dev/null +++ b/users/riblee/riblee.h | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | /* Copyright 2020 Janos Daniel Reibl <janos.daniel.reibl@protonmail.com> @riblee | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #include QMK_KEYBOARD_H | ||
| 20 | |||
| 21 | enum preonic_layers { | ||
| 22 | _QWERTY, | ||
| 23 | _COLEMAK, | ||
| 24 | _DVORAK, | ||
| 25 | _LOWER, | ||
| 26 | _RAISE, | ||
| 27 | _ADJUST | ||
| 28 | }; | ||
| 29 | |||
| 30 | enum preonic_keycodes { | ||
| 31 | QWERTY = SAFE_RANGE, | ||
| 32 | COLEMAK, | ||
| 33 | DVORAK, | ||
| 34 | BACKLIT | ||
| 35 | }; | ||
| 36 | |||
| 37 | #define LOWER MO(_LOWER) | ||
| 38 | #define RAISE MO(_RAISE) | ||
| 39 | |||
| 40 | // Tap Dance declarations | ||
| 41 | enum { | ||
| 42 | TD_A, | ||
| 43 | TD_E, | ||
| 44 | TD_I, | ||
| 45 | TD_O, | ||
| 46 | TD_U, | ||
| 47 | }; | ||
| 48 | |||
| 49 | void dance_key_a (qk_tap_dance_state_t *, void *); | ||
| 50 | void dance_key_e (qk_tap_dance_state_t *, void *); | ||
| 51 | void dance_key_i (qk_tap_dance_state_t *, void *); | ||
| 52 | void dance_key_o (qk_tap_dance_state_t *, void *); | ||
| 53 | void dance_key_u (qk_tap_dance_state_t *, void *); | ||
| 54 | |||
| 55 | layer_state_t layer_state_set_user(layer_state_t); | ||
| 56 | bool process_record_user(uint16_t keycode, keyrecord_t *record); \ No newline at end of file | ||
diff --git a/users/riblee/rules.mk b/users/riblee/rules.mk new file mode 100644 index 000000000..31c0645d7 --- /dev/null +++ b/users/riblee/rules.mk | |||
| @@ -0,0 +1 @@ | |||
| SRC += riblee.c \ No newline at end of file | |||
