From d3db8d62f6fc6a7dee43978ddc8356579b502b37 Mon Sep 17 00:00:00 2001 From: Erez Zukerman Date: Wed, 28 Oct 2015 04:07:15 +0200 Subject: [PATCH] More work on ErgoDox EZ default keymap --- keyboard/ergodox_ez/Makefile | 16 +- keyboard/ergodox_ez/config.h | 2 +- keyboard/ergodox_ez/ergodox_ez.c | 29 - keyboard/ergodox_ez/ergodox_ez.h | 21 - keyboard/ergodox_ez/ergodox_ez.hex | 2880 +++++++++--------- keyboard/ergodox_ez/keymaps/keymap_default.c | 46 +- keyboard/ergodox_ez/matrix.c | 4 +- quantum/keymap_common.c | 7 +- quantum/keymap_common.h | 7 +- 9 files changed, 1442 insertions(+), 1570 deletions(-) diff --git a/keyboard/ergodox_ez/Makefile b/keyboard/ergodox_ez/Makefile index f9260b1cedc..16ced9032b4 100644 --- a/keyboard/ergodox_ez/Makefile +++ b/keyboard/ergodox_ez/Makefile @@ -27,7 +27,8 @@ TARGET_DIR = . # # project specific files SRC = ergodox_ez.c \ - twimaster.c + twimaster.c \ + matrix.c ifdef KEYMAP SRC := keymaps/keymap_$(KEYMAP).c $(SRC) @@ -84,17 +85,18 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT # Atmel DFU loader 4096 # LUFA bootloader 4096 # USBaspLoader 2048 -OPT_DEFS += -DBOOTLOADER_SIZE=4096 +OPT_DEFS += -DBOOTLOADER_SIZE=512 # 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 +CUSTOM_MATRIX = yes # Custom matrix file for the ErgoDox EZ # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE # SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend # NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA diff --git a/keyboard/ergodox_ez/config.h b/keyboard/ergodox_ez/config.h index 850d245791d..583ad84f58e 100644 --- a/keyboard/ergodox_ez/config.h +++ b/keyboard/ergodox_ez/config.h @@ -52,7 +52,7 @@ along with this program. If not, see . /* Set 0 if debouncing isn't needed */ #define DEBOUNCE 2 -#define TAPPING_TERM 100 +#define TAPPING_TERM 200 /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ #define LOCKING_SUPPORT_ENABLE diff --git a/keyboard/ergodox_ez/ergodox_ez.c b/keyboard/ergodox_ez/ergodox_ez.c index f7e156b319f..78e956a0428 100644 --- a/keyboard/ergodox_ez/ergodox_ez.c +++ b/keyboard/ergodox_ez/ergodox_ez.c @@ -4,10 +4,6 @@ bool i2c_initialized = 0; uint8_t mcp23018_status = 0x20; -bool ergodox_left_led_1 = 0; // left top -bool ergodox_left_led_2 = 0; // left middle -bool ergodox_left_led_3 = 0; // left bottom - __attribute__ ((weak)) void * matrix_init_user(void) { @@ -92,32 +88,7 @@ uint8_t init_mcp23018(void) { out: i2c_stop(); - if (!mcp23018_status) mcp23018_status = ergodox_left_leds_update(); - return mcp23018_status; } -uint8_t ergodox_left_leds_update(void) { - if (mcp23018_status) { // if there was an error - return mcp23018_status; - } - - // set logical value (doesn't matter on inputs) - // - unused : hi-Z : 1 - // - input : hi-Z : 1 - // - driving : hi-Z : 1 - mcp23018_status = i2c_start(I2C_ADDR_WRITE); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(OLATA); if (mcp23018_status) goto out; - mcp23018_status = i2c_write(0b11111111 - & ~(ergodox_left_led_3<. #include "report.h" #include "keycode.h" #include "action_layer.h" +#include #include "action.h" #include "action_macro.h" #include "debug.h" @@ -71,6 +72,8 @@ action_t action_for_key(uint8_t layer, keypos_t key) return action; #endif } else if (keycode == RESET) { // RESET is 0x5000, which is why this is here + clear_keyboard(); + _delay_ms(250); bootloader_jump(); return; } else if (keycode == DEBUG) { // DEBUG is 0x5001 @@ -78,7 +81,7 @@ action_t action_for_key(uint8_t layer, keypos_t key) print("\nDEBUG: enabled.\n"); debug_enable = true; return; - } else if (keycode >= 0x5000 && keycode < 0x6000) { + } else if (keycode >= 0x5000 && keycode < 0x6000) { // Layer movement shortcuts // See .h to see constraints/usage int type = (keycode >> 0x8) & 0xF; @@ -107,7 +110,7 @@ action_t action_for_key(uint8_t layer, keypos_t key) action_t action; action.code = ACTION_LAYER_TOGGLE(layer); return action; - } + } #ifdef MIDI_ENABLE } else if (keycode >= 0x6000 && keycode < 0x7000) { action_t action; diff --git a/quantum/keymap_common.h b/quantum/keymap_common.h index 5735631d959..2da01251d6e 100644 --- a/quantum/keymap_common.h +++ b/quantum/keymap_common.h @@ -190,12 +190,7 @@ extern const uint16_t fn_actions[]; #define GUI_T(kc) MT(0x8, kc) // L-ayer, T-ap - 256 keycode max, 16 layer max -#define LT(layer, kc) (kc | 0x7000 | ((layer & 0xF) << 8)) - -// For sending unicode codes. -// You may not send codes over 1FFF -- this supports most of UTF8. -// To have a key that sends out Œ, go UC(0x0152) -#define UNICODE(n) (n | 0x8000) +#define LT(layer, kc) (kc | 0x8000 | ((layer & 0xF) << 8)) #define UC(n) UNICODE(n)