aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboards/ergodox/keymaps/swedish/keymap.c247
-rw-r--r--keyboards/ergodox/keymaps/swedish/readme.md36
-rw-r--r--quantum/keymap_extras/keymap_swedish.h52
3 files changed, 335 insertions, 0 deletions
diff --git a/keyboards/ergodox/keymaps/swedish/keymap.c b/keyboards/ergodox/keymaps/swedish/keymap.c
new file mode 100644
index 000000000..c110538e6
--- /dev/null
+++ b/keyboards/ergodox/keymaps/swedish/keymap.c
@@ -0,0 +1,247 @@
1/* Copyright 2017 Andreas Lindhé
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 "ergodox.h"
18#include "debug.h"
19#include "action_layer.h"
20#include "version.h"
21#include "keymap_swedish.h"
22
23#define BASE 0 // default layer
24#define SYMB 1 // symbols
25#define MDIA 2 // media keys
26
27enum custom_keycodes {
28 PLACEHOLDER = SAFE_RANGE, // can always be here
29 EPRM,
30 VRSN,
31 RGB_SLD
32};
33
34const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
35/* Keymap 0: Basic layer
36 *
37 * ,--------------------------------------------------. ,--------------------------------------------------.
38 * | ½ | ! | " | # | # | % | LEFT | | RIGHT| & | / | ( | ) | = | ? |
39 * | § | 1 | 2 @ | 3 £ | 4 $ | 5 | | | | 6 | 7 { | 8 [ | 9 ] | 0 } | + \ |
40 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
41 * | Delete | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | Å |
42 * | | | | | | | | | | | | | | | |
43 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
44 * | Caps | A | S | D | F | G |------| |------| H | J | K | L |Ö / L2|Ä / Cmd |
45 * | Lock | | | | | | Hyper| | Meh | | | | | | |
46 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
47 * | Left |Z/Ctrl| X | C | V | B | | | | N | M | ; | : |_/Ctrl| RShift |
48 * | Shift | | | | | | | | | | | , | . |- | |
49 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
50 * | '/L1 | ` |AltShf| Left | Right| | Up | Down | ^ | * | ~L1 |
51 * | | ' | | | | | | | | | |
52 * `----------------------------------' `----------------------------------'
53 * ,-------------. ,---------------.
54 * | App | LGui | | AltGr|Ctrl/Esc|
55 * ,------|------|------| |------+--------+------.
56 * | | | Home | | PgUp | | |
57 * | Space|Back- |------| |------| Tab |Enter |
58 * | |space | End | | PgDn | | |
59 * `--------------------' `----------------------'
60 */
61// If it accepts an argument (i.e, is a function), it doesn't need KC_.
62// Otherwise, it needs KC_*
63[BASE] = KEYMAP( // layer 0 : default
64 // left hand
65 NO_HALF, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT,
66 KC_DELT, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB),
67 KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G,
68 KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO),
69 LT(SYMB,NO_APOS), NO_ACUT, LALT(KC_LSFT), KC_LEFT, KC_RGHT,
70 ALT_T(KC_APP), KC_LGUI,
71 KC_HOME,
72 KC_SPC,KC_BSPC,KC_END,
73 // right hand
74 KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, NO_PLUS,
75 TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, NO_AA,
76 KC_H, KC_J, KC_K, KC_L, LT(MDIA, NO_OSLH), GUI_T(NO_AE),
77 MEH_T(KC_NO), KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(NO_MINS), KC_RSFT,
78 KC_UP, KC_DOWN, NO_CIRC, NO_ASTR, KC_FN1,
79 NO_ALGR, CTL_T(KC_ESC),
80 KC_PGUP,
81 KC_PGDN,KC_TAB, KC_ENT
82),
83
84/* Keymap 1: Symbol Layer
85 *
86 * ,--------------------------------------------------. ,--------------------------------------------------.
87 * |Version | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
88 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
89 * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 |
90 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
91 * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
92 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
93 * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
94 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
95 * | | | | | | | | . | 0 | = | |
96 * `----------------------------------' `----------------------------------'
97 * ,-------------. ,-------------.
98 * |Animat| | |Toggle|Solid |
99 * ,------|------|------| |------+------+------.
100 * |Bright|Bright| | | |Hue- |Hue+ |
101 * |ness- |ness+ |------| |------| | |
102 * | | | | | | | |
103 * `--------------------' `--------------------'
104 */
105// SYMBOLS
106[SYMB] = KEYMAP(
107 // left hand
108 VRSN, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
109 KC_TRNS,KC_EXLM,NO_AT, NO_LCBR,NO_RCBR,NO_PIPE,KC_TRNS,
110 KC_TRNS,KC_HASH,NO_DLR, NO_LPRN,NO_RPRN,NO_GRV,
111 KC_TRNS,KC_PERC,NO_CIRC,NO_LBRC,NO_RBRC,NO_TILD,KC_TRNS,
112 EPRM,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
113 RGB_MOD,KC_TRNS,
114 KC_TRNS,
115 RGB_VAD,RGB_VAI,KC_TRNS,
116 // right hand
117 KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
118 KC_TRNS, KC_UP, KC_7, KC_8, KC_9, NO_ASTR, KC_F12,
119 KC_DOWN, KC_4, KC_5, KC_6, NO_PLUS, KC_TRNS,
120 KC_TRNS, NO_AMPR, KC_1, KC_2, KC_3, NO_MINS, KC_TRNS,
121 KC_TRNS,KC_DOT, KC_0, NO_EQL, KC_TRNS,
122 RGB_TOG, RGB_SLD,
123 KC_TRNS,
124 KC_TRNS, RGB_HUD, RGB_HUI
125),
126
127/* Keymap 2: Media and mouse keys
128 *
129 * ,--------------------------------------------------. ,--------------------------------------------------.
130 * | | | | | | | | | | | | | | | |
131 * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
132 * | | | | MsUp | | | | | | | | | | | |
133 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
134 * | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play |
135 * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
136 * | | | | | | | | | | | | Prev | Next | | |
137 * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
138 * | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | |
139 * `----------------------------------' `----------------------------------'
140 * ,-------------. ,-------------.
141 * | | | | | |
142 * ,------|------|------| |------+------+------.
143 * | | | | | | |Brwser|
144 * | | |------| |------| |Back |
145 * | | | | | | | |
146 * `--------------------' `--------------------'
147 */
148// MEDIA AND MOUSE
149[MDIA] = KEYMAP(
150 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
151 KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
152 KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
153 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
154 KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
155 KC_TRNS, KC_TRNS,
156 KC_TRNS,
157 KC_TRNS, KC_TRNS, KC_TRNS,
158 // right hand
159 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
160 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
161 KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY,
162 KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
163 KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
164 KC_TRNS, KC_TRNS,
165 KC_TRNS,
166 KC_TRNS, KC_TRNS, KC_WBAK
167),
168};
169
170const uint16_t PROGMEM fn_actions[] = {
171 [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols)
172};
173
174const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
175{
176 // MACRODOWN only works in this function
177 switch(id) {
178 case 0:
179 if (record->event.pressed) {
180 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
181 }
182 break;
183 case 1:
184 if (record->event.pressed) { // For resetting EEPROM
185 eeconfig_init();
186 }
187 break;
188 }
189 return MACRO_NONE;
190};
191
192bool process_record_user(uint16_t keycode, keyrecord_t *record) {
193 switch (keycode) {
194 // dynamically generate these.
195 case EPRM:
196 if (record->event.pressed) {
197 eeconfig_init();
198 }
199 return false;
200 break;
201 case VRSN:
202 if (record->event.pressed) {
203 SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
204 }
205 return false;
206 break;
207 case RGB_SLD:
208 if (record->event.pressed) {
209 #ifdef RGBLIGHT_ENABLE
210 rgblight_mode(1);
211 #endif
212 }
213 return false;
214 break;
215 }
216 return true;
217}
218
219// Runs just one time when the keyboard initializes.
220void matrix_init_user(void) {
221
222};
223
224
225// Runs constantly in the background, in a loop.
226void matrix_scan_user(void) {
227
228 uint8_t layer = biton32(layer_state);
229
230 ergodox_board_led_off();
231 ergodox_right_led_1_off();
232 ergodox_right_led_2_off();
233 ergodox_right_led_3_off();
234 switch (layer) {
235 // TODO: Make this relevant to the ErgoDox EZ.
236 case 1:
237 ergodox_right_led_1_on();
238 break;
239 case 2:
240 ergodox_right_led_2_on();
241 break;
242 default:
243 // none
244 break;
245 }
246
247};
diff --git a/keyboards/ergodox/keymaps/swedish/readme.md b/keyboards/ergodox/keymaps/swedish/readme.md
new file mode 100644
index 000000000..b5b859bce
--- /dev/null
+++ b/keyboards/ergodox/keymaps/swedish/readme.md
@@ -0,0 +1,36 @@
1# Swedish (sv_SE) Qwerty layout for ErgoDox EZ, based on the Default configuration
2
3*NOTE:* it might still be desirable to set the software layout to sv_SE in your
4OS.
5
6Remind me and I'll provide a picture of the layout.
7
8I have tried making this as close of a match I could between the [default
9ErgoDox EZ configuration](https://ergodox-ez.com/pages/our-firmware) and a
10standard Swedish Qwerty layout.
11
12## Notable differences from default:
13
14* There are three special character buttons (acute accent, circumflex/tilde and
15 apostrophe/asterisk) that don't have any buttons to map to naturally. I've put
16 these at other places:
17
18 * Acute accent (´) can be found in the lower left corner, conveniently
19 placed to reach for making an é.
20
21 * Apostrophe (') was put in the lower left corner, close to acute accent.
22
23 * Circumflex (^) and asterisk (*) was placed in the lower right corner.
24
25 * Tilde (~) and diaeresis (¨) I couldn't find a good place for, so I left
26 those out. I could only get the buttons to produce a single one of the
27 characters. How can I get it to work properly?
28
29* The Alt button on right thumb was exchanged for AltGr (RAlt).
30
31* I changed the backslash in the numpad (layer 1) for a minus. Thought it was
32 more sensible.
33
34* I didn't find a good place for the "<>|" button, so that one was left out.
35 That is a problem that really needs to be resolved. Pipe can be found on layer
36 one, however.
diff --git a/quantum/keymap_extras/keymap_swedish.h b/quantum/keymap_extras/keymap_swedish.h
new file mode 100644
index 000000000..dcfad720d
--- /dev/null
+++ b/quantum/keymap_extras/keymap_swedish.h
@@ -0,0 +1,52 @@
1/* Copyright 2017 Andreas Lindhé
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#ifndef KEYMAP_SWEDISH_H
18#define KEYMAP_SWEDISH_H
19
20#include "keymap_nordic.h"
21
22// There are slight differrences in the keyboards in the nordic contries
23
24// Swedish redifinitions from the nordic keyset
25#undef NO_AE
26#define NO_AE KC_QUOT // ä
27#undef NO_CIRC
28#define NO_CIRC LSFT(KC_RBRC) // ^
29#undef NO_GRV
30#define NO_GRV LSFT(NO_BSLS) //
31#undef NO_OSLH
32#define NO_OSLH KC_SCLN // ö
33
34// Additional Swedish keys not defined in the nordic keyset
35#define NO_AA KC_LBRC // å
36#define NO_ASTR LSFT(KC_BSLS) // *
37
38// Norwegian unique MAC characters (not vetted for Swedish)
39#define NO_ACUT_MAC KC_EQL // =
40#define NO_APOS_MAC KC_NUBS // '
41#define NO_AT_MAC KC_BSLS // @
42#define NO_BSLS_MAC ALGR(LSFT(KC_7)) // '\'
43#define NO_DLR_MAC LSFT(KC_4) // $
44#define NO_GRV_MAC ALGR(NO_BSLS) // `
45#define NO_GRTR_MAC LSFT(KC_GRV) // >
46#define NO_LCBR_MAC ALGR(LSFT(KC_8)) // }
47#define NO_LESS_MAC KC_GRV // >
48#define NO_PIPE_MAC ALGR(KC_7) // |
49#define NO_RCBR_MAC ALGR(LSFT(KC_9)) // }
50
51#endif
52