From 7235c93827e67bd69aee75c6effb4773647fdfba Mon Sep 17 00:00:00 2001 From: Balz Guenat Date: Mon, 20 Nov 2017 18:26:44 +0100 Subject: [PATCH] clean up bananasplit keymap --- keyboards/bananasplit/bananasplit.h | 10 ++--- .../bananasplit/keymaps/coloneljesus/config.h | 2 +- .../bananasplit/keymaps/coloneljesus/keymap.c | 44 +++++++++---------- keyboards/bananasplit/rules.mk | 23 +++++----- 4 files changed, 39 insertions(+), 40 deletions(-) diff --git a/keyboards/bananasplit/bananasplit.h b/keyboards/bananasplit/bananasplit.h index fa4c13258..f9b055c63 100644 --- a/keyboards/bananasplit/bananasplit.h +++ b/keyboards/bananasplit/bananasplit.h @@ -47,11 +47,11 @@ along with this program. If not, see . } /* Here is the above keymap filled with KC_TRNS. It's a useful starting point when defining layers. KEYMAP( \ - ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, \ - ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, \ - ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, \ - ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______,\ - ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, ______ \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,\ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ ) */ diff --git a/keyboards/bananasplit/keymaps/coloneljesus/config.h b/keyboards/bananasplit/keymaps/coloneljesus/config.h index af6cf8ef1..5f2cd13fe 100644 --- a/keyboards/bananasplit/keymaps/coloneljesus/config.h +++ b/keyboards/bananasplit/keymaps/coloneljesus/config.h @@ -17,7 +17,7 @@ #ifndef CONFIG_USER_H #define CONFIG_USER_H -#include "../../config.h" +#include "config_common.h" // place overrides here #define GRAVE_ESC_CTRL_OVERRIDE diff --git a/keyboards/bananasplit/keymaps/coloneljesus/keymap.c b/keyboards/bananasplit/keymaps/coloneljesus/keymap.c index 5d67079f8..ac7f1113a 100644 --- a/keyboards/bananasplit/keymaps/coloneljesus/keymap.c +++ b/keyboards/bananasplit/keymaps/coloneljesus/keymap.c @@ -15,7 +15,9 @@ */ #include "bananasplit.h" -#define ______ KC_TRNS +enum custom_keycodes { + WIN_SWITCH_LAYOUT = SAFE_RANGE +}; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* @@ -35,7 +37,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \ MO(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, M(0),\ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, WIN_SWITCH_LAYOUT,\ KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, MO(1), KC_SPC, KC_RALT, KC_RGUI, KC_NO, KC_APP, KC_RCTL \ ), /* @@ -52,11 +54,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ------------------------------------------------------------------------------------------- */ [1] = KEYMAP( \ - ______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ______, \ - KC_CAPS, KC_MPRV, KC_VOLU, KC_MNXT, KC_PGUP, KC_INS, KC_HOME, LCTL(KC_LEFT), LCTL(KC_RGHT), KC_END, ______, ______, ______, KC_PSCR, \ - ______, KC_MUTE, KC_VOLD, KC_MPLY, KC_PGDN, KC_DEL, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, ______, ______, ______, \ - ______, ______, ______, ______, ______, ______, LCTL(KC_BSPC), LCTL(KC_DEL), ______, ______, ______, ______, ______, \ - ______, ______, ______, ______, ______, ______, ______, ______, ______, ______, RESET \ + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, \ + KC_CAPS, KC_MPRV, KC_VOLU, KC_MNXT, KC_PGUP, KC_INS, KC_HOME, LCTL(KC_LEFT), LCTL(KC_RGHT), KC_END, _______, _______, _______, KC_PSCR, \ + _______, KC_MUTE, KC_VOLD, KC_MPLY, KC_PGDN, KC_DEL, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, \ + _______, _______, _______, _______, _______,_______, LCTL(KC_BSPC), LCTL(KC_DEL), _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______,_______, _______, _______, _______, _______, RESET \ ), }; @@ -64,21 +66,6 @@ const uint16_t PROGMEM fn_actions[] = { }; -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { - switch(id) { - case 0: - // Sends Alt+Shift on both key down and key up. - // Fesigned to switch between two keyboard layouts on Windows using a locking switch. - // Does nothing if right shift is pressed for easier resync. - if (!(get_mods() & MOD_BIT(KC_RSFT))) - return MACRO(D(LALT), T(LSFT), U(LALT), END); - else - return MACRO_NONE; - } - return MACRO_NONE; -}; - - void matrix_init_user(void) { } @@ -88,6 +75,19 @@ void matrix_scan_user(void) { } bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case WIN_SWITCH_LAYOUT: { + // Sends Alt+Shift on both key down and key up. + // Designed to switch between two keyboard layouts on Windows using a locking switch. + // Does nothing if right shift is pressed for easy resync. + if (!(get_mods() & MOD_BIT(KC_RSFT))) { + SEND_STRING(SS_DOWN(X_LALT)SS_TAP(X_LSHIFT)SS_UP(X_LALT)); + return false; + } + else + return false; + } + } return true; } diff --git a/keyboards/bananasplit/rules.mk b/keyboards/bananasplit/rules.mk index 04579d4ce..168fa06d1 100644 --- a/keyboards/bananasplit/rules.mk +++ b/keyboards/bananasplit/rules.mk @@ -1,6 +1,5 @@ # MCU name -#MCU = at90usb1287 -MCU = atmega32u4 +MCU ?= atmega32u4 # Processor frequency. # This will define a symbol, F_CPU, in all source code files equal to the @@ -13,14 +12,14 @@ MCU = atmega32u4 # does not *change* the processor frequency - it should merely be updated to # reflect the processor speed set externally so that the code can use accurate # software delays. -F_CPU = 16000000 +F_CPU ?= 16000000 # # LUFA specific # # Target architecture (see library "Board Types" documentation). -ARCH = AVR8 +ARCH ?= AVR8 # Input clock frequency. # This will define a symbol, F_USB, in all source code files equal to the @@ -33,7 +32,7 @@ ARCH = AVR8 # # If no clock division is performed on the input clock inside the AVR (via the # CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. -F_USB = $(F_CPU) +F_USB ?= $(F_CPU) # Interrupt driven control endpoint task(+60) OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT @@ -51,14 +50,14 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096 # Build Options # comment out to disable the options. # -BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) -EXTRAKEY_ENABLE = yes # Audio control and System control(+450) -CONSOLE_ENABLE = yes # Console for debug(+400) -COMMAND_ENABLE = yes # Commands for debug and configuration +BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) +EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) +CONSOLE_ENABLE ?= yes # Console for debug(+400) +COMMAND_ENABLE ?= yes # Commands for debug and configuration #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend -NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA -BACKLIGHT_ENABLE = yes +NKRO_ENABLE ?= yes # USB Nkey Rollover - not yet supported in LUFA +BACKLIGHT_ENABLE ?= yes # Optimize size but this may cause error "relocation truncated to fit"