From e740520b3fe8fdeebd087fe6b7390582661f86f8 Mon Sep 17 00:00:00 2001 From: rai-suta Date: Mon, 26 Jun 2017 00:24:32 +0900 Subject: Fix bug. --- quantum/quantum.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'quantum') 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) { shift = false; } else { - int hi = ascii_code>>4 & 0x0f; + int hi = ascii_code>>4 & 0x0f, lo = ascii_code & 0x0f; keycode = pgm_read_byte(&ascii_to_keycode_lut[hi][lo]); shift = !!( pgm_read_word(&ascii_to_shift_lut[hi]) & (0x8000u>>lo) ); -- cgit v1.2.3-24-g4f1b From 42e6ecc36b65ad0f0d29c6c35c93b95078c11a1a Mon Sep 17 00:00:00 2001 From: Ethan Madden Date: Sun, 25 Jun 2017 18:30:40 -0700 Subject: Whitefox LED control (#1432) * use new grave_esc functionality * Port LED control from Ergodox Infinity to Whitefox --- quantum/visualizer/led_keyframes.c | 4 ++-- quantum/visualizer/visualizer.c | 33 +++++++++++++++++++-------------- quantum/visualizer/visualizer.mk | 26 +++++++++++++++----------- 3 files changed, 36 insertions(+), 27 deletions(-) (limited to 'quantum') 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 } // TODO: Should be customizable per keyboard -#define NUM_ROWS 7 -#define NUM_COLS 7 +#define NUM_ROWS LED_NUM_ROWS +#define NUM_COLS LED_NUM_COLS static uint8_t crossfade_start_frame[NUM_ROWS][NUM_COLS]; 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[] = { GDisplay* LCD_DISPLAY = 0; GDisplay* LED_DISPLAY = 0; +#ifdef LCD_DISPLAY_NUMBER __attribute__((weak)) GDisplay* get_lcd_display(void) { - return gdispGetDisplay(0); + return gdispGetDisplay(LCD_DISPLAY_NUMBER); } +#endif +#ifdef LED_DISPLAY_NUMBER __attribute__((weak)) GDisplay* get_led_display(void) { - return gdispGetDisplay(1); + return gdispGetDisplay(LED_DISPLAY_NUMBER); } +#endif void start_keyframe_animation(keyframe_animation_t* animation) { animation->current_frame = -1; @@ -251,9 +255,9 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) { .mods = 0xFF, .leds = 0xFFFFFFFF, .suspended = false, -#ifdef VISUALIZER_USER_DATA_SIZE + #ifdef VISUALIZER_USER_DATA_SIZE .user_data = {0}, -#endif + #endif }; visualizer_state_t state = { @@ -379,25 +383,26 @@ static DECLARE_THREAD_FUNCTION(visualizerThread, arg) { void visualizer_init(void) { gfxInit(); -#ifdef LCD_BACKLIGHT_ENABLE + #ifdef LCD_BACKLIGHT_ENABLE lcd_backlight_init(); -#endif + #endif -#ifdef SERIAL_LINK_ENABLE + #ifdef SERIAL_LINK_ENABLE add_remote_objects(remote_objects, sizeof(remote_objects) / sizeof(remote_object_t*) ); -#endif + #endif -#ifdef LCD_ENABLE + #ifdef LCD_ENABLE LCD_DISPLAY = get_lcd_display(); -#endif -#ifdef BACKLIGHT_ENABLE + #endif + + #ifdef BACKLIGHT_ENABLE LED_DISPLAY = get_led_display(); -#endif + #endif // We are using a low priority thread, the idea is to have it run only // when the main thread is sleeping during the matrix scanning - gfxThreadCreate(visualizerThreadStack, sizeof(visualizerThreadStack), - VISUALIZER_THREAD_PRIORITY, visualizerThread, NULL); + gfxThreadCreate(visualizerThreadStack, sizeof(visualizerThreadStack), + VISUALIZER_THREAD_PRIORITY, visualizerThread, NULL); } 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)) GFXDEFS := $(patsubst %,-D%,$(patsubst -D%,%,$(GFXDEFS))) ifneq ("$(wildcard $(KEYMAP_PATH)/visualizer.c)","") - SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c + SRC += keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/visualizer.c else - ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/visualizer.c)","") - ifeq ("$(wildcard $(SUBPROJECT_PATH)/visualizer.c)","") -$(error "$(KEYMAP_PATH)/visualizer.c" does not exist) - else - SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/visualizer.c - endif - else - SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/visualizer.c - endif + ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/visualizer.c)","") + ifeq ("$(wildcard $(SUBPROJECT_PATH)/visualizer.c)","") + ifeq ("$(wildcard $(KEYBOARD_PATH)/visualizer.c)","") +$(error "visualizer.c" not found") + else + SRC += keyboards/$(KEYBOARD)/visualizer.c + endif + else + SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/visualizer.c + endif + else + SRC += keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/visualizer.c + endif endif ifdef EMULATOR UINCDIR += $(TMK_DIR)/common -endif \ No newline at end of file +endif -- cgit v1.2.3-24-g4f1b From 61cdc9aaa462afbcbaf57f2c5991e06924caed0e Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Mon, 26 Jun 2017 18:54:01 -0400 Subject: Allow mod swapping for mod tap (MT) (#1202) * allow mod swapping for mod tap * quick include * fix the mod swapping * make changes consistent with action code * fix bug * re-enable no gui, etc * fix binary comps * solid logic --- quantum/keycode_config.c | 28 ++++++++++++++++++++++++++++ quantum/keycode_config.h | 2 ++ quantum/keymap_common.c | 3 ++- 3 files changed, 32 insertions(+), 1 deletion(-) (limited to 'quantum') 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) { return keycode; } } + +uint8_t mod_config(uint8_t mod) { + keymap_config.raw = eeconfig_read_keymap(); + if (keymap_config.swap_lalt_lgui) { + if ((mod & MOD_RGUI) == MOD_LGUI) { + mod &= ~MOD_LGUI; + mod |= MOD_LALT; + } else if ((mod & MOD_RALT) == MOD_LALT) { + mod &= ~MOD_LALT; + mod |= MOD_LGUI; + } + } + if (keymap_config.swap_ralt_rgui) { + if ((mod & MOD_RGUI) == MOD_RGUI) { + mod &= ~MOD_RGUI; + mod |= MOD_RALT; + } else if ((mod & MOD_RALT) == MOD_RALT) { + mod &= ~MOD_RALT; + mod |= MOD_RGUI; + } + } + if (keymap_config.no_gui) { + mod &= ~MOD_LGUI; + mod &= ~MOD_RGUI; + } + + return mod; +} \ 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 @@ #include "eeconfig.h" #include "keycode.h" +#include "action_code.h" #ifndef KEYCODE_CONFIG_H #define KEYCODE_CONFIG_H uint16_t keycode_config(uint16_t keycode); +uint8_t mod_config(uint8_t mod); /* NOTE: Not portable. Bit field order depends on implementation */ 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) action.code = ACTION_LAYER_TAP_TOGGLE(keycode & 0xFF); break; case QK_MOD_TAP ... QK_MOD_TAP_MAX: - action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0x1F, keycode & 0xFF); + mod = mod_config((keycode >> 0x8) & 0x1F); + action.code = ACTION_MODS_TAP_KEY(mod, keycode & 0xFF); break; #ifdef BACKLIGHT_ENABLE case BL_0 ... BL_15: -- cgit v1.2.3-24-g4f1b From a25dbaad327f834dad6fb572b074bab7be1e1d0f Mon Sep 17 00:00:00 2001 From: Andreas Lindhé Date: Tue, 27 Jun 2017 14:58:38 +0200 Subject: Create sv_SE Qwerty layout for ErgoDox MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit *NOTE:* it might still be desirable to set the software layout to sv_SE in your OS. Swedish (sv_SE) Qwerty layout for ErgoDox, based on the Default configuration I have tried making this as close of a match I could between the [default ErgoDox EZ configuration](https://ergodox-ez.com/pages/our-firmware) and a standard Swedish Qwerty layout. Notable differences from default: ================================= * There are three special character buttons (acute accent, circumflex/tilde and apostrophe/asterisk) that don't have any buttons to map to naturally. I've put these at other places: * Acute accent (´) can be found in the lower left corner, conveniently placed to reach for making an é. * Apostrophe (') was put in the lower left corner, close to acute accent. * Circumflex (^) and asterisk (*) was placed in the lower right corner. * Tilde (~) and diaeresis (¨) I couldn't find a good place for, so I left those out. I could only get the buttons to produce a single one of the characters. How can I get it to work properly? * The Alt button on right thumb was exchanged for AltGr (RAlt). * I changed the backslash in the numpad (layer 1) for a minus. Thought it was more sensible. * I didn't find a good place for the "<>|" button, so that one was left out. That is a problem that really needs to be resolved. Pipe can be found on layer one, however. --- quantum/keymap_extras/keymap_swedish.h | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 quantum/keymap_extras/keymap_swedish.h (limited to 'quantum') 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 @@ +/* Copyright 2017 Andreas Lindhé + * + * 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 . + */ + +#ifndef KEYMAP_SWEDISH_H +#define KEYMAP_SWEDISH_H + +#include "keymap_nordic.h" + +// There are slight differrences in the keyboards in the nordic contries + +// Swedish redifinitions from the nordic keyset +#undef NO_AE +#define NO_AE KC_QUOT // ä +#undef NO_CIRC +#define NO_CIRC LSFT(KC_RBRC) // ^ +#undef NO_GRV +#define NO_GRV LSFT(NO_BSLS) // +#undef NO_OSLH +#define NO_OSLH KC_SCLN // ö + +// Additional Swedish keys not defined in the nordic keyset +#define NO_AA KC_LBRC // å +#define NO_ASTR LSFT(KC_BSLS) // * + +// Norwegian unique MAC characters (not vetted for Swedish) +#define NO_ACUT_MAC KC_EQL // = +#define NO_APOS_MAC KC_NUBS // ' +#define NO_AT_MAC KC_BSLS // @ +#define NO_BSLS_MAC ALGR(LSFT(KC_7)) // '\' +#define NO_DLR_MAC LSFT(KC_4) // $ +#define NO_GRV_MAC ALGR(NO_BSLS) // ` +#define NO_GRTR_MAC LSFT(KC_GRV) // > +#define NO_LCBR_MAC ALGR(LSFT(KC_8)) // } +#define NO_LESS_MAC KC_GRV // > +#define NO_PIPE_MAC ALGR(KC_7) // | +#define NO_RCBR_MAC ALGR(LSFT(KC_9)) // } + +#endif + -- cgit v1.2.3-24-g4f1b From b2979eba236dcda7928079e8102b521a0c8f57aa Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 27 Jun 2017 12:55:18 -0400 Subject: Adds parenthesis where they might be needed Addresses #764 --- quantum/quantum_keycodes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'quantum') 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 { #define OSL(layer) (layer | QK_ONE_SHOT_LAYER) // One-shot mod -#define OSM(mod) (mod | QK_ONE_SHOT_MOD) +#define OSM(mod) ((mod) | QK_ONE_SHOT_MOD) // Layer tap-toggle #define TT(layer) (layer | QK_LAYER_TAP_TOGGLE) // M-od, T-ap - 256 keycode max -#define MT(mod, kc) (kc | QK_MOD_TAP | ((mod & 0x1F) << 8)) +#define MT(mod, kc) (kc | QK_MOD_TAP | (((mod) & 0x1F) << 8)) #define CTL_T(kc) MT(MOD_LCTL, kc) #define LCTL_T(kc) MT(MOD_LCTL, kc) -- cgit v1.2.3-24-g4f1b