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 | |
parent | 27f9f3196d39ab0ce1b72665ea4b57ff741e6dd8 (diff) | |
download | qmk_firmware-661f4aaa8a4c25655007a238226d5d14549d083a.tar.gz |
[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>
-rw-r--r-- | keyboards/handwired/riblee_f401/riblee_f401.h | 2 | ||||
-rw-r--r-- | keyboards/handwired/riblee_f401/rules.mk | 2 | ||||
-rw-r--r-- | layouts/community/ortho_5x12/riblee/config.h (renamed from keyboards/handwired/riblee_f401/keymaps/riblee/config.h) | 2 | ||||
-rw-r--r-- | layouts/community/ortho_5x12/riblee/keymap.c (renamed from keyboards/handwired/riblee_f401/keymaps/riblee/keymap.c) | 184 | ||||
-rw-r--r-- | layouts/community/ortho_5x12/riblee/readme.md (renamed from keyboards/handwired/riblee_f401/keymaps/riblee/readme.md) | 0 | ||||
-rw-r--r-- | layouts/community/ortho_5x12/riblee/rules.mk (renamed from keyboards/handwired/riblee_f401/keymaps/riblee/rules.mk) | 0 | ||||
-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 |
10 files changed, 244 insertions, 183 deletions
diff --git a/keyboards/handwired/riblee_f401/riblee_f401.h b/keyboards/handwired/riblee_f401/riblee_f401.h index 306565a31..a1b326aae 100644 --- a/keyboards/handwired/riblee_f401/riblee_f401.h +++ b/keyboards/handwired/riblee_f401/riblee_f401.h @@ -1,5 +1,5 @@ /* -Copyright 2020 QMK Community, Daniel Reibl <janos.daniel.reibl@protonmail.com> +Copyright 2020 QMK Community, Janos Daniel Reibl <janos.daniel.reibl@protonmail.com> @riblee 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/keyboards/handwired/riblee_f401/rules.mk b/keyboards/handwired/riblee_f401/rules.mk index bd4592d50..efe2522ee 100644 --- a/keyboards/handwired/riblee_f401/rules.mk +++ b/keyboards/handwired/riblee_f401/rules.mk @@ -22,3 +22,5 @@ BACKLIGHT_DRIVER = software RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow BLUETOOTH_ENABLE = no # Enable Bluetooth AUDIO_ENABLE = no # Audio output + +LAYOUTS = ortho_5x12
\ No newline at end of file diff --git a/keyboards/handwired/riblee_f401/keymaps/riblee/config.h b/layouts/community/ortho_5x12/riblee/config.h index bc80ffdd7..8dbff5e10 100644 --- a/keyboards/handwired/riblee_f401/keymaps/riblee/config.h +++ b/layouts/community/ortho_5x12/riblee/config.h @@ -1,4 +1,4 @@ -/* Copyright 2020 Daniel Reibl <janos.daniel.reibl@protonmail.com> +/* Copyright 2020 Janos Daniel Reibl <janos.daniel.reibl@protonmail.com> @riblee * * 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/keyboards/handwired/riblee_f401/keymaps/riblee/keymap.c b/layouts/community/ortho_5x12/riblee/keymap.c index eec732df5..ba5eb07b8 100644 --- a/keyboards/handwired/riblee_f401/keymaps/riblee/keymap.c +++ b/layouts/community/ortho_5x12/riblee/keymap.c @@ -1,5 +1,4 @@ -/* Copyright 2015-2017 Jack Humbert - * Copyright 2020 Daniel Reibl <janos.daniel.reibl@protonmail.com> +/* Copyright 2020 Janos Daniel Reibl <janos.daniel.reibl@protonmail.com> @riblee * * 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 @@ -14,146 +13,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 "riblee.h" -#include QMK_KEYBOARD_H - -enum preonic_layers { - _QWERTY, - _COLEMAK, - _DVORAK, - _LOWER, - _RAISE, - _ADJUST -}; - -enum preonic_keycodes { - QWERTY = SAFE_RANGE, - COLEMAK, - DVORAK, - BACKLIT -}; - -#define LOWER MO(_LOWER) -#define RAISE MO(_RAISE) - -// Tap Dance declarations -enum { - TD_A, - TD_E, - TD_I, - TD_O, - TD_U, -}; - -const uint8_t shift = MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT); - -// Tap Dance functions -void dance_key_a (qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - SEND_STRING("a"); - reset_tap_dance(state); - } else if (state->count == 2) { - if (!(keyboard_report->mods & shift)) { - send_unicode_string("á"); - } else { - send_unicode_string("Á"); - } - - reset_tap_dance(state); - } -} - -void dance_key_e (qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - SEND_STRING("e"); - reset_tap_dance(state); - } else if (state->count == 2) { - if (!(keyboard_report->mods & shift)) { - send_unicode_string("é"); - } else { - send_unicode_string("É"); - } - - reset_tap_dance(state); - } -} - -void dance_key_i (qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - SEND_STRING("i"); - reset_tap_dance(state); - } else if (state->count == 2) { - if (!(keyboard_report->mods & shift)) { - send_unicode_string("í"); - } else { - send_unicode_string("Í"); - } - - reset_tap_dance(state); - } -} - -void dance_key_o (qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - SEND_STRING("o"); - reset_tap_dance(state); - } else if (state->count == 2) { - if (!(keyboard_report->mods & shift)) { - send_unicode_string("ó"); - } else { - send_unicode_string("Ó"); - } - - reset_tap_dance(state); - } else if (state->count == 3) { - if (!(keyboard_report->mods & shift)) { - send_unicode_string("ö"); - } else { - send_unicode_string("Ö"); - } - - reset_tap_dance(state); - } else if (state->count == 4) { - if (!(keyboard_report->mods & shift)) { - send_unicode_string("ő"); - } else { - send_unicode_string("Ő"); - } - - reset_tap_dance(state); - } -} - -void dance_key_u (qk_tap_dance_state_t *state, void *user_data) { - if (state->count == 1) { - SEND_STRING("u"); - reset_tap_dance(state); - } else if (state->count == 2) { - if (!(keyboard_report->mods & shift)) { - send_unicode_string("ú"); - } else { - send_unicode_string("Ú"); - } - - reset_tap_dance(state); - } else if (state->count == 3) { - if (!(keyboard_report->mods & shift)) { - send_unicode_string("ü"); - } else { - send_unicode_string("Ü"); - } - - reset_tap_dance(state); - } else if (state->count == 4) { - if (!(keyboard_report->mods & shift)) { - send_unicode_string("ű"); - } else { - send_unicode_string("Ű"); - } - - reset_tap_dance(state); - } -} // Tap Dance definitions qk_tap_dance_action_t tap_dance_actions[] = { @@ -299,43 +160,4 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ) -}; - -layer_state_t layer_state_set_user(layer_state_t state) { - return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case QWERTY: - if (record->event.pressed) { - set_single_persistent_default_layer(_QWERTY); - } - return false; - break; - case COLEMAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_COLEMAK); - } - return false; - break; - case DVORAK: - if (record->event.pressed) { - set_single_persistent_default_layer(_DVORAK); - } - return false; - break; - case BACKLIT: - if (record->event.pressed) { - register_code(keycode_config(KC_LGUI)); - #ifdef BACKLIGHT_ENABLE - backlight_step(); - #endif - } else { - unregister_code(keycode_config(KC_LGUI)); - } - return false; - break; - } - return true; -}; +};
\ No newline at end of file diff --git a/keyboards/handwired/riblee_f401/keymaps/riblee/readme.md b/layouts/community/ortho_5x12/riblee/readme.md index 231f7afd3..231f7afd3 100644 --- a/keyboards/handwired/riblee_f401/keymaps/riblee/readme.md +++ b/layouts/community/ortho_5x12/riblee/readme.md diff --git a/keyboards/handwired/riblee_f401/keymaps/riblee/rules.mk b/layouts/community/ortho_5x12/riblee/rules.mk index 517f2700e..517f2700e 100644 --- a/keyboards/handwired/riblee_f401/keymaps/riblee/rules.mk +++ b/layouts/community/ortho_5x12/riblee/rules.mk 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 @@ +Copyright 2020 Janos Daniel Reibl <janos.daniel.reibl@protonmail.com> @riblee + +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/>. 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 @@ +/* Copyright 2020 Janos Daniel Reibl <janos.daniel.reibl@protonmail.com> @riblee + * + * 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 "riblee.h" + +const uint8_t shift = MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT); + +// Tap Dance functions +void dance_key_a (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + SEND_STRING("a"); + reset_tap_dance(state); + } else if (state->count == 2) { + if (!(keyboard_report->mods & shift)) { + send_unicode_string("á"); + } else { + send_unicode_string("Á"); + } + + reset_tap_dance(state); + } +} + +void dance_key_e (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + SEND_STRING("e"); + reset_tap_dance(state); + } else if (state->count == 2) { + if (!(keyboard_report->mods & shift)) { + send_unicode_string("é"); + } else { + send_unicode_string("É"); + } + + reset_tap_dance(state); + } +} + +void dance_key_i (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + SEND_STRING("i"); + reset_tap_dance(state); + } else if (state->count == 2) { + if (!(keyboard_report->mods & shift)) { + send_unicode_string("í"); + } else { + send_unicode_string("Í"); + } + + reset_tap_dance(state); + } +} + +void dance_key_o (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + SEND_STRING("o"); + reset_tap_dance(state); + } else if (state->count == 2) { + if (!(keyboard_report->mods & shift)) { + send_unicode_string("ó"); + } else { + send_unicode_string("Ó"); + } + + reset_tap_dance(state); + } else if (state->count == 3) { + if (!(keyboard_report->mods & shift)) { + send_unicode_string("ö"); + } else { + send_unicode_string("Ö"); + } + + reset_tap_dance(state); + } else if (state->count == 4) { + if (!(keyboard_report->mods & shift)) { + send_unicode_string("ő"); + } else { + send_unicode_string("Ő"); + } + + reset_tap_dance(state); + } +} + +void dance_key_u (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + SEND_STRING("u"); + reset_tap_dance(state); + } else if (state->count == 2) { + if (!(keyboard_report->mods & shift)) { + send_unicode_string("ú"); + } else { + send_unicode_string("Ú"); + } + + reset_tap_dance(state); + } else if (state->count == 3) { + if (!(keyboard_report->mods & shift)) { + send_unicode_string("ü"); + } else { + send_unicode_string("Ü"); + } + + reset_tap_dance(state); + } else if (state->count == 4) { + if (!(keyboard_report->mods & shift)) { + send_unicode_string("ű"); + } else { + send_unicode_string("Ű"); + } + + reset_tap_dance(state); + } +} + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_DVORAK); + } + return false; + break; + case BACKLIT: + if (record->event.pressed) { + register_code(keycode_config(KC_LGUI)); +#ifdef BACKLIGHT_ENABLE + backlight_step(); +#endif + } else { + unregister_code(keycode_config(KC_LGUI)); + } + return false; + break; + } + return true; +}; 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 @@ +/* Copyright 2020 Janos Daniel Reibl <janos.daniel.reibl@protonmail.com> @riblee + * + * 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 + +enum preonic_layers { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _ADJUST +}; + +enum preonic_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + BACKLIT +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) + +// Tap Dance declarations +enum { + TD_A, + TD_E, + TD_I, + TD_O, + TD_U, +}; + +void dance_key_a (qk_tap_dance_state_t *, void *); +void dance_key_e (qk_tap_dance_state_t *, void *); +void dance_key_i (qk_tap_dance_state_t *, void *); +void dance_key_o (qk_tap_dance_state_t *, void *); +void dance_key_u (qk_tap_dance_state_t *, void *); + +layer_state_t layer_state_set_user(layer_state_t); +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 |