diff options
| author | Jack Humbert <jack.humb@gmail.com> | 2017-06-27 14:21:42 -0400 |
|---|---|---|
| committer | Jack Humbert <jack.humb@gmail.com> | 2017-06-27 14:21:42 -0400 |
| commit | 9f5b4e1d7a37f873acbc19b8385964121566653e (patch) | |
| tree | 78a51918d16a84148af5276170d2c30525dee661 /quantum | |
| parent | b82604dadad81872abdb9fdde18086ee69e66671 (diff) | |
| parent | 4ba9438c3f71e6ea3433be4f9e1a28d36471d247 (diff) | |
| download | qmk_firmware-9f5b4e1d7a37f873acbc19b8385964121566653e.tar.gz qmk_firmware-9f5b4e1d7a37f873acbc19b8385964121566653e.zip | |
Merge branch 'master' of https://github.com/qmk/qmk_firmware into dual_audio
Diffstat (limited to 'quantum')
| -rw-r--r-- | quantum/keycode_config.c | 28 | ||||
| -rw-r--r-- | quantum/keycode_config.h | 2 | ||||
| -rw-r--r-- | quantum/keymap_common.c | 3 | ||||
| -rw-r--r-- | quantum/keymap_extras/keymap_swedish.h | 52 | ||||
| -rw-r--r-- | quantum/quantum.c | 2 | ||||
| -rw-r--r-- | quantum/quantum_keycodes.h | 4 | ||||
| -rw-r--r-- | quantum/visualizer/led_keyframes.c | 4 | ||||
| -rw-r--r-- | quantum/visualizer/visualizer.c | 33 | ||||
| -rw-r--r-- | quantum/visualizer/visualizer.mk | 26 |
9 files changed, 123 insertions, 31 deletions
diff --git a/quantum/keycode_config.c b/quantum/keycode_config.c index 4f7bc525e..eb39c8fe0 100644 --- a/quantum/keycode_config.c +++ b/quantum/keycode_config.c | |||
| @@ -88,3 +88,31 @@ uint16_t keycode_config(uint16_t keycode) { | |||
| 88 | return keycode; | 88 | return keycode; |
| 89 | } | 89 | } |
| 90 | } | 90 | } |
| 91 | |||
| 92 | uint8_t mod_config(uint8_t mod) { | ||
| 93 | keymap_config.raw = eeconfig_read_keymap(); | ||
| 94 | if (keymap_config.swap_lalt_lgui) { | ||
| 95 | if ((mod & MOD_RGUI) == MOD_LGUI) { | ||
| 96 | mod &= ~MOD_LGUI; | ||
| 97 | mod |= MOD_LALT; | ||
| 98 | } else if ((mod & MOD_RALT) == MOD_LALT) { | ||
| 99 | mod &= ~MOD_LALT; | ||
| 100 | mod |= MOD_LGUI; | ||
| 101 | } | ||
| 102 | } | ||
| 103 | if (keymap_config.swap_ralt_rgui) { | ||
| 104 | if ((mod & MOD_RGUI) == MOD_RGUI) { | ||
| 105 | mod &= ~MOD_RGUI; | ||
| 106 | mod |= MOD_RALT; | ||
| 107 | } else if ((mod & MOD_RALT) == MOD_RALT) { | ||
| 108 | mod &= ~MOD_RALT; | ||
| 109 | mod |= MOD_RGUI; | ||
| 110 | } | ||
| 111 | } | ||
| 112 | if (keymap_config.no_gui) { | ||
| 113 | mod &= ~MOD_LGUI; | ||
| 114 | mod &= ~MOD_RGUI; | ||
| 115 | } | ||
| 116 | |||
| 117 | return mod; | ||
| 118 | } \ No newline at end of file | ||
diff --git a/quantum/keycode_config.h b/quantum/keycode_config.h index 293fefecf..022f4bd19 100644 --- a/quantum/keycode_config.h +++ b/quantum/keycode_config.h | |||
| @@ -16,11 +16,13 @@ | |||
| 16 | 16 | ||
| 17 | #include "eeconfig.h" | 17 | #include "eeconfig.h" |
| 18 | #include "keycode.h" | 18 | #include "keycode.h" |
| 19 | #include "action_code.h" | ||
| 19 | 20 | ||
| 20 | #ifndef KEYCODE_CONFIG_H | 21 | #ifndef KEYCODE_CONFIG_H |
| 21 | #define KEYCODE_CONFIG_H | 22 | #define KEYCODE_CONFIG_H |
| 22 | 23 | ||
| 23 | uint16_t keycode_config(uint16_t keycode); | 24 | uint16_t keycode_config(uint16_t keycode); |
| 25 | uint8_t mod_config(uint8_t mod); | ||
| 24 | 26 | ||
| 25 | /* NOTE: Not portable. Bit field order depends on implementation */ | 27 | /* NOTE: Not portable. Bit field order depends on implementation */ |
| 26 | typedef union { | 28 | typedef union { |
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c index 9dafc8b51..b1460c53c 100644 --- a/quantum/keymap_common.c +++ b/quantum/keymap_common.c | |||
| @@ -123,7 +123,8 @@ action_t action_for_key(uint8_t layer, keypos_t key) | |||
| 123 | action.code = ACTION_LAYER_TAP_TOGGLE(keycode & 0xFF); | 123 | action.code = ACTION_LAYER_TAP_TOGGLE(keycode & 0xFF); |
| 124 | break; | 124 | break; |
| 125 | case QK_MOD_TAP ... QK_MOD_TAP_MAX: | 125 | case QK_MOD_TAP ... QK_MOD_TAP_MAX: |
| 126 | action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0x1F, keycode & 0xFF); | 126 | mod = mod_config((keycode >> 0x8) & 0x1F); |
| 127 | action.code = ACTION_MODS_TAP_KEY(mod, keycode & 0xFF); | ||
| 127 | break; | 128 | break; |
| 128 | #ifdef BACKLIGHT_ENABLE | 129 | #ifdef BACKLIGHT_ENABLE |
| 129 | case BL_0 ... BL_15: | 130 | case BL_0 ... BL_15: |
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 | |||
diff --git a/quantum/quantum.c b/quantum/quantum.c index 3b5e52ff1..5bb7b04d5 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c | |||
| @@ -530,7 +530,7 @@ void send_string(const char *str) { | |||
| 530 | shift = false; | 530 | shift = false; |
| 531 | } | 531 | } |
| 532 | else { | 532 | else { |
| 533 | int hi = ascii_code>>4 & 0x0f; | 533 | int hi = ascii_code>>4 & 0x0f, |
| 534 | lo = ascii_code & 0x0f; | 534 | lo = ascii_code & 0x0f; |
| 535 | keycode = pgm_read_byte(&ascii_to_keycode_lut[hi][lo]); | 535 | keycode = pgm_read_byte(&ascii_to_keycode_lut[hi][lo]); |
| 536 | shift = !!( pgm_read_word(&ascii_to_shift_lut[hi]) & (0x8000u>>lo) ); | 536 | shift = !!( pgm_read_word(&ascii_to_shift_lut[hi]) & (0x8000u>>lo) ); |
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index c34ecafa5..6038e31c4 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h | |||
| @@ -550,13 +550,13 @@ enum quantum_keycodes { | |||
| 550 | #define OSL(layer) (layer | QK_ONE_SHOT_LAYER) | 550 | #define OSL(layer) (layer | QK_ONE_SHOT_LAYER) |
| 551 | 551 | ||
| 552 | // One-shot mod | 552 | // One-shot mod |
| 553 | #define OSM(mod) (mod | QK_ONE_SHOT_MOD) | 553 | #define OSM(mod) ((mod) | QK_ONE_SHOT_MOD) |
| 554 | 554 | ||
| 555 | // Layer tap-toggle | 555 | // Layer tap-toggle |
| 556 | #define TT(layer) (layer | QK_LAYER_TAP_TOGGLE) | 556 | #define TT(layer) (layer | QK_LAYER_TAP_TOGGLE) |
| 557 | 557 | ||
| 558 | // M-od, T-ap - 256 keycode max | 558 | // M-od, T-ap - 256 keycode max |
| 559 | #define MT(mod, kc) (kc | QK_MOD_TAP | ((mod & 0x1F) << 8)) | 559 | #define MT(mod, kc) (kc | QK_MOD_TAP | (((mod) & 0x1F) << 8)) |
| 560 | 560 | ||
| 561 | #define CTL_T(kc) MT(MOD_LCTL, kc) | 561 | #define CTL_T(kc) MT(MOD_LCTL, kc) |
| 562 | #define LCTL_T(kc) MT(MOD_LCTL, kc) | 562 | #define LCTL_T(kc) MT(MOD_LCTL, kc) |
diff --git a/quantum/visualizer/led_keyframes.c b/quantum/visualizer/led_keyframes.c index 2f4e20043..7e6e5d1ab 100644 --- a/quantum/visualizer/led_keyframes.c +++ b/quantum/visualizer/led_keyframes.c | |||
| @@ -41,8 +41,8 @@ static void keyframe_fade_all_leds_from_to(keyframe_animation_t* animation, uint | |||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | // TODO: Should be customizable per keyboard | 43 | // TODO: Should be customizable per keyboard |
| 44 | #define NUM_ROWS 7 | 44 | #define NUM_ROWS LED_NUM_ROWS |
| 45 | #define NUM_COLS 7 | 45 | #define NUM_COLS LED_NUM_COLS |
| 46 | 46 | ||
| 47 | static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS]; | 47 | static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS]; |
| 48 | static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS]; | 48 | static uint8_t crossfade_end_frame[NUM_ROWS][NUM_COLS]; |
diff --git a/quantum/visualizer/visualizer.c b/quantum/visualizer/visualizer.c index a4b3ea7e4..cc99d1e3b 100644 --- a/quantum/visualizer/visualizer.c +++ b/quantum/visualizer/visualizer.c | |||
| @@ -105,15 +105,19 @@ static remote_object_t* remote_objects[] = { | |||
| 105 | GDisplay* LCD_DISPLAY = 0; | 105 | GDisplay* LCD_DISPLAY = 0; |
| 106 | GDisplay* LED_DISPLAY = 0; | 106 | GDisplay* LED_DISPLAY = 0; |
| 107 | 107 | ||
| 108 | #ifdef LCD_DISPLAY_NUMBER | ||
| 108 | __attribute__((weak)) | 109 | __attribute__((weak)) |
| 109 | GDisplay* get_lcd_display(void) { | 110 | GDisplay* get_lcd_display(void) { |
| 110 | return gdispGetDisplay(0); | 111 | return gdispGetDisplay(LCD_DISPLAY_NUMBER); |
| 111 | } | 112 | } |
| 113 | #endif | ||
| 112 | 114 | ||
| 115 | #ifdef LED_DISPLAY_NUMBER | ||
| 113 | __attribute__((weak)) | 116 | __attribute__((weak)) |
| 114 | GDisplay* get_led_display(void) { | 117 | GDisplay* get_led_display(void) { |
| 115 | return gdispGetDisplay(1); | 118 | return gdispGetDisplay(LED_DISPLAY_NUMBER); |
| 116 | } | 119 | } |
| 120 | #endif | ||
| 117 | 121 | ||
| 118 | void start_keyframe_animation(keyframe_animation_t* animation) { | 122 | void start_keyframe_animation(keyframe_animation_t* animation) { |
| 119 | animation->current_frame = -1; | 123 | animation->current_frame = -1; |
| @@ -251,9 +255,9 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) { | |||
| 251 | .mods = 0xFF, | 255 | .mods = 0xFF, |
| 252 | .leds = 0xFFFFFFFF, | 256 | .leds = 0xFFFFFFFF, |
| 253 | .suspended = false, | 257 | .suspended = false, |
| 254 | #ifdef VISUALIZER_USER_DATA_SIZE | 258 | #ifdef VISUALIZER_USER_DATA_SIZE |
| 255 | .user_data = {0}, | 259 | .user_data = {0}, |
| 256 | #endif | 260 | #endif |
| 257 | }; | 261 | }; |
| 258 | 262 | ||
| 259 | visualizer_state_t state = { | 263 | visualizer_state_t state = { |
| @@ -379,25 +383,26 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) { | |||
| 379 | void visualizer_init(void) { | 383 | void visualizer_init(void) { |
| 380 | gfxInit(); | 384 | gfxInit(); |
| 381 | 385 | ||
| 382 | #ifdef LCD_BACKLIGHT_ENABLE | 386 | #ifdef LCD_BACKLIGHT_ENABLE |
| 383 | lcd_backlight_init(); | 387 | lcd_backlight_init(); |
| 384 | #endif | 388 | #endif |
| 385 | 389 | ||
| 386 | #ifdef SERIAL_LINK_ENABLE | 390 | #ifdef SERIAL_LINK_ENABLE |
| 387 | add_remote_objects(remote_objects, sizeof(remote_objects) / sizeof(remote_object_t*) ); | 391 | add_remote_objects(remote_objects, sizeof(remote_objects) / sizeof(remote_object_t*) ); |
| 388 | #endif | 392 | #endif |
| 389 | 393 | ||
| 390 | #ifdef LCD_ENABLE | 394 | #ifdef LCD_ENABLE |
| 391 | LCD_DISPLAY = get_lcd_display(); | 395 | LCD_DISPLAY = get_lcd_display(); |
| 392 | #endif | 396 | #endif |
| 393 | #ifdef BACKLIGHT_ENABLE | 397 | |
| 398 | #ifdef BACKLIGHT_ENABLE | ||
| 394 | LED_DISPLAY = get_led_display(); | 399 | LED_DISPLAY = get_led_display(); |
| 395 | #endif | 400 | #endif |
| 396 | 401 | ||
| 397 | // We are using a low priority thread, the idea is to have it run only | 402 | // We are using a low priority thread, the idea is to have it run only |
| 398 | // when the main thread is sleeping during the matrix scanning | 403 | // when the main thread is sleeping during the matrix scanning |
| 399 | gfxThreadCreate(visualizerThreadStack, sizeof(visualizerThreadStack), | 404 | gfxThreadCreate(visualizerThreadStack, sizeof(visualizerThreadStack), |
| 400 | VISUALIZER_THREAD_PRIORITY, visualizerThread, NULL); | 405 | VISUALIZER_THREAD_PRIORITY, visualizerThread, NULL); |
| 401 | } | 406 | } |
| 402 | 407 | ||
| 403 | void update_status(bool changed) { | 408 | void update_status(bool changed) { |
diff --git a/quantum/visualizer/visualizer.mk b/quantum/visualizer/visualizer.mk index 6f97603bd..0f7d8636c 100644 --- a/quantum/visualizer/visualizer.mk +++ b/quantum/visualizer/visualizer.mk | |||
| @@ -51,19 +51,23 @@ GFXSRC := $(patsubst $(TOP_DIR)/%,%,$(GFXSRC)) | |||
| 51 | GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS))) | 51 | GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS))) |
| 52 | 52 | ||
| 53 | ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","") | 53 | ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","") |
| 54 | SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c | 54 | SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c |
| 55 | else | 55 | else |
| 56 | ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/visualizer.c)","") | 56 | ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/visualizer.c)","") |
| 57 | ifeq ("$(wildcard $(SUBPROJECT_PATH)/visualizer.c)","") | 57 | ifeq ("$(wildcard $(SUBPROJECT_PATH)/visualizer.c)","") |
| 58 | $(error "$(KEYMAP_PATH)/visualizer.c" does not exist) | 58 | ifeq ("$(wildcard $(KEYBOARD_PATH)/visualizer.c)","") |
| 59 | else | 59 | $(error "visualizer.c" not found") |
| 60 | SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/visualizer.c | 60 | else |
| 61 | endif | 61 | SRC += keyboards/$(KEYBOARD)/visualizer.c |
| 62 | else | 62 | endif |
| 63 | SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/visualizer.c | 63 | else |
| 64 | endif | 64 | SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/visualizer.c |
| 65 | endif | ||
| 66 | else | ||
| 67 | SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/visualizer.c | ||
| 68 | endif | ||
| 65 | endif | 69 | endif |
| 66 | 70 | ||
| 67 | ifdef EMULATOR | 71 | ifdef EMULATOR |
| 68 | UINCDIR += $(TMK_DIR)/common | 72 | UINCDIR += $(TMK_DIR)/common |
| 69 | endif \ No newline at end of file | 73 | endif |
