diff options
author | jpetermans <tibcmhhm@gmail.com> | 2017-05-08 15:24:50 -0700 |
---|---|---|
committer | jpetermans <tibcmhhm@gmail.com> | 2017-05-08 15:24:50 -0700 |
commit | 967cf0f6d43bd05c9951c7c31190971acd0799ea (patch) | |
tree | 34ff786a7e5177c6edc48e93b69ce71132cb3cbf /keyboards/ergodox | |
parent | 5df74f3ba73f18f6bbd13b82a3a960c86fa592e1 (diff) | |
parent | 153eb95ab208cf5563ce2fae7ec68981b64d11ce (diff) |
Merge remote-tracking branch 'upstream/master' into user_led_configuration
Diffstat (limited to 'keyboards/ergodox')
35 files changed, 1743 insertions, 424 deletions
diff --git a/keyboards/ergodox/config.h b/keyboards/ergodox/config.h index 3618598320..994a8c6433 100644 --- a/keyboards/ergodox/config.h +++ b/keyboards/ergodox/config.h @@ -34,4 +34,4 @@ #endif -#endif /* KEYBOARDS_ERGODOX_CONFIG_H_ */
\ No newline at end of file +#endif /* KEYBOARDS_ERGODOX_CONFIG_H_ */ diff --git a/keyboards/ergodox/ez/config.h b/keyboards/ergodox/ez/config.h index a3347de45e..aa17c3e8d3 100644 --- a/keyboards/ergodox/ez/config.h +++ b/keyboards/ergodox/ez/config.h @@ -58,7 +58,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define RGBW 1 /* Set 0 if debouncing isn't needed */ -#define DEBOUNCE 5 +#define DEBOUNCE 15 #define USB_MAX_POWER_CONSUMPTION 500 diff --git a/keyboards/ergodox/ez/matrix.c b/keyboards/ergodox/ez/matrix.c index 43f5152591..21b60a542e 100644 --- a/keyboards/ergodox/ez/matrix.c +++ b/keyboards/ergodox/ez/matrix.c @@ -53,11 +53,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef DEBOUNCE # define DEBOUNCE 5 #endif -static uint8_t debouncing = DEBOUNCE; /* matrix state(1:on, 0:off) */ static matrix_row_t matrix[MATRIX_ROWS]; -static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +// Debouncing: store for each key the number of scans until it's eligible to +// change. When scanning the matrix, ignore any changes in keys that have +// already changed in the last DEBOUNCE scans. +static uint8_t debounce_matrix[MATRIX_ROWS * MATRIX_COLS]; static matrix_row_t read_cols(uint8_t row); static void init_cols(void); @@ -113,7 +116,9 @@ void matrix_init(void) // initialize matrix state: all keys off for (uint8_t i=0; i < MATRIX_ROWS; i++) { matrix[i] = 0; - matrix_debouncing[i] = 0; + for (uint8_t j=0; j < MATRIX_COLS; ++j) { + debounce_matrix[i * MATRIX_COLS + j] = 0; + } } #ifdef DEBUG_MATRIX_SCAN_RATE @@ -134,14 +139,36 @@ void matrix_power_up(void) { // initialize matrix state: all keys off for (uint8_t i=0; i < MATRIX_ROWS; i++) { matrix[i] = 0; - matrix_debouncing[i] = 0; } #ifdef DEBUG_MATRIX_SCAN_RATE matrix_timer = timer_read32(); matrix_scan_count = 0; #endif +} + +// Returns a matrix_row_t whose bits are set if the corresponding key should be +// eligible to change in this scan. +matrix_row_t debounce_mask(uint8_t row) { + matrix_row_t result = 0; + for (uint8_t j=0; j < MATRIX_COLS; ++j) { + if (debounce_matrix[row * MATRIX_COLS + j]) { + --debounce_matrix[row * MATRIX_COLS + j]; + } else { + result |= (1 << j); + } + } + return result; +} +// Report changed keys in the given row. Resets the debounce countdowns +// corresponding to each set bit in 'change' to DEBOUNCE. +void debounce_report(matrix_row_t change, uint8_t row) { + for (uint8_t i = 0; i < MATRIX_COLS; ++i) { + if (change & (1 << i)) { + debounce_matrix[row * MATRIX_COLS + i] = DEBOUNCE; + } + } } uint8_t matrix_scan(void) @@ -178,26 +205,12 @@ uint8_t matrix_scan(void) for (uint8_t i = 0; i < MATRIX_ROWS; i++) { select_row(i); wait_us(30); // without this wait read unstable value. - matrix_row_t cols = read_cols(i); - if (matrix_debouncing[i] != cols) { - matrix_debouncing[i] = cols; - if (debouncing) { - debug("bounce!: "); debug_hex(debouncing); debug("\n"); - } - debouncing = DEBOUNCE; - } - unselect_rows(); - } + matrix_row_t mask = debounce_mask(i); + matrix_row_t cols = (read_cols(i) & mask) | (matrix[i] & ~mask); + debounce_report(cols ^ matrix[i], i); + matrix[i] = cols; - if (debouncing) { - if (--debouncing) { - wait_us(1); - // this should be wait_ms(1) but has been left as-is at EZ's request - } else { - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - matrix[i] = matrix_debouncing[i]; - } - } + unselect_rows(); } matrix_scan_quantum(); @@ -205,9 +218,8 @@ uint8_t matrix_scan(void) return 1; } -bool matrix_is_modified(void) +bool matrix_is_modified(void) // deprecated and evidently not called. { - if (debouncing) return false; return true; } diff --git a/keyboards/ergodox/ez/rules.mk b/keyboards/ergodox/ez/rules.mk index 64b2db8158..6cd1c0c4f7 100644 --- a/keyboards/ergodox/ez/rules.mk +++ b/keyboards/ergodox/ez/rules.mk @@ -74,7 +74,3 @@ OPT_DEFS += -DBOOTLOADER_SIZE=512 SLEEP_LED_ENABLE = no API_SYSEX_ENABLE ?= no RGBLIGHT_ENABLE ?= yes - -ifndef QUANTUM_DIR - include ../../../Makefile -endif diff --git a/keyboards/ergodox/infinity/Makefile b/keyboards/ergodox/infinity/Makefile index 191c6bb664..bd09e5885d 100644 --- a/keyboards/ergodox/infinity/Makefile +++ b/keyboards/ergodox/infinity/Makefile @@ -1,3 +1,3 @@ ifndef MAKEFILE_INCLUDED include ../../../Makefile -endif
\ No newline at end of file +endif diff --git a/keyboards/ergodox/infinity/animations.c b/keyboards/ergodox/infinity/animations.c new file mode 100644 index 0000000000..4c9f6d9c85 --- /dev/null +++ b/keyboards/ergodox/infinity/animations.c @@ -0,0 +1,107 @@ +/* Copyright 2017 Fred Sundvik + * + * 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/>. + */ + +#if defined(VISUALIZER_ENABLE) + +#include "animations.h" +#include "visualizer.h" +#ifdef LCD_ENABLE +#include "lcd_keyframes.h" +#endif +#ifdef LCD_BACKLIGHT_ENABLE +#include "lcd_backlight_keyframes.h" +#endif + +#ifdef LED_ENABLE +#include "led_keyframes.h" +#endif + +#include "visualizer_keyframes.h" + + +#if defined(LCD_ENABLE) && defined(LCD_BACKLIGHT_ENABLE) + +// Don't worry, if the startup animation is long, you can use the keyboard like normal +// during that time +keyframe_animation_t default_startup_animation = { + .num_frames = 4, + .loop = false, + .frame_lengths = {0, 0, 0, gfxMillisecondsToTicks(5000), 0}, + .frame_functions = { + lcd_keyframe_enable, + backlight_keyframe_enable, + lcd_keyframe_draw_logo, + backlight_keyframe_animate_color, + }, +}; + +keyframe_animation_t default_suspend_animation = { + .num_frames = 4, + .loop = false, + .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0, 0}, + .frame_functions = { + lcd_keyframe_display_layer_text, + backlight_keyframe_animate_color, + lcd_keyframe_disable, + backlight_keyframe_disable, + }, +}; +#endif + +#if defined(LED_ENABLE) +#define CROSSFADE_TIME 1000 +#define GRADIENT_TIME 3000 + +keyframe_animation_t led_test_animation = { + .num_frames = 14, + .loop = true, + .frame_lengths = { + gfxMillisecondsToTicks(1000), // fade in + gfxMillisecondsToTicks(1000), // no op (leds on) + gfxMillisecondsToTicks(1000), // fade out + gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade + gfxMillisecondsToTicks(GRADIENT_TIME), // left to rigt (outside in) + gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade + gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom + 0, // mirror leds + gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade + gfxMillisecondsToTicks(GRADIENT_TIME), // left_to_right (mirrored, so inside out) + gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade + gfxMillisecondsToTicks(GRADIENT_TIME), // top_to_bottom + 0, // normal leds + gfxMillisecondsToTicks(CROSSFADE_TIME), // crossfade + + }, + .frame_functions = { + led_keyframe_fade_in_all, + keyframe_no_operation, + led_keyframe_fade_out_all, + led_keyframe_crossfade, + led_keyframe_left_to_right_gradient, + led_keyframe_crossfade, + led_keyframe_top_to_bottom_gradient, + led_keyframe_mirror_orientation, + led_keyframe_crossfade, + led_keyframe_left_to_right_gradient, + led_keyframe_crossfade, + led_keyframe_top_to_bottom_gradient, + led_keyframe_normal_orientation, + led_keyframe_crossfade, + }, +}; +#endif + +#endif diff --git a/keyboards/ergodox/infinity/animations.h b/keyboards/ergodox/infinity/animations.h new file mode 100644 index 0000000000..6d8b9830d9 --- /dev/null +++ b/keyboards/ergodox/infinity/animations.h @@ -0,0 +1,30 @@ +/* Copyright 2017 Fred Sundvik + * + * 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 KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ +#define KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ + +#include "visualizer.h" + +// You can use these default animations, but of course you can also write your own custom ones instead +extern keyframe_animation_t default_startup_animation; +extern keyframe_animation_t default_suspend_animation; + +// An animation for testing and demonstrating the led support, should probably not be used for real world +// cases +extern keyframe_animation_t led_test_animation; + +#endif /* KEYBOARDS_ERGODOX_INFINITY_ANIMATIONS_H_ */ diff --git a/keyboards/ergodox/infinity/config.h b/keyboards/ergodox/infinity/config.h index 9e264083be..95f713819e 100644 --- a/keyboards/ergodox/infinity/config.h +++ b/keyboards/ergodox/infinity/config.h @@ -40,7 +40,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. /* number of backlight levels */ #define BACKLIGHT_LEVELS 3 -#define LED_BRIGHTNESS_LO 15 +#define LED_BRIGHTNESS_LO 100 #define LED_BRIGHTNESS_HI 255 /* define if matrix has ghost */ @@ -54,6 +54,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // The visualizer needs gfx thread priorities #define VISUALIZER_THREAD_PRIORITY (NORMAL_PRIORITY - 2) +#define VISUALIZER_USER_DATA_SIZE 16 + /* * Feature disable options * These options are also useful to firmware size reduction. diff --git a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c b/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c index 1d21f0c498..ea09c4bb0c 100644 --- a/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c +++ b/keyboards/ergodox/infinity/drivers/gdisp/IS31FL3731C/gdisp_IS31FL3731C.c @@ -25,6 +25,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "board_IS31FL3731C.h" + +// Can't include led_tables from here +extern const uint8_t CIE1931_CURVE[]; + /*===========================================================================*/ /* Driver local definitions. */ /*===========================================================================*/ @@ -100,37 +104,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define IS31 -//Generated by http://jared.geek.nz/2013/feb/linear-led-pwm -const unsigned char cie[256] = { - 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, - 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, - 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, - 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, - 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, - 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, - 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, - 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, - 28, 28, 29, 29, 30, 31, 31, 32, 32, 33, - 34, 34, 35, 36, 37, 37, 38, 39, 39, 40, - 41, 42, 43, 43, 44, 45, 46, 47, 47, 48, - 49, 50, 51, 52, 53, 54, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 70, 71, 72, 73, 74, 75, 76, 77, 79, - 80, 81, 82, 83, 85, 86, 87, 88, 90, 91, - 92, 94, 95, 96, 98, 99, 100, 102, 103, 105, - 106, 108, 109, 110, 112, 113, 115, 116, 118, 120, - 121, 123, 124, 126, 128, 129, 131, 132, 134, 136, - 138, 139, 141, 143, 145, 146, 148, 150, 152, 154, - 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, - 175, 177, 179, 181, 183, 185, 187, 189, 191, 193, - 196, 198, 200, 202, 204, 207, 209, 211, 214, 216, - 218, 220, 223, 225, 228, 230, 232, 235, 237, 240, - 242, 245, 247, 250, 252, 255, -}; - - /*===========================================================================*/ /* Driver local functions. */ /*===========================================================================*/ @@ -231,7 +204,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { uint8_t* src = PRIV(g)->frame_buffer; for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) { for (int x=0;x<GDISP_SCREEN_WIDTH;x++) { - PRIV(g)->write_buffer[get_led_address(g, x, y)]=cie[*src]; + PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[*src]; ++src; } } diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/board_ST7565.h b/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/board_ST7565.h index 290571ce5b..9650ffb440 100644 --- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/board_ST7565.h +++ b/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/board_ST7565.h @@ -8,8 +8,6 @@ #ifndef _GDISP_LLD_BOARD_H #define _GDISP_LLD_BOARD_H -#include "print.h" - #define ST7565_LCD_BIAS ST7565_LCD_BIAS_9 // actually 6 #define ST7565_ADC ST7565_ADC_NORMAL #define ST7565_COM_SCAN ST7565_COM_SCAN_DEC @@ -39,35 +37,49 @@ // MSB First // CLK Low by default static const SPIConfig spi1config = { - NULL, - /* HW dependent part.*/ - ST7565_GPIOPORT, - ST7565_SS_PIN, - SPIx_CTARn_FMSZ(7) - | SPIx_CTARn_ASC(7) - | SPIx_CTARn_DT(7) - | SPIx_CTARn_CSSCK(7) - | SPIx_CTARn_PBR(0) - | SPIx_CTARn_BR(7) - //SPI_CR1_BR_0 + // Operation complete callback or @p NULL. + .end_cb = NULL, + //The chip select line port - when not using pcs. + .ssport = ST7565_GPIOPORT, + // brief The chip select line pad number - when not using pcs. + .sspad=ST7565_SS_PIN, + // SPI initialization data. + .tar0 = + SPIx_CTARn_FMSZ(7) // Frame size = 8 bytes + | SPIx_CTARn_ASC(1) // After SCK Delay Scaler (min 50 ns) = 55.56ns + | SPIx_CTARn_DT(0) // Delay After Transfer Scaler (no minimum)= 27.78ns + | SPIx_CTARn_CSSCK(0) // PCS to SCK Delay Scaler (min 20 ns) = 27.78ns + | SPIx_CTARn_PBR(0) // Baud Rate Prescaler = 2 + | SPIx_CTARn_BR(0) // Baud rate (min 50ns) = 55.56ns }; -static bool_t st7565_is_data_mode = 1; +static GFXINLINE void acquire_bus(GDisplay *g) { + (void) g; + // Only the LCD is using the SPI bus, so no need to acquire + // spiAcquireBus(&SPID1); + spiSelect(&SPID1); +} + +static GFXINLINE void release_bus(GDisplay *g) { + (void) g; + // Only the LCD is using the SPI bus, so no need to release + //spiReleaseBus(&SPID1); + spiUnselect(&SPID1); +} static GFXINLINE void init_board(GDisplay *g) { (void) g; palSetPadModeNamed(A0, PAL_MODE_OUTPUT_PUSHPULL); palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN); - st7565_is_data_mode = 1; palSetPadModeNamed(RST, PAL_MODE_OUTPUT_PUSHPULL); palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN); palSetPadModeRaw(MOSI, ST7565_SPI_MODE); palSetPadModeRaw(SLCK, ST7565_SPI_MODE); - palSetPadModeRaw(SS, ST7565_SPI_MODE); + palSetPadModeNamed(SS, PAL_MODE_OUTPUT_PUSHPULL); spiInit(); spiStart(&SPID1, &spi1config); - spiSelect(&SPID1); + release_bus(g); } static GFXINLINE void post_init_board(GDisplay *g) { @@ -84,43 +96,17 @@ static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) { } } -static GFXINLINE void acquire_bus(GDisplay *g) { - (void) g; - // Only the LCD is using the SPI bus, so no need to acquire - // spiAcquireBus(&SPID1); +static GFXINLINE void enter_data_mode(GDisplay *g) { + palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN); } -static GFXINLINE void release_bus(GDisplay *g) { - (void) g; - // Only the LCD is using the SPI bus, so no need to release - //spiReleaseBus(&SPID1); +static GFXINLINE void enter_cmd_mode(GDisplay *g) { + palClearPad(ST7565_GPIOPORT, ST7565_A0_PIN); } -static GFXINLINE void write_cmd(GDisplay *g, uint8_t cmd) { - (void) g; - if (st7565_is_data_mode) { - // The sleeps need to be at lest 10 vs 25 ns respectively - // So let's sleep two ticks, one tick might not be enough - // if we are at the end of the tick - chThdSleep(2); - palClearPad(ST7565_GPIOPORT, ST7565_A0_PIN); - chThdSleep(2); - st7565_is_data_mode = 0; - } - spiSend(&SPID1, 1, &cmd); -} static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) { (void) g; - if (!st7565_is_data_mode) { - // The sleeps need to be at lest 10 vs 25 ns respectively - // So let's sleep two ticks, one tick might not be enough - // if we are at the end of the tick - chThdSleep(2); - palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN); - chThdSleep(2); - st7565_is_data_mode = 1; - } spiSend(&SPID1, length, data); } diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c b/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c index c33aea81a8..b04ad02935 100644 --- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c +++ b/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_ST7565.c @@ -20,16 +20,16 @@ /*===========================================================================*/ #ifndef GDISP_SCREEN_HEIGHT - #define GDISP_SCREEN_HEIGHT 32 +#define GDISP_SCREEN_HEIGHT 32 #endif #ifndef GDISP_SCREEN_WIDTH - #define GDISP_SCREEN_WIDTH 128 +#define GDISP_SCREEN_WIDTH 128 #endif #ifndef GDISP_INITIAL_CONTRAST - #define GDISP_INITIAL_CONTRAST 0 +#define GDISP_INITIAL_CONTRAST 35 #endif #ifndef GDISP_INITIAL_BACKLIGHT - #define GDISP_INITIAL_BACKLIGHT 100 +#define GDISP_INITIAL_BACKLIGHT 100 #endif #define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0) @@ -40,16 +40,16 @@ /* Driver config defaults for backward compatibility. */ /*===========================================================================*/ #ifndef ST7565_LCD_BIAS - #define ST7565_LCD_BIAS ST7565_LCD_BIAS_7 +#define ST7565_LCD_BIAS ST7565_LCD_BIAS_7 #endif #ifndef ST7565_ADC - #define ST7565_ADC ST7565_ADC_NORMAL +#define ST7565_ADC ST7565_ADC_NORMAL #endif #ifndef ST7565_COM_SCAN - #define ST7565_COM_SCAN ST7565_COM_SCAN_INC +#define ST7565_COM_SCAN ST7565_COM_SCAN_INC #endif #ifndef ST7565_PAGE_ORDER - #define ST7565_PAGE_ORDER 0,1,2,3 +#define ST7565_PAGE_ORDER 0,1,2,3 #endif /*===========================================================================*/ @@ -58,12 +58,24 @@ typedef struct{ bool_t buffer2; + uint8_t data_pos; + uint8_t data[16]; uint8_t ram[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8]; }PrivData; // Some common routines and macros #define PRIV(g) ((PrivData*)g->priv) #define RAM(g) (PRIV(g)->ram) + +static GFXINLINE void write_cmd(GDisplay* g, uint8_t cmd) { + PRIV(g)->data[PRIV(g)->data_pos++] = cmd; +} + +static GFXINLINE void flush_cmd(GDisplay* g) { + write_data(g, PRIV(g)->data, PRIV(g)->data_pos); + PRIV(g)->data_pos = 0; +} + #define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); } #define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); } @@ -86,207 +98,232 @@ typedef struct{ */ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { - // The private area is the display surface. - g->priv = gfxAlloc(sizeof(PrivData)); - PRIV(g)->buffer2 = false; - - // Initialise the board interface - init_board(g); - - // Hardware reset - setpin_reset(g, TRUE); - gfxSleepMilliseconds(20); - setpin_reset(g, FALSE); - gfxSleepMilliseconds(20); - - acquire_bus(g); - write_cmd(g, ST7565_DISPLAY_OFF); - write_cmd(g, ST7565_LCD_BIAS); + // The private area is the display surface. + g->priv = gfxAlloc(sizeof(PrivData)); + PRIV(g)->buffer2 = false; + PRIV(g)->data_pos = 0; + + // Initialise the board interface + init_board(g); + + // Hardware reset + setpin_reset(g, TRUE); + gfxSleepMilliseconds(20); + setpin_reset(g, FALSE); + gfxSleepMilliseconds(20); + acquire_bus(g); + enter_cmd_mode(g); + + write_cmd(g, ST7565_RESET); + write_cmd(g, ST7565_LCD_BIAS); write_cmd(g, ST7565_ADC); write_cmd(g, ST7565_COM_SCAN); - - write_cmd(g, ST7565_START_LINE | 0); - - write_cmd(g, ST7565_RESISTOR_RATIO | 0x6); - - // turn on voltage converter (VC=1, VR=0, VF=0) - write_cmd(g, ST7565_POWER_CONTROL | 0x04); - delay_ms(50); - // turn on voltage regulator (VC=1, VR=1, VF=0) - write_cmd(g, ST7565_POWER_CONTROL | 0x06); - delay_ms(50); + write_cmd(g, ST7565_RESISTOR_RATIO | 0x1); + write_cmd2(g, ST7565_CONTRAST, GDISP_INITIAL_CONTRAST); - // turn on voltage follower (VC=1, VR=1, VF=1) - write_cmd(g, ST7565_POWER_CONTROL | 0x07); - delay_ms(50); + // turn on internal power supply (VC=1, VR=1, VF=1) + write_cmd(g, ST7565_POWER_CONTROL | 0x07); - write_cmd(g, 0xE2); - write_cmd(g, ST7565_COM_SCAN); - write_cmd2(g, ST7565_CONTRAST, GDISP_INITIAL_CONTRAST*64/101); - //write_cmd2(g, ST7565_CONTRAST, 0); - write_cmd(g, ST7565_DISPLAY_ON); - write_cmd(g, ST7565_ALLON_NORMAL); - write_cmd(g, ST7565_INVERT_DISPLAY); + write_cmd(g, ST7565_INVERT_DISPLAY); + write_cmd(g, ST7565_ALLON_NORMAL); - write_cmd(g, ST7565_RMW); + write_cmd(g, ST7565_START_LINE | 0); + write_cmd(g, ST7565_RMW); + flush_cmd(g); // Finish Init post_init_board(g); - // Release the bus - release_bus(g); - - /* Initialise the GDISP structure */ - g->g.Width = GDISP_SCREEN_WIDTH; - g->g.Height = GDISP_SCREEN_HEIGHT; - g->g.Orientation = GDISP_ROTATE_0; - g->g.Powermode = powerOn; - g->g.Backlight = GDISP_INITIAL_BACKLIGHT; - g->g.Contrast = GDISP_INITIAL_CONTRAST; - return TRUE; + // Release the bus + release_bus(g); + + /* Initialise the GDISP structure */ + g->g.Width = GDISP_SCREEN_WIDTH; + g->g.Height = GDISP_SCREEN_HEIGHT; + g->g.Orientation = GDISP_ROTATE_0; + g->g.Powermode = powerOff; + g->g.Backlight = GDISP_INITIAL_BACKLIGHT; + g->g.Contrast = GDISP_INITIAL_CONTRAST; + return TRUE; } #if GDISP_HARDWARE_FLUSH - LLDSPEC void gdisp_lld_flush(GDisplay *g) { - unsigned p; - - // Don't flush if we don't need it. - if (!(g->flags & GDISP_FLG_NEEDFLUSH)) - return; - - acquire_bus(g); - unsigned dstOffset = (PRIV(g)->buffer2 ? 4 : 0); - for (p = 0; p < 4; p++) { - write_cmd(g, ST7565_PAGE | (p + dstOffset)); - write_cmd(g, ST7565_COLUMN_MSB | 0); - write_cmd(g, ST7565_COLUMN_LSB | 0); - write_cmd(g, ST7565_RMW); - write_data(g, RAM(g) + (p*GDISP_SCREEN_WIDTH), GDISP_SCREEN_WIDTH); - } - unsigned line = (PRIV(g)->buffer2 ? 32 : 0); - write_cmd(g, ST7565_START_LINE | line); - PRIV(g)->buffer2 = !PRIV(g)->buffer2; - release_bus(g); - - g->flags &= ~GDISP_FLG_NEEDFLUSH; - } +LLDSPEC void gdisp_lld_flush(GDisplay *g) { + unsigned p; + + // Don't flush if we don't need it. + if (!(g->flags & GDISP_FLG_NEEDFLUSH)) + return; + + acquire_bus(g); + enter_cmd_mode(g); + unsigned dstOffset = (PRIV(g)->buffer2 ? 4 : 0); + for (p = 0; p < 4; p++) { + write_cmd(g, ST7565_PAGE | (p + dstOffset)); + write_cmd(g, ST7565_COLUMN_MSB | 0); + write_cmd(g, ST7565_COLUMN_LSB | 0); + write_cmd(g, ST7565_RMW); + flush_cmd(g); + enter_data_mode(g); + write_data(g, RAM(g) + (p*GDISP_SCREEN_WIDTH), GDISP_SCREEN_WIDTH); + enter_cmd_mode(g); + } + unsigned line = (PRIV(g)->buffer2 ? 32 : 0); + write_cmd(g, ST7565_START_LINE | line); + flush_cmd(g); + PRIV(g)->buffer2 = !PRIV(g)->buffer2; + release_bus(g); + + g->flags &= ~GDISP_FLG_NEEDFLUSH; +} #endif #if GDISP_HARDWARE_DRAWPIXEL - LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { - coord_t x, y; - - switch(g->g.Orientation) { - default: - case GDISP_ROTATE_0: - x = g->p.x; - y = g->p.y; - break; - case GDISP_ROTATE_90: - x = g->p.y; - y = GDISP_SCREEN_HEIGHT-1 - g->p.x; - break; - case GDISP_ROTATE_180: - x = GDISP_SCREEN_WIDTH-1 - g->p.x; - y = GDISP_SCREEN_HEIGHT-1 - g->p.y; - break; - case GDISP_ROTATE_270: - x = GDISP_SCREEN_HEIGHT-1 - g->p.y; - y = g->p.x; - break; - } - if (gdispColor2Native(g->p.color) != Black) - RAM(g)[xyaddr(x, y)] |= xybit(y); - else - RAM(g)[xyaddr(x, y)] &= ~xybit(y); - g->flags |= GDISP_FLG_NEEDFLUSH; - } +LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { + coord_t x, y; + + switch(g->g.Orientation) { + default: + case GDISP_ROTATE_0: + x = g->p.x; + y = g->p.y; + break; + case GDISP_ROTATE_90: + x = g->p.y; + y = GDISP_SCREEN_HEIGHT-1 - g->p.x; + break; + case GDISP_ROTATE_180: + x = GDISP_SCREEN_WIDTH-1 - g->p.x; + y = GDISP_SCREEN_HEIGHT-1 - g->p.y; + break; + case GDISP_ROTATE_270: + x = GDISP_SCREEN_HEIGHT-1 - g->p.y; + y = g->p.x; + break; + } + if (gdispColor2Native(g->p.color) != Black) + RAM(g)[xyaddr(x, y)] |= xybit(y); + else + RAM(g)[xyaddr(x, y)] &= ~xybit(y); + g->flags |= GDISP_FLG_NEEDFLUSH; +} #endif #if GDISP_HARDWARE_PIXELREAD - LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { - coord_t x, y; - - switch(g->g.Orientation) { - default: - case GDISP_ROTATE_0: - x = g->p.x; - y = g->p.y; - break; - case GDISP_ROTATE_90: - x = g->p.y; - y = GDISP_SCREEN_HEIGHT-1 - g->p.x; - break; - case GDISP_ROTATE_180: - x = GDISP_SCREEN_WIDTH-1 - g->p.x; - y = GDISP_SCREEN_HEIGHT-1 - g->p.y; - break; - case GDISP_ROTATE_270: - x = GDISP_SCREEN_HEIGHT-1 - g->p.y; - y = g->p.x; - break; - } - return (RAM(g)[xyaddr(x, y)] & xybit(y)) ? White : Black; - } +LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) { + coord_t x, y; + + switch(g->g.Orientation) { + default: + case GDISP_ROTATE_0: + x = g->p.x; + y = g->p.y; + break; + case GDISP_ROTATE_90: + x = g->p.y; + y = GDISP_SCREEN_HEIGHT-1 - g->p.x; + break; + case GDISP_ROTATE_180: + x = GDISP_SCREEN_WIDTH-1 - g->p.x; + y = GDISP_SCREEN_HEIGHT-1 - g->p.y; + break; + case GDISP_ROTATE_270: + x = GDISP_SCREEN_HEIGHT-1 - g->p.y; + y = g->p.x; + break; + } + return (RAM(g)[xyaddr(x, y)] & xybit(y)) ? White : Black; +} #endif +LLDSPEC void gdisp_lld_blit_area(GDisplay *g) { + uint8_t* buffer = (uint8_t*)g->p.ptr; + int linelength = g->p.cx; + for (int i = 0; i < g->p.cy; i++) { + unsigned dstx = g->p.x; + unsigned dsty = g->p.y + i; + unsigned srcx = g->p.x1; + unsigned srcy = g->p.y1 + i; + unsigned srcbit = srcy * g->p.x2 + srcx; + for(int j=0; j < linelength; j++) { + uint8_t src = buffer[srcbit / 8]; + uint8_t bit = 7-(srcbit % 8); + uint8_t bitset = (src >> bit) & 1; + uint8_t* dst = &(RAM(g)[xyaddr(dstx, dsty)]); + if (bitset) { + *dst |= xybit(dsty); + } + else { + *dst &= ~xybit(dsty); + } + dstx++; + srcbit++; + } + } + g->flags |= GDISP_FLG_NEEDFLUSH; +} + #if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL - LLDSPEC void gdisp_lld_control(GDisplay *g) { - switch(g->p.x) { - case GDISP_CONTROL_POWER: - if (g->g.Powermode == (powermode_t)g->p.ptr) - return; - switch((powermode_t)g->p.ptr) { - case powerOff: - case powerSleep: - case powerDeepSleep: - acquire_bus(g); - write_cmd(g, ST7565_DISPLAY_OFF); - release_bus(g); - break; - case powerOn: - acquire_bus(g); - write_cmd(g, ST7565_DISPLAY_ON); - release_bus(g); - break; - default: - return; - } - g->g.Powermode = (powermode_t)g->p.ptr; - return; - - case GDISP_CONTROL_ORIENTATION: - if (g->g.Orientation == (orientation_t)g->p.ptr) - return; - switch((orientation_t)g->p.ptr) { - /* Rotation is handled by the drawing routines */ - case GDISP_ROTATE_0: - case GDISP_ROTATE_180: - g->g.Height = GDISP_SCREEN_HEIGHT; - g->g.Width = GDISP_SCREEN_WIDTH; - break; - case GDISP_ROTATE_90: - case GDISP_ROTATE_270: - g->g.Height = GDISP_SCREEN_WIDTH; - g->g.Width = GDISP_SCREEN_HEIGHT; - break; - default: - return; - } - g->g.Orientation = (orientation_t)g->p.ptr; - return; - - case GDISP_CONTROL_CONTRAST: - if ((unsigned)g->p.ptr > 100) - g->p.ptr = (void *)100; - acquire_bus(g); - write_cmd2(g, ST7565_CONTRAST, ((((unsigned)g->p.ptr)<<6)/101) & 0x3F); - release_bus(g); - g->g.Contrast = (unsigned)g->p.ptr; - return; - } - } +LLDSPEC void gdisp_lld_control(GDisplay *g) { + switch(g->p.x) { + case GDISP_CONTROL_POWER: + if (g->g.Powermode == (powermode_t)g->p.ptr) + return; + switch((powermode_t)g->p.ptr) { + case powerOff: + case powerSleep: + case powerDeepSleep: + acquire_bus(g); + enter_cmd_mode(g); + write_cmd(g, ST7565_DISPLAY_OFF); + flush_cmd(g); + release_bus(g); + break; + case powerOn: + acquire_bus(g); + enter_cmd_mode(g); + write_cmd(g, ST7565_DISPLAY_ON); + flush_cmd(g); + release_bus(g); + break; + default: + return; + } + g->g.Powermode = (powermode_t)g->p.ptr; + return; + + case GDISP_CONTROL_ORIENTATION: + if (g->g.Orientation == (orientation_t)g->p.ptr) + return; + switch((orientation_t)g->p.ptr) { + /* Rotation is handled by the drawing routines */ + case GDISP_ROTATE_0: + case GDISP_ROTATE_180: + g->g.Height = GDISP_SCREEN_HEIGHT; + g->g.Width = GDISP_SCREEN_WIDTH; + break; + case GDISP_ROTATE_90: + case GDISP_ROTATE_270: + g->g.Height = GDISP_SCREEN_WIDTH; + g->g.Width = GDISP_SCREEN_HEIGHT; + break; + default: + return; + } + g->g.Orientation = (orientation_t)g->p.ptr; + return; + + case GDISP_CONTROL_CONTRAST: + g->g.Contrast = (unsigned)g->p.ptr & 63; + acquire_bus(g); + enter_cmd_mode(g); + write_cmd2(g, ST7565_CONTRAST, g->g.Contrast); + flush_cmd(g); + release_bus(g); + return; + } +} #endif // GDISP_NEED_CONTROL #endif // GFX_USE_GDISP diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_config.h b/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_config.h index 48587b9e14..2b66a877c8 100644 --- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_config.h +++ b/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/gdisp_lld_config.h @@ -14,12 +14,13 @@ /* Driver hardware support. */ /*===========================================================================*/ -#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing -#define GDISP_HARDWARE_DRAWPIXEL TRUE -#define GDISP_HARDWARE_PIXELREAD TRUE -#define GDISP_HARDWARE_CONTROL TRUE +#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing +#define GDISP_HARDWARE_DRAWPIXEL TRUE +#define GDISP_HARDWARE_PIXELREAD TRUE +#define GDISP_HARDWARE_CONTROL TRUE +#define GDISP_HARDWARE_BITFILLS TRUE -#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO +#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO #endif /* GFX_USE_GDISP */ diff --git a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/st7565.h b/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/st7565.h index 48636b33d6..24924ff050 100644 --- a/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/st7565.h +++ b/keyboards/ergodox/infinity/drivers/gdisp/st7565ergodox/st7565.h @@ -34,4 +34,6 @@ #define ST7565_RESISTOR_RATIO 0x20 #define ST7565_POWER_CONTROL 0x28 +#define ST7565_RESET 0xE2 + #endif /* _ST7565_H */ diff --git a/keyboards/ergodox/infinity/gfxconf.h b/keyboards/ergodox/infinity/gfxconf.h index 8caa577b73..45b9f58580 100644 --- a/keyboards/ergodox/infinity/gfxconf.h +++ b/keyboards/ergodox/infinity/gfxconf.h @@ -143,7 +143,7 @@ #define GDISP_HARDWARE_DRAWPIXEL TRUE #define GDISP_HARDWARE_CLEARS FALSE #define GDISP_HARDWARE_FILLS FALSE - #define GDISP_HARDWARE_BITFILLS FALSE + //#define GDISP_HARDWARE_BITFILLS FALSE #define GDISP_HARDWARE_SCROLL FALSE #define GDISP_HARDWARE_PIXELREAD TRUE #define GDISP_HARDWARE_CONTROL TRUE diff --git a/keyboards/ergodox/infinity/infinity.c b/keyboards/ergodox/infinity/infinity.c index 02db67eaf2..62259ed3f6 100644 --- a/keyboards/ergodox/infinity/infinity.c +++ b/keyboards/ergodox/infinity/infinity.c @@ -70,10 +70,33 @@ void lcd_backlight_hal_init(void) { RGB_PORT->PCR[BLUE_PIN] = RGB_MODE; } +static uint16_t cie_lightness(uint16_t v) { + // The CIE 1931 formula for lightness + // Y = luminance (output) 0-1 + // L = lightness input 0 - 100 + + // Y = (L* / 902.3) if L* <= 8 + // Y = ((L* + 16) / 116)^3 if L* > 8 + + float l = 100.0f * (v / 65535.0f); + float y = 0.0f; + if (l <= 8.0f) { + y = l / 902.3; + } + else { + y = ((l + 16.0f) / 116.0f); + y = y * y * y; + if (y > 1.0f) { + y = 1.0f; + } + } + return y * 65535.0f; +} + void lcd_backlight_hal_color(uint16_t r, uint16_t g, uint16_t b) { - CHANNEL_RED.CnV = r; - CHANNEL_GREEN.CnV = g; - CHANNEL_BLUE.CnV = b; + CHANNEL_RED.CnV = cie_lightness(r); + CHANNEL_GREEN.CnV = cie_lightness(g); + CHANNEL_BLUE.CnV = cie_lightness(b); } __attribute__ ((weak)) @@ -103,34 +126,48 @@ void matrix_scan_kb(void) { matrix_scan_user(); } +__attribute__ ((weak)) void ergodox_board_led_on(void){ } +__attribute__ ((weak)) void ergodox_right_led_1_on(void){ } +__attribute__ ((weak)) void ergodox_right_led_2_on(void){ } +__attribute__ ((weak)) void ergodox_right_led_3_on(void){ } -void ergodox_right_led_on(uint8_t led){ -} - +__attribute__ ((weak)) void ergodox_board_led_off(void){ } +__attribute__ ((weak)) void ergodox_right_led_1_off(void){ } +__attribute__ ((weak)) void ergodox_right_led_2_off(void){ } +__attribute__ ((weak)) void ergodox_right_led_3_off(void){ } -void ergodox_right_led_off(uint8_t led){ +__attribute__ ((weak)) +void ergodox_right_led_1_set(uint8_t n) { +} + +__attribute__ ((weak)) +void ergodox_right_led_2_set(uint8_t n) { +} + +__attribute__ ((weak)) +void ergodox_right_led_3_set(uint8_t n) { } #ifdef ONEHAND_ENABLE diff --git a/keyboards/ergodox/infinity/infinity.h b/keyboards/ergodox/infinity/infinity.h index fec9e565cd..73a0f4bf70 100644 --- a/keyboards/ergodox/infinity/infinity.h +++ b/keyboards/ergodox/infinity/infinity.h @@ -7,13 +7,38 @@ void ergodox_board_led_on(void); void ergodox_right_led_1_on(void); void ergodox_right_led_2_on(void); void ergodox_right_led_3_on(void); -void ergodox_right_led_on(uint8_t led); + +inline void ergodox_right_led_on(uint8_t led) { + switch (led) { + case 0: + ergodox_right_led_1_on(); + break; + case 1: + ergodox_right_led_2_on(); + break; + case 2: + ergodox_right_led_3_on(); + break; + } +} void ergodox_board_led_off(void); void ergodox_right_led_1_off(void); void ergodox_right_led_2_off(void); void ergodox_right_led_3_off(void); -void ergodox_right_led_off(uint8_t led); +inline void ergodox_right_led_off(uint8_t led) { + switch (led) { + case 0: + ergodox_right_led_1_off(); + break; + case 1: + ergodox_right_led_2_off(); + break; + case 2: + ergodox_right_led_3_off(); + break; + } +} inline void ergodox_led_all_on(void) { @@ -31,36 +56,22 @@ inline void ergodox_led_all_off(void) ergodox_right_led_3_off(); } -inline void ergodox_right_led_1_set(uint8_t n){ - if (n) { - ergodox_right_led_1_on(); - } else { - ergodox_right_led_1_off(); - } -} - -inline void ergodox_right_led_2_set(uint8_t n){ - if (n) { - ergodox_right_led_2_on(); - } else { - ergodox_right_led_2_off(); - } -} - -inline void ergodox_right_led_3_set(uint8_t n){ - if (n) { - ergodox_right_led_3_on(); - } else { - ergodox_right_led_3_off(); - } -} +void ergodox_right_led_1_set(uint8_t n); +void ergodox_right_led_2_set(uint8_t n); +void ergodox_right_led_3_set(uint8_t n); inline void ergodox_right_led_set(uint8_t led, uint8_t n){ - if (n) { - ergodox_right_led_on(led); - } else { - ergodox_right_led_off(led); - } + switch (led) { + case 0: + ergodox_right_led_1_set(n); + break; + case 1: + ergodox_right_led_2_set(n); + break; + case 2: + ergodox_right_led_3_set(n); + break; + } } inline void ergodox_led_all_set(uint8_t n) { diff --git a/keyboards/ergodox/infinity/matrix.c b/keyboards/ergodox/infinity/matrix.c index 1fda904849..3364f8c905 100644 --- a/keyboards/ergodox/infinity/matrix.c +++ b/keyboards/ergodox/infinity/matrix.c @@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "print.h" #include "debug.h" #include "matrix.h" +#include "serial_link/system/serial_link.h" /* diff --git a/keyboards/ergodox/infinity/rules.mk b/keyboards/ergodox/infinity/rules.mk index 473a6dfec6..9e6170d89a 100644 --- a/keyboards/ergodox/infinity/rules.mk +++ b/keyboards/ergodox/infinity/rules.mk @@ -1,6 +1,7 @@ # project specific files SRC = matrix.c \ - led.c + led.c \ + animations.c ## chip/board settings # - the next two should match the directories in @@ -59,21 +60,17 @@ OPT_DEFS += -DCORTEX_VTOR_INIT=0x00002000 # CUSTOM_MATRIX ?= yes # Custom matrix file SERIAL_LINK_ENABLE = yes -VISUALIZER_ENABLE ?= no #temporarily disabled to make everything compile +VISUALIZER_ENABLE ?= yes LCD_ENABLE ?= yes -LED_ENABLE ?= yes +LED_ENABLE ?= no LCD_BACKLIGHT_ENABLE ?= yes MIDI_ENABLE = no RGBLIGHT_ENABLE = no -ifndef QUANTUM_DIR - include ../../../Makefile -endif - ifdef LCD_ENABLE include $(SUBPROJECT_PATH)/drivers/gdisp/st7565ergodox/driver.mk endif ifdef LED_ENABLE include $(SUBPROJECT_PATH)/drivers/gdisp/IS31FL3731C/driver.mk -endif +endif
\ No newline at end of file diff --git a/keyboards/ergodox/infinity/simple_visualizer.h b/keyboards/ergodox/infinity/simple_visualizer.h new file mode 100644 index 0000000000..ded8a3222e --- /dev/null +++ b/keyboards/ergodox/infinity/simple_visualizer.h @@ -0,0 +1,123 @@ +/* Copyright 2017 Fred Sundvik + * + * 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 KEYBOARDS_ERGODOX_INFINITY_SIMPLE_VISUALIZER_H_ +#define KEYBOARDS_ERGODOX_INFINITY_SIMPLE_VISUALIZER_H_ + +// Currently we are assuming that both the backlight and LCD are enabled +// But it's entirely possible to write a custom visualizer that use only +// one of them +#ifndef LCD_BACKLIGHT_ENABLE +#error This visualizer needs that LCD backlight is enabled +#endif + +#ifndef LCD_ENABLE +#error This visualizer needs that LCD is enabled +#endif + +#include "visualizer.h" +#include "visualizer_keyframes.h" +#include "lcd_keyframes.h" +#include "lcd_backlight_keyframes.h" +#include "system/serial_link.h" +#include "led.h" +#include "animations.h" + +static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); +static const uint32_t initial_color = LCD_COLOR(0, 0, 0); + +static bool initial_update = true; + +// Feel free to modify the animations below, or even add new ones if needed + +static keyframe_animation_t lcd_layer_display = { + .num_frames = 1, + .loop = false, + .frame_lengths = {gfxMillisecondsToTicks(0)}, + .frame_functions = {lcd_keyframe_display_layer_and_led_states} +}; + +// The color animation animates the LCD color when you change layers +static keyframe_animation_t color_animation = { + .num_frames = 2, + .loop = false, + // Note that there's a 200 ms no-operation frame, + // this prevents the color from changing when activating the layer + // momentarily + .frame_lengths = {gfxMillisecondsToTicks(200), gfxMillisecondsToTicks(500)}, + .frame_functions = {keyframe_no_operation, backlight_keyframe_animate_color}, +}; + +void initialize_user_visualizer(visualizer_state_t* state) { + // The brightness will be dynamically adjustable in the future + // But for now, change it here. + lcd_backlight_brightness(130); + state->current_lcd_color = initial_color; + state->target_lcd_color = logo_background_color; + initial_update = true; + start_keyframe_animation(&default_startup_animation); +} + + +// This function should be implemented by the keymap visualizer +// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing +// that the simple_visualizer assumes that you are updating +// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is +// stopped. This can be done by either double buffering it or by using constant strings +static void get_visualizer_layer_and_color(visualizer_state_t* state); + +void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { + // Add more tests, change the colors and layer texts here + // Usually you want to check the high bits (higher layers first) + // because that's the order layers are processed for keypresses + // You can for check for example: + // state->status.layer + // state->status.default_layer + // state->status.leds (see led.h for available statuses) + + uint32_t prev_color = state->target_lcd_color; + const char* prev_layer_text = state->layer_text; + + get_visualizer_layer_and_color(state); + + if (initial_update || prev_color != state->target_lcd_color) { + start_keyframe_animation(&color_animation); + } + + if (initial_update || prev_layer_text != state->layer_text) { + start_keyframe_animation(&lcd_layer_display); + } + // You can also stop existing animations, and start your custom ones here + // remember that you should normally have only one animation for the LCD + // and one for the background. But you can also combine them if you want. +} + +void user_visualizer_suspend(visualizer_state_t* state) { + state->layer_text = "Suspending..."; + uint8_t hue = LCD_HUE(state->current_lcd_color); + uint8_t sat = LCD_SAT(state->current_lcd_color); + state->target_lcd_color = LCD_COLOR(hue, sat, 0); + start_keyframe_animation(&default_suspend_animation); +} + +void user_visualizer_resume(visualizer_state_t* state) { + state->current_lcd_color = initial_color; + state->target_lcd_color = logo_background_color; + initial_update = true; + start_keyframe_animation(&default_startup_animation); +} + +#endif /* KEYBOARDS_ERGODOX_INFINITY_SIMPLE_VISUALIZER_H_ */ diff --git a/keyboards/ergodox/infinity/visualizer.c b/keyboards/ergodox/infinity/visualizer.c new file mode 100644 index 0000000000..a4b09a34d0 --- /dev/null +++ b/keyboards/ergodox/infinity/visualizer.c @@ -0,0 +1,329 @@ +/* +Copyright 2016 Fred Sundvik <fsundvik@gmail.com> + +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/>. +*/ + +// Currently we are assuming that both the backlight and LCD are enabled +// But it's entirely possible to write a custom visualizer that use only +// one of them +#ifndef LCD_BACKLIGHT_ENABLE +#error This visualizer needs that LCD backlight is enabled +#endif + +#ifndef LCD_ENABLE +#error This visualizer needs that LCD is enabled +#endif + +#include "visualizer.h" +#include "visualizer_keyframes.h" +#include "lcd_keyframes.h" +#include "lcd_backlight_keyframes.h" +#include "system/serial_link.h" +#include "animations.h" + +static const uint32_t logo_background_color = LCD_COLOR(0x00, 0x00, 0xFF); +static const uint32_t initial_color = LCD_COLOR(0, 0, 0); + +static const uint32_t led_emulation_colors[4] = { + LCD_COLOR(0, 0, 0), + LCD_COLOR(255, 255, 255), + LCD_COLOR(84, 255, 255), + LCD_COLOR(168, 255, 255), +}; + +static uint32_t next_led_target_color = 0; + +typedef enum { + LCD_STATE_INITIAL, + LCD_STATE_LAYER_BITMAP, + LCD_STATE_BITMAP_AND_LEDS, +} lcd_state_t; + +static lcd_state_t lcd_state = LCD_STATE_INITIAL; + +typedef struct { + uint8_t led_on; + uint8_t led1; + uint8_t led2; + uint8_t led3; +} visualizer_user_data_t; + +// Don't access from visualization function, use the visualizer state instead +static visualizer_user_data_t user_data_keyboard = { + .led_on = 0, + .led1 = LED_BRIGHTNESS_HI, + .led2 = LED_BRIGHTNESS_HI, + .led3 = LED_BRIGHTNESS_HI, +}; + +_Static_assert(sizeof(visualizer_user_data_t) <= VISUALIZER_USER_DATA_SIZE, + "Please increase the VISUALIZER_USER_DATA_SIZE"); + +// Feel free to modify the animations below, or even add new ones if needed + + +// The color animation animates the LCD color when you change layers +static keyframe_animation_t one_led_color = { + .num_frames = 1, + .loop = false, + .frame_lengths = {gfxMillisecondsToTicks(0)}, + .frame_functions = {backlight_keyframe_set_color}, +}; + +bool swap_led_target_color(keyframe_animation_t* animation, visualizer_state_t* state) { + uint32_t temp = next_led_target_color; + next_led_target_color = state->target_lcd_color; + state->target_lcd_color = temp; + return false; +} + +// The color animation animates the LCD color when you change layers +static keyframe_animation_t two_led_colors = { + .num_frames = 2, + .loop = true, + .frame_lengths = {gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(0)}, + .frame_functions = {backlight_keyframe_set_color, swap_led_target_color}, +}; + +// The LCD animation alternates between the layer name display and a +// bitmap that displays all active layers +static keyframe_animation_t lcd_bitmap_animation = { + .num_frames = 1, + .loop = false, + .frame_lengths = {gfxMillisecondsToTicks(0)}, + .frame_functions = {lcd_keyframe_display_layer_bitmap}, +}; + +static keyframe_animation_t lcd_bitmap_leds_animation = { + .num_frames = 2, + .loop = true, + .frame_lengths = {gfxMillisecondsToTicks(2000), gfxMillisecondsToTicks(2000)}, + .frame_functions = {lcd_keyframe_display_layer_bitmap, lcd_keyframe_display_led_states}, +}; + +void initialize_user_visualizer(visualizer_state_t* state) { + // The brightness will be dynamically adjustable in the future + // But for now, change it here. + lcd_backlight_brightness(130); + state->current_lcd_color = initial_color; + state->target_lcd_color = logo_background_color; + lcd_state = LCD_STATE_INITIAL; + start_keyframe_animation(&default_startup_animation); +} + +inline bool is_led_on(visualizer_user_data_t* user_data, uint8_t num) { + return user_data->led_on & (1u << num); +} + +static uint8_t get_led_index_master(visualizer_user_data_t* user_data) { + for (int i=0; i < 3; i++) { + if (is_led_on(user_data, i)) { + return i + 1; + } + } + return 0; +} + +static uint8_t get_led_index_slave(visualizer_user_data_t* user_data) { + uint8_t master_index = get_led_index_master(user_data); + if (master_index!=0) { + for (int i=master_index; i < 3; i++) { + if (is_led_on(user_data, i)) { + return i + 1; + } + } + } + + return 0; +} + +static uint8_t get_secondary_led_index(visualizer_user_data_t* user_data) { + if (is_led_on(user_data, 0) && + is_led_on(user_data, 1) && + is_led_on(user_data, 2)) { + return 3; + } + return 0; +} + +static uint8_t get_brightness(visualizer_user_data_t* user_data, uint8_t index) { + switch (index) { + case 1: + return user_data->led1; + case 2: + return user_data->led2; + case 3: + return user_data->led3; + } + return 0; +} + +static void update_emulated_leds(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { + visualizer_user_data_t* user_data_new = (visualizer_user_data_t*)state->status.user_data; + visualizer_user_data_t* user_data_old = (visualizer_user_data_t*)prev_status->user_data; + + uint8_t new_index; + uint8_t old_index; + + if (is_serial_link_master()) { + new_index = get_led_index_master(user_data_new); + old_index = get_led_index_master(user_data_old); + } + else { + new_index = get_led_index_slave(user_data_new); + old_index = get_led_index_slave(user_data_old); + } + uint8_t new_secondary_index = get_secondary_led_index(user_data_new); + uint8_t old_secondary_index = get_secondary_led_index(user_data_old); + + uint8_t old_brightness = get_brightness(user_data_old, old_index); + uint8_t new_brightness = get_brightness(user_data_new, new_index); + + uint8_t old_secondary_brightness = get_brightness(user_data_old, old_secondary_index); + uint8_t new_secondary_brightness = get_brightness(user_data_new, new_secondary_index); + + if (lcd_state == LCD_STATE_INITIAL || + new_index != old_index || + new_secondary_index != old_secondary_index || + new_brightness != old_brightness || + new_secondary_brightness != old_secondary_brightness) { + + if (new_secondary_index != 0) { + state->target_lcd_color = change_lcd_color_intensity( + led_emulation_colors[new_index], new_brightness); + next_led_target_color = change_lcd_color_intensity( + led_emulation_colors[new_secondary_index], new_secondary_brightness); + + stop_keyframe_animation(&one_led_color); + start_keyframe_animation(&two_led_colors); + } else { + state->target_lcd_color = change_lcd_color_intensity( + led_emulation_colors[new_index], new_brightness); + stop_keyframe_animation(&two_led_colors); + start_keyframe_animation(&one_led_color); + } + } +} + +static void update_lcd_text(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { + if (state->status.leds) { + if (lcd_state != LCD_STATE_BITMAP_AND_LEDS || + state->status.leds != prev_status->leds || + state->status.layer != prev_status->layer || + state->status.default_layer != prev_status->default_layer) { + + // NOTE: that it doesn't matter if the animation isn't playing, stop will do nothing in that case + stop_keyframe_animation(&lcd_bitmap_animation); + + lcd_state = LCD_STATE_BITMAP_AND_LEDS; + // For information: + // The logic in this function makes sure that this doesn't happen, but if you call start on an + // animation that is already playing it will be restarted. + start_keyframe_animation(&lcd_bitmap_leds_animation); + } + } else { + if (lcd_state != LCD_STATE_LAYER_BITMAP || + state->status.layer != prev_status->layer || + state->status.default_layer != prev_status->default_layer) { + + stop_keyframe_animation(&lcd_bitmap_leds_animation); + + lcd_state = LCD_STATE_LAYER_BITMAP; + start_keyframe_animation(&lcd_bitmap_animation); + } + } +} + +void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status) { + // Check the status here to start and stop animations + // You might have to save some state, like the current animation here so that you can start the right + // This function is called every time the status changes + + // NOTE that this is called from the visualizer thread, so don't access anything else outside the status + // This is also important because the slave won't have access to the active layer for example outside the + // status. + + update_emulated_leds(state, prev_status); + update_lcd_text(state, prev_status); + +} + +void user_visualizer_suspend(visualizer_state_t* state) { + state->layer_text = "Suspending..."; + uint8_t hue = LCD_HUE(state->current_lcd_color); + uint8_t sat = LCD_SAT(state->current_lcd_color); + state->target_lcd_color = LCD_COLOR(hue, sat, 0); + start_keyframe_animation(&default_suspend_animation); +} + +void user_visualizer_resume(visualizer_state_t* state) { + state->current_lcd_color = initial_color; + state->target_lcd_color = logo_background_color; + lcd_state = LCD_STATE_INITIAL; + start_keyframe_animation(&default_startup_animation); +} + +void ergodox_board_led_on(void){ + // No board led support +} + +void ergodox_right_led_1_on(void){ + user_data_keyboard.led_on |= (1u << 0); + visualizer_set_user_data(&user_data_keyboard); +} + +void ergodox_right_led_2_on(void){ + user_data_keyboard.led_on |= (1u << 1); + visualizer_set_user_data(&user_data_keyboard); +} + +void ergodox_right_led_3_on(void){ + user_data_keyboard.led_on |= (1u << 2); + visualizer_set_user_data(&user_data_keyboard); +} + +void ergodox_board_led_off(void){ + // No board led support +} + +void ergodox_right_led_1_off(void){ + user_data_keyboard.led_on &= ~(1u << 0); + visualizer_set_user_data(&user_data_keyboard); +} + +void ergodox_right_led_2_off(void){ + user_data_keyboard.led_on &= ~(1u << 1); + visualizer_set_user_data(&user_data_keyboard); +} + +void ergodox_right_led_3_off(void){ + user_data_keyboard.led_on &= ~(1u << 2); + visualizer_set_user_data(&user_data_keyboard); +} + +void ergodox_right_led_1_set(uint8_t n) { + user_data_keyboard.led1 = n; + visualizer_set_user_data(&user_data_keyboard); +} + +void ergodox_right_led_2_set(uint8_t n) { + user_data_keyboard.led2 = n; + visualizer_set_user_data(&user_data_keyboard); +} + +void ergodox_right_led_3_set(uint8_t n) { + user_data_keyboard.led3 = n; + visualizer_set_user_data(&user_data_keyboard); +} diff --git a/keyboards/ergodox/keymaps/coderkun_neo2/keymap.c b/keyboards/ergodox/keymaps/coderkun_neo2/keymap.c index aaf75d58f2..2d6f76856a 100644 --- a/keyboards/ergodox/keymaps/coderkun_neo2/keymap.c +++ b/keyboards/ergodox/keymaps/coderkun_neo2/keymap.c @@ -22,7 +22,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโโโโโโโค TL2 โ โ TL3 โโโโโโโโโโโโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค * โ LSHFT โ ร โ ร โ ร โ P โ Z โ โ โ โ B โ M โ , โ . โ J โ Shift โ * โโโฌโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโดโโโโโโ โโโโโโโดโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโฌโโ - * โ CTL โ ALT โ MO1 โ Win โ Mod4โ โ Mod4โ Win โ MO1 โ Alt โ CTL โ + * โ CTL โ ALT โ MO1 โ Win โ Mod4โ โ Mod4โ Win โ MO1 โ ALT โ CTL โ * โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ * โ โ โ โ โ โ โ โ โ โ * โโโโโโโผโโโโโโผโโโโโโค โโโโโโโผโโโโโโผโโโโโโ @@ -46,7 +46,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_END, NEO_K, NEO_H, NEO_G, NEO_F, NEO_Q, NEO_SS, NEO_S, NEO_N, NEO_R, NEO_T, NEO_D, NEO_L1_R, TG(PMN), NEO_B, NEO_M, KC_COMM,KC_DOT, NEO_J, KC_RSFT, - NEO_L2_R,KC_RGUI,MO(FMU),KC_RALT,KC_RCTL, + NEO_L2_R,KC_RGUI,MO(FMU),KC_LALT,KC_RCTL, KC_DOWN, KC_RGHT, KC_MINS, MEH_T(KC_NO),KC_ENT,KC_SPC @@ -63,7 +63,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโโโโโโโค(TL2)โ โ(TL3)โโโโโโโโโโโโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค * โ LSHFT โ ร โ Q โ R โ W โ N โ โ โ โ J โ M โ , โ . โ แบ โ Shift โ * โโโฌโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโดโโโโโโ โโโโโโโดโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโฌโโ - * โ CTL โ ALT โ MO1 โ Win โ MO4 โ โ M04 โ Win โ MO1 โ Alt โ CTL โ + * โ CTL โ ALT โ MO1 โ Win โ MO4 โ โ M04 โ Win โ MO1 โ ALT โ CTL โ * โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ * โ โ โ โ โ โ โ โ โ โ * โโโโโโโผโโโโโโผโโโโโโค โโโโโโโผโโโโโโผโโโโโโ @@ -87,7 +87,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_END, DE_B, DE_A, DE_S, DE_G, DE_V, DE_Y, DE_U, DE_MINS,DE_Z, DE_E, DE_X, NEO_L1_R, KC_TRNS, DE_J, DE_M, DE_COMM,DE_DOT, DE_SS, KC_RSFT, - MO(NHL),KC_RGUI,MO(FMU),KC_RALT,KC_RCTL, + MO(NHL),KC_RGUI,MO(FMU),KC_LALT,KC_RCTL, KC_DOWN, KC_RGHT, KC_MINS, MEH_T(KC_NO),KC_ENT,KC_SPC @@ -104,7 +104,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโโโโโโโค(TL2)โ โ(TL3)โโโโโโโโโโโโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค * โ LSHFT โ ร โ ร โ ร โ P โ Z โ โ โ โ B โ M โ , โ . โ J โ Shift โ * โโโฌโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโดโโโโโโ โโโโโโโดโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโฌโโ - * โ CTL โ ALT โ MO1 โ Win โ MO4 โ โ M04 โ Win โ MO1 โ Alt โ CTL โ + * โ CTL โ ALT โ MO1 โ Win โ MO4 โ โ M04 โ Win โ MO1 โ ALT โ CTL โ * โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ * โ โ โ โ โ โ โ โ โ โ * โโโโโโโผโโโโโโผโโโโโโค โโโโโโโผโโโโโโผโโโโโโ @@ -127,7 +127,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_END, DE_K, DE_H, DE_G, DE_F, DE_Q, DE_SS, DE_S, DE_N, DE_R, DE_T, DE_D, KC_NO, KC_TRNS, DE_B, DE_M, KC_COMM,KC_DOT, DE_J, KC_RSFT, - MO(NHL),KC_RGUI,MO(FMU),KC_RALT,KC_RCTL, + MO(NHL),KC_RGUI,MO(FMU),KC_LALT,KC_RCTL, KC_DOWN, KC_RGHT, KC_MINS, MEH_T(KC_NO),KC_ENT,KC_SPC @@ -135,13 +135,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Layer 3: F-keys, Mouse and Unicode * โโโโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโโโ - * โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ + * โ โ F1 โ F2 โ F3 โ F4 โ F5 โ F6 โ โ F7 โ F8 โ F9 โ F10 โ F11 โ F12 โ โ * โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโค โโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค - * โ โ โ โ โฌ โ โ โ โ โ โ โ โ โ โ โ F9 โ F10 โ F11 โ F12 โ โ + * โ โ โ โ โฌ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ * โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโ
โโโโโโค โ โ โโโโโโโโโโโโโ
โโโโโโผโโโโโโผโโโโโโผโโโโโโโโค - * โ โ โ โ โผ โ โค โ โ โ โ โโโโโโโค โโโโโโโค โ F5 โ F6 โ F7 โ F8 โ โ + * โ โ โ โ โผ โ โค โ ใ โ ใ โโโโโโโค โโโโโโโค โ โ โ โ โ โข โ โถ โ โ * โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโโโโโโโค(TL2)โ โ(TL3)โโโโโโโโโโโโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค - * โ โ โ โ โด โ โ โ โ โ โ โ โ โ โ โ F1 โ F2 โ F3 โ F4 โ โ + * โ โ โ โ โด โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ * โโโฌโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโดโโโโโโ โโโโโโโดโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโฌโโ * โ โ โ(MO1)โ โ(MO4)โ โ(MO4)โ โ(MO1)โ โ โ * โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ @@ -154,23 +154,23 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ [FMU] = KEYMAP( // left hand - KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_TRNS, UC(0x250C),UC(0x252C),UC(0x2510),UC(0x2500),UC(0x2502),KC_TRNS, - KC_TRNS, UC(0x251C),UC(0x253C),UC(0x2524),UC(0x2713),UC(0x2715), - KC_TRNS, UC(0x2514),UC(0x2534),UC(0x2518),UC(0x2194),UC(0x21D4),KC_TRNS, - KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_MS_L, KC_MS_U, + KC_TRNS, UC(0x251C),UC(0x253C),UC(0x2524),UC(0x3008),UC(0x3009), + KC_TRNS, UC(0x2514),UC(0x2534),UC(0x2518),KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_MS_L, KC_MS_U, KC_BTN1, - KC_TRNS,KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, // right hand - KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, - KC_TRNS, KC_TRNS,KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, - KC_TRNS,KC_F5, KC_F6, KC_F7, KC_F8, KC_TRNS, - KC_TRNS, KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_TRNS, - KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, + KC_TRNS, UC(0x2194),UC(0x2190),UC(0x2192),UC(0x2191),UC(0x2193),KC_TRNS, + KC_TRNS, UC(0x2713),UC(0x2715),UC(0x2022),UC(0x2236),KC_TRNS, + KC_TRNS, UC(0x21D4),UC(0x21D0),UC(0x21D2),UC(0x21D1),UC(0x21D3),KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_D, KC_MS_R, KC_BTN2, - KC_TRNS, KC_TRNS,KC_TRNS + KC_TRNS, KC_TRNS, KC_TRNS ), /* Layer 4: Neoโs software layer 4 rebuilt in Hardware @@ -294,11 +294,10 @@ void unicode_input_start (void) { // Override method to use NEO_A instead of KC_A uint16_t hex_to_keycode(uint8_t hex) { - if (hex == 0x0) { + if(hex == 0x0) { return KC_0; - } else if (hex < 0xA) { - return KC_1 + (hex - 0x1); - } else { + } + else if(hex >= 0xA) { switch(hex) { case 0xA: return NEO_A; @@ -316,4 +315,6 @@ uint16_t hex_to_keycode(uint8_t hex) return KC_NO; } } + + return KC_1 + (hex - 0x1); } diff --git a/keyboards/ergodox/keymaps/coderkun_neo2/readme.md b/keyboards/ergodox/keymaps/coderkun_neo2/readme.md index 2a4d3a535b..0c9290bf08 100644 --- a/keyboards/ergodox/keymaps/coderkun_neo2/readme.md +++ b/keyboards/ergodox/keymaps/coderkun_neo2/readme.md @@ -4,10 +4,18 @@ The idea of this layout is to use it for [Neo2](http://www.neo-layout.org) but a The main goal of the default layer is to provide a complete symmetric layout with each modifier equally placed for both hands (mirror, of course). -It also features a layer for additional keys like F-keys (F1 โ F12), some mouse keys and (hopefully in the near future) some useful Unicode symbols. +It also features a layer for additional keys like F-keys (F1 โ F12), some mouse keys and some useful Unicode symbols. -## Layers +## Build + + ``` + make clean + make coderkun_neo2 + ``` + + +## Keymap 0. Default layer for Neo2 1. Poor manโs QWERTZ @@ -16,16 +24,106 @@ It also features a layer for additional keys like F-keys (F1 โ F12), some mous 4. Neoโs software layers 4 rebuilt in hardware -## Build +### Layer 0: Default layer for Neo2 -1. Enable Unicode in Makefile + โโโโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโโโ + โ TAB โ 1 โ 2 โ 3 โ 4 โ 5 โ ` โ โ ยด โ 6 โ 7 โ 8 โ 9 โ 0 โ BKSPC โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโค โโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ Y โ X โ V โ L โ C โ W โ HOM โ โ END โ K โ H โ G โ F โ Q โ ร โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโ
โโโโโโค E โ โ โโโโโโโโโโโโโ
โโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ Mod3 โ U โ I โ A โ E โ O โโโโโโโค โโโโโโโค S โ N โ R โ T โ D โ Mod3 โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโโโโโโโค TL2 โ โ TL3 โโโโโโโโโโโโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ LSHFT โ ร โ ร โ ร โ P โ Z โ โ โ โ B โ M โ , โ . โ J โ Shift โ + โโโฌโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโดโโโโโโ โโโโโโโดโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโฌโโ + โ CTL โ ALT โ MO1 โ Win โ Mod4โ โ Mod4โ Win โ MO1 โ Alt โ CTL โ + โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ + โ โ โ โ โ โ โ โ โ โ + โโโโโโโผโโโโโโผโโโโโโค โโโโโโโผโโโโโโผโโโโโโ + โ โ โ โ โ โ โ โ โ โ + โ SPC โ RTN โโโโโโโค โโโโโโโค RTN โ SPC โ + โ โ โ HYP โ โ MEH โ โ โ + โโโโโโโดโโโโโโดโโโโโโ โโโโโโโดโโโโโโดโโโโโโ - ``` - UNICODE_ENABLE = yes - ``` -2. Build as usual - ``` - make clean - make KEYMAP=coderkun_neo2 - ``` +### Layer 1: Poor manโs QWERTZ + + โโโโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโโโ + โ TAB โ 1 โ 2 โ 3 โ 4 โ 5 โ ` โ โ ยด โ 6 โ 7 โ 8 โ 9 โ 0 โ BKSPC โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโค โโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ C โ P โ T โ F โ K โ L โ HOM โ โ END โ B โ A โ S โ G โ V โ Y โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโ
โโโโโโค E โ โ โโโโโโโโโโโโโ
โโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ Mod3 โ D โ H โ ร โ O โ I โโโโโโโค โโโโโโโค U โ - โ Z โ E โ X โ Mod3 โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโโโโโโโค(TL2)โ โ(TL3)โโโโโโโโโโโโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ LSHFT โ ร โ Q โ R โ W โ N โ โ โ โ J โ M โ , โ . โ แบ โ Shift โ + โโโฌโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโดโโโโโโ โโโโโโโดโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโฌโโ + โ CTL โ ALT โ MO1 โ Win โ MO4 โ โ M04 โ Win โ MO1 โ Alt โ CTL โ + โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ + โ โ โ โ โ โ โ โ โ โ + โโโโโโโผโโโโโโผโโโโโโค โโโโโโโผโโโโโโผโโโโโโ + โ โ โ โ โ โ โ โ โ โ + โ SPC โ RTN โโโโโโโค โโโโโโโค RTN โ SPC โ + โ โ โ HYP โ โ MEH โ โ โ + โโโโโโโดโโโโโโดโโโโโโ โโโโโโโดโโโโโโดโโโโโโ + + +### Layer 2: Poor manโs Neo + + โโโโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโโโ + โ TAB โ 1 โ 2 โ 3 โ 4 โ 5 โ ` โ โ ยด โ 6 โ 7 โ 8 โ 9 โ 0 โ BKSPC โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโค โโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ Y โ X โ V โ L โ C โ W โ HOM โ โ END โ K โ H โ G โ F โ Q โ ร โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโ
โโโโโโค E โ โ โโโโโโโโโโโโโ
โโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ Mod3 โ U โ I โ A โ E โ O โโโโโโโค โโโโโโโค S โ N โ R โ T โ D โ Mod3 โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโโโโโโโค(TL2)โ โ(TL3)โโโโโโโโโโโโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ LSHFT โ ร โ ร โ ร โ P โ Z โ โ โ โ B โ M โ , โ . โ J โ Shift โ + โโโฌโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโดโโโโโโ โโโโโโโดโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโฌโโ + โ CTL โ ALT โ MO1 โ Win โ MO4 โ โ M04 โ Win โ MO1 โ Alt โ CTL โ + โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ + โ โ โ โ โ โ โ โ โ โ + โโโโโโโผโโโโโโผโโโโโโค โโโโโโโผโโโโโโผโโโโโโ + โ โ โ โ โ โ โ โ โ โ + โ SPC โ RTN โโโโโโโค โโโโโโโค RTN โ SPC โ + โ โ โ HYP โ โ MEH โ โ โ + โโโโโโโดโโโโโโดโโโโโโ โโโโโโโดโโโโโโดโโโโโโ + + +### Layer 3: F-keys, mouse keys und Unicode symbols + + โโโโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโโโ + โ โ F1 โ F2 โ F3 โ F4 โ F5 โ F6 โ โ F7 โ F8 โ F9 โ F10 โ F11 โ F12 โ โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโค โโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ โ โ โ โฌ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโ
โโโโโโค โ โ โโโโโโโโโโโโโ
โโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ โ โ โ โผ โ โค โ ใ โ ใ โโโโโโโค โโโโโโโค โ โ โ โ โ โข โ โถ โ โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโโโโโโโค(TL2)โ โ(TL3)โโโโโโโโโโโโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ โ โ โ โด โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ + โโโฌโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโดโโโโโโ โโโโโโโดโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโฌโโ + โ โ โ(MO1)โ โ(MO4)โ โ(MO4)โ โ(MO1)โ โ โ + โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ + โ Msโ โ Msโ โ โ Msโ โ Msโ โ + โโโโโโโผโโโโโโผโโโโโโค โโโโโโโผโโโโโโผโโโโโโ + โ โ โ MLC โ โ MRC โ โ โ + โ โ โโโโโโโค โโโโโโโค โ โ + โ โ โ โ โ โ โ โ + โโโโโโโดโโโโโโดโโโโโโ โโโโโโโดโโโโโโดโโโโโโ + + +### Layer 4: Neoโs software layers 4 rebuilt in hardware + + โโโโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโฌโโโโโโโโ + โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโค โโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ โ PgUpโ BSpcโ โ โ Del โ PgDnโ โ โ โ โ 7 โ 8 โ 9 โ + โ โ โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโ
โโโโโโค โ โ โโโโโโโโโโโโโ
โโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ โ Homeโ โ โ โ โ โ โ End โโโโโโโค โโโโโโโค โ 4 โ 5 โ 6 โ , โ . โ + โโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโโโโโโโโโโโค(TL2)โ โ(TL3)โโโโโโโโโโโโโโโโโโโผโโโโโโผโโโโโโผโโโโโโโโค + โ โ Esc โ Tab โ Ins โ Ret โ Undoโ โ โ โ โ 1 โ 2 โ 3 โ โ โ + โโโฌโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโดโโโโโโ โโโโโโโดโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโผโโโโโโฌโโ + โ โ โ(MO1)โ โ(MO4)โ โ(MO4)โ โ(MO1)โ โ โ + โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโฌโโโโโโ โโโโโโโดโโโโโโดโโโโโโดโโโโโโดโโโโโโ + โ โ โ โ โ โ + โโโโโโโผโโโโโโผโโโโโโค โโโโโโโผโโโโโโผโโโโโโ + โ โ โ โ โ โ โ โ + โ โ โโโโโโโค โโโโโโโค โ โ + โ โ โ โ โ โ โ โ + โโโโโโโดโโโโโโดโโโโโโ โโโโโโโดโโโโโโดโโโโโโ diff --git a/keyboards/ergodox/keymaps/default/visualizer.c b/keyboards/ergodox/keymaps/default/visualizer.c new file mode 100644 index 0000000000..502e53f3d1 --- /dev/null +++ b/keyboards/ergodox/keymaps/default/visualizer.c @@ -0,0 +1,42 @@ +/* +Copyright 2017 Fred Sundvik + +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/>. +*/ + +#include "simple_visualizer.h" + +// This function should be implemented by the keymap visualizer +// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing +// that the simple_visualizer assumes that you are updating +// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is +// stopped. This can be done by either double buffering it or by using constant strings +static void get_visualizer_layer_and_color(visualizer_state_t* state) { + uint8_t saturation = 60; + if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) { + saturation = 255; + } + if (state->status.layer & 0x4) { + state->target_lcd_color = LCD_COLOR(0, saturation, 0xFF); + state->layer_text = "Media & Mouse"; + } + else if (state->status.layer & 0x2) { + state->target_lcd_color = LCD_COLOR(168, saturation, 0xFF); + state->layer_text = "Symbol"; + } + else { + state->target_lcd_color = LCD_COLOR(84, saturation, 0xFF); + state->layer_text = "Default"; + } +} diff --git a/keyboards/ergodox/keymaps/dvorak_programmer/keymap.c b/keyboards/ergodox/keymaps/dvorak_programmer/keymap.c index ae4fd444d1..d299d02c34 100644 --- a/keyboards/ergodox/keymaps/dvorak_programmer/keymap.c +++ b/keyboards/ergodox/keymaps/dvorak_programmer/keymap.c @@ -311,12 +311,12 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) break; case SWITCH_NDS: if (record->event.pressed) { - return MACRO( D(LSFT), T(F11), U(LSFT), W(500), D(LALT), T(TAB), U(LALT), END); + return MACRO( D(LSFT), T(F11), U(LSFT), W(255), D(LALT), T(TAB), U(LALT), END); } break; case OPEN_CLOSE_PAREN: if (record->event.pressed) { - return MACRO( D(LSFT), T(LPRN), T(RPRN), U(LSFT), T(LEFT), END); + return MACRO( D(LSFT), T(9), T(0), U(LSFT), T(LEFT), END); } break; case OPEN_CLOSE_BRACKET: @@ -326,7 +326,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) break; case OPEN_CLOSE_CURLY: if (record->event.pressed) { - return MACRO( D(LSFT), T(LCBR), T(RCBR), U(LSFT), T(LEFT), END); + return MACRO( D(LSFT), T(LBRC), T(RBRC), U(LSFT), T(LEFT), END); } break; case OPEN_CLOSE_SINGLE_QUOTE: diff --git a/keyboards/ergodox/keymaps/familiar/README.md b/keyboards/ergodox/keymaps/familiar/README.md new file mode 100644 index 0000000000..e4336d9b55 --- /dev/null +++ b/keyboards/ergodox/keymaps/familiar/README.md @@ -0,0 +1,69 @@ +# ErgoDox Familiar Layout +Familiar layout for those who regularly switch back and forth from ErgoDox to regular QWERTY. + +[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](../../../../license_GPLv3.md../../../../license_GPLv3.md) [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg)](https://github.com/RichardLitt/standard-readme) + +## Table of Contents + +- [Background](#background) +- [Install](#install) +- [Usage](#usage) + - [Layers](#layers) +- [Contribute](#contribute) + - [Issues](#issues) +- [License](#license) + +## Background + +This layout is built to be as familiar as possible for users coming directly from a default (QWERTY US) keyboard, while gaining as much advantage as possible from the ErgoDox and QMK featureset. I use an ErgoDoxEZ at home, but I don't have a regular office (CS grad student) so I regularly use either my laptop or a default-setup lab computer; I context switch daily so this layout is meant to reduce the mental overhead as much as possible. + +The default ErgoDoxEZ layout is probably more optimized as a solo daily driver - as are a lot of the others available keymaps. The focus of this layout is to get as much from the 'Dox as possible without overly disrupting long-established muscle memory. + +Key features of the familiar layout: +1. QWERTY default layout. +1. International symbols layer, mapped in the US-International layout default positions, through [UCIS](https://github.com/qmk/qmk_firmware/wiki/Unicode-and-additional-language-support#ucis_enable). +1. Numpad layer on right hand. +1. Thumb cluster holds spacebar, ALT, and access to secondary layers. +1. Function-layer arrow keys in both the first-person-shooter (actually ESDF instead of WASD) and vim (HJKL) locations. + +## Install + +If you are on Windows or Mac, choose the proper line in [`keymap.c`](keymap.c) for [unicode/international character support](https://github.com/qmk/qmk_firmware/wiki/Unicode-and-additional-language-support#ucis_enable) (starts at line 235). +```c +void matrix_init_user(void) { + set_unicode_input_mode(UC_LNX); // Linux + //set_unicode_input_mode(UC_OSX); // Mac OSX + //set_unicode_input_mode(UC_WIN); // Windows (with registry key, see wiki) + //set_unicode_input_mode(UC_WINC); // Windows (with WinCompose, see wiki) +}; +``` + +For instructions on building and installing this keymap, [go to the wiki](https://github.com/qmk/qmk_firmware/tree/master/keyboards/ergodox#build-dependencies). Below is the command for me; it may be different for you. +```sh +$ make ergodox-ez-familiar-teensy +``` + +## Usage + +[![Familiar Layout](familiar.png)](http://www.keyboard-layout-editor.com/#/gists/13508a9f99cff381d58b7be6f7dcc644) + +### Layers +1. Base Layer: QWERTY, with arrow keys at bottom right. +1. UCIS Layer: US-International symbols layer, plus โ. Accessed by toggling the `INTL` layer using the UCIS key (bottom of left thumb cluster). +1. UCIS-Shifted Layer: Making shift work for UCIS characters. An ugly workaround. Any ideas? Accessed through holding shift while the UCIS layer is active (toggles the `INSF` layer). +1. Numpad Layer: Right hand number pad. Accessed by toggling the `NUMP` layer using the NPAD key (bottom of right thumb cluster). +1. Function Layer: F1-F12, arrows on ESDF and HJKL, media player controls. Accessed by holding either FN key (center key of each thumb cluster), which toggles the `ARRW` layer. I know, I need to work on my naming conventions. + +## Contribute + +[Contributor Covenant](http://contributor-covenant.org/) + +I'm terrible at this; I have no background in human-computer interaction, kinesiology, or keyboard-ology. Please send comments/issues/pull requests/angry tweets/etc. If you think there is a better way to take advantage of the ErgoDox/QMK comination without straying far from 84/101-key QWERTY, I want to know it. + +### Issues +1. The top two keys of the right thumb cluster are currently unused. I wanted them for screen brightness, but I haven't found a solution I like. +1. The `'`, `"`, `[`, and `]` keys are terrible to access; I want to put them somewhere else but I haven't figured out where. +1. The `INSF` layer is an ugly workaround. I should write a function for doing different things in the `INTL` layer depending on whether SHIFT is being held. Or something. Ideas? + +## License +QMK is licensed ([mostly](https://github.com/qmk/qmk_firmware/issues/1038)) under the [GPLv2](blob/master/license_GPLv2.md). Accordingly, to whatever extent applicable, this keymap is licensed under the [GPLv3](../../../../license_GPLv3.md). diff --git a/keyboards/ergodox/keymaps/familiar/familiar.png b/keyboards/ergodox/keymaps/familiar/familiar.png Binary files differnew file mode 100644 index 0000000000..f8b50e75ec --- /dev/null +++ b/keyboards/ergodox/keymaps/familiar/familiar.png diff --git a/keyboards/ergodox/keymaps/familiar/keymap.c b/keyboards/ergodox/keymaps/familiar/keymap.c new file mode 100644 index 0000000000..c5f94afda8 --- /dev/null +++ b/keyboards/ergodox/keymaps/familiar/keymap.c @@ -0,0 +1,267 @@ +#include "ergodox.h" +#include "debug.h" +#include "action_layer.h" +#include "version.h" + +// Layers +#define BASE 0 // default layer +#define INTL 1 // international symbols +#define INSF 2 // international symbols shifted +#define NUMP 3 // numpad +#define ARRW 4 // function, media, arrow keys + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +/* layer 0 : default + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ESC | 1 | 2 | 3 | 4 | 5 | 6 | | 7 | 8 | 9 | 0 | - | = | BCKSPC | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | TAB | Q | W | E | R | T | HOME | | PGUP | Y | U | I | O | P | DELETE | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | ` | A | S | D | F | G |------| |------| H | J | K | L | ; | ENTER | + * |--------+------+------+------+------+------| END | | PGDN |------+------+------+------+------+--------| + * | (/LSFT | Z | X | C | V | B | | | | N | M | , | . | UP | )/RSFT | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | LCTRL | LGUI | MENU | ' | " | | [ | ] | LEFT | DOWN | RIGHT | + * `------------------------------------' `------------------------------------' + * ,-------------. ,-------------. + * | VOL- | VOL+ | | | | + * ,------|------|------| |------+------+------. + * | SPC/ |SLASH/| MUTE | |NUMLCK|WHACK/| SPC/ | + * | ALT | MO(1)|------| |------|MO(1) | ALT | + * | | | LAY3 | | LAY2 | | | + * `--------------------' `--------------------' + */ +[BASE] = KEYMAP( + // left hand + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_HOME, + KC_GRV, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_END, + KC_LCTL, KC_LGUI, KC_MENU, KC_QUOT, S(KC_QUOT), + KC_VOLD, KC_VOLU, + KC_MUTE, + ALT_T(KC_SPC), LT(ARRW,KC_SLSH), TG(INTL), + // right hand + KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_PGUP, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, + KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENTER, + KC_PGDN, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_RSPC, + KC_LBRC, KC_RBRC, KC_LEFT, KC_DOWN, KC_RGHT, + _______, _______, + KC_NLCK, + TG(NUMP), LT(ARRW,KC_BSLS), ALT_T(KC_SPC) + ), + +/* layer 1: International symbols, etc + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ยด | ยก | ยฒ | ยณ | ยค | โฌ | ยผ | | ยฝ | ยพ | โ | โ | ยฅ | ร | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | รค | รฅ | รฉ | ยฎ | รพ | | | | รผ | รบ | รญ | รณ | รถ | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | รก | ร | รฐ | | |------| |------| | | | รธ | ยถ | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * |MO(INSF)| รฆ | | ยฉ | | | | | | รฑ | ยต | รง | | |MO(INSF)| + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | ยฌ | ยฟ | | ยซ | ยป | | | | + * `------------------------------------' `------------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +[INTL] = KEYMAP( + // left hand + UC(0x00B4), UC(0x00A1), UC(0x00B2), UC(0x00B3), UC(0x00A4), UC(0x20AC), UC(0x00BC), + _______, UC(0x00E4), UC(0x00E5), UC(0x00E9), UC(0x00AE), UC(0x00FE), _______, + _______, UC(0x00E1), UC(0x00DF), UC(0x00F0), _______, _______, + MO(INSF), UC(0x00E6), _______, UC(0x00A9), _______, _______, _______, + _______, _______, _______, UC(0x00AC), UC(0x00BF), + _______, _______, + _______, + _______, _______, _______, + // right hand + UC(0x00BD), UC(0x00BE), UC(0x2018), UC(0x2019), UC(0x00A5), UC(0x00D7), _______, + _______, UC(0x00FC), UC(0x00FA), UC(0x00ED), UC(0x00F3), UC(0x00F6), _______, + _______, _______, _______, UC(0x00F8), UC(0x00B6), _______, + _______, UC(0x00F1), UC(0x00B5), UC(0x00E7), _______, _______, MO(INSF), + UC(0x00AB), UC(0x00BB), _______, _______, _______, + _______, _______, + _______, + _______, _______, _______ + ), + +/* layer 2 : international symbols, shifted + * This layer is an ugly workaround; it pretends that SHIFT still works normally on keys + * which don't produce an "upper case" or "shifted" international symobol. + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ยจ | ยน | | | ยฃ | | | | | | | | โ | รท | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | ร | ร
| ร | | ร | | | | ร | ร | ร | ร | ร | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | ร | ยง | ร | | |------| |------| | | | ร | ยฐ | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | ร | | ยข | | | | | | ร | | ร | | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | ยฆ | | | | | | | | + * `------------------------------------' `------------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +[INSF] = KEYMAP( + // left hand + UC(0x00A8), UC(0x00B9), _______, _______, UC(0x00A3), _______, _______, + _______, UC(0x00C4), UC(0x00C5), UC(0x00C9), _______, UC(0x00DE), _______, + _______, UC(0x00C1), UC(0x00A7), UC(0x00D0), S(KC_F), S(KC_G), + _______, UC(0x00C6), S(KC_X), UC(0x00A2), S(KC_V), S(KC_B), _______, + _______, _______, _______, UC(0x00A6), _______, + _______, _______, + _______, + _______, _______, _______, + // right hand + _______, _______, _______, _______, UC(0x2014), UC(0x00F7), _______, + _______, UC(0x00DC), UC(0x00DA), UC(0x00CD), UC(0x00D3), UC(0x00D6), _______, + S(KC_H), S(KC_J), S(KC_K), UC(0x00D8), UC(0x00B0), _______, + _______, UC(0x00D1), _______, UC(0x00C7), S(KC_DOT), _______, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + _______, _______, _______ + ), + +/* layer 3: numberpad + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | ( | ) | / | * | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | | | | | | | | 7 | 8 | 9 | - | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | |------| |------| | 4 | 5 | 6 | + | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | | | | | | 1 | 2 | 3 | = | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | 0 | . | , | ENTER| | + * `------------------------------------' `------------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +[NUMP] = KEYMAP( + // left hand + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, _______, + _______, + _______, _______, _______, + // right hand + _______, _______, S(KC_9), S(KC_0), KC_PSLS, KC_PAST, _______, + _______, _______, KC_KP_7, KC_KP_8, KC_KP_9, KC_PMNS, _______, + _______, KC_KP_4, KC_KP_5, KC_KP_6, KC_PPLS, _______, + _______, _______, KC_KP_1, KC_KP_2, KC_KP_3, KC_PEQL, _______, + KC_KP_0, KC_KP_DOT, KC_PCMM, KC_PENT, _______, + _______, _______, + _______, + _______, _______, _______ + ), + +/* layer 4 : functions and arrows + * This layer is at the top so that the functions still work no matter what layers are active. + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | ESCAPE | F1 | F2 | F3 | F4 | F5 | F6 | | F7 | F8 | F9 | F10 | F11 | F12 | SYSREQ | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | UP | | | | | | | | | | | INSERT | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * |CAPSLOCK| | LEFT | DOWN |RIGHT | |------| |------| LEFT | DOWN | UP | RIGHT| | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | |M_PREV|M_STOP|M_PLPS|M_NEXT| | | | | | | | | PGUP | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | | HOME | PGDN | END | + * `------------------------------------' `------------------------------------' + * ,-------------. ,-------------. + * | | PAUSE| | | | + * ,------|------|------| |------+------+------. + * | | | | |SCRLK | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +[ARRW] = KEYMAP( + // left hand + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, + _______, _______, _______, KC_UP, _______, _______, _______, + KC_CAPS, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, + _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, + _______, KC_PAUSE, + _______, + _______, _______, _______, + // right hand + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_SYSREQ, + _______, _______, _______, _______, _______, _______, KC_INS, + KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, + _______, _______, _______, _______, _______, KC_PGUP, _______, + _______, _______, KC_HOME, KC_PGDN, KC_END, + _______, _______, + KC_SLCK, + _______, _______, _______ + ), +}; + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { + set_unicode_input_mode(UC_LNX); // Linux + //set_unicode_input_mode(UC_OSX); // Mac OSX + //set_unicode_input_mode(UC_WIN); // Windows (with registry key, see wiki) + //set_unicode_input_mode(UC_WINC); // Windows (with WinCompose, see wiki) +}; + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + case INTL: + case INSF: + ergodox_right_led_1_on(); + break; + case NUMP: + ergodox_right_led_2_on(); + break; + case ARRW: + ergodox_right_led_3_on(); + break; + default: + // none + break; + } + +}; diff --git a/keyboards/ergodox/keymaps/ordinary/keymap.c b/keyboards/ergodox/keymaps/ordinary/keymap.c index 1dfdf7e624..ac84df5701 100644 --- a/keyboards/ergodox/keymaps/ordinary/keymap.c +++ b/keyboards/ergodox/keymaps/ordinary/keymap.c @@ -392,7 +392,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case NotEq: if (record->event.pressed) { - return MACRO( I(10), D(LSFT), T(EXLM), U(LSFT), T(EQL), END ); // != + return MACRO( I(10), D(LSFT), T(1), U(LSFT), T(EQL), END ); // != } break; diff --git a/keyboards/ergodox/keymaps/siroken3/default.png b/keyboards/ergodox/keymaps/siroken3/default.png Binary files differnew file mode 100644 index 0000000000..6575f7b5e3 --- /dev/null +++ b/keyboards/ergodox/keymaps/siroken3/default.png diff --git a/keyboards/ergodox/keymaps/siroken3/default_firmware_v1.2-2.png b/keyboards/ergodox/keymaps/siroken3/default_firmware_v1.2-2.png Binary files differnew file mode 100644 index 0000000000..e3c321cc09 --- /dev/null +++ b/keyboards/ergodox/keymaps/siroken3/default_firmware_v1.2-2.png diff --git a/keyboards/ergodox/keymaps/siroken3/default_highres.png b/keyboards/ergodox/keymaps/siroken3/default_highres.png Binary files differnew file mode 100644 index 0000000000..7d9f045f43 --- /dev/null +++ b/keyboards/ergodox/keymaps/siroken3/default_highres.png diff --git a/keyboards/ergodox/keymaps/siroken3/keymap.c b/keyboards/ergodox/keymaps/siroken3/keymap.c new file mode 100644 index 0000000000..258f122b48 --- /dev/null +++ b/keyboards/ergodox/keymaps/siroken3/keymap.c @@ -0,0 +1,187 @@ +// Netable differences vs. the default firmware for the ErgoDox EZ: +// 1. The Cmd key is now on the right side, making Cmd+Space easier. +// 2. The media keys work on OSX (But not on Windows). +#include "ergodox.h" +#include "debug.h" +#include "action_layer.h" + +#define BASE 0 // default layer +#define SYMB 1 // symbols +#define MDIA 2 // media keys + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* Keymap 0: Basic layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | Tab | Q | W | E | R | T | L1 | | L1 | Y | U | I | O | P | \ | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | LCtl | A | S | D | F | G |------| |------| H | J | K | L |; / L2| LGui | + * |--------+------+------+------+------+------| BkSp | | Meh |------+------+------+------+------+--------| + * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * |Grv/L1| '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 | + * `----------------------------------' `----------------------------------' + * ,-------------. ,---------------. + * | BkSp | LGui | | Alt |Ctrl/Esc| + * ,------|------|------| |------+--------+------. + * | | | Home | | PgUp | | | + * | Space|LANG1 |------| |------|LANG2 |Enter | + * | /LGui| | End | | PgDn | | | + * `--------------------' `----------------------' + */ +// If it accepts an argument (i.e, is a function), it doesn't need KC_. +// Otherwise, it needs KC_* +[BASE] = KEYMAP( // layer 0 : default + // left hand + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB), + KC_LCTRL, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_BSPC, + LT(SYMB,KC_GRV),KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT, + KC_BSPC, KC_LGUI, + KC_HOME, + MT(MOD_LGUI, KC_SPC),KC_LANG1,KC_END, + // right hand + KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),KC_LGUI, + MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, + KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1, + KC_LALT, CTL_T(KC_ESC), + KC_PGUP, + KC_PGDN,KC_LANG2, KC_ENT + ), +/* Keymap 1: Symbol Layer + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | | | | | . | 0 | = | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | | | + * | | |------| |------| | | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// SYMBOLS +[SYMB] = KEYMAP( + // left hand + KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, + KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS, + KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, + KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + KC_TRNS,KC_TRNS, + KC_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS, + // right hand + KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, + KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12, + KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS, + KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS, + KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS +), +/* Keymap 2: Media and mouse keys + * + * ,--------------------------------------------------. ,--------------------------------------------------. + * | | | | | | | | | | | | | | | | + * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| + * | | | | MsUp | | | | | | | | | | | | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play | + * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| + * | | | | | | | | | | | | Prev | Next | | | + * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' + * | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | | + * `----------------------------------' `----------------------------------' + * ,-------------. ,-------------. + * | | | | | | + * ,------|------|------| |------+------+------. + * | | | | | | |Brwser| + * | | |------| |------| |Back | + * | | | | | | | | + * `--------------------' `--------------------' + */ +// MEDIA AND MOUSE +[MDIA] = KEYMAP( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, + // right hand + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, + KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, + KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_WBAK +), +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); + } else { + unregister_code(KC_RSFT); + } + break; + } + return MACRO_NONE; +}; + +// Runs just one time when the keyboard initializes. +void matrix_init_user(void) { + +}; + +// Runs constantly in the background, in a loop. +void matrix_scan_user(void) { + + uint8_t layer = biton32(layer_state); + + ergodox_board_led_off(); + ergodox_right_led_1_off(); + ergodox_right_led_2_off(); + ergodox_right_led_3_off(); + switch (layer) { + // TODO: Make this relevant to the ErgoDox EZ. + case 1: + ergodox_right_led_1_on(); + break; + case 2: + ergodox_right_led_2_on(); + break; + default: + // none + break; + } + +}; diff --git a/keyboards/ergodox/keymaps/siroken3/readme.md b/keyboards/ergodox/keymaps/siroken3/readme.md new file mode 100644 index 0000000000..979ce0f5b8 --- /dev/null +++ b/keyboards/ergodox/keymaps/siroken3/readme.md @@ -0,0 +1,15 @@ +# ErgoDox EZ Default Configuration + +## Changelog + +* Dec 2016: + * Added LED keys + * Refreshed layout graphic, comes from http://configure.ergodox-ez.com now. +* Sep 22, 2016: + * Created a new key in layer 1 (bottom-corner key) that resets the EEPROM. +* Feb 2, 2016 (V1.1): + * Made the right-hand quote key double as Cmd/Win on hold. So you get ' when you tap it, " when you tap it with Shift, and Cmd or Win when you hold it. You can then use it as a modifier, or just press and hold it for a moment (and then let go) to send a single Cmd or Win keystroke (handy for opening the Start menu on Windows). + +This is what we ship with out of the factory. :) The image says it all: + +![Default](default_firmware_v1.2-2.png) diff --git a/keyboards/ergodox/keymaps/yoruian/keymap.c b/keyboards/ergodox/keymaps/yoruian/keymap.c index d3635ddf3f..41dfda3c6d 100644 --- a/keyboards/ergodox/keymaps/yoruian/keymap.c +++ b/keyboards/ergodox/keymaps/yoruian/keymap.c @@ -17,7 +17,7 @@ #include "yoruian.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = KEYMAP\ +[0] = KEYMAP_YORUIAN\ (9, 7, 5, 3, 1, GRV, MINS, EQL, LBRC, 0, 2, 4, 6, 8, ES, RBRC, Y, O, R, BSLS, P3, P3, J, V, D, F, W, Q, LC, U, I, A, N, SCLN, M, H, T, S, C, RC, @@ -26,7 +26,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { BSPC, RALT, P2, TAB, NO, NO, E, LSFT, NO, NO, ENT, SPC), -[1] = KEYMAP\ +[1] = KEYMAP_YORUIAN\ (TR, TR, TR, TR, TR, TR, TR, TR, TR, F5, F6, F7, F8, F9, TR, TR, TR, TR, TR, TR, TR, TR, TR, F1, F2, F3, F4, FT, TR, TR, TR, TR, TR, TR, PAUS, LEFT, DOWN, UP, RGHT, FE, diff --git a/keyboards/ergodox/keymaps/yoruian/yoruian.h b/keyboards/ergodox/keymaps/yoruian/yoruian.h index 1adcb7fd3f..b5aaf74b1a 100644 --- a/keyboards/ergodox/keymaps/yoruian/yoruian.h +++ b/keyboards/ergodox/keymaps/yoruian/yoruian.h @@ -18,36 +18,32 @@ #include "debug.h" #include "action_layer.h" -#undef KEYMAP -#define KEYMAP\ -( \ - /* Spacial positions. */ \ - k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, \ - k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, \ - k20, k21, k22, k23, k24, k25, k28, k29, k2A, k2B, k2C, k2D, \ - k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, \ - k40, k41, k42, k43, k44, k49, k4A, k4B, k4C, k4D, \ - k55, k56, k57, k58, \ - k54, k59, \ - k53, k52, k51, k5C, k5B, k5A) \ - \ - /* Matrix positions. */ \ - { \ - { KC_##k00, KC_##k10, KC_##k20, KC_##k30, KC_##k40, KC_NO }, \ - { KC_##k01, KC_##k11, KC_##k21, KC_##k31, KC_##k41, KC_##k51 }, \ - { KC_##k02, KC_##k12, KC_##k22, KC_##k32, KC_##k42, KC_##k52 }, \ - { KC_##k03, KC_##k13, KC_##k23, KC_##k33, KC_##k43, KC_##k53 }, \ - { KC_##k04, KC_##k14, KC_##k24, KC_##k34, KC_##k44, KC_##k54 }, \ - { KC_##k05, KC_##k15, KC_##k25, KC_##k35, KC_NO, KC_##k55 }, \ - { KC_##k06, KC_##k16, KC_NO, KC_##k36, KC_NO, KC_##k56 }, \ - { KC_##k07, KC_##k17, KC_NO, KC_##k37, KC_NO, KC_##k57 }, \ - { KC_##k08, KC_##k18, KC_##k28, KC_##k38, KC_NO, KC_##k58 }, \ - { KC_##k09, KC_##k19, KC_##k29, KC_##k39, KC_##k49, KC_##k59 }, \ - { KC_##k0A, KC_##k1A, KC_##k2A, KC_##k3A, KC_##k4A, KC_##k5A }, \ - { KC_##k0B, KC_##k1B, KC_##k2B, KC_##k3B, KC_##k4B, KC_##k5B }, \ - { KC_##k0C, KC_##k1C, KC_##k2C, KC_##k3C, KC_##k4C, KC_##k5C }, \ - { KC_##k0D, KC_##k1D, KC_##k2D, KC_##k3D, KC_##k4D, KC_NO } \ - } +#define KEYMAP_YORUIAN( \ + /* Spacial positions. */ \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0A, k0B, k0C, k0D, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1A, k1B, k1C, k1D, \ + k20, k21, k22, k23, k24, k25, k28, k29, k2A, k2B, k2C, k2D, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3A, k3B, k3C, k3D, \ + k40, k41, k42, k43, k44, k49, k4A, k4B, k4C, k4D, \ + k55, k56, k57, k58, \ + k54, k59, \ + k53, k52, k51, k5C, k5B, k5A) \ + KEYMAP(KC_##k00, KC_##k01, KC_##k02, KC_##k03, KC_##k04, KC_##k05, KC_##k06, \ + KC_##k10, KC_##k11, KC_##k12, KC_##k13, KC_##k14, KC_##k15, KC_##k16, \ + KC_##k20, KC_##k21, KC_##k22, KC_##k23, KC_##k24, KC_##k25, \ + KC_##k30, KC_##k31, KC_##k32, KC_##k33, KC_##k34, KC_##k35, KC_##k36, \ + KC_##k40, KC_##k41, KC_##k42, KC_##k43, KC_##k44, \ + KC_##k55, KC_##k56, \ + KC_##k54, \ + KC_##k53, KC_##k52, KC_##k51, \ + KC_##k07, KC_##k08, KC_##k09, KC_##k0A, KC_##k0B, KC_##k0C, KC_##k0D, \ + KC_##k17, KC_##k18, KC_##k19, KC_##k1A, KC_##k1B, KC_##k1C, KC_##k1D, \ + KC_##k28, KC_##k29, KC_##k2A, KC_##k2B, KC_##k2C, KC_##k2D, \ + KC_##k37, KC_##k38, KC_##k39, KC_##k3A, KC_##k3B, KC_##k3C, KC_##k3D, \ + KC_##k49, KC_##k4A, KC_##k4B, KC_##k4C, KC_##k4D, \ + KC_##k57, KC_##k58, \ + KC_##k59, \ + KC_##k5C, KC_##k5B, KC_##k5A) #define KC_ES KC_ESC #define KC_LC KC_LCTL |