diff options
author | Jonathan Cameron <jmcameron@gmail.com> | 2019-11-11 09:26:14 -0800 |
---|---|---|
committer | James Young <18669334+noroadsleft@users.noreply.github.com> | 2019-11-11 09:26:14 -0800 |
commit | 1d550552cab30ef49b5935bdd31bf2f659255c19 (patch) | |
tree | df3936e1d608bbd513fe3aab43ca09194a70602a | |
parent | b2b947f815dd4930b12851faf1b42ceb12aab6ee (diff) | |
download | qmk_firmware-1d550552cab30ef49b5935bdd31bf2f659255c19.tar.gz qmk_firmware-1d550552cab30ef49b5935bdd31bf2f659255c19.zip |
[Keyboard] Added French layer to handwired/2x5keypad (#7313)
* Added new 2x5 Keypad with 3 LEDs to indicate the selected layer. By Jonathan Cameron.
* Minor refactor from suggestions from qmk team
* Added
* Moved to 'handwired' directory
* Update readme.md
* Update readme.md
* Update readme.md
* Update keyboards/handwired/2x5keypad/readme.md
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Switch to image offsite
* Moved image offsite
* Update keyboards/handwired/2x5keypad/keymaps/default/keymap.h
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Update keyboards/handwired/2x5keypad/2x5keypad.h
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Moved functions into .c file per suggestions
* Cosmetic
* Fixed function called, per suggestions.
* Update keyboards/handwired/2x5keypad/2x5keypad.h
Ok
Co-Authored-By: fauxpark <fauxpark@gmail.com>
* Moved LED functions to the top level since they can be used it various flavors
* Declare those moved LED functions!
* Update keyboards/handwired/2x5keypad/config.h
Co-Authored-By: Drashna Jaelre <drashna@live.com>
* First cut at French support
* Added French layer (green) for accented and special French characters
* Added french layer
* Fixed typo
* Updated to get more reasonable tap function
-rw-r--r-- | keyboards/handwired/2x5keypad/config.h | 6 | ||||
-rw-r--r-- | keyboards/handwired/2x5keypad/keymaps/default/keymap.c | 123 | ||||
-rw-r--r-- | keyboards/handwired/2x5keypad/rules.mk | 16 |
3 files changed, 122 insertions, 23 deletions
diff --git a/keyboards/handwired/2x5keypad/config.h b/keyboards/handwired/2x5keypad/config.h index 6d09b5ed0..35a0fda8d 100644 --- a/keyboards/handwired/2x5keypad/config.h +++ b/keyboards/handwired/2x5keypad/config.h | |||
@@ -37,6 +37,9 @@ | |||
37 | /* Locking resynchronize hack */ | 37 | /* Locking resynchronize hack */ |
38 | #define LOCKING_RESYNC_ENABLE | 38 | #define LOCKING_RESYNC_ENABLE |
39 | 39 | ||
40 | /* Tap dancing params */ | ||
41 | #define TAPPING_TERM 250 | ||
42 | |||
40 | /* key combination for command */ | 43 | /* key combination for command */ |
41 | /* DISABLED | 44 | /* DISABLED |
42 | #define IS_COMMAND() ( \ | 45 | #define IS_COMMAND() ( \ |
@@ -44,9 +47,6 @@ | |||
44 | ) | 47 | ) |
45 | */ | 48 | */ |
46 | 49 | ||
47 | /* prevent stuck modifiers */ | ||
48 | |||
49 | |||
50 | #ifdef RGB_DI_PIN | 50 | #ifdef RGB_DI_PIN |
51 | #define RGBLIGHT_ANIMATIONS | 51 | #define RGBLIGHT_ANIMATIONS |
52 | #define RGBLED_NUM 0 | 52 | #define RGBLED_NUM 0 |
diff --git a/keyboards/handwired/2x5keypad/keymaps/default/keymap.c b/keyboards/handwired/2x5keypad/keymaps/default/keymap.c index 808824f3a..91a0e28f6 100644 --- a/keyboards/handwired/2x5keypad/keymaps/default/keymap.c +++ b/keyboards/handwired/2x5keypad/keymaps/default/keymap.c | |||
@@ -7,27 +7,116 @@ enum layers { | |||
7 | NORMAL_LAYER = 0, | 7 | NORMAL_LAYER = 0, |
8 | MEDIA_LAYER, | 8 | MEDIA_LAYER, |
9 | TBD_LAYER2, | 9 | TBD_LAYER2, |
10 | TBD_LAYER3 | 10 | FRENCH_LAYER |
11 | }; | 11 | }; |
12 | 12 | ||
13 | 13 | ||
14 | /* Enum for the tap dancing keys */ | ||
15 | enum tap_codes { | ||
16 | A_Q, E_Q, E_U, E_E, | ||
17 | A_Y, I_I, O_C, U_U | ||
18 | }; | ||
19 | |||
20 | #define FR_A_GRAVE "00E0" | ||
21 | #define FR_A_HAT "00E2" | ||
22 | |||
23 | #define FR_C_CIRCUM "00E7" | ||
24 | |||
25 | #define FR_E_AIGU "00E9" | ||
26 | #define FR_E_GRAVE "00E8" | ||
27 | #define FR_E_HAT "00EA" | ||
28 | #define FR_E_UMLAUT "00EB" | ||
29 | |||
30 | #define FR_I_HAT "00EE" | ||
31 | #define FR_I_UMLAUT "00EF" | ||
32 | |||
33 | #define FR_O_HAT "00F4" | ||
34 | |||
35 | #define FR_U_GRAVE "00F9" | ||
36 | #define FR_U_HAT "00FB" | ||
37 | #define FR_U_UMLAUT "00FC" | ||
38 | |||
39 | #define FR_Y_UMLAUT "00FF" | ||
40 | |||
41 | #define FR_L_QUOTE "00AB" | ||
42 | #define FR_R_QUOTE "00BB" | ||
43 | |||
44 | void send_french_unicode_char(uint8_t count, char *once, char *twice) | ||
45 | { | ||
46 | if (count <= 1) | ||
47 | send_unicode_hex_string(once); | ||
48 | else | ||
49 | send_unicode_hex_string(twice); | ||
50 | } | ||
51 | |||
52 | void dance_a_q(qk_tap_dance_state_t *state, void *user_data) | ||
53 | { | ||
54 | send_french_unicode_char(state->count, FR_A_GRAVE, FR_L_QUOTE); | ||
55 | } | ||
56 | |||
57 | void dance_e_q(qk_tap_dance_state_t *state, void *user_data) | ||
58 | { | ||
59 | send_french_unicode_char(state->count, FR_E_AIGU, FR_R_QUOTE); | ||
60 | } | ||
61 | |||
62 | void dance_e_u(qk_tap_dance_state_t *state, void *user_data) | ||
63 | { | ||
64 | send_french_unicode_char(state->count, FR_E_GRAVE, FR_U_GRAVE); | ||
65 | } | ||
66 | |||
67 | void dance_e_e(qk_tap_dance_state_t *state, void *user_data) | ||
68 | { | ||
69 | send_french_unicode_char(state->count, FR_E_HAT, FR_E_UMLAUT); | ||
70 | } | ||
71 | |||
72 | void dance_a_y(qk_tap_dance_state_t *state, void *user_data) | ||
73 | { | ||
74 | send_french_unicode_char(state->count, FR_A_HAT, FR_Y_UMLAUT); | ||
75 | } | ||
76 | |||
77 | void dance_i_i(qk_tap_dance_state_t *state, void *user_data) | ||
78 | { | ||
79 | send_french_unicode_char(state->count, FR_I_HAT, FR_I_UMLAUT); | ||
80 | } | ||
81 | |||
82 | void dance_o_c(qk_tap_dance_state_t *state, void *user_data) | ||
83 | { | ||
84 | send_french_unicode_char(state->count, FR_O_HAT, FR_C_CIRCUM); | ||
85 | } | ||
86 | |||
87 | void dance_u_u(qk_tap_dance_state_t *state, void *user_data) | ||
88 | { | ||
89 | send_french_unicode_char(state->count, FR_U_HAT, FR_U_UMLAUT); | ||
90 | } | ||
91 | |||
92 | /* Define the tap dance actions for the french characters */ | ||
93 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
94 | [A_Q] = ACTION_TAP_DANCE_FN(dance_a_q), | ||
95 | [E_Q] = ACTION_TAP_DANCE_FN(dance_e_q), | ||
96 | [E_U] = ACTION_TAP_DANCE_FN(dance_e_u), | ||
97 | [E_E] = ACTION_TAP_DANCE_FN(dance_e_e), | ||
98 | |||
99 | [A_Y] = ACTION_TAP_DANCE_FN(dance_a_y), | ||
100 | [I_I] = ACTION_TAP_DANCE_FN(dance_i_i), | ||
101 | [O_C] = ACTION_TAP_DANCE_FN(dance_o_c), | ||
102 | [U_U] = ACTION_TAP_DANCE_FN(dance_u_u) | ||
103 | }; | ||
104 | |||
105 | |||
106 | |||
14 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 107 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
15 | 108 | ||
16 | [NORMAL_LAYER]= | 109 | [NORMAL_LAYER] = LAYOUT(TO(1), WIN_TAB, KC_HOME, KC_UP, KC_END, |
17 | LAYOUT(TO(1), WIN_TAB, KC_HOME, KC_UP, KC_END, | 110 | WIN_LOCK, KC_MUTE, KC_LEFT, KC_DOWN, KC_RGHT), |
18 | WIN_LOCK, KC_MUTE, KC_LEFT, KC_DOWN, KC_RGHT), | ||
19 | 111 | ||
20 | [MEDIA_LAYER]= | 112 | [MEDIA_LAYER] = LAYOUT(TO(2), KC_CALC, KC_MPRV, KC_MNXT, KC_VOLU, |
21 | LAYOUT(TO(2), KC_CALC, KC_MPRV, KC_MNXT, KC_VOLU, | 113 | KC_TRNS, KC_TRNS, KC_MSTP, KC_MPLY, KC_VOLD), |
22 | KC_TRNS, KC_TRNS, KC_MSTP, KC_MPLY, KC_VOLD), | ||
23 | 114 | ||
24 | [TBD_LAYER2]= | 115 | [TBD_LAYER2] = LAYOUT(TO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, |
25 | LAYOUT(TO(3), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | 116 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), |
26 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), | ||
27 | 117 | ||
28 | [TBD_LAYER3]= | 118 | [FRENCH_LAYER] = LAYOUT(TO(0), TD(A_Q), TD(E_Q), TD(E_U), TD(E_E), |
29 | LAYOUT(TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, | 119 | KC_TRNS, TD(A_Y), TD(I_I), TD(O_C), TD(U_U)) |
30 | KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS) | ||
31 | }; | 120 | }; |
32 | 121 | ||
33 | 122 | ||
@@ -44,6 +133,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
44 | */ | 133 | */ |
45 | 134 | ||
46 | 135 | ||
136 | void matrix_init_user(void) | ||
137 | { | ||
138 | set_unicode_input_mode(UC_WINC); /* See https://jayliu50.github.io/qmk-cheatsheet/ */ | ||
139 | } | ||
140 | |||
141 | |||
47 | layer_state_t layer_state_set_user(layer_state_t state) | 142 | layer_state_t layer_state_set_user(layer_state_t state) |
48 | { | 143 | { |
49 | turn_off_leds(); | 144 | turn_off_leds(); |
@@ -61,7 +156,7 @@ layer_state_t layer_state_set_user(layer_state_t state) | |||
61 | turn_on_led(BLUE_LED); | 156 | turn_on_led(BLUE_LED); |
62 | break; | 157 | break; |
63 | 158 | ||
64 | case TBD_LAYER3: | 159 | case FRENCH_LAYER: |
65 | turn_on_led(GREEN_LED); | 160 | turn_on_led(GREEN_LED); |
66 | break; | 161 | break; |
67 | } | 162 | } |
diff --git a/keyboards/handwired/2x5keypad/rules.mk b/keyboards/handwired/2x5keypad/rules.mk index b7027cd9e..e62a0f24a 100644 --- a/keyboards/handwired/2x5keypad/rules.mk +++ b/keyboards/handwired/2x5keypad/rules.mk | |||
@@ -11,13 +11,17 @@ MCU = atmega32u4 | |||
11 | # ATmega328P USBasp | 11 | # ATmega328P USBasp |
12 | BOOTLOADER = caterina | 12 | BOOTLOADER = caterina |
13 | 13 | ||
14 | |||
15 | AUDIO_ENABLE = no | ||
16 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | ||
14 | BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration | 17 | BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration |
15 | MOUSEKEY_ENABLE = yes # Mouse keys | ||
16 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
17 | CONSOLE_ENABLE= no # Console for debug | ||
18 | COMMAND_ENABLE = no # Commands for debug and configuration | 18 | COMMAND_ENABLE = no # Commands for debug and configuration |
19 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | 19 | CONSOLE_ENABLE= no # Console for debug |
20 | EXTRAKEY_ENABLE = yes # Audio control and System control | ||
21 | MOUSEKEY_ENABLE = yes # Mouse keys | ||
20 | NKRO_ENABLE = yes # USB Nkey Rollover - | 22 | NKRO_ENABLE = yes # USB Nkey Rollover - |
21 | BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality | 23 | |
22 | AUDIO_ENABLE = no | ||
23 | RGBLIGHT_ENABLE = no | 24 | RGBLIGHT_ENABLE = no |
25 | SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend | ||
26 | UNICODE_ENABLE = yes | ||
27 | TAP_DANCE_ENABLE = yes | ||