diff options
| author | Reibl János Dániel <janos.daniel.reibl@protonmail.com> | 2022-01-13 18:16:03 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-13 09:16:03 -0800 |
| commit | a3af4b09b0786e7c228828b2b3676fb7dd9a1c2f (patch) | |
| tree | c192d445ab9006d9e7ba8b58f50b7ab3231acb75 /users/riblee/riblee.c | |
| parent | e2d1547f31c0ceda27b68e26e79224b49cadaa97 (diff) | |
| download | qmk_firmware-a3af4b09b0786e7c228828b2b3676fb7dd9a1c2f.tar.gz qmk_firmware-a3af4b09b0786e7c228828b2b3676fb7dd9a1c2f.zip | |
[Keymap] Misc userspace and keymap improvements (#15844)
Diffstat (limited to 'users/riblee/riblee.c')
| -rw-r--r-- | users/riblee/riblee.c | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/users/riblee/riblee.c b/users/riblee/riblee.c index 307c69720..02ba246f6 100644 --- a/users/riblee/riblee.c +++ b/users/riblee/riblee.c | |||
| @@ -18,15 +18,13 @@ | |||
| 18 | #include "raw_hid.h" | 18 | #include "raw_hid.h" |
| 19 | #include <string.h> | 19 | #include <string.h> |
| 20 | 20 | ||
| 21 | const uint8_t shift = MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT); | ||
| 22 | |||
| 23 | // Tap Dance functions | 21 | // Tap Dance functions |
| 24 | void dance_key_a (qk_tap_dance_state_t *state, void *user_data) { | 22 | void dance_key_a (qk_tap_dance_state_t *state, void *user_data) { |
| 25 | if (state->count == 1) { | 23 | if (state->count == 1) { |
| 26 | SEND_STRING("a"); | 24 | SEND_STRING("a"); |
| 27 | reset_tap_dance(state); | 25 | reset_tap_dance(state); |
| 28 | } else if (state->count == 2) { | 26 | } else if (state->count == 2) { |
| 29 | if (!(keyboard_report->mods & shift)) { | 27 | if (!(keyboard_report->mods & MOD_MASK_SHIFT)) { |
| 30 | send_unicode_string("á"); | 28 | send_unicode_string("á"); |
| 31 | } else { | 29 | } else { |
| 32 | send_unicode_string("Á"); | 30 | send_unicode_string("Á"); |
| @@ -41,7 +39,7 @@ void dance_key_e (qk_tap_dance_state_t *state, void *user_data) { | |||
| 41 | SEND_STRING("e"); | 39 | SEND_STRING("e"); |
| 42 | reset_tap_dance(state); | 40 | reset_tap_dance(state); |
| 43 | } else if (state->count == 2) { | 41 | } else if (state->count == 2) { |
| 44 | if (!(keyboard_report->mods & shift)) { | 42 | if (!(keyboard_report->mods & MOD_MASK_SHIFT)) { |
| 45 | send_unicode_string("é"); | 43 | send_unicode_string("é"); |
| 46 | } else { | 44 | } else { |
| 47 | send_unicode_string("É"); | 45 | send_unicode_string("É"); |
| @@ -56,7 +54,7 @@ void dance_key_i (qk_tap_dance_state_t *state, void *user_data) { | |||
| 56 | SEND_STRING("i"); | 54 | SEND_STRING("i"); |
| 57 | reset_tap_dance(state); | 55 | reset_tap_dance(state); |
| 58 | } else if (state->count == 2) { | 56 | } else if (state->count == 2) { |
| 59 | if (!(keyboard_report->mods & shift)) { | 57 | if (!(keyboard_report->mods & MOD_MASK_SHIFT)) { |
| 60 | send_unicode_string("í"); | 58 | send_unicode_string("í"); |
| 61 | } else { | 59 | } else { |
| 62 | send_unicode_string("Í"); | 60 | send_unicode_string("Í"); |
| @@ -71,7 +69,7 @@ void dance_key_o (qk_tap_dance_state_t *state, void *user_data) { | |||
| 71 | SEND_STRING("o"); | 69 | SEND_STRING("o"); |
| 72 | reset_tap_dance(state); | 70 | reset_tap_dance(state); |
| 73 | } else if (state->count == 2) { | 71 | } else if (state->count == 2) { |
| 74 | if (!(keyboard_report->mods & shift)) { | 72 | if (!(keyboard_report->mods & MOD_MASK_SHIFT)) { |
| 75 | send_unicode_string("ó"); | 73 | send_unicode_string("ó"); |
| 76 | } else { | 74 | } else { |
| 77 | send_unicode_string("Ó"); | 75 | send_unicode_string("Ó"); |
| @@ -79,7 +77,7 @@ void dance_key_o (qk_tap_dance_state_t *state, void *user_data) { | |||
| 79 | 77 | ||
| 80 | reset_tap_dance(state); | 78 | reset_tap_dance(state); |
| 81 | } else if (state->count == 3) { | 79 | } else if (state->count == 3) { |
| 82 | if (!(keyboard_report->mods & shift)) { | 80 | if (!(keyboard_report->mods & MOD_MASK_SHIFT)) { |
| 83 | send_unicode_string("ö"); | 81 | send_unicode_string("ö"); |
| 84 | } else { | 82 | } else { |
| 85 | send_unicode_string("Ö"); | 83 | send_unicode_string("Ö"); |
| @@ -87,7 +85,7 @@ void dance_key_o (qk_tap_dance_state_t *state, void *user_data) { | |||
| 87 | 85 | ||
| 88 | reset_tap_dance(state); | 86 | reset_tap_dance(state); |
| 89 | } else if (state->count == 4) { | 87 | } else if (state->count == 4) { |
| 90 | if (!(keyboard_report->mods & shift)) { | 88 | if (!(keyboard_report->mods & MOD_MASK_SHIFT)) { |
| 91 | send_unicode_string("ő"); | 89 | send_unicode_string("ő"); |
| 92 | } else { | 90 | } else { |
| 93 | send_unicode_string("Ő"); | 91 | send_unicode_string("Ő"); |
| @@ -102,7 +100,7 @@ void dance_key_u (qk_tap_dance_state_t *state, void *user_data) { | |||
| 102 | SEND_STRING("u"); | 100 | SEND_STRING("u"); |
| 103 | reset_tap_dance(state); | 101 | reset_tap_dance(state); |
| 104 | } else if (state->count == 2) { | 102 | } else if (state->count == 2) { |
| 105 | if (!(keyboard_report->mods & shift)) { | 103 | if (!(keyboard_report->mods & MOD_MASK_SHIFT)) { |
| 106 | send_unicode_string("ú"); | 104 | send_unicode_string("ú"); |
| 107 | } else { | 105 | } else { |
| 108 | send_unicode_string("Ú"); | 106 | send_unicode_string("Ú"); |
| @@ -110,7 +108,7 @@ void dance_key_u (qk_tap_dance_state_t *state, void *user_data) { | |||
| 110 | 108 | ||
| 111 | reset_tap_dance(state); | 109 | reset_tap_dance(state); |
| 112 | } else if (state->count == 3) { | 110 | } else if (state->count == 3) { |
| 113 | if (!(keyboard_report->mods & shift)) { | 111 | if (!(keyboard_report->mods & MOD_MASK_SHIFT)) { |
| 114 | send_unicode_string("ü"); | 112 | send_unicode_string("ü"); |
| 115 | } else { | 113 | } else { |
| 116 | send_unicode_string("Ü"); | 114 | send_unicode_string("Ü"); |
| @@ -118,7 +116,7 @@ void dance_key_u (qk_tap_dance_state_t *state, void *user_data) { | |||
| 118 | 116 | ||
| 119 | reset_tap_dance(state); | 117 | reset_tap_dance(state); |
| 120 | } else if (state->count == 4) { | 118 | } else if (state->count == 4) { |
| 121 | if (!(keyboard_report->mods & shift)) { | 119 | if (!(keyboard_report->mods & MOD_MASK_SHIFT)) { |
| 122 | send_unicode_string("ű"); | 120 | send_unicode_string("ű"); |
| 123 | } else { | 121 | } else { |
| 124 | send_unicode_string("Ű"); | 122 | send_unicode_string("Ű"); |
| @@ -164,23 +162,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 164 | } | 162 | } |
| 165 | return false; | 163 | return false; |
| 166 | break; | 164 | break; |
| 167 | case BACKLIT: | ||
| 168 | if (record->event.pressed) { | ||
| 169 | register_code(keycode_config(KC_LGUI)); | ||
| 170 | #ifdef BACKLIGHT_ENABLE | ||
| 171 | backlight_step(); | ||
| 172 | #endif | ||
| 173 | } else { | ||
| 174 | unregister_code(keycode_config(KC_LGUI)); | ||
| 175 | } | ||
| 176 | return false; | ||
| 177 | break; | ||
| 178 | case CG_NORM: | ||
| 179 | set_unicode_input_mode(UC_MAC); | ||
| 180 | break; | ||
| 181 | case CG_SWAP: | ||
| 182 | set_unicode_input_mode(UC_LNX); | ||
| 183 | break; | ||
| 184 | } | 165 | } |
| 185 | return true; | 166 | return true; |
| 186 | }; | 167 | }; |
| @@ -287,3 +268,11 @@ void raw_hid_receive(uint8_t *data, uint8_t length) { | |||
| 287 | #endif | 268 | #endif |
| 288 | 269 | ||
| 289 | #endif | 270 | #endif |
| 271 | |||
| 272 | void keyboard_pre_init_user(void) { | ||
| 273 | // Set C13 pin as output | ||
| 274 | setPinOutput(C13); | ||
| 275 | |||
| 276 | // Turn off the LED | ||
| 277 | writePinHigh(C13); | ||
| 278 | } \ No newline at end of file | ||
