summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/keycode_config.c28
-rw-r--r--quantum/keycode_config.h2
-rw-r--r--quantum/keymap_common.c3
-rw-r--r--quantum/keymap_extras/keymap_swedish.h52
-rw-r--r--quantum/quantum.c2
-rw-r--r--quantum/quantum_keycodes.h4
-rw-r--r--quantum/visualizer/led_keyframes.c4
-rw-r--r--quantum/visualizer/visualizer.c33
-rw-r--r--quantum/visualizer/visualizer.mk26
9 files changed, 123 insertions, 31 deletions
diff --git a/quantum/keycode_config.c b/quantum/keycode_config.c
index 4f7bc525ec..eb39c8fe00 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 293fefecfb..022f4bd19b 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 9dafc8b516..b1460c53cc 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:
diff --git a/quantum/keymap_extras/keymap_swedish.h b/quantum/keymap_extras/keymap_swedish.h
new file mode 100644
index 0000000000..dcfad720d0
--- /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 <http://www.gnu.org/licenses/>.
+ */
+
+#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
+
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 3b5e52ff12..5bb7b04d53 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) );
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index c34ecafa51..6038e31c46 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)
diff --git a/quantum/visualizer/led_keyframes.c b/quantum/visualizer/led_keyframes.c
index 2f4e200439..7e6e5d1ab9 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 a4b3ea7e49..cc99d1e3b6 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 6f97603bd8..0f7d8636cf 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