From 6037cede2ce66dd8ce4df82d6d9a347c1de3110a Mon Sep 17 00:00:00 2001 From: Luiz Ribeiro Date: Sun, 28 May 2017 12:40:03 -0400 Subject: [PATCH 01/45] rgblight support for ps2avrGB --- build_keyboard.mk | 4 +- keyboards/ps2avrGB/config.h | 3 + keyboards/ps2avrGB/i2c.c | 104 ++++++++++++++++++++ keyboards/ps2avrGB/i2c.h | 25 +++++ keyboards/ps2avrGB/keymaps/default/keymap.c | 66 +++++++++++++ keyboards/ps2avrGB/matrix.c | 2 + keyboards/ps2avrGB/ps2avrGB.c | 50 ++++++++++ keyboards/ps2avrGB/rules.mk | 6 +- 8 files changed, 257 insertions(+), 3 deletions(-) create mode 100644 keyboards/ps2avrGB/i2c.c create mode 100644 keyboards/ps2avrGB/i2c.h diff --git a/build_keyboard.mk b/build_keyboard.mk index 9fa8c3126322..dc9e5dad631f 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -198,7 +198,9 @@ endif ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) OPT_DEFS += -DRGBLIGHT_ENABLE - SRC += $(QUANTUM_DIR)/light_ws2812.c +ifneq ($(strip $(DISABLE_WS2812)), yes) + SRC += $(QUANTUM_DIR)/light_ws2812.c +endif SRC += $(QUANTUM_DIR)/rgblight.c CIE1931_CURVE = yes LED_BREATHING_TABLE = yes diff --git a/keyboards/ps2avrGB/config.h b/keyboards/ps2avrGB/config.h index b5c696f3f826..fc17b5d5e2e6 100644 --- a/keyboards/ps2avrGB/config.h +++ b/keyboards/ps2avrGB/config.h @@ -29,6 +29,9 @@ along with this program. If not, see . #define MATRIX_ROWS 8 #define MATRIX_COLS 15 +#define RGBLED_NUM 16 +#define RGBLIGHT_ANIMATIONS + #define NO_UART 1 #define BOOTLOADHID_BOOTLOADER 1 diff --git a/keyboards/ps2avrGB/i2c.c b/keyboards/ps2avrGB/i2c.c new file mode 100644 index 000000000000..c27f3e3d17e1 --- /dev/null +++ b/keyboards/ps2avrGB/i2c.c @@ -0,0 +1,104 @@ +/* +Copyright 2016 Luiz Ribeiro + +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 . +*/ + +#include +#include + +#include "i2c.h" + +void i2c_set_bitrate(uint16_t bitrate_khz) { + uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz); + if (bitrate_div >= 16) { + bitrate_div = (bitrate_div - 16) / 2; + } + TWBR = bitrate_div; +} + +void i2c_init(void) { + // set pull-up resistors on I2C bus pins + PORTC |= 0b11; + + i2c_set_bitrate(400); + + // enable TWI (two-wire interface) + TWCR |= (1 << TWEN); + + // enable TWI interrupt and slave address ACK + TWCR |= (1 << TWIE); + TWCR |= (1 << TWEA); +} + +uint8_t i2c_start(uint8_t address) { + // reset TWI control register + TWCR = 0; + + // begin transmission and wait for it to end + TWCR = (1< + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef __I2C_H__ +#define __I2C_H__ + +void i2c_init(void); +void i2c_set_bitrate(uint16_t bitrate_khz); +uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length); + +#endif diff --git a/keyboards/ps2avrGB/keymaps/default/keymap.c b/keyboards/ps2avrGB/keymaps/default/keymap.c index 3e4cebc81e0b..60929ac99741 100644 --- a/keyboards/ps2avrGB/keymaps/default/keymap.c +++ b/keyboards/ps2avrGB/keymaps/default/keymap.c @@ -16,6 +16,8 @@ along with this program. If not, see . */ #include "ps2avrGB.h" +#include "action_layer.h" +#include "rgblight.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_KEYMAP( @@ -28,5 +30,69 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) }; +enum function_id { + RGBLED_TOGGLE, + RGBLED_STEP_MODE, + RGBLED_INCREASE_HUE, + RGBLED_DECREASE_HUE, + RGBLED_INCREASE_SAT, + RGBLED_DECREASE_SAT, + RGBLED_INCREASE_VAL, + RGBLED_DECREASE_VAL, +}; + const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_FUNCTION(RGBLED_TOGGLE), + [1] = ACTION_FUNCTION(RGBLED_STEP_MODE), + [2] = ACTION_FUNCTION(RGBLED_INCREASE_HUE), + [3] = ACTION_FUNCTION(RGBLED_DECREASE_HUE), + [4] = ACTION_FUNCTION(RGBLED_INCREASE_SAT), + [5] = ACTION_FUNCTION(RGBLED_DECREASE_SAT), + [6] = ACTION_FUNCTION(RGBLED_INCREASE_VAL), + [7] = ACTION_FUNCTION(RGBLED_DECREASE_VAL), +}; + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + switch (id) { + case RGBLED_TOGGLE: + if (record->event.pressed) { + rgblight_toggle(); + } + break; + case RGBLED_STEP_MODE: + if (record->event.pressed) { + rgblight_step(); + } + break; + case RGBLED_INCREASE_HUE: + if (record->event.pressed) { + rgblight_increase_hue(); + } + break; + case RGBLED_DECREASE_HUE: + if (record->event.pressed) { + rgblight_decrease_hue(); + } + break; + case RGBLED_INCREASE_SAT: + if (record->event.pressed) { + rgblight_increase_sat(); + } + break; + case RGBLED_DECREASE_SAT: + if (record->event.pressed) { + rgblight_decrease_sat(); + } + break; + case RGBLED_INCREASE_VAL: + if (record->event.pressed) { + rgblight_increase_val(); + } + break; + case RGBLED_DECREASE_VAL: + if (record->event.pressed) { + rgblight_decrease_val(); + } + break; + } }; diff --git a/keyboards/ps2avrGB/matrix.c b/keyboards/ps2avrGB/matrix.c index beaa54c400af..140026013f02 100644 --- a/keyboards/ps2avrGB/matrix.c +++ b/keyboards/ps2avrGB/matrix.c @@ -93,6 +93,8 @@ uint8_t matrix_scan(void) { } } + matrix_scan_user(); + return 1; } diff --git a/keyboards/ps2avrGB/ps2avrGB.c b/keyboards/ps2avrGB/ps2avrGB.c index e69de29bb2d1..89e437786bc7 100644 --- a/keyboards/ps2avrGB/ps2avrGB.c +++ b/keyboards/ps2avrGB/ps2avrGB.c @@ -0,0 +1,50 @@ +/* +Copyright 2017 Luiz Ribeiro + +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 . +*/ + +#include "ps2avrGB.h" +#include "rgblight.h" + +#include + +#include "action_layer.h" +#include "i2c.h" +#include "quantum.h" + +extern rgblight_config_t rgblight_config; + +void rgblight_set(void) { + uint8_t data[3 * RGBLED_NUM]; + for (uint8_t i = 0; i < RGBLED_NUM; i++) { + if (rgblight_config.enable) { + data[3 * i] = led[i].g; + data[3 * i + 1] = led[i].r; + data[3 * i + 2] = led[i].b; + } else { + data[3 * i] = 0; + data[3 * i + 1] = 0; + data[3 * i + 2] = 0; + } + } + + i2c_init(); + i2c_send(0xb0, data, 48); +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { + rgblight_task(); +} diff --git a/keyboards/ps2avrGB/rules.mk b/keyboards/ps2avrGB/rules.mk index e2b5922ea27e..9fb27efed907 100644 --- a/keyboards/ps2avrGB/rules.mk +++ b/keyboards/ps2avrGB/rules.mk @@ -20,7 +20,6 @@ PROTOCOL = VUSB # unsupported features for now NO_UART = yes NO_SUSPEND_POWER_DOWN = yes -BACKLIGHT_ENABLE = no # processor frequency F_CPU = 12000000 @@ -31,13 +30,16 @@ MOUSEKEY_ENABLE = yes EXTRAKEY_ENABLE = yes CONSOLE_ENABLE = yes COMMAND_ENABLE = yes +BACKLIGHT_ENABLE = no +RGBLIGHT_ENABLE = yes +DISABLE_WS2812 = yes OPT_DEFS = -DDEBUG_LEVEL=0 OPT_DEFS += -DBOOTLOADER_SIZE=2048 # custom matrix setup CUSTOM_MATRIX = yes -SRC = matrix.c +SRC = matrix.c i2c.c # programming options PROGRAM_CMD = ./keyboards/ps2avrGB/program $(TARGET).hex From 964d7060e1176d487a1f9dfe9bb76b491983748d Mon Sep 17 00:00:00 2001 From: Luiz Ribeiro Date: Sun, 28 May 2017 12:53:13 -0400 Subject: [PATCH 02/45] Simplified ps2avrGB rgblight_set logic a bit --- keyboards/ps2avrGB/ps2avrGB.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/keyboards/ps2avrGB/ps2avrGB.c b/keyboards/ps2avrGB/ps2avrGB.c index 89e437786bc7..7ff8998544c2 100644 --- a/keyboards/ps2avrGB/ps2avrGB.c +++ b/keyboards/ps2avrGB/ps2avrGB.c @@ -27,21 +27,16 @@ along with this program. If not, see . extern rgblight_config_t rgblight_config; void rgblight_set(void) { - uint8_t data[3 * RGBLED_NUM]; - for (uint8_t i = 0; i < RGBLED_NUM; i++) { - if (rgblight_config.enable) { - data[3 * i] = led[i].g; - data[3 * i + 1] = led[i].r; - data[3 * i + 2] = led[i].b; - } else { - data[3 * i] = 0; - data[3 * i + 1] = 0; - data[3 * i + 2] = 0; + if (!rgblight_config.enable) { + for (uint8_t i = 0; i < RGBLED_NUM; i++) { + led[i].r = 0; + led[i].g = 0; + led[i].b = 0; } } i2c_init(); - i2c_send(0xb0, data, 48); + i2c_send(0xb0, (uint8_t*)led, 48); } __attribute__ ((weak)) From d4cd5dda5c3e3c5b8b8d4db5d0bbed2fec0c770d Mon Sep 17 00:00:00 2001 From: Luiz Ribeiro Date: Sat, 10 Jun 2017 12:40:32 -0400 Subject: [PATCH 03/45] Added a build flag for using a custom rgblight driver --- build_keyboard.mk | 8 ++++--- keyboards/ps2avrGB/program | 2 +- keyboards/ps2avrGB/rules.mk | 2 +- quantum/light_ws2812.h | 18 +-------------- quantum/rgblight.c | 3 ++- quantum/rgblight.h | 3 +++ quantum/rgblight_types.h | 44 +++++++++++++++++++++++++++++++++++++ 7 files changed, 57 insertions(+), 23 deletions(-) create mode 100644 quantum/rgblight_types.h diff --git a/build_keyboard.mk b/build_keyboard.mk index dc9e5dad631f..550440cbcfe5 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -198,12 +198,14 @@ endif ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) OPT_DEFS += -DRGBLIGHT_ENABLE -ifneq ($(strip $(DISABLE_WS2812)), yes) - SRC += $(QUANTUM_DIR)/light_ws2812.c -endif SRC += $(QUANTUM_DIR)/rgblight.c CIE1931_CURVE = yes LED_BREATHING_TABLE = yes +ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes) + OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER +else + SRC += $(QUANTUM_DIR)/light_ws2812.c +endif endif ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) diff --git a/keyboards/ps2avrGB/program b/keyboards/ps2avrGB/program index a88d9cd9b042..081a8219ced0 100755 --- a/keyboards/ps2avrGB/program +++ b/keyboards/ps2avrGB/program @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3.5 # Copyright 2017 Luiz Ribeiro # # This program is free software: you can redistribute it and/or modify diff --git a/keyboards/ps2avrGB/rules.mk b/keyboards/ps2avrGB/rules.mk index 9fb27efed907..9e76993c4a50 100644 --- a/keyboards/ps2avrGB/rules.mk +++ b/keyboards/ps2avrGB/rules.mk @@ -32,7 +32,7 @@ CONSOLE_ENABLE = yes COMMAND_ENABLE = yes BACKLIGHT_ENABLE = no RGBLIGHT_ENABLE = yes -DISABLE_WS2812 = yes +RGBLIGHT_CUSTOM_DRIVER = yes OPT_DEFS = -DDEBUG_LEVEL=0 OPT_DEFS += -DBOOTLOADER_SIZE=2048 diff --git a/quantum/light_ws2812.h b/quantum/light_ws2812.h index 60924a0fb61d..f7e0c31440ca 100755 --- a/quantum/light_ws2812.h +++ b/quantum/light_ws2812.h @@ -28,23 +28,7 @@ //#include "ws2812_config.h" //#include "i2cmaster.h" -#ifdef RGBW - #define LED_TYPE struct cRGBW -#else - #define LED_TYPE struct cRGB -#endif - - -/* - * Structure of the LED array - * - * cRGB: RGB for WS2812S/B/C/D, SK6812, SK6812Mini, SK6812WWA, APA104, APA106 - * cRGBW: RGBW for SK6812RGBW - */ - -struct cRGB { uint8_t g; uint8_t r; uint8_t b; }; -struct cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;}; - +#include "rgblight_types.h" /* User Interface diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 4eec2a776201..49420de37695 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -364,7 +364,7 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { rgblight_set(); } -__attribute__ ((weak)) +#ifndef RGBLIGHT_CUSTOM_DRIVER void rgblight_set(void) { if (rgblight_config.enable) { #ifdef RGBW @@ -385,6 +385,7 @@ void rgblight_set(void) { #endif } } +#endif #ifdef RGBLIGHT_ANIMATIONS diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 92130192ce37..6b609da7fce4 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -61,7 +61,10 @@ #include #include #include "eeconfig.h" +#ifndef RGBLIGHT_CUSTOM_DRIVER #include "light_ws2812.h" +#endif +#include "rgblight_types.h" extern LED_TYPE led[RGBLED_NUM]; diff --git a/quantum/rgblight_types.h b/quantum/rgblight_types.h new file mode 100644 index 000000000000..1d1467a12a3d --- /dev/null +++ b/quantum/rgblight_types.h @@ -0,0 +1,44 @@ +/* + * light weight WS2812 lib include + * + * Version 2.3 - Nev 29th 2015 + * Author: Tim (cpldcpu@gmail.com) + * + * Please do not change this file! All configuration is handled in "ws2812_config.h" + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef RGBLIGHT_TYPES + +#include + +#ifdef RGBW + #define LED_TYPE struct cRGBW +#else + #define LED_TYPE struct cRGB +#endif + + +/* + * Structure of the LED array + * + * cRGB: RGB for WS2812S/B/C/D, SK6812, SK6812Mini, SK6812WWA, APA104, APA106 + * cRGBW: RGBW for SK6812RGBW + */ + +struct cRGB { uint8_t g; uint8_t r; uint8_t b; }; +struct cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;}; + +#endif From 945f2f591649f1478ac0c24ca52950b7499f3eb5 Mon Sep 17 00:00:00 2001 From: Luiz Ribeiro Date: Sat, 10 Jun 2017 17:28:59 -0400 Subject: [PATCH 04/45] Fixed rgblight_types.h --- keyboards/ps2avrGB/program | 2 +- quantum/rgblight_types.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/keyboards/ps2avrGB/program b/keyboards/ps2avrGB/program index 081a8219ced0..b45bff8e5fc1 100755 --- a/keyboards/ps2avrGB/program +++ b/keyboards/ps2avrGB/program @@ -1,4 +1,4 @@ -#!/usr/bin/env python3.5 +#!/usr/bin/env python3 # Copyright 2017 Luiz Ribeiro # # This program is free software: you can redistribute it and/or modify diff --git a/quantum/rgblight_types.h b/quantum/rgblight_types.h index 1d1467a12a3d..b1aa7026c487 100644 --- a/quantum/rgblight_types.h +++ b/quantum/rgblight_types.h @@ -21,6 +21,7 @@ */ #ifndef RGBLIGHT_TYPES +#define RGBLIGHT_TYPES #include From 60153e7bbc51e62c329cd55ea026340940c88104 Mon Sep 17 00:00:00 2001 From: Luiz Ribeiro Date: Sun, 11 Jun 2017 12:28:04 -0400 Subject: [PATCH 05/45] Always send 3 * RGBLED_NUM bytes through I2C on ps2avrGB This wasn't going to work on boards with a different number of LEDs, since I was always sending 48 bytes. --- keyboards/ps2avrGB/ps2avrGB.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/ps2avrGB/ps2avrGB.c b/keyboards/ps2avrGB/ps2avrGB.c index 7ff8998544c2..701c5847f539 100644 --- a/keyboards/ps2avrGB/ps2avrGB.c +++ b/keyboards/ps2avrGB/ps2avrGB.c @@ -36,7 +36,7 @@ void rgblight_set(void) { } i2c_init(); - i2c_send(0xb0, (uint8_t*)led, 48); + i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); } __attribute__ ((weak)) From 738b072bb0f25d0369a998c550c369e4f64cc7a5 Mon Sep 17 00:00:00 2001 From: Luiz Ribeiro Date: Tue, 4 Jul 2017 11:12:42 -0400 Subject: [PATCH 06/45] Fixed indentation and now using quantum keycodes for rgblight --- build_keyboard.mk | 10 +-- keyboards/ps2avrGB/keymaps/default/keymap.c | 89 ++++----------------- keyboards/ps2avrGB/program | 2 +- keyboards/ps2avrGB/ps2avrGB.h | 1 + 4 files changed, 24 insertions(+), 78 deletions(-) diff --git a/build_keyboard.mk b/build_keyboard.mk index 550440cbcfe5..b4f1c1cfffbb 100644 --- a/build_keyboard.mk +++ b/build_keyboard.mk @@ -201,11 +201,11 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) SRC += $(QUANTUM_DIR)/rgblight.c CIE1931_CURVE = yes LED_BREATHING_TABLE = yes -ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes) - OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER -else - SRC += $(QUANTUM_DIR)/light_ws2812.c -endif + ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes) + OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER + else + SRC += $(QUANTUM_DIR)/light_ws2812.c + endif endif ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) diff --git a/keyboards/ps2avrGB/keymaps/default/keymap.c b/keyboards/ps2avrGB/keymaps/default/keymap.c index 60929ac99741..4650ff633ffe 100644 --- a/keyboards/ps2avrGB/keymaps/default/keymap.c +++ b/keyboards/ps2avrGB/keymaps/default/keymap.c @@ -20,79 +20,24 @@ along with this program. If not, see . #include "rgblight.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - KC_KEYMAP( - ESC, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, PSCR,HOME,END, - GRV, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSPC, DEL, - TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSLS, INS, - CAPS,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, PGUP, - LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT, UP, PGDN, - LCTL,LALT,LGUI, SPC, RGUI,RALT,RCTL,LEFT,DOWN,RGHT - ) -}; - -enum function_id { - RGBLED_TOGGLE, - RGBLED_STEP_MODE, - RGBLED_INCREASE_HUE, - RGBLED_DECREASE_HUE, - RGBLED_INCREASE_SAT, - RGBLED_DECREASE_SAT, - RGBLED_INCREASE_VAL, - RGBLED_DECREASE_VAL, + [0] = KEYMAP( + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR,KC_HOME,KC_END, + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSPC, KC_DEL, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC,KC_RBRC,KC_BSLS, KC_INS, + KC_FN0, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_ENT, KC_PGUP, + KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT, KC_UP, KC_PGDN, + KC_LCTL,KC_LALT,KC_LGUI, KC_SPC, KC_RGUI,KC_RALT,KC_RCTL,KC_LEFT,KC_DOWN,KC_RGHT + ), + [1] = KEYMAP( + KC_TRNS,RGB_TOG,RGB_MOD,RGB_HUI,RGB_SAI,RGB_VAI,RGB_HUD,RGB_SAD,RGB_VAD,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_END, + 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_DEL, + 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_INS, + 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_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_RGHT + ), }; const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(RGBLED_TOGGLE), - [1] = ACTION_FUNCTION(RGBLED_STEP_MODE), - [2] = ACTION_FUNCTION(RGBLED_INCREASE_HUE), - [3] = ACTION_FUNCTION(RGBLED_DECREASE_HUE), - [4] = ACTION_FUNCTION(RGBLED_INCREASE_SAT), - [5] = ACTION_FUNCTION(RGBLED_DECREASE_SAT), - [6] = ACTION_FUNCTION(RGBLED_INCREASE_VAL), - [7] = ACTION_FUNCTION(RGBLED_DECREASE_VAL), -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - switch (id) { - case RGBLED_TOGGLE: - if (record->event.pressed) { - rgblight_toggle(); - } - break; - case RGBLED_STEP_MODE: - if (record->event.pressed) { - rgblight_step(); - } - break; - case RGBLED_INCREASE_HUE: - if (record->event.pressed) { - rgblight_increase_hue(); - } - break; - case RGBLED_DECREASE_HUE: - if (record->event.pressed) { - rgblight_decrease_hue(); - } - break; - case RGBLED_INCREASE_SAT: - if (record->event.pressed) { - rgblight_increase_sat(); - } - break; - case RGBLED_DECREASE_SAT: - if (record->event.pressed) { - rgblight_decrease_sat(); - } - break; - case RGBLED_INCREASE_VAL: - if (record->event.pressed) { - rgblight_increase_val(); - } - break; - case RGBLED_DECREASE_VAL: - if (record->event.pressed) { - rgblight_decrease_val(); - } - break; - } + [0] = ACTION_LAYER_MOMENTARY(1), }; diff --git a/keyboards/ps2avrGB/program b/keyboards/ps2avrGB/program index b45bff8e5fc1..a88d9cd9b042 100755 --- a/keyboards/ps2avrGB/program +++ b/keyboards/ps2avrGB/program @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env python # Copyright 2017 Luiz Ribeiro # # This program is free software: you can redistribute it and/or modify diff --git a/keyboards/ps2avrGB/ps2avrGB.h b/keyboards/ps2avrGB/ps2avrGB.h index 813f31f804f7..35902cff4dda 100644 --- a/keyboards/ps2avrGB/ps2avrGB.h +++ b/keyboards/ps2avrGB/ps2avrGB.h @@ -18,6 +18,7 @@ along with this program. If not, see . #ifndef KEYMAP_COMMON_H #define KEYMAP_COMMON_H +#include "quantum_keycodes.h" #include "keycode.h" #include "action.h" From 17c84f24cd1d459ce383171537744d556c43e987 Mon Sep 17 00:00:00 2001 From: Florent C Date: Fri, 15 Sep 2017 19:07:26 +0200 Subject: [PATCH 07/45] Adapt build instructions to new keyboard name --- keyboards/ergodox_infinity/readme.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/keyboards/ergodox_infinity/readme.md b/keyboards/ergodox_infinity/readme.md index 2d037d1c906f..d3277d18b821 100644 --- a/keyboards/ergodox_infinity/readme.md +++ b/keyboards/ergodox_infinity/readme.md @@ -3,21 +3,21 @@ The Infinity is two completely independent keyboards, and needs to be flashed for the left and right halves seperately. To flash them: - - Build the firmware with `make infinity-keymapname` + - Build the firmware with `make ergodox_infinity-keymapname` - Plug in the left hand keyboard only. - Press the program button (back of keyboard, above thumb pad). - - Install the firmware with `sudo make infinity-keymapname-dfu-util` + - Install the firmware with `sudo make ergodox_infinity-keymapname-dfu-util` - - Build right hand firmware with `make infinity-keymapname MASTER=right` + - Build right hand firmware with `make ergodox_infinity-keymapname MASTER=right` - Plug in the right hand keyboard only. - Press the program button (back of keyboard, above thumb pad). - - Install the firmware with `sudo make infinity-keymapname-dfu-util MASTER=right` + - Install the firmware with `sudo make ergodox_infinity-keymapname-dfu-util MASTER=right` More information on the Infinity firmware is available in the [TMK/chibios for Input Club Infinity Ergodox](https://github.com/fredizzimo/infinity_ergodox/blob/master/README.md) @@ -42,4 +42,4 @@ You have a few options in how you flash the firmware: - For minor changes such as changing only the keymap without having updated any part of the firmware code itself, you can program only the MASTER half. - It is safest to program both halves though. \ No newline at end of file + It is safest to program both halves though. From c02de0932ad9a546727bd7097ba33c5b17aebd98 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Fri, 15 Sep 2017 11:20:55 -0400 Subject: [PATCH 08/45] Remove accidentally pasted line in MF68 readme --- keyboards/mf68/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/keyboards/mf68/README.md b/keyboards/mf68/README.md index 1fabd9372175..74bbe9b579dd 100644 --- a/keyboards/mf68/README.md +++ b/keyboards/mf68/README.md @@ -3,8 +3,6 @@ MF68 Magicforce 68 with [replacement PCB](https://github.com/di0ib/tmk_keyboard/tree/master/keyboard/mf68) designed by [di0ib](https://github.com/di0ib). -A split 60% split 5x12 ortholinear keyboard made and sold by Keebio. [More info at Keebio](https://keeb.io). - Keyboard Maintainer: [di0ib](http://www.40percent.club) Hardware Supported: Pro Micro Hardware Availability: [PCB files](https://github.com/di0ib/tmk_keyboard/tree/master/keyboard/mf68/pcb) From 19f48fa922b438d4bd415c37e93645f861edea7d Mon Sep 17 00:00:00 2001 From: Hugh Date: Fri, 15 Sep 2017 15:51:47 -0400 Subject: [PATCH 09/45] "New" Atreus Keymap (#1717) * Merge with upstream * Finish merge * Add new keymap * Change use of KEYMAP macro * Add Readme.md * Fix link * Clean up comments * Raise on leading edge of keypress --- keyboards/atreus/keymaps/henxing/Readme.md | 6 ++ keyboards/atreus/keymaps/henxing/keymap.c | 105 +++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 keyboards/atreus/keymaps/henxing/Readme.md create mode 100644 keyboards/atreus/keymaps/henxing/keymap.c diff --git a/keyboards/atreus/keymaps/henxing/Readme.md b/keyboards/atreus/keymaps/henxing/Readme.md new file mode 100644 index 000000000000..a615adf9665c --- /dev/null +++ b/keyboards/atreus/keymaps/henxing/Readme.md @@ -0,0 +1,6 @@ +# Hugh's Atreus Keymap + +This keymap is the same as the [default](../default) layout for the Atreus, but +uses the programming style found in the Let's +Split [default](../../../lets_split/keymaps/default) keymap. See +[`keymap.c`](keymap.c) for the layout. diff --git a/keyboards/atreus/keymaps/henxing/keymap.c b/keyboards/atreus/keymaps/henxing/keymap.c new file mode 100644 index 000000000000..e5ff5f5d3fbb --- /dev/null +++ b/keyboards/atreus/keymaps/henxing/keymap.c @@ -0,0 +1,105 @@ +#include "atreus.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _LOWER 1 +#define _RAISE 2 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + LOWER, + RAISE +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + /* + * q w e r t || y u i o p + * a s d f g || h j k l ; + * z x c v b || n m , . / + * esc tab gui shift bksp ctrl || alt space lower - ' enter + */ + [_QWERTY] = KEYMAP( \ + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, \ + KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, \ + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \ + KC_ESC, KC_TAB, KC_LGUI, KC_LSFT, KC_BSPC, KC_LCTL, KC_LALT, KC_SPC, LOWER, KC_MINS, KC_QUOT, KC_ENT \ + ), + + /* + * ! @ up { } || pgup 7 8 9 * + * # left down right $ || pgdn 4 5 6 + + * [ ] ( ) & || ` 1 2 3 \ + * raise insert gui shift bksp ctrl || alt space ____ . 0 = + */ + [_LOWER] = KEYMAP( \ + KC_EXLM, KC_AT, KC_UP, KC_LCBR, KC_RCBR, KC_PGUP, KC_7, KC_8, KC_9, KC_ASTR, \ + KC_HASH, KC_LEFT, KC_DOWN, KC_RGHT, KC_DEL, KC_PGDN, KC_4, KC_5, KC_6, KC_PLUS, \ + KC_LBRC, KC_RBRC, KC_LPRN, KC_RPRN, KC_AMPR, KC_GRV, KC_1, KC_2, KC_3, KC_BSLS, \ + RAISE, KC_INS, KC_LGUI, KC_LSFT, KC_BSPC, KC_LCTL, KC_LALT, KC_SPC, KC_TRNS, KC_DOT, KC_0, KC_EQL \ + ), + + /* + * insert home up end pgup || up F7 F8 F9 F10 + * del left down right pgdn || down F4 F5 F6 F11 + * volup reset || F1 F2 F3 F12 + * voldn super shift bksp ctrl || alt space QWERTY prtsc scroll pause + */ + [_RAISE] = KEYMAP( \ + KC_INS, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_UP, KC_F7, KC_F8, KC_F9, KC_F10, \ + KC_DEL, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_DOWN, KC_F4, KC_F5, KC_F6, KC_F11, \ + KC_TRNS, KC_VOLU, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F12, \ + KC_NO, KC_VOLD, KC_LGUI, KC_LSFT, KC_BSPC, KC_LCTL, KC_LALT, KC_SPC, QWERTY, KC_PSCR, KC_SLCK, KC_PAUS \ + ) + +}; + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + + // The value to return + bool return_value = false; + + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + persistent_default_layer_set(1UL<<_QWERTY); + } + break; + + case LOWER: + // Toggle LOWER layer on when key pressed and off when released + if (record->event.pressed) { + layer_on(_LOWER); + } else { + layer_off(_LOWER); + } + break; + + case RAISE: + if (record->event.pressed) { + persistent_default_layer_set(1UL<<_RAISE); + } + break; + + default: + + // If the keycode is not handled by any of the other cases, the + // function should return true + return_value = true; + break; + } + + return return_value; +} From 5eb5b6074ce20fe286808b9667d01274cea73be9 Mon Sep 17 00:00:00 2001 From: Danny Date: Fri, 15 Sep 2017 19:20:50 -0400 Subject: [PATCH 10/45] Add Levinson keyboard (#1723) * Fork lets_split to levinson Update subproject default * Update Readme * Pass LED backlight info from master to slave over serial --- keyboards/levinson/config.h | 31 ++ keyboards/levinson/i2c.c | 162 ++++++ keyboards/levinson/i2c.h | 49 ++ .../levinson/keymaps/bakingpy2u/config.h | 30 ++ .../levinson/keymaps/bakingpy2u/keymap.c | 206 ++++++++ .../levinson/keymaps/bakingpy2u/rules.mk | 6 + keyboards/levinson/keymaps/default/config.h | 37 ++ keyboards/levinson/keymaps/default/keymap.c | 214 ++++++++ keyboards/levinson/keymaps/default/rules.mk | 3 + keyboards/levinson/levinson.c | 16 + keyboards/levinson/levinson.h | 25 + keyboards/levinson/matrix.c | 477 ++++++++++++++++++ keyboards/levinson/readme.md | 20 + keyboards/levinson/rev1/config.h | 88 ++++ keyboards/levinson/rev1/rev1.c | 39 ++ keyboards/levinson/rev1/rev1.h | 60 +++ keyboards/levinson/rev1/rules.mk | 1 + keyboards/levinson/rules.mk | 78 +++ keyboards/levinson/serial.c | 228 +++++++++ keyboards/levinson/serial.h | 26 + keyboards/levinson/split_util.c | 86 ++++ keyboards/levinson/split_util.h | 20 + keyboards/levinson/subproject.mk | 1 + 23 files changed, 1903 insertions(+) create mode 100644 keyboards/levinson/config.h create mode 100644 keyboards/levinson/i2c.c create mode 100644 keyboards/levinson/i2c.h create mode 100644 keyboards/levinson/keymaps/bakingpy2u/config.h create mode 100644 keyboards/levinson/keymaps/bakingpy2u/keymap.c create mode 100644 keyboards/levinson/keymaps/bakingpy2u/rules.mk create mode 100644 keyboards/levinson/keymaps/default/config.h create mode 100644 keyboards/levinson/keymaps/default/keymap.c create mode 100644 keyboards/levinson/keymaps/default/rules.mk create mode 100644 keyboards/levinson/levinson.c create mode 100644 keyboards/levinson/levinson.h create mode 100644 keyboards/levinson/matrix.c create mode 100644 keyboards/levinson/readme.md create mode 100644 keyboards/levinson/rev1/config.h create mode 100644 keyboards/levinson/rev1/rev1.c create mode 100644 keyboards/levinson/rev1/rev1.h create mode 100644 keyboards/levinson/rev1/rules.mk create mode 100644 keyboards/levinson/rules.mk create mode 100644 keyboards/levinson/serial.c create mode 100644 keyboards/levinson/serial.h create mode 100644 keyboards/levinson/split_util.c create mode 100644 keyboards/levinson/split_util.h create mode 100644 keyboards/levinson/subproject.mk diff --git a/keyboards/levinson/config.h b/keyboards/levinson/config.h new file mode 100644 index 000000000000..591c656a2985 --- /dev/null +++ b/keyboards/levinson/config.h @@ -0,0 +1,31 @@ +/* +Copyright 2012 Jun Wako +Copyright 2015 Jack Humbert + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +#ifdef SUBPROJECT_rev1 + #include "rev1/config.h" +#endif +#ifdef SUBPROJECT_rev2 + #include "rev2/config.h" +#endif + +#endif diff --git a/keyboards/levinson/i2c.c b/keyboards/levinson/i2c.c new file mode 100644 index 000000000000..084c890c405f --- /dev/null +++ b/keyboards/levinson/i2c.c @@ -0,0 +1,162 @@ +#include +#include +#include +#include +#include +#include +#include "i2c.h" + +#ifdef USE_I2C + +// Limits the amount of we wait for any one i2c transaction. +// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is +// 9 bits, a single transaction will take around 90μs to complete. +// +// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit +// poll loop takes at least 8 clock cycles to execute +#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 + +#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) + +volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; + +static volatile uint8_t slave_buffer_pos; +static volatile bool slave_has_register_set = false; + +// Wait for an i2c operation to finish +inline static +void i2c_delay(void) { + uint16_t lim = 0; + while(!(TWCR & (1<10. + // Check datasheets for more info. + TWBR = ((F_CPU/SCL_CLOCK)-16)/2; +} + +// Start a transaction with the given i2c slave address. The direction of the +// transfer is set with I2C_READ and I2C_WRITE. +// returns: 0 => success +// 1 => error +uint8_t i2c_master_start(uint8_t address) { + TWCR = (1< slave ACK +// 1 => slave NACK +uint8_t i2c_master_write(uint8_t data) { + TWDR = data; + TWCR = (1<= SLAVE_BUFFER_SIZE ) { + ack = 0; + slave_buffer_pos = 0; + } + slave_has_register_set = true; + } else { + i2c_slave_buffer[slave_buffer_pos] = TWDR; + BUFFER_POS_INC(); + } + break; + + case TW_ST_SLA_ACK: + case TW_ST_DATA_ACK: + // master has addressed this device as a slave transmitter and is + // requesting data. + TWDR = i2c_slave_buffer[slave_buffer_pos]; + BUFFER_POS_INC(); + break; + + case TW_BUS_ERROR: // something went wrong, reset twi state + TWCR = 0; + default: + break; + } + // Reset everything, so we are ready for the next TWI interrupt + TWCR |= (1< + +#ifndef F_CPU +#define F_CPU 16000000UL +#endif + +#define I2C_READ 1 +#define I2C_WRITE 0 + +#define I2C_ACK 1 +#define I2C_NACK 0 + +#define SLAVE_BUFFER_SIZE 0x10 + +// i2c SCL clock frequency +#define SCL_CLOCK 400000L + +extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; + +void i2c_master_init(void); +uint8_t i2c_master_start(uint8_t address); +void i2c_master_stop(void); +uint8_t i2c_master_write(uint8_t data); +uint8_t i2c_master_read(int); +void i2c_reset_state(void); +void i2c_slave_init(uint8_t address); + + +static inline unsigned char i2c_start_read(unsigned char addr) { + return i2c_master_start((addr << 1) | I2C_READ); +} + +static inline unsigned char i2c_start_write(unsigned char addr) { + return i2c_master_start((addr << 1) | I2C_WRITE); +} + +// from SSD1306 scrips +extern unsigned char i2c_rep_start(unsigned char addr); +extern void i2c_start_wait(unsigned char addr); +extern unsigned char i2c_readAck(void); +extern unsigned char i2c_readNak(void); +extern unsigned char i2c_read(unsigned char ack); + +#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); + +#endif diff --git a/keyboards/levinson/keymaps/bakingpy2u/config.h b/keyboards/levinson/keymaps/bakingpy2u/config.h new file mode 100644 index 000000000000..6b409bf0d5d3 --- /dev/null +++ b/keyboards/levinson/keymaps/bakingpy2u/config.h @@ -0,0 +1,30 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define _MASTER_RIGHT +// #define EE_HANDS + +#define TAPPING_TERM 150 + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 12 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +#define BACKLIGHT_PIN B6 +//#define BACKLIGHT_BREATHING +#define BACKLIGHT_LEVELS 7 + +#endif \ No newline at end of file diff --git a/keyboards/levinson/keymaps/bakingpy2u/keymap.c b/keyboards/levinson/keymaps/bakingpy2u/keymap.c new file mode 100644 index 000000000000..bea3f5daa014 --- /dev/null +++ b/keyboards/levinson/keymaps/bakingpy2u/keymap.c @@ -0,0 +1,206 @@ +#include "levinson.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _FN3 5 +#define _FN4 6 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + LOWER, + RAISE, + FN3, + FN4, + ADJUST, +}; + +#define KC_ KC_TRNS +#define _______ KC_TRNS + +#define KC_CAPW LGUI(LSFT(KC_3)) // Capture whole screen +#define KC_CPYW LGUI(LSFT(LCTL(KC_3))) // Copy whole screen +#define KC_CAPP LGUI(LSFT(KC_4)) // Capture portion of screen +#define KC_CPYP LGUI(LSFT(LCTL(KC_4))) // Copy portion of screen +#define KC_X0 MT(MOD_LCTL, KC_ESC) +#define KC_X1 LOWER +#define KC_X2 RAISE +#define KC_X3 LT(_FN3, KC_GRV) +#define KC_X4 MT(MOD_LSFT, KC_ENT) +#define KC_X5 BL_STEP + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + TAB , Q , W , E , R , T , Y , U , I , O , P ,MINS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + X0 , A , S , D , F , G , H , J , K , L ,SCLN,QUOT, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LSFT, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH, X4 , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + X3 ,LCTL, X1 ,LGUI,SPC ,SPC , BSPC,BSPC, X2 ,RALT, UP ,RGHT + //`----+----+----+----+----+----' `----+----+----+----+----+----' + ), + + [_COLEMAK] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + TAB , Q , W , F , P , G , J , L , U , Y ,SCLN,MINS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + X0 , A , R , S , T , D , H , N , E , I , O ,QUOT, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LSFT, Z , X , C , V , B , K , M ,COMM,DOT ,SLSH, X4 , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + X3 ,LCTL, X1 ,LGUI,SPC ,SPC , BSPC,BSPC, X2 ,RALT, UP ,RGHT + //`----+----+----+----+----+----' `----+----+----+----+----+----' + ), + + [_DVORAK] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + TAB ,QUOT,COMM,DOT , P , Y , F , G , C , R , L ,MINS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + X0 , A , O , E , U , I , D , H , T , N , S ,SLSH, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + LSFT,SCLN, Q , J , K , X , B , M , W , V , Z , X4 , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + X3 ,LCTL, X1 ,LGUI,SPC ,SPC , BSPC,BSPC, X2 ,RALT, UP ,RGHT + //`----+----+----+----+----+----' `----+----+----+----+----+----' + ), + + [_LOWER] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + X5 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + DEL ,CAPP,LEFT,RGHT, UP ,LBRC, RBRC, P4 , P5 , P6 ,PLUS,PIPE, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + ,CPYP, , ,DOWN,LCBR, RCBR, P1 , P2 , P3 ,MINS, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , ,DEL , DEL , , P0 ,PDOT, , + //`----+----+----+----+----+----' `----+----+----+----+----+----' + ), + + [_RAISE] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + ,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN, , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + DEL ,MPRV,MNXT,VOLU,PGUP,UNDS, EQL ,HOME, , , ,BSLS, + //|----+----+----+----+----+----| |----+----+----+----+----+----| + MUTE,MSTP,MPLY,VOLD,PGDN,MINS, PLUS,END , , , , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , , , , , , , , + //`----+----+----+----+----+----' `----+----+----+----+----+----' + ), + + [_FN3] = KC_KEYMAP( + //,----+----+----+----+----+----. ,----+----+----+----+----+----. + F12 , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , , , , , , , , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , , , , , , , , , + //|----+----+----+----+----+----| |----+----+----+----+----+----| + , , , , , , , , , , , + //`----+----+----+----+----+----' `----+----+----+----+----+----' + ), + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset|RGB Tg|RGB Md|Hue Up|Hue Dn|Sat Up|Sat Dn|Val Up|Val Dn| | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ + [_ADJUST] = KEYMAP( \ + _______, RESET , RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, _______, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ) + + +}; + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +#endif + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_colemak); + #endif + persistent_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_dvorak); + #endif + persistent_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + } + return true; +} diff --git a/keyboards/levinson/keymaps/bakingpy2u/rules.mk b/keyboards/levinson/keymaps/bakingpy2u/rules.mk new file mode 100644 index 000000000000..22b6ec476625 --- /dev/null +++ b/keyboards/levinson/keymaps/bakingpy2u/rules.mk @@ -0,0 +1,6 @@ +RGBLIGHT_ENABLE = yes +BACKLIGHT_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/levinson/keymaps/default/config.h b/keyboards/levinson/keymaps/default/config.h new file mode 100644 index 000000000000..7f33a43630aa --- /dev/null +++ b/keyboards/levinson/keymaps/default/config.h @@ -0,0 +1,37 @@ +/* +This is the c configuration file for the keymap + +Copyright 2012 Jun Wako +Copyright 2015 Jack Humbert + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define _MASTER_RIGHT +// #define EE_HANDS + +#endif \ No newline at end of file diff --git a/keyboards/levinson/keymaps/default/keymap.c b/keyboards/levinson/keymaps/default/keymap.c new file mode 100644 index 000000000000..4bee2c5e6d68 --- /dev/null +++ b/keyboards/levinson/keymaps/default/keymap.c @@ -0,0 +1,214 @@ +#include "levinson.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + LOWER, + RAISE, + ADJUST, +}; + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = KEYMAP( \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ +), + +/* Colemak + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_COLEMAK] = KEYMAP( \ + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ + KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ +), + +/* Dvorak + * ,-----------------------------------------------------------------------------------. + * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_DVORAK] = KEYMAP( \ + KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ + KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ + KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \ + ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ +), + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = KEYMAP( \ + KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ +), + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = KEYMAP( \ + KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ + KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ +), + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = KEYMAP( \ + _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ +) + + +}; + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +#endif + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_qwerty); + #endif + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_colemak); + #endif + persistent_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_dvorak); + #endif + persistent_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + } + return true; +} \ No newline at end of file diff --git a/keyboards/levinson/keymaps/default/rules.mk b/keyboards/levinson/keymaps/default/rules.mk new file mode 100644 index 000000000000..457a3d01d4a4 --- /dev/null +++ b/keyboards/levinson/keymaps/default/rules.mk @@ -0,0 +1,3 @@ +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/levinson/levinson.c b/keyboards/levinson/levinson.c new file mode 100644 index 000000000000..2c993daece85 --- /dev/null +++ b/keyboards/levinson/levinson.c @@ -0,0 +1,16 @@ +#include "levinson.h" + +#ifdef ONEHAND_ENABLE +__attribute__ ((weak)) +const keypos_t hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = { + + {{5, 4}, {4, 4}, {3, 4}, {2, 4}, {1, 4}, {0, 4}}, + {{5, 5}, {4, 5}, {3, 5}, {2, 5}, {1, 5}, {0, 5}}, + {{5, 6}, {4, 6}, {3, 6}, {2, 6}, {1, 6}, {0, 6}}, + {{5, 7}, {4, 7}, {3, 7}, {2, 7}, {1, 7}, {0, 7}}, + {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}}, + {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}}, + {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}}, + {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}}, +}; +#endif diff --git a/keyboards/levinson/levinson.h b/keyboards/levinson/levinson.h new file mode 100644 index 000000000000..c69a06faba9a --- /dev/null +++ b/keyboards/levinson/levinson.h @@ -0,0 +1,25 @@ +#ifndef LEVINSON_H +#define LEVINSON_H + +#include "quantum.h" + +#include QMK_SUBPROJECT_H + +// Used to create a keymap using only KC_ prefixed keys +#define KC_KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \ + ) \ + KEYMAP( \ + KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \ + KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \ + KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \ + KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35 \ + ) + +#define LAYOUT_ortho_4x12 KEYMAP +#define KC_LAYOUT_ortho_4x12 KC_KEYMAP + +#endif \ No newline at end of file diff --git a/keyboards/levinson/matrix.c b/keyboards/levinson/matrix.c new file mode 100644 index 000000000000..9d8a14d19053 --- /dev/null +++ b/keyboards/levinson/matrix.c @@ -0,0 +1,477 @@ +/* +Copyright 2012 Jun Wako + +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 . +*/ + +/* + * scan matrix + */ +#include +#include +#include +#include "wait.h" +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "split_util.h" +#include "pro_micro.h" +#include "config.h" +#include "timer.h" +#include "backlight.h" + +#ifdef USE_I2C +# include "i2c.h" +#else // USE_SERIAL +# include "serial.h" +#endif + +#ifndef DEBOUNCING_DELAY +# define DEBOUNCING_DELAY 5 +#endif + +#if (DEBOUNCING_DELAY > 0) + static uint16_t debouncing_time; + static bool debouncing = false; +#endif + +#if (MATRIX_COLS <= 8) +# define print_matrix_header() print("\nr/c 01234567\n") +# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop(matrix[i]) +# define ROW_SHIFTER ((uint8_t)1) +#else +# error "Currently only supports 8 COLS" +#endif +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +#define ERROR_DISCONNECT_COUNT 5 + +#define SERIAL_LED_ADDR 0x00 + +#define ROWS_PER_HAND (MATRIX_ROWS/2) + +static uint8_t error_count = 0; + +static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +#if (DIODE_DIRECTION == COL2ROW) + static void init_cols(void); + static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row); + static void unselect_rows(void); + static void select_row(uint8_t row); + static void unselect_row(uint8_t row); +#elif (DIODE_DIRECTION == ROW2COL) + static void init_rows(void); + static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col); + static void unselect_cols(void); + static void unselect_col(uint8_t col); + static void select_col(uint8_t col); +#endif +__attribute__ ((weak)) +void matrix_init_quantum(void) { + matrix_init_kb(); +} + +__attribute__ ((weak)) +void matrix_scan_quantum(void) { + matrix_scan_kb(); +} + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { +} + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +void matrix_init(void) +{ + debug_enable = true; + debug_matrix = true; + debug_mouse = true; + // initialize row and col + unselect_rows(); + init_cols(); + + TX_RX_LED_INIT; + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } + + matrix_init_quantum(); + +} + +uint8_t _matrix_scan(void) +{ + int offset = isLeftHand ? 0 : (ROWS_PER_HAND); +#if (DIODE_DIRECTION == COL2ROW) + // Set row, read cols + for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) { +# if (DEBOUNCING_DELAY > 0) + bool matrix_changed = read_cols_on_row(matrix_debouncing+offset, current_row); + + if (matrix_changed) { + debouncing = true; + debouncing_time = timer_read(); + PORTD ^= (1 << 2); + } + +# else + read_cols_on_row(matrix+offset, current_row); +# endif + + } + +#elif (DIODE_DIRECTION == ROW2COL) + // Set col, read rows + for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { +# if (DEBOUNCING_DELAY > 0) + bool matrix_changed = read_rows_on_col(matrix_debouncing+offset, current_col); + if (matrix_changed) { + debouncing = true; + debouncing_time = timer_read(); + } +# else + read_rows_on_col(matrix+offset, current_col); +# endif + + } +#endif + +# if (DEBOUNCING_DELAY > 0) + if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) { + for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { + matrix[i+offset] = matrix_debouncing[i+offset]; + } + debouncing = false; + } +# endif + + return 1; +} + +#ifdef USE_I2C + +// Get rows from other half over i2c +int i2c_transaction(void) { + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + + int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); + if (err) goto i2c_error; + + // start of matrix stored at 0x00 + err = i2c_master_write(0x00); + if (err) goto i2c_error; + + // Start read + err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); + if (err) goto i2c_error; + + if (!err) { + int i; + for (i = 0; i < ROWS_PER_HAND-1; ++i) { + matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); + } + matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); + i2c_master_stop(); + } else { +i2c_error: // the cable is disconnceted, or something else went wrong + i2c_reset_state(); + return err; + } + + return 0; +} + +#else // USE_SERIAL + +int serial_transaction(void) { + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + + if (serial_update_buffers()) { + return 1; + } + + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[slaveOffset+i] = serial_slave_buffer[i]; + } + +#ifdef BACKLIGHT_ENABLE + // Write backlight level for slave to read + serial_master_buffer[SERIAL_LED_ADDR] = get_backlight_level(); +#endif + return 0; +} +#endif + +uint8_t matrix_scan(void) +{ + uint8_t ret = _matrix_scan(); + +#ifdef USE_I2C + if( i2c_transaction() ) { +#else // USE_SERIAL + if( serial_transaction() ) { +#endif + // turn on the indicator led when halves are disconnected + TXLED1; + + error_count++; + + if (error_count > ERROR_DISCONNECT_COUNT) { + // reset other half if disconnected + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[slaveOffset+i] = 0; + } + } + } else { + // turn off the indicator led on no error + TXLED0; + error_count = 0; + } + matrix_scan_quantum(); + return ret; +} + +void matrix_slave_scan(void) { + _matrix_scan(); + + int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; + +#ifdef USE_I2C + for (int i = 0; i < ROWS_PER_HAND; ++i) { + i2c_slave_buffer[i] = matrix[offset+i]; + } +#else // USE_SERIAL + for (int i = 0; i < ROWS_PER_HAND; ++i) { + serial_slave_buffer[i] = matrix[offset+i]; + } + +#ifdef BACKLIGHT_ENABLE + // Read backlight level sent from master and update level on slave + backlight_set(serial_master_buffer[SERIAL_LED_ADDR]); +#endif +#endif +} + +bool matrix_is_modified(void) +{ + if (debouncing) return false; + return true; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1<> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) +{ + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[current_row]; + + // Clear data in matrix row + current_matrix[current_row] = 0; + + // Select row and wait for row selecton to stabilize + select_row(current_row); + wait_us(30); + + // For each col... + for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { + + // Select the col pin to read (active low) + uint8_t pin = col_pins[col_index]; + uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF)); + + // Populate the matrix row with the state of the col pin + current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); + } + + // Unselect row + unselect_row(current_row); + + return (last_row_value != current_matrix[current_row]); +} + +static void select_row(uint8_t row) +{ + uint8_t pin = row_pins[row]; + _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW +} + +static void unselect_row(uint8_t row) +{ + uint8_t pin = row_pins[row]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI +} + +static void unselect_rows(void) +{ + for(uint8_t x = 0; x < ROWS_PER_HAND; x++) { + uint8_t pin = row_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +#elif (DIODE_DIRECTION == ROW2COL) + +static void init_rows(void) +{ + for(uint8_t x = 0; x < ROWS_PER_HAND; x++) { + uint8_t pin = row_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) +{ + bool matrix_changed = false; + + // Select col and wait for col selecton to stabilize + select_col(current_col); + wait_us(30); + + // For each row... + for(uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) + { + + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[row_index]; + + // Check row pin state + if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0) + { + // Pin LO, set col bit + current_matrix[row_index] |= (ROW_SHIFTER << current_col); + } + else + { + // Pin HI, clear col bit + current_matrix[row_index] &= ~(ROW_SHIFTER << current_col); + } + + // Determine if the matrix changed state + if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) + { + matrix_changed = true; + } + } + + // Unselect col + unselect_col(current_col); + + return matrix_changed; +} + +static void select_col(uint8_t col) +{ + uint8_t pin = col_pins[col]; + _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW +} + +static void unselect_col(uint8_t col) +{ + uint8_t pin = col_pins[col]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI +} + +static void unselect_cols(void) +{ + for(uint8_t x = 0; x < MATRIX_COLS; x++) { + uint8_t pin = col_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +#endif diff --git a/keyboards/levinson/readme.md b/keyboards/levinson/readme.md new file mode 100644 index 000000000000..1fcad3c1b707 --- /dev/null +++ b/keyboards/levinson/readme.md @@ -0,0 +1,20 @@ +Levinson +======== + +A split 40% split 4x12 ortholinear keyboard made and sold by Keebio. It's essentially a Let's Split with LED backlight support and 2u thumb key support. [More info at Keebio](https://keeb.io). + +Keyboard Maintainer: [Bakingpy/nooges](https://github.com/nooges) +Hardware Supported: Pro Micro +Hardware Availability: [Keebio](https://keeb.io) + +Make example for this keyboard (after setting up your build environment): + + make levinson-rev1-default + +Example of flashing this keyboard: + + make levinson-rev1-default-avrdude + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. + +A build guide for this keyboard can be found here: [Nyquist Build Guide](https://docs.keeb.io) diff --git a/keyboards/levinson/rev1/config.h b/keyboards/levinson/rev1/config.h new file mode 100644 index 000000000000..696722cfb37f --- /dev/null +++ b/keyboards/levinson/rev1/config.h @@ -0,0 +1,88 @@ +/* +Copyright 2012 Jun Wako +Copyright 2015 Jack Humbert + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef REV1_CONFIG_H +#define REV1_CONFIG_H + +#include "../config.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xCEEB +#define PRODUCT_ID 0x1146 +#define DEVICE_VER 0x0100 +#define MANUFACTURER Keebio +#define PRODUCT Levinson +#define DESCRIPTION Split 40 percent ortholinear keyboard + +/* key matrix size */ +// Rows are doubled-up +#define MATRIX_ROWS 8 +#define MATRIX_COLS 6 + +// wiring of each half +#define MATRIX_ROW_PINS { D7, E6, B4, B5 } +#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, F4 } + +#define CATERINA_BOOTLOADER + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +#define BACKLIGHT_LEVELS 7 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D3 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 12 // Number of LEDs +#define ws2812_PORTREG PORTD +#define ws2812_DDRREG DDRD + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +// #define NO_DEBUG + +/* disable print */ +// #define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + + +#endif diff --git a/keyboards/levinson/rev1/rev1.c b/keyboards/levinson/rev1/rev1.c new file mode 100644 index 000000000000..f849b5c4e248 --- /dev/null +++ b/keyboards/levinson/rev1/rev1.c @@ -0,0 +1,39 @@ +#include "levinson.h" + +#ifdef AUDIO_ENABLE + float tone_startup[][2] = SONG(STARTUP_SOUND); + float tone_goodbye[][2] = SONG(GOODBYE_SOUND); +#endif + +#ifdef SSD1306OLED +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + led_set_user(usb_led); +} +#endif + +void matrix_init_kb(void) { + + #ifdef AUDIO_ENABLE + _delay_ms(20); // gets rid of tick + PLAY_SONG(tone_startup); + #endif + + // // green led on + // DDRD |= (1<<5); + // PORTD &= ~(1<<5); + + // // orange led on + // DDRB |= (1<<0); + // PORTB &= ~(1<<0); + + matrix_init_user(); +}; + +void shutdown_user(void) { + #ifdef AUDIO_ENABLE + PLAY_SONG(tone_goodbye); + _delay_ms(150); + stop_all_notes(); + #endif +} diff --git a/keyboards/levinson/rev1/rev1.h b/keyboards/levinson/rev1/rev1.h new file mode 100644 index 000000000000..968095cba722 --- /dev/null +++ b/keyboards/levinson/rev1/rev1.h @@ -0,0 +1,60 @@ +#ifndef REV2_H +#define REV2_H + +#include "../levinson.h" + +//void promicro_bootloader_jmp(bool program); +#include "quantum.h" + + +#ifdef USE_I2C +#include +#ifdef __AVR__ + #include + #include +#endif +#endif + +//void promicro_bootloader_jmp(bool program); + +#ifndef FLIP_HALF +// Standard Keymap +// (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left) +#define KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05 }, \ + { L10, L11, L12, L13, L14, L15 }, \ + { L20, L21, L22, L23, L24, L25 }, \ + { L30, L31, L32, L33, L34, L35 }, \ + { R05, R04, R03, R02, R01, R00 }, \ + { R15, R14, R13, R12, R11, R10 }, \ + { R25, R24, R23, R22, R21, R20 }, \ + { R35, R34, R33, R32, R31, R30 } \ + } +#else +// Keymap with right side flipped +// (TRRS jack on both halves are to the right) +#define KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05 }, \ + { L10, L11, L12, L13, L14, L15 }, \ + { L20, L21, L22, L23, L24, L25 }, \ + { L30, L31, L32, L33, L34, L35 }, \ + { R00, R01, R02, R03, R04, R05 }, \ + { R10, R11, R12, R13, R14, R15 }, \ + { R20, R21, R22, R23, R24, R25 }, \ + { R30, R31, R32, R33, R34, R35 } \ + } +#endif + +#endif diff --git a/keyboards/levinson/rev1/rules.mk b/keyboards/levinson/rev1/rules.mk new file mode 100644 index 000000000000..bd518d8f273f --- /dev/null +++ b/keyboards/levinson/rev1/rules.mk @@ -0,0 +1 @@ +BACKLIGHT_ENABLE = yes diff --git a/keyboards/levinson/rules.mk b/keyboards/levinson/rules.mk new file mode 100644 index 000000000000..7b7224fd4d47 --- /dev/null +++ b/keyboards/levinson/rules.mk @@ -0,0 +1,78 @@ +SRC += matrix.c \ + i2c.c \ + split_util.c \ + serial.c \ + ssd1306.c + +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SUBPROJECT_rev1 = yes +USE_I2C = yes +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +CUSTOM_MATRIX = yes + +LAYOUTS = ortho_4x12 \ No newline at end of file diff --git a/keyboards/levinson/serial.c b/keyboards/levinson/serial.c new file mode 100644 index 000000000000..74bcbb6bf6e2 --- /dev/null +++ b/keyboards/levinson/serial.c @@ -0,0 +1,228 @@ +/* + * WARNING: be careful changing this code, it is very timing dependent + */ + +#ifndef F_CPU +#define F_CPU 16000000 +#endif + +#include +#include +#include +#include +#include "serial.h" + +#ifndef USE_I2C + +// Serial pulse period in microseconds. Its probably a bad idea to lower this +// value. +#define SERIAL_DELAY 24 + +uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; +uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; + +#define SLAVE_DATA_CORRUPT (1<<0) +volatile uint8_t status = 0; + +inline static +void serial_delay(void) { + _delay_us(SERIAL_DELAY); +} + +inline static +void serial_output(void) { + SERIAL_PIN_DDR |= SERIAL_PIN_MASK; +} + +// make the serial pin an input with pull-up resistor +inline static +void serial_input(void) { + SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK; + SERIAL_PIN_PORT |= SERIAL_PIN_MASK; +} + +inline static +uint8_t serial_read_pin(void) { + return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK); +} + +inline static +void serial_low(void) { + SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; +} + +inline static +void serial_high(void) { + SERIAL_PIN_PORT |= SERIAL_PIN_MASK; +} + +void serial_master_init(void) { + serial_output(); + serial_high(); +} + +void serial_slave_init(void) { + serial_input(); + + // Enable INT0 + EIMSK |= _BV(INT0); + // Trigger on falling edge of INT0 + EICRA &= ~(_BV(ISC00) | _BV(ISC01)); +} + +// Used by the master to synchronize timing with the slave. +static +void sync_recv(void) { + serial_input(); + // This shouldn't hang if the slave disconnects because the + // serial line will float to high if the slave does disconnect. + while (!serial_read_pin()); + serial_delay(); +} + +// Used by the slave to send a synchronization signal to the master. +static +void sync_send(void) { + serial_output(); + + serial_low(); + serial_delay(); + + serial_high(); +} + +// Reads a byte from the serial line +static +uint8_t serial_read_byte(void) { + uint8_t byte = 0; + serial_input(); + for ( uint8_t i = 0; i < 8; ++i) { + byte = (byte << 1) | serial_read_pin(); + serial_delay(); + _delay_us(1); + } + + return byte; +} + +// Sends a byte with MSB ordering +static +void serial_write_byte(uint8_t data) { + uint8_t b = 8; + serial_output(); + while( b-- ) { + if(data & (1 << b)) { + serial_high(); + } else { + serial_low(); + } + serial_delay(); + } +} + +// interrupt handle to be used by the slave device +ISR(SERIAL_PIN_INTERRUPT) { + sync_send(); + + uint8_t checksum = 0; + for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { + serial_write_byte(serial_slave_buffer[i]); + sync_send(); + checksum += serial_slave_buffer[i]; + } + serial_write_byte(checksum); + sync_send(); + + // wait for the sync to finish sending + serial_delay(); + + // read the middle of pulses + _delay_us(SERIAL_DELAY/2); + + uint8_t checksum_computed = 0; + for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { + serial_master_buffer[i] = serial_read_byte(); + sync_send(); + checksum_computed += serial_master_buffer[i]; + } + uint8_t checksum_received = serial_read_byte(); + sync_send(); + + serial_input(); // end transaction + + if ( checksum_computed != checksum_received ) { + status |= SLAVE_DATA_CORRUPT; + } else { + status &= ~SLAVE_DATA_CORRUPT; + } +} + +inline +bool serial_slave_DATA_CORRUPT(void) { + return status & SLAVE_DATA_CORRUPT; +} + +// Copies the serial_slave_buffer to the master and sends the +// serial_master_buffer to the slave. +// +// Returns: +// 0 => no error +// 1 => slave did not respond +int serial_update_buffers(void) { + // this code is very time dependent, so we need to disable interrupts + cli(); + + // signal to the slave that we want to start a transaction + serial_output(); + serial_low(); + _delay_us(1); + + // wait for the slaves response + serial_input(); + serial_high(); + _delay_us(SERIAL_DELAY); + + // check if the slave is present + if (serial_read_pin()) { + // slave failed to pull the line low, assume not present + sei(); + return 1; + } + + // if the slave is present syncronize with it + sync_recv(); + + uint8_t checksum_computed = 0; + // receive data from the slave + for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { + serial_slave_buffer[i] = serial_read_byte(); + sync_recv(); + checksum_computed += serial_slave_buffer[i]; + } + uint8_t checksum_received = serial_read_byte(); + sync_recv(); + + if (checksum_computed != checksum_received) { + sei(); + return 1; + } + + uint8_t checksum = 0; + // send data to the slave + for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { + serial_write_byte(serial_master_buffer[i]); + sync_recv(); + checksum += serial_master_buffer[i]; + } + serial_write_byte(checksum); + sync_recv(); + + // always, release the line when not in use + serial_output(); + serial_high(); + + sei(); + return 0; +} + +#endif diff --git a/keyboards/levinson/serial.h b/keyboards/levinson/serial.h new file mode 100644 index 000000000000..15fe4db7b4c6 --- /dev/null +++ b/keyboards/levinson/serial.h @@ -0,0 +1,26 @@ +#ifndef MY_SERIAL_H +#define MY_SERIAL_H + +#include "config.h" +#include + +/* TODO: some defines for interrupt setup */ +#define SERIAL_PIN_DDR DDRD +#define SERIAL_PIN_PORT PORTD +#define SERIAL_PIN_INPUT PIND +#define SERIAL_PIN_MASK _BV(PD0) +#define SERIAL_PIN_INTERRUPT INT0_vect + +#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 +#define SERIAL_MASTER_BUFFER_LENGTH 1 + +// Buffers for master - slave communication +extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; +extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; + +void serial_master_init(void); +void serial_slave_init(void); +int serial_update_buffers(void); +bool serial_slave_data_corrupt(void); + +#endif diff --git a/keyboards/levinson/split_util.c b/keyboards/levinson/split_util.c new file mode 100644 index 000000000000..7f200e6c9420 --- /dev/null +++ b/keyboards/levinson/split_util.c @@ -0,0 +1,86 @@ +#include +#include +#include +#include +#include +#include +#include "split_util.h" +#include "matrix.h" +#include "keyboard.h" +#include "config.h" +#include "timer.h" + +#ifdef USE_I2C +# include "i2c.h" +#else +# include "serial.h" +#endif + +volatile bool isLeftHand = true; + +static void setup_handedness(void) { + #ifdef EE_HANDS + isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); + #else + // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c + #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) + isLeftHand = !has_usb(); + #else + isLeftHand = has_usb(); + #endif + #endif +} + +static void keyboard_master_setup(void) { +#ifdef USE_I2C + i2c_master_init(); +#ifdef SSD1306OLED + matrix_master_OLED_init(); +#endif +#else + serial_master_init(); +#endif +} + +static void keyboard_slave_setup(void) { + timer_init(); +#ifdef USE_I2C + i2c_slave_init(SLAVE_I2C_ADDRESS); +#else + serial_slave_init(); +#endif +} + +bool has_usb(void) { + USBCON |= (1 << OTGPADE); //enables VBUS pad + _delay_us(5); + return (USBSTA & (1< +#include "eeconfig.h" + +#define SLAVE_I2C_ADDRESS 0x32 + +extern volatile bool isLeftHand; + +// slave version of matix scan, defined in matrix.c +void matrix_slave_scan(void); + +void split_keyboard_setup(void); +bool has_usb(void); +void keyboard_slave_loop(void); + +void matrix_master_OLED_init (void); + +#endif diff --git a/keyboards/levinson/subproject.mk b/keyboards/levinson/subproject.mk new file mode 100644 index 000000000000..928b1edd0268 --- /dev/null +++ b/keyboards/levinson/subproject.mk @@ -0,0 +1 @@ +SUBPROJECT_DEFAULT = rev1 From ee9a20ff3733425e6040b97a1ba8a89a4755ae79 Mon Sep 17 00:00:00 2001 From: Dylan Khor Date: Fri, 15 Sep 2017 19:21:46 -0400 Subject: [PATCH 11/45] Cleaned, revised, and updated my keymaps to reflect new changes/defaults (#1712) * add new RGB keycodes and clean up lets split keymap * extraneous cases * More cleanup and added macro * one more macro * cleaned up my planck keymap and added macros * Transitioned planck keymap to new formatting / audio modes based on new default * Remove extraneous newline in song list, add keycodes missed in previous commit * error in graphical representation of keycodes --- keyboards/lets_split/keymaps/khord/keymap.c | 122 +++------- keyboards/planck/keymaps/khord/config.h | 116 +++------- keyboards/planck/keymaps/khord/keymap.c | 237 +++----------------- keyboards/planck/keymaps/khord/rules.mk | 3 +- quantum/audio/song_list.h | 1 - 5 files changed, 96 insertions(+), 383 deletions(-) diff --git a/keyboards/lets_split/keymaps/khord/keymap.c b/keyboards/lets_split/keymaps/khord/keymap.c index 66673e889c58..d9f850e02984 100644 --- a/keyboards/lets_split/keymaps/khord/keymap.c +++ b/keyboards/lets_split/keymaps/khord/keymap.c @@ -4,24 +4,18 @@ extern keymap_config_t keymap_config; -// Each layer gets a name for readability, which is then used in the keymap matrix below. -// The underscores don't mean anything - you can have a layer called STUFF or any other name. -// Layer names don't all need to be of the same length, obviously, and you can also skip them -// entirely and just use numbers. #define _QWERTY 0 -#define _COLEMAK 1 -#define _DVORAK 2 #define _LOWER 3 #define _RAISE 4 #define _ADJUST 16 enum custom_keycodes { QWERTY = SAFE_RANGE, - COLEMAK, - DVORAK, LOWER, RAISE, ADJUST, + ADMIN, + SMSPC1 }; // Fillers to make layering more clear @@ -30,11 +24,7 @@ enum custom_keycodes { // Tap Dance Declarations enum { - SFT_CAP = 0, - LFT_HOM, - DWN_PDN, - UPP_PUP, - RGT_END + SFT_CAP = 0 }; // Dylan's additions @@ -61,49 +51,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ ), -/* Colemak - * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | R | S | T | D | H | N | E | I | O | " | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_COLEMAK] = KEYMAP( \ - KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ - KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ - KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ - ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ -), - -/* Dvorak - * ,-----------------------------------------------------------------------------------. - * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | O | E | U | I | D | H | T | N | S | / | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_DVORAK] = KEYMAP( \ - KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ - KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ - KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \ - ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ -), - /* Lower * ,-----------------------------------------------------------------------------------. * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | * |------+------+------+------+------+-------------+------+------+------+------+------| * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | END | HOME |Enter | + * | | F7 | F8 | F9 | F10 | F11 | F12 | | | END | HOME |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' @@ -111,7 +65,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_LOWER] = KEYMAP( \ KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),KC_END, KC_HOME, _______, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_END, KC_HOME, _______, \ _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ ), @@ -121,7 +75,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+-------------+------+------+------+------+------| * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |PG DN |PG UP |Enter | + * | | F7 | F8 | F9 | F10 | F11 | F12 | | |PG DN |PG UP |Enter | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' @@ -129,45 +83,34 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_RAISE] = KEYMAP( \ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ - _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGDN, KC_PGUP, _______, \ + _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_PGDN, KC_PGUP, _______, \ _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ ), /* Adjust (Lower + Raise) * ,-----------------------------------------------------------------------------------. - * | | Reset| | | | | | | | | | Del | + * | | Reset| | |AGnorm|AGswap| | | |string|string| Del | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | + * | |RGBMOD|HUE-UP|SAT-UP|BRI-UP| |PLAIN |BREATH|RANBOW| SWIRL| | | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | | | | | | | | | | | | + * | |RGBTOG|HUE-DN|SAT-DN|BRI-DN| |GRDNT | XMAS |KNIGHT| SNAKE| | CAIns| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | + * | | | | | | | | | | | CADel| * `-----------------------------------------------------------------------------------' */ [_ADJUST] = KEYMAP( \ - _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL, \ - _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ - _______, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, _______, C_A_INS, \ - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, C_A_DEL \ + _______, RESET, _______, _______, AG_NORM, AG_SWAP, _______, _______, _______, ADMIN, SMSPC1, KC_DEL, \ + _______, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, _______, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW, _______, _______, \ + _______, RGB_TOG, RGB_HUD, RGB_SAD, RGB_VAD, _______, RGB_M_G, RGB_M_X, RGB_M_K, RGB_M_SN, _______, C_A_INS, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, C_A_DEL \ ) - }; qk_tap_dance_action_t tap_dance_actions[] = { - [SFT_CAP] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS), - [LFT_HOM] = ACTION_TAP_DANCE_DOUBLE(KC_LEFT, KC_HOME), - [DWN_PDN] = ACTION_TAP_DANCE_DOUBLE(KC_DOWN, KC_PGDN), - [UPP_PUP] = ACTION_TAP_DANCE_DOUBLE(KC_UP, KC_PGUP), - [RGT_END] = ACTION_TAP_DANCE_DOUBLE(KC_RGHT, KC_END) + [SFT_CAP] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS) }; -#ifdef AUDIO_ENABLE -float tone_qwerty[][2] = SONG(QWERTY_SOUND); -float tone_dvorak[][2] = SONG(DVORAK_SOUND); -float tone_colemak[][2] = SONG(COLEMAK_SOUND); -#endif - void persistent_default_layer_set(uint16_t default_layer) { eeconfig_update_default_layer(default_layer); default_layer_set(default_layer); @@ -177,31 +120,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case QWERTY: if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(tone_qwerty); - #endif persistent_default_layer_set(1UL<<_QWERTY); } return false; break; - case COLEMAK: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(tone_colemak); - #endif - persistent_default_layer_set(1UL<<_COLEMAK); - } - return false; - break; - case DVORAK: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(tone_dvorak); - #endif - persistent_default_layer_set(1UL<<_DVORAK); - } - return false; - break; case LOWER: if (record->event.pressed) { layer_on(_LOWER); @@ -230,6 +152,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; + case ADMIN: + if (record->event.pressed) { + SEND_STRING("Administrator"); + } + return false; + break; + case SMSPC1: + if (record->event.pressed) { + SEND_STRING("Simspace1!"); + } + return false; + break; } return true; } diff --git a/keyboards/planck/keymaps/khord/config.h b/keyboards/planck/keymaps/khord/config.h index 83dece50ea43..5482aba52fdf 100644 --- a/keyboards/planck/keymaps/khord/config.h +++ b/keyboards/planck/keymaps/khord/config.h @@ -1,94 +1,44 @@ -/* -Copyright 2012 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#ifndef CONFIG_H -#define CONFIG_H - -#include "config_common.h" - -/* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x6060 -#define MANUFACTURER Ortholinear Keyboards -#define PRODUCT The Planck Keyboard -#define DESCRIPTION A compact ortholinear keyboard - -/* key matrix size */ -#define MATRIX_ROWS 4 -#define MATRIX_COLS 12 - -/* Planck PCB default pin-out */ -#define MATRIX_ROW_PINS { D0, D5, B5, B6 } -#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } -#define UNUSED_PINS - -#define AUDIO_VOICES - -#define BACKLIGHT_PIN B7 - -/* COL2ROW or ROW2COL */ -#define DIODE_DIRECTION COL2ROW - -/* define if matrix has ghost */ -//#define MATRIX_HAS_GHOST +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#ifdef AUDIO_ENABLE + #define STARTUP_SONG SONG(SONIC_RING) + #define MUSIC_ON_SONG SONG(ZELDA_PUZZLE) + #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ + SONG(COLEMAK_SOUND), \ + SONG(DVORAK_SOUND) \ + } +#endif -/* number of backlight levels */ -#define BACKLIGHT_LEVELS 3 #define BACKLIGHT_BREATHING - -/* Set 0 if debouncing isn't needed */ -#define DEBOUNCING_DELAY 5 - -/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ -#define LOCKING_SUPPORT_ENABLE -/* Locking resynchronize hack */ -#define LOCKING_RESYNC_ENABLE - -/* key combination for command */ -#define IS_COMMAND() ( \ - keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ -) - -/* Tap Dance */ #define TAPPING_TERM 150 +#define MUSIC_MASK (keycode != KC_NO) + /* - * Feature disable options - * These options are also useful to firmware size reduction. + * MIDI options */ -/* disable debug print */ -//#define NO_DEBUG - -/* disable print */ -//#define NO_PRINT +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ + +#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED -#ifdef SUBPROJECT_rev3 - #include "rev3/config.h" -#endif -#ifdef SUBPROJECT_rev4 - #include "rev4/config.h" -#endif +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 #endif diff --git a/keyboards/planck/keymaps/khord/keymap.c b/keyboards/planck/keymaps/khord/keymap.c index 0adda43af9b1..c0fd464ad4b8 100644 --- a/keyboards/planck/keymaps/khord/keymap.c +++ b/keyboards/planck/keymaps/khord/keymap.c @@ -1,42 +1,25 @@ -// This is the canonical layout file for the Quantum project. If you want to add another keyboard, -// this is the style you want to emulate. - #include "planck.h" #include "action_layer.h" -#ifdef AUDIO_ENABLE - #include "audio.h" -#endif -#include "eeconfig.h" extern keymap_config_t keymap_config; -// Each layer gets a name for readability, which is then used in the keymap matrix below. -// The underscores don't mean anything - you can have a layer called STUFF or any other name. -// Layer names don't all need to be of the same length, obviously, and you can also skip them -// entirely and just use numbers. -#define _QWERTY 0 -#define _COLEMAK 1 -#define _DVORAK 2 -#define _LOWER 3 -#define _RAISE 4 -#define _PLOVER 5 -#define _ADJUST 16 +enum planck_layers { + _QWERTY, + _LOWER, + _RAISE, + _ADJUST +}; enum planck_keycodes { QWERTY = SAFE_RANGE, - COLEMAK, - DVORAK, - PLOVER, LOWER, RAISE, BACKLIT, - EXT_PLV + ADMIN, + SMSPC1 }; -// Fillers to make layering more clear -#define _______ KC_TRNS -#define XXXXXXX KC_NO - +// LED backlight breathing #define MACRO_BREATH_TOGGLE 21 #define MACRO_BREATH_SPEED_INC 23 #define MACRO_BREATH_SPEED_DEC 24 @@ -45,13 +28,10 @@ enum planck_keycodes { #define M_BRINC M(MACRO_BREATH_SPEED_INC) #define M_BRDEC M(MACRO_BREATH_SPEED_DEC) #define M_BRDFT M(MACRO_BREATH_DEFAULT) + // Tap Dance Declarations enum { - SFT_CAP = 0, - LFT_HOM, - DWN_PDN, - UPP_PUP, - RGT_END + SFT_CAP = 0 }; // Dylan's additions @@ -72,46 +52,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_QWERTY] = { - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC }, - {CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT }, - {TD(SFT_CAP), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_T(KC_ENT)}, - {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT } -}, - -/* Colemak - * ,-----------------------------------------------------------------------------------. - * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | R | S | T | D | H | N | E | I | O | " | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_COLEMAK] = { - {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, - {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, - {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, - {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} -}, - -/* Dvorak - * ,-----------------------------------------------------------------------------------. - * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | Esc | A | O | E | U | I | D | H | T | N | S | / | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | - * `-----------------------------------------------------------------------------------' - */ -[_DVORAK] = { - {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, - {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, - {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, - {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {TD(SFT_CAP), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_T(KC_ENT)}, + {BACKLIT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} }, /* Lower @@ -120,7 +64,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+-------------+------+------+------+------+------| * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | END | HOME |Enter | + * | | F7 | F8 | F9 | F10 | F11 | F12 | | | End | Home | | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' @@ -128,7 +72,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_LOWER] = { {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, - {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),KC_END, KC_HOME, _______}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_END, KC_HOME, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, @@ -138,7 +82,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * |------+------+------+------+------+-------------+------+------+------+------+------| * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |PG DN |PG UP |Enter | + * | | F7 | F8 | F9 | F10 | F11 | F12 | | |Pg Dn |Pg Up | | * |------+------+------+------+------+------+------+------+------+------+------+------| * | | | | | | | | Next | Vol- | Vol+ | Play | * `-----------------------------------------------------------------------------------' @@ -146,78 +90,34 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_RAISE] = { {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, - {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGDN, KC_PGUP, _______}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_PGDN, KC_PGUP, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} }, -/* Plover layer (http://opensteno.org) - * ,-----------------------------------------------------------------------------------. - * | # | # | # | # | # | # | # | # | # | # | # | # | - * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | S | T | P | H | * | * | F | P | L | T | D | - * |------+------+------+------+------+------|------+------+------+------+------+------| - * |TogOut| S | K | W | R | * | * | R | B | G | S | Z | - * |------+------+------+------+------+------+------+------+------+------+------+------| - * | Exit | | | A | O | | E | U | | | | - * `-----------------------------------------------------------------------------------' - */ - -[_PLOVER] = { - {KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 }, - {XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC}, - {XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, - {EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX} -}, - /* Adjust (Lower + Raise) * ,-----------------------------------------------------------------------------------. - * | | Reset| | | | | | | | | | Del | + * | | Reset| | | | | | | |string|string| Del | * |------+------+------+------+------+-------------+------+------+------+------+------| - * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | + * | | | |Aud on|Audoff|AGnorm|AGswap| | |BRTHdf|BRTHup| | * |------+------+------+------+------+------|------+------+------+------+------+------| - * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | | + * | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | |BRTHtg|BRTHdn| CAIns| * |------+------+------+------+------+------+------+------+------+------+------+------| - * | | | | | | | | | | | | + * | | | | | | | | | | | CADel| * `-----------------------------------------------------------------------------------' */ [_ADJUST] = { - {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, M_BRDFT, KC_DEL }, - {_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, _______, _______, M_BRINC, _______}, - {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, M_BRDEC, C_A_INS}, - {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, M_BRTOG, C_A_DEL} + {_______, RESET, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF, ADMIN, SMSPC1, KC_DEL }, + {_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, _______, _______, M_BRDFT, M_BRINC, _______}, + {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, M_BRTOG, M_BRDEC, C_A_INS}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, C_A_DEL} } - }; - qk_tap_dance_action_t tap_dance_actions[] = { - [SFT_CAP] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS), - [LFT_HOM] = ACTION_TAP_DANCE_DOUBLE(KC_LEFT, KC_HOME), - [DWN_PDN] = ACTION_TAP_DANCE_DOUBLE(KC_DOWN, KC_PGDN), - [UPP_PUP] = ACTION_TAP_DANCE_DOUBLE(KC_UP, KC_PGUP), - [RGT_END] = ACTION_TAP_DANCE_DOUBLE(KC_RGHT, KC_END) + [SFT_CAP] = ACTION_TAP_DANCE_DOUBLE(KC_LSFT, KC_CAPS) }; -#ifdef AUDIO_ENABLE - -float tone_startup[][2] = SONG(SONIC_RING); //plug in -float tone_qwerty[][2] = SONG(QWERTY_SOUND); -float tone_dvorak[][2] = SONG(DVORAK_SOUND); -float tone_colemak[][2] = SONG(COLEMAK_SOUND); -float tone_plover[][2] = SONG(PLOVER_SOUND); -float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND); -float music_scale[][2] = SONG(ZELDA_PUZZLE); //music mode - -float tone_goodbye[][2] = SONG(GOODBYE_SOUND); -#endif - - -void persistent_default_layer_set(uint16_t default_layer) { - eeconfig_update_default_layer(default_layer); - default_layer_set(default_layer); -} - const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { switch(id) { case MACRO_BREATH_TOGGLE: @@ -248,28 +148,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case QWERTY: if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(tone_qwerty); - #endif - persistent_default_layer_set(1UL<<_QWERTY); - } - return false; - break; - case COLEMAK: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(tone_colemak); - #endif - persistent_default_layer_set(1UL<<_COLEMAK); - } - return false; - break; - case DVORAK: - if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(tone_dvorak); - #endif - persistent_default_layer_set(1UL<<_DVORAK); + print("mode just switched to qwerty and this is a huge string\n"); + set_single_persistent_default_layer(_QWERTY); } return false; break; @@ -304,67 +184,18 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return false; break; - case PLOVER: + case ADMIN: if (record->event.pressed) { - #ifdef AUDIO_ENABLE - stop_all_notes(); - PLAY_SONG(tone_plover); - #endif - layer_off(_RAISE); - layer_off(_LOWER); - layer_off(_ADJUST); - layer_on(_PLOVER); - if (!eeconfig_is_enabled()) { - eeconfig_init(); - } - keymap_config.raw = eeconfig_read_keymap(); - keymap_config.nkro = 1; - eeconfig_update_keymap(keymap_config.raw); + SEND_STRING("Administrator"); } return false; break; - case EXT_PLV: + case SMSPC1: if (record->event.pressed) { - #ifdef AUDIO_ENABLE - PLAY_SONG(tone_plover_gb); - #endif - layer_off(_PLOVER); + SEND_STRING("Simspace1!"); } return false; break; } return true; } - -void matrix_init_user(void) { - #ifdef AUDIO_ENABLE - startup_user(); - #endif -} - -#ifdef AUDIO_ENABLE - -void startup_user() -{ - _delay_ms(20); // gets rid of tick - PLAY_SONG(tone_startup); -} - -void shutdown_user() -{ - PLAY_SONG(tone_goodbye); - _delay_ms(150); - stop_all_notes(); -} - -void music_on_user(void) -{ - music_scale_user(); -} - -void music_scale_user(void) -{ - PLAY_SONG(music_scale); -} - -#endif diff --git a/keyboards/planck/keymaps/khord/rules.mk b/keyboards/planck/keymaps/khord/rules.mk index d1caeee9333d..c248822b2318 100644 --- a/keyboards/planck/keymaps/khord/rules.mk +++ b/keyboards/planck/keymaps/khord/rules.mk @@ -1,6 +1,5 @@ -TAP_DANCE_ENABLE = yes -CONSOLE_ENABLE = no BACKLIGHT_ENABLE = yes +TAP_DANCE_ENABLE = yes ifndef QUANTUM_DIR include ../../../../Makefile diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h index 25e66e67c19e..afb82a2981b6 100644 --- a/quantum/audio/song_list.h +++ b/quantum/audio/song_list.h @@ -116,7 +116,6 @@ S__NOTE(_REST), \ ED_NOTE(_E7 ), - #define MUSIC_ON_SOUND \ E__NOTE(_A5 ), \ E__NOTE(_B5 ), \ From afcf3a2878d5b5de0f9daba201ab44d779a8b2b1 Mon Sep 17 00:00:00 2001 From: krusli Date: Fri, 15 Sep 2017 23:56:16 +1000 Subject: [PATCH 12/45] Update Mechmini keymap, reduce reported power consumption for iOS Camera Adapter compatibility --- keyboards/mechmini/keymaps/default/keymap.c | 45 ++++++++++++++++++--- keyboards/mechmini/mechmini.h | 11 ++--- keyboards/mechmini/usbconfig.h | 2 +- 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/keyboards/mechmini/keymaps/default/keymap.c b/keyboards/mechmini/keymaps/default/keymap.c index 786132f7b165..10f11c5f55d0 100644 --- a/keyboards/mechmini/keymaps/default/keymap.c +++ b/keyboards/mechmini/keymaps/default/keymap.c @@ -14,15 +14,48 @@ along with this program. If not, see . */ #include "mechmini.h" +#define _BL 0 +#define _FN1 1 +#define _FN2 2 +#define _FN3 3 +#define _____ KC_TRNS const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - KEYMAP( - TAB, Q, W, E, R, T, Y, U, I, O, P, BSLS, - LCTL, A, S, D, F, G, H, J, K, L, SCLN, - LSFT, Z, X, C, V, B, N, M, COMM, DOT, SLSH, - GRV, LALT, LGUI, SPC, ENT, RGUI, RALT, RCTL - ) + [_BL] = KEYMAP( + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, MO(_FN2), + KC_LCTL, KC_LGUI, KC_LALT, _____, KC_SPC, _____, MO(_FN1), MO(_FN3) + ), + [_FN1] = KEYMAP( + _____, _____, KC_UP, KC_MUTE, KC_VOLD, KC_VOLU, KC_MRWD, KC_MPLY, KC_MFFD, KC_SLCK, KC_PAUS, KC_DEL, + KC_CAPS, KC_LEFT, KC_DOWN, KC_RIGHT, _____, _____, _____, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, + _____, _____, _____, _____, _____, _____, _____, KC_END, KC_PGDN, _____, _____, + _____, _____, _____, _____, _____, _____, _____, _____ + ), + [_FN2] = KEYMAP( + KC_GRAVE, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, + KC_CAPS, _____, _____, _____, _____, KC_LBRC, KC_RBRC, KC_BSLS, KC_MINS, KC_EQL, _____, + _____, _____, _____, _____, _____, _____, _____, KC_SCLN, KC_QUOT, KC_SLSH, _____, + _____, _____, _____, _____, _____, _____, _____, _____ + ), + [_FN3] = KEYMAP( + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, + _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, + _____, _____, _____, _____, _____, _____, _____, _____ + ) }; +/** + * Blank keymap + [0] = KEYMAP( + _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____ + _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, + _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, + _____, _____, _____, _____, _____, _____, _____, _____ + ) + */ + const uint16_t PROGMEM fn_actions[] = { }; diff --git a/keyboards/mechmini/mechmini.h b/keyboards/mechmini/mechmini.h index 4dc1e88878c5..35c85c839d88 100644 --- a/keyboards/mechmini/mechmini.h +++ b/keyboards/mechmini/mechmini.h @@ -20,18 +20,19 @@ along with this program. If not, see . #include "keycode.h" #include "action.h" +#include "quantum.h" #define KEYMAP( \ K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, \ K02, K12, K22, K32, K42, K52, K36, KD6, KD7, K37, KA2, \ K01, K11, K21, K31, K41, K51, K46, KE6, KE7, K47, KA1, \ - K00, K10, K20, K56, K57, KB0, KC0, K66 \ + K00, K10, K20, K56, K57, KB0, KC0, K66 \ ) \ { \ - { KC_##K00, KC_##K10, KC_##K20, KC_##K56, KC_NO, KC_NO, KC_##K57, KC_NO, KC_##KB0, KC_##KC0, KC_##K66, KC_NO, KC_NO, KC_NO, KC_NO }, \ - { KC_##K01, KC_##K11, KC_##K21, KC_##K31, KC_##K41, KC_##K51, KC_##K46, KC_##KE6, KC_##KE7, KC_##K47, KC_##KA1, KC_NO, KC_NO, KC_NO, KC_NO }, \ - { KC_##K02, KC_##K12, KC_##K22, KC_##K32, KC_##K42, KC_##K52, KC_##K36, KC_##KD6, KC_##KD7, KC_##K37, KC_##KA2, KC_NO, KC_NO, KC_NO, KC_NO }, \ - { KC_##K03, KC_##K13, KC_##K23, KC_##K33, KC_##K43, KC_##K53, KC_##K26, KC_##KC6, KC_##KC7, KC_##K27, KC_##KA3, KC_##KB3, KC_NO, KC_NO, KC_NO }, \ + { K00, K10, K20, K56, KC_NO, K57, KC_NO, KC_NO, KB0, KC0, K66, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { K01, K11, K21, K31, K41, K51, K46, KE6, KE7, K47, KA1, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { K02, K12, K22, K32, K42, K52, K36, KD6, KD7, K37, KA2, KC_NO, KC_NO, KC_NO, KC_NO }, \ + { K03, K13, K23, K33, K43, K53, K26, KC6, KC7, K27, KA3, KB3, KC_NO, KC_NO, KC_NO }, \ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ { KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \ diff --git a/keyboards/mechmini/usbconfig.h b/keyboards/mechmini/usbconfig.h index d2d848fcdc8f..b6b8cdbbb4df 100644 --- a/keyboards/mechmini/usbconfig.h +++ b/keyboards/mechmini/usbconfig.h @@ -118,7 +118,7 @@ section at the end of this file). /* Define this to 1 if the device has its own power supply. Set it to 0 if the * device is powered from the USB bus. */ -#define USB_CFG_MAX_BUS_POWER 500 +#define USB_CFG_MAX_BUS_POWER 100 /* Set this variable to the maximum USB bus power consumption of your device. * The value is in milliamperes. [It will be divided by two since USB * communicates power requirements in units of 2 mA.] From 7bcf3e2781c754eb2b5ac62ece1021bdcca783b6 Mon Sep 17 00:00:00 2001 From: Rob Rogers Date: Fri, 15 Sep 2017 14:32:35 -0500 Subject: [PATCH 13/45] Wording changes for the WSL install script --- util/wsl_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/wsl_install.sh b/util/wsl_install.sh index 1574803534b2..d11c78ac7165 100644 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -51,7 +51,7 @@ popd echo echo "Creating a softlink to the utils directory as ~/qmk_utils." echo "This is needed so that the the make system can find all utils it need." -read -p "Press any key to continue (ctrl-c to abort)" +read -p "Press enter to continue (ctrl-c to abort)" ln -sfn "$dir" ~/qmk_utils if grep "^source ~/qmk_utils/activate_wsl.sh$" ~/.bashrc @@ -91,7 +91,7 @@ done echo echo "******************************************************************************" echo "Installation completed!" -echo "You need to open a new batch command prompt for all the utils to work properly" +echo "You need to open a new bash command prompt for all the utils to work properly" echo "******************************************************************************" popd > /dev/null From 3e1f388bda5b3d8ad6daeb32de9cdc4e41a34d45 Mon Sep 17 00:00:00 2001 From: lucwastiaux Date: Sat, 16 Sep 2017 10:00:26 +0800 Subject: [PATCH 14/45] Adding Ergodox EZ and Atreus Dvorak 42-key layouts (#1705) * importing 42 key dvorak layout * added comment for build instructions * adding atreus dvorak 42 key layout * added readme * add readme * build instructions * additional MEH shortcuts --- .../atreus/keymaps/dvorak_42_key/README.md | 21 ++ .../atreus/keymaps/dvorak_42_key/config.h | 106 ++++++ .../atreus/keymaps/dvorak_42_key/keymap.c | 93 +++++ .../keymaps/dvorak_42_key/README.md | 17 + .../ergodox_ez/keymaps/dvorak_42_key/keymap.c | 321 ++++++++++++++++++ 5 files changed, 558 insertions(+) create mode 100644 keyboards/atreus/keymaps/dvorak_42_key/README.md create mode 100644 keyboards/atreus/keymaps/dvorak_42_key/config.h create mode 100644 keyboards/atreus/keymaps/dvorak_42_key/keymap.c create mode 100644 keyboards/ergodox_ez/keymaps/dvorak_42_key/README.md create mode 100644 keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c diff --git a/keyboards/atreus/keymaps/dvorak_42_key/README.md b/keyboards/atreus/keymaps/dvorak_42_key/README.md new file mode 100644 index 000000000000..45e3ab75cc08 --- /dev/null +++ b/keyboards/atreus/keymaps/dvorak_42_key/README.md @@ -0,0 +1,21 @@ +Overview +======== + +This is a dvorak based layout for the Atreus. Its basic key layout is similar to the ergodox_ez "dvorak_42_key" layout. In fact this layout was created for seamless switching between the Ergodox EZ and Atreus. + +How to build and flash +---------------------- + +to build; +make atreus-dvorak_42_key + +to flash: +avrdude -p atmega32u4 -c avr109 -U flash:w:atreus_dvorak_42_key.hex -P COM7 + +Layers +------ +* BASE: basic dvorak layout +* KEYNAV: arrow-key navigation. Momentary toggle held by thumb allows the right hand to navigate through text as well as copy/paste/cut, page up/page down +* KEYSEL: similar to KEYNAV, except for shift-selection +* COMBINED: this is a layer that combines numbers, brackets and special characters. !@#$%^&*( can be type by shift+COMBINED+1/2/3/etc.. +* MOUSE: mouse navigation, as well as browser tab-left/tab-right shortcuts \ No newline at end of file diff --git a/keyboards/atreus/keymaps/dvorak_42_key/config.h b/keyboards/atreus/keymaps/dvorak_42_key/config.h new file mode 100644 index 000000000000..43c51fb2f28e --- /dev/null +++ b/keyboards/atreus/keymaps/dvorak_42_key/config.h @@ -0,0 +1,106 @@ +/* +Copyright 2012 Jun Wako + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + + +#include "config_common.h" + + +// mouse speed + +#define MOUSEKEY_INTERVAL 15 +#define MOUSEKEY_DELAY 100 +#define MOUSEKEY_TIME_TO_MAX 100 +#define MOUSEKEY_MAX_SPEED 3 + +#define MOUSEKEY_WHEEL_DELAY 500 +#define MOUSEKEY_WHEEL_DELTA 1 +#define MOUSEKEY_WHEEL_MAX_SPEED 1 +#define MOUSEKEY_WHEEL_TIME_TO_MAX 100 + +/* USB Device descriptor parameter */ + +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6060 +#define DEVICE_VER 0x0001 +#define MANUFACTURER Technomancy +#define PRODUCT Atreus +#define DESCRIPTION q.m.k. keyboard firmware for Atreus + +/* key matrix size */ +#define MATRIX_ROWS 4 +#define MATRIX_COLS 11 + +// Change this to how you wired your keyboard +// COLS: Left to right, ROWS: Top to bottom +#if defined(ATREUS_ASTAR) +# define MATRIX_ROW_PINS { D0, D1, D3, D2 } +#if defined(PCBDOWN) +# define MATRIX_COL_PINS { B7, D6, F7, F6, B6, D4, E6, B4, B5, C6, D7 } +#else +# define MATRIX_COL_PINS { D7, C6, B5, B4, E6, D4, B6, F6, F7, D6, B7 } +#endif +# define UNUSED_PINS +#elif defined(ATREUS_TEENSY2) +# define MATRIX_ROW_PINS { D0, D1, D2, D3 } +# define MATRIX_COL_PINS { F6, F5, F4, B7, B6, B5, B4, B3, B2, B1, B0 } +# define UNUSED_PINS +#endif + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +//#define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +#endif diff --git a/keyboards/atreus/keymaps/dvorak_42_key/keymap.c b/keyboards/atreus/keymaps/dvorak_42_key/keymap.c new file mode 100644 index 000000000000..8f8c319c5467 --- /dev/null +++ b/keyboards/atreus/keymaps/dvorak_42_key/keymap.c @@ -0,0 +1,93 @@ + +#include "atreus.h" + +// layers +#define BASE 0 +#define KEYNAV 1 +#define KEYSEL 2 +#define MOUSE 3 +#define COMBINED 4 + +// macros +#define MOUSE_TOGGLE 1 +#define MOUSE_LOCK 2 + +static bool mouse_lock = false; + +// building instructions: +// make atreus-dvorak_42_key + +// flashing instructions: +// avrdude -p atmega32u4 -c avr109 -U flash:w:atreus_dvorak_42_key.hex -P COM7 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[BASE] = { + {KC_QUOTE, KC_COMMA, KC_DOT, KC_P, KC_Y, KC_TRNS, KC_F, KC_G, KC_C, KC_R, KC_L, }, + {KC_A, KC_O, KC_E, KC_U, KC_I, KC_TRNS, KC_D, KC_H, KC_T, KC_N, KC_S, }, + {KC_SCOLON, KC_Q, KC_J, KC_K, KC_X, MO(KEYNAV), KC_B, KC_M, KC_W, KC_V, KC_Z, }, + {OSM(MOD_LSFT), OSM(MOD_LCTL), M(MOUSE_TOGGLE), MO(KEYSEL), MO(COMBINED), KC_ENTER, KC_SPACE, KC_BSPC, RCTL(KC_BSPC), KC_CAPSLOCK, OSM(MOD_LSFT), } +}, + +[KEYNAV] = { + {KC_ESC, MEH(KC_A), RCTL(KC_Z), RCTL(KC_S), MEH(KC_B), KC_TRNS, KC_TRNS, KC_HOME, KC_UP, KC_END, KC_PGUP, }, + {MEH(KC_C), MEH(KC_D), RSFT(KC_TAB), KC_TAB, MEH(KC_E), KC_TRNS, LCTL(KC_LEFT), KC_LEFT, KC_DOWN, KC_RIGHT, LCTL(KC_RIGHT), }, + {MEH(KC_F), MEH(KC_G), MEH(KC_H), MEH(KC_I), MEH(KC_J), KC_TRNS, KC_TRNS, RCTL(KC_C), RCTL(KC_X), RCTL(KC_V), KC_PGDOWN, }, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENTER, KC_SPACE, KC_BSPC, RCTL(KC_BSPC), KC_DELETE, LCTL(KC_DELETE), } +}, + +[KEYSEL] = { + {KC_TRNS, KC_TRNS, RCTL(KC_Z), RCTL(KC_S), KC_TRNS, KC_TRNS, KC_TRNS, RSFT(KC_HOME), RSFT(KC_UP), RSFT(KC_END), RSFT(KC_PGUP), }, + {KC_TRNS, KC_TRNS, RSFT(KC_TAB), KC_TAB, KC_TRNS, KC_TRNS, RSFT(RCTL(KC_LEFT)), RSFT(KC_LEFT), RSFT(KC_DOWN), RSFT(KC_RIGHT), RSFT(RCTL(KC_RIGHT)), }, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RCTL(KC_C),RCTL(KC_X), RCTL(KC_V), RSFT(KC_PGDN), }, + {RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_ENTER, KC_SPACE, KC_BSPC, RCTL(KC_BSPC), KC_DELETE, LCTL(KC_DELETE), } +}, + +[COMBINED] = { + {KC_ESC, KC_LABK, KC_RABK, KC_DQUO, KC_GRAVE, KC_TRNS, KC_PLUS, KC_7, KC_8, KC_9, KC_ASTR, }, + {KC_LPRN, KC_RPRN, KC_LBRACKET, KC_RBRACKET, KC_UNDS, KC_TRNS, KC_MINS, KC_4, KC_5, KC_6, KC_SLSH, }, + {KC_LCBR, KC_RCBR, KC_BSLS, KC_PIPE, KC_TILD, KC_TRNS, KC_EQUAL, KC_1, KC_2, KC_3, KC_QUES, }, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_0, KC_DOT, KC_TRNS, KC_TRNS, } +}, + +[MOUSE] = { + {KC_TRNS, KC_PGUP, KC_MS_WH_UP, KC_UP, KC_TRNS, KC_TRNS, KC_UP, KC_HOME, KC_MS_U, KC_END, KC_MS_WH_UP, }, + {KC_MS_ACCEL0, KC_PGDN, KC_MS_WH_DOWN, KC_DOWN, KC_TRNS, KC_TRNS, KC_DOWN, KC_MS_L, KC_MS_D, KC_MS_R, KC_MS_WH_DOWN, }, + {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN3, MEH(KC_X), MEH(KC_Y), MEH(KC_Z), KC_F5, RCTL(KC_W), }, + {KC_TRNS, M(MOUSE_LOCK), KC_TRNS, KC_MS_ACCEL0, KC_TRNS, KC_BTN1, KC_BTN2, RSFT(RCTL(KC_TAB)), RCTL(KC_TAB), RCTL(KC_T), LALT(KC_LEFT), } +}, + + +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + // MACRODOWN only works in this function + switch(id) { + case MOUSE_TOGGLE: + if (record->event.pressed) { + layer_on(MOUSE); + } else { + if(!mouse_lock) + layer_off(MOUSE); + } + break; + case MOUSE_LOCK: + if (record->event.pressed) + { + if(mouse_lock) + { + mouse_lock = false; + layer_off(MOUSE); + } + else + mouse_lock = true; + } + break; + } + return MACRO_NONE; +}; diff --git a/keyboards/ergodox_ez/keymaps/dvorak_42_key/README.md b/keyboards/ergodox_ez/keymaps/dvorak_42_key/README.md new file mode 100644 index 000000000000..18af2cdeef2c --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/dvorak_42_key/README.md @@ -0,0 +1,17 @@ +Overview +======== + +This is a dvorak based layout for the Ergodox EZ. Its basic key layout is similar to the Atreus "dvorak_42_key" layout. In fact this layout was created for seamless switching between the Ergodox EZ and Atreus. On the base layer, the keys that don't exist on the Atreus are mapped to MEH shortcuts and can be interpreted by Autohotkey. This layout only makes use of the 42 keys that the Atreus also has for the main functionality. + +How to build +------------ +make ergodox_ez-dvorak_42_key-teensy + +Layers +------ +* BASE: basic dvorak layout +* KEYNAV: arrow-key navigation. Momentary toggle held by thumb allows the right hand to navigate through text as well as copy/paste/cut, page up/page down +* KEYSEL: similar to KEYNAV, except for shift-selection +* COMBINED: this is a layer that combines numbers, brackets and special characters. !@#$%^&*( can be type by shift+COMBINED+1/2/3/etc.. +* MOUSE: mouse navigation, as well as browser tab-left/tab-right shortcuts +* SHELL_NAV: Linux Bash shortcuts (move forward/backward in command line, move between screen windows, Ctrl+C, recall last argument, etc \ No newline at end of file diff --git a/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c b/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c new file mode 100644 index 000000000000..55168e85d56d --- /dev/null +++ b/keyboards/ergodox_ez/keymaps/dvorak_42_key/keymap.c @@ -0,0 +1,321 @@ +#include QMK_KEYBOARD_H +#include "debug.h" +#include "action_layer.h" +#include "version.h" + + +// to build this keymap +// make ergodox_ez-dvorak_42_key-teensy + +static bool mouse_lock = false; + +enum custom_keycodes { + PLACEHOLDER = SAFE_RANGE, // can always be here + EPRM, + VRSN, + RGB_SLD, + +}; + + +#define BASE 0 // base dvorak layer +#define KEYNAV 1 // arrow navigation (right hand) +#define KEYSEL 2 // arrow navigation + shift (allow text selection) +#define SHELL_NAV 3 // bash shortcuts +#define MOUSE 4 // mouse layer (can be locked with lock key) +#define COMBINED 5 // combined numbers and symbols layer + +// macros +#define MOUSE_TOGGLE 1 +#define MOUSE_LOCK 2 +#define SCREEN_TAB_LEFT 4 +#define SCREEN_TAB_RIGHT 5 +#define SCREEN_NEW_TAB 6 +#define SWITCH_NDS 7 +#define SCREEN_COPY_MODE 8 +#define SCREEN_PASTE 9 +#define SHELL_RECALL_LAST_ARG_REMOVE_FIRST_COMMAND 15 + + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [BASE] = KEYMAP( + // left hand + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, + KC_TAB, KC_QUOTE, KC_COMMA, KC_DOT, KC_P, KC_Y, MEH(KC_2), + MO(SHELL_NAV), KC_A, KC_O, KC_E, KC_U, KC_I, + MEH(KC_0), KC_SCOLON, KC_Q, KC_J, KC_K, KC_X, MEH(KC_3), + MEH(KC_1), OSM(MOD_LSFT), OSM(MOD_LCTL), M(MOUSE_TOGGLE), MO(KEYSEL), + + // left thumb cluster + MEH(KC_4), MEH(KC_5), + MEH(KC_6), + MO(COMBINED),MO(KEYNAV), OSM(MOD_LALT), + + // right hand + KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, MEH(KC_9), + MEH(KC_7), KC_F, KC_G, KC_C, KC_R, KC_L, MEH(KC_F1), + KC_D, KC_H, KC_T, KC_N, KC_S, MEH(KC_F2), + MEH(KC_8), KC_B, KC_M, KC_W, KC_V, KC_Z, MEH(KC_F3), + KC_BSPC, RCTL(KC_BSPC), KC_CAPSLOCK, OSM(MOD_LSFT),MEH(KC_F4), + + // right thumb cluster + MEH(KC_F5),MEH(KC_F6),MEH(KC_F7),MEH(KC_F8),KC_ENTER,KC_SPACE + + ), + + [KEYNAV] = KEYMAP( + // left hand + KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS,KC_ESC, MEH(KC_F9), RCTL(KC_Z), RCTL(KC_S), MEH(KC_F10), KC_TRNS, + KC_TRNS,MEH(KC_F11), MEH(KC_F12), RSFT(KC_TAB), KC_TAB, MEH(KC_A), + KC_TRNS,MEH(KC_B), MEH(KC_C), MEH(KC_D), MEH(KC_E), MEH(KC_F), KC_TRNS, + KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + // left thumb cluster + KC_TRNS,KC_TRNS,KC_TRNS,TO(MOUSE),KC_TRNS,KC_TRNS, + + // right hand + KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, MEH(KC_G), + KC_TRNS,KC_NO, KC_HOME, KC_UP, KC_END, KC_PGUP, MEH(KC_H), + LCTL(KC_LEFT), KC_LEFT, KC_DOWN, KC_RIGHT, LCTL(KC_RIGHT), MEH(KC_I), + KC_TRNS,KC_NO, RCTL(KC_C), RCTL(KC_X), RCTL(KC_V), KC_PGDOWN, MEH(KC_J), + KC_BSPC, RCTL(KC_BSPC), KC_DELETE, LCTL(KC_DELETE), MEH(KC_K), + + // right thumb cluster + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS + ), + + // key selection layer + [KEYSEL] = KEYMAP( + // left hand + KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS,MEH(KC_G), MEH(KC_H),MEH(KC_I), MEH(KC_J), MEH(KC_K), KC_TRNS, + KC_TRNS,MEH(KC_L), MEH(KC_M),MEH(KC_N), MEH(KC_O), MEH(KC_P), + KC_TRNS,MEH(KC_Q), MEH(KC_R),MEH(KC_S), MEH(KC_T), MEH(KC_U), KC_TRNS, + // bottom row + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + // thumb cluster + 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, MEH(KC_Q), + RSFT(KC_PGUP), KC_TRNS, RSFT(KC_HOME), RSFT(KC_UP), RSFT(KC_END), RSFT(KC_PGUP), MEH(KC_R), + RSFT(RCTL(KC_LEFT)), RSFT(KC_LEFT), RSFT(KC_DOWN), RSFT(KC_RIGHT), RSFT(RCTL(KC_RIGHT)), MEH(KC_S), + RSFT(KC_PGDN), KC_TRNS, RCTL(KC_C), RCTL(KC_X), RCTL(KC_V), RSFT(KC_PGDN), MEH(KC_T), + // bottom row + KC_BSPC, RCTL(KC_BSPC), KC_DELETE, LCTL(KC_DELETE), MEH(KC_U), + // thumb cluster + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS + ), + + // shell navigation layer + [SHELL_NAV] = KEYMAP( + // left 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_TRNS, + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + // bottom row + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + // thumb cluster + KC_TRNS,KC_TRNS, + LALT(KC_D), + KC_TRNS,RCTL(KC_W),KC_TRNS, + // right hand + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, M(SWITCH_NDS), + RCTL(KC_L), RCTL(KC_W), KC_HOME, KC_UP, KC_END, LALT(KC_D), RCTL(KC_R), + LALT(KC_B), KC_LEFT, KC_DOWN, KC_RIGHT, LALT(KC_F), LALT(KC_DOT), + RCTL(KC_C), RCTL(KC_U), M(SCREEN_COPY_MODE), M(SCREEN_PASTE), MEH(KC_V), RCTL(KC_K), M(SHELL_RECALL_LAST_ARG_REMOVE_FIRST_COMMAND), + // bottom row + M(SCREEN_TAB_LEFT), M(SCREEN_TAB_RIGHT), M(SCREEN_NEW_TAB), KC_TRNS, KC_TRNS, + // thumb cluster + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS + ), + + + + [COMBINED] = KEYMAP( + + // left hand + KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, + KC_TRNS,KC_ESC, KC_LABK, KC_RABK, KC_DQUO, KC_GRAVE,KC_TRNS, + KC_TRNS,KC_LPRN, KC_RPRN, KC_LBRACKET, KC_RBRACKET, KC_UNDS, + KC_TRNS,KC_LCBR, KC_RCBR, KC_BSLS, KC_PIPE, KC_TILD,KC_TRNS, + // bottom row + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS, + // thumb cluster + 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, MEH(KC_L), + KC_TRNS, KC_PLUS, KC_7, KC_8, KC_9, KC_ASTR, MEH(KC_M), + KC_MINS, KC_4, KC_5, KC_6, KC_SLSH, MEH(KC_N), + KC_TRNS, KC_EQUAL, KC_1, KC_2, KC_3, KC_QUES, MEH(KC_O), + // bottom row + KC_0, KC_DOT, KC_TRNS, KC_TRNS, MEH(KC_P), + // thumb cluster + KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS), + + + [MOUSE] = KEYMAP( + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_PGUP, KC_MS_WH_UP, KC_UP, KC_TRNS, KC_TRNS, + KC_TRNS, KC_MS_ACCEL0, KC_PGDN, KC_MS_WH_DOWN, KC_DOWN, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, M(MOUSE_LOCK), KC_TRNS, KC_MS_ACCEL0, + + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_BTN3, KC_TRNS, + // right hand + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_UP, KC_HOME, KC_MS_U, KC_END, KC_MS_WH_UP, KC_TRNS, + KC_DOWN, KC_MS_L, KC_MS_D, KC_MS_R, KC_MS_WH_DOWN, KC_TRNS, + KC_TRNS, MEH(KC_X), MEH(KC_Y), MEH(KC_Z), KC_F5, RCTL(KC_W), KC_TRNS, + // browser tab control + RSFT(RCTL(KC_TAB)), RCTL(KC_TAB), RCTL(KC_T), LALT(KC_LEFT), KC_TRNS, + KC_TRNS, KC_TRNS, + KC_TRNS, + KC_TRNS, KC_BTN1, KC_BTN2 + ), + + +}; + +const uint16_t PROGMEM fn_actions[] = { + [1] = ACTION_LAYER_TAP_TOGGLE(1) +}; + +// leaving this in place for compatibilty with old keymaps cloned and re-compiled. +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + switch(id) { + case MOUSE_TOGGLE: + if (record->event.pressed) { + layer_on(MOUSE); + } else { + if(!mouse_lock) + layer_off(MOUSE); + } + break; + case MOUSE_LOCK: + if (record->event.pressed) + { + if(mouse_lock) + { + mouse_lock = false; + layer_off(MOUSE); + } + else + mouse_lock = true; + } + break; + case SCREEN_TAB_LEFT: + if (record->event.pressed) { + return MACRO( D(LCTL), T(A), U(LCTL), T(P), END); + } + break; + case SCREEN_TAB_RIGHT: + if (record->event.pressed) { + return MACRO( D(LCTL), T(A), U(LCTL), T(N), END); + } + break; + case SCREEN_NEW_TAB: + if (record->event.pressed) { + return MACRO( D(LCTL), T(A), U(LCTL), T(C), END); + } + break; + case SCREEN_COPY_MODE: + if (record->event.pressed) { + return MACRO( D(LCTL), T(A), U(LCTL), T(ESC), END); + } + break; + case SCREEN_PASTE: + if (record->event.pressed) { + return MACRO( D(LCTL), T(A), U(LCTL), T(RBRC), END); + } + break; + case SWITCH_NDS: + if (record->event.pressed) { + return MACRO( D(LSFT), + T(F11), + U(LSFT), + W(255), + D(LALT), + T(TAB), + U(LALT), + END); + } + break; + case SHELL_RECALL_LAST_ARG_REMOVE_FIRST_COMMAND: + if (record->event.pressed) { + return MACRO( T(UP), T(HOME), D(LALT), T(D), U(LALT), END); + } + break; + } + return MACRO_NONE; +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + // dynamically generate these. + case EPRM: + if (record->event.pressed) { + eeconfig_init(); + } + return false; + break; + case VRSN: + if (record->event.pressed) { + SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); + } + return false; + break; + case RGB_SLD: + if (record->event.pressed) { + rgblight_mode(1); + } + return false; + break; + + } + return true; +} + +void led_set_user(uint8_t usb_led) { + if (usb_led & (1< Date: Fri, 15 Sep 2017 22:01:51 -0400 Subject: [PATCH 15/45] Updated README in ergodox_infinity keyboard (#1702) * changed 'infinity' to 'ergodox_infinity' and specified to be in the top-level directory as per recent changes to directory structure of QMK_firmware git repo * accidently removed '-' in last line of readme --- keyboards/ergodox_infinity/readme.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/keyboards/ergodox_infinity/readme.md b/keyboards/ergodox_infinity/readme.md index d3277d18b821..4ad5990b8a04 100644 --- a/keyboards/ergodox_infinity/readme.md +++ b/keyboards/ergodox_infinity/readme.md @@ -3,6 +3,8 @@ The Infinity is two completely independent keyboards, and needs to be flashed for the left and right halves seperately. To flash them: + - Make sure you are in the top-level qmk_firmware directory + - Build the firmware with `make ergodox_infinity-keymapname` - Plug in the left hand keyboard only. @@ -42,4 +44,5 @@ You have a few options in how you flash the firmware: - For minor changes such as changing only the keymap without having updated any part of the firmware code itself, you can program only the MASTER half. - It is safest to program both halves though. + +- It is safest to program both halves though. From 024f0455deefaa9d47cae255a9ba098650c3841f Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Fri, 15 Sep 2017 22:12:25 -0400 Subject: [PATCH 16/45] [core] fix rgb source include --- common_features.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common_features.mk b/common_features.mk index 6f29c97c9a47..117f84260ba7 100644 --- a/common_features.mk +++ b/common_features.mk @@ -93,12 +93,13 @@ endif ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) OPT_DEFS += -DRGBLIGHT_ENABLE + SRC += $(QUANTUM_DIR)/rgblight.c CIE1931_CURVE = yes LED_BREATHING_TABLE = yes ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes) OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER else - SRC += ws2812.c + SRC += ws2812.c endif endif From 69ab37fca1f891af6a0101766dc74642c5c2fa82 Mon Sep 17 00:00:00 2001 From: krusli Date: Sat, 16 Sep 2017 11:08:29 +1000 Subject: [PATCH 17/45] Got luizribeiro's ps2avrgb implementation working for Mechmini --- keyboards/mechmini/config.h | 5 + keyboards/mechmini/i2c.c | 104 ++++++++++++++++++++ keyboards/mechmini/i2c.h | 22 +++++ keyboards/mechmini/keymaps/default/keymap.c | 71 ++++++++++++- keyboards/mechmini/matrix.c | 2 + keyboards/mechmini/mechmini.c | 42 ++++++++ keyboards/mechmini/program | 0 keyboards/mechmini/rules.mk | 7 +- 8 files changed, 250 insertions(+), 3 deletions(-) create mode 100644 keyboards/mechmini/i2c.c create mode 100644 keyboards/mechmini/i2c.h mode change 100644 => 100755 keyboards/mechmini/program diff --git a/keyboards/mechmini/config.h b/keyboards/mechmini/config.h index ecd50ca29647..96f4bb51e436 100644 --- a/keyboards/mechmini/config.h +++ b/keyboards/mechmini/config.h @@ -14,6 +14,7 @@ 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 . */ +#include "config_common.h" #ifndef CONFIG_H #define CONFIG_H @@ -29,6 +30,10 @@ along with this program. If not, see . #define MATRIX_ROWS 8 #define MATRIX_COLS 15 +#define RGBLED_NUM 16 +#define RGBLIGHT_ANIMATIONS +#define RGB_DI_PIN E2 + #define NO_UART 1 #define BOOTLOADHID_BOOTLOADER 1 diff --git a/keyboards/mechmini/i2c.c b/keyboards/mechmini/i2c.c new file mode 100644 index 000000000000..c27f3e3d17e1 --- /dev/null +++ b/keyboards/mechmini/i2c.c @@ -0,0 +1,104 @@ +/* +Copyright 2016 Luiz Ribeiro + +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 . +*/ + +#include +#include + +#include "i2c.h" + +void i2c_set_bitrate(uint16_t bitrate_khz) { + uint8_t bitrate_div = ((F_CPU / 1000l) / bitrate_khz); + if (bitrate_div >= 16) { + bitrate_div = (bitrate_div - 16) / 2; + } + TWBR = bitrate_div; +} + +void i2c_init(void) { + // set pull-up resistors on I2C bus pins + PORTC |= 0b11; + + i2c_set_bitrate(400); + + // enable TWI (two-wire interface) + TWCR |= (1 << TWEN); + + // enable TWI interrupt and slave address ACK + TWCR |= (1 << TWIE); + TWCR |= (1 << TWEA); +} + +uint8_t i2c_start(uint8_t address) { + // reset TWI control register + TWCR = 0; + + // begin transmission and wait for it to end + TWCR = (1< +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef __I2C_H__ +#define __I2C_H__ + +void i2c_init(void); +void i2c_set_bitrate(uint16_t bitrate_khz); +uint8_t i2c_send(uint8_t address, uint8_t *data, uint16_t length); + +#endif diff --git a/keyboards/mechmini/keymaps/default/keymap.c b/keyboards/mechmini/keymaps/default/keymap.c index 10f11c5f55d0..cf3d174f9ce4 100644 --- a/keyboards/mechmini/keymaps/default/keymap.c +++ b/keyboards/mechmini/keymaps/default/keymap.c @@ -14,6 +14,10 @@ along with this program. If not, see . */ #include "mechmini.h" +#include "rgblight.h" +#include "action_layer.h" +#include "quantum.h" + #define _BL 0 #define _FN1 1 #define _FN2 2 @@ -30,7 +34,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_FN1] = KEYMAP( _____, _____, KC_UP, KC_MUTE, KC_VOLD, KC_VOLU, KC_MRWD, KC_MPLY, KC_MFFD, KC_SLCK, KC_PAUS, KC_DEL, KC_CAPS, KC_LEFT, KC_DOWN, KC_RIGHT, _____, _____, _____, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, - _____, _____, _____, _____, _____, _____, _____, KC_END, KC_PGDN, _____, _____, + _____, _____, M(0), M(1), M(2), _____, _____, KC_END, KC_PGDN, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____ ), [_FN2] = KEYMAP( @@ -57,5 +61,68 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) */ -const uint16_t PROGMEM fn_actions[] = { +uint8_t current_level = 8; +uint8_t prev_current_level = 8; +int is_on = 0; + +enum macro_id { + TOGGLE_RGB, + RGB_LEVEL_DOWN, + RGB_LEVEL_UP }; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { + keyevent_t event = record->event; + + switch (id) { + case TOGGLE_RGB: + if (event.pressed) { + if (!is_on) { + is_on = 1; + } else { + is_on = 0; + } + } + case RGB_LEVEL_DOWN: + if (event.pressed && current_level > 0) { + current_level--; + prev_current_level--; + } + break; + case RGB_LEVEL_UP: + if (event.pressed && current_level < 15) { + current_level++; + prev_current_level++; + } + break; + } + + return MACRO_NONE; +} + +const uint16_t fn_actions[] PROGMEM = { + [0] = ACTION_MACRO(TOGGLE_RGB), + [1] = ACTION_MACRO(RGB_LEVEL_DOWN), + [2] = ACTION_MACRO(RGB_LEVEL_UP) +}; + +void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b); + +uint8_t dim(uint8_t color, uint8_t opacity) { + return ((uint16_t) color * opacity / 0xFF) & 0xFF; +} + +void user_setrgb(uint8_t r, uint8_t g, uint8_t b) { + uint8_t alpha = current_level * 0x11; + rgblight_setrgb(dim(r, alpha), dim(g, alpha), dim(b, alpha)); +} + +void matrix_scan_user(void) { + if (is_on) { + current_level = prev_current_level; + user_setrgb(0xFF, 0xFF, 0xFF); + } else { + current_level = 0; + user_setrgb(0xFF, 0xFF, 0xFF); + } +} diff --git a/keyboards/mechmini/matrix.c b/keyboards/mechmini/matrix.c index beaa54c400af..140026013f02 100644 --- a/keyboards/mechmini/matrix.c +++ b/keyboards/mechmini/matrix.c @@ -93,6 +93,8 @@ uint8_t matrix_scan(void) { } } + matrix_scan_user(); + return 1; } diff --git a/keyboards/mechmini/mechmini.c b/keyboards/mechmini/mechmini.c index e69de29bb2d1..72b9d624fbeb 100644 --- a/keyboards/mechmini/mechmini.c +++ b/keyboards/mechmini/mechmini.c @@ -0,0 +1,42 @@ +/* +Copyright 2017 Luiz Ribeiro +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 . +*/ + +#include "mechmini.h" +#include "rgblight.h" + +#include + +#include "action_layer.h" +#include "i2c.h" +#include "quantum.h" + +extern rgblight_config_t rgblight_config; + +void rgblight_set(void) { + if (!rgblight_config.enable) { + for (uint8_t i = 0; i < RGBLED_NUM; i++) { + led[i].r = 0; + led[i].g = 0; + led[i].b = 0; + } + } + + i2c_init(); + i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { + rgblight_task(); +} diff --git a/keyboards/mechmini/program b/keyboards/mechmini/program old mode 100644 new mode 100755 diff --git a/keyboards/mechmini/rules.mk b/keyboards/mechmini/rules.mk index 26dfe36d0a40..626af1d131f6 100644 --- a/keyboards/mechmini/rules.mk +++ b/keyboards/mechmini/rules.mk @@ -21,6 +21,8 @@ PROTOCOL = VUSB NO_UART = yes NO_SUSPEND_POWER_DOWN = yes BACKLIGHT_ENABLE = no +RGBLIGHT_ENABLE = yes +DISABLE_WS2812 = yes # processor frequency F_CPU = 12000000 @@ -32,12 +34,15 @@ EXTRAKEY_ENABLE = yes CONSOLE_ENABLE = yes COMMAND_ENABLE = yes +RGBLIGHT_ENABLE = yes +RGBLIGHT_CUSTOM_DRIVER = yes + OPT_DEFS = -DDEBUG_LEVEL=0 OPT_DEFS += -DBOOTLOADER_SIZE=2048 # custom matrix setup CUSTOM_MATRIX = yes -SRC = matrix.c +SRC = matrix.c i2c.c # programming options PROGRAM_CMD = ./keyboards/mechmini/program $(TARGET).hex From d281cd5c40fc2ecf4d3b3d568cc4b793eaf31907 Mon Sep 17 00:00:00 2001 From: krusli Date: Sat, 16 Sep 2017 11:19:13 +1000 Subject: [PATCH 18/45] Change max brightness level for iOS --- keyboards/mechmini/keymaps/default/keymap.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/keyboards/mechmini/keymaps/default/keymap.c b/keyboards/mechmini/keymaps/default/keymap.c index cf3d174f9ce4..b3d2345e95f3 100644 --- a/keyboards/mechmini/keymaps/default/keymap.c +++ b/keyboards/mechmini/keymaps/default/keymap.c @@ -18,6 +18,9 @@ along with this program. If not, see . #include "action_layer.h" #include "quantum.h" +#define MAX_BRIGHTNESS 15 +#define MAX_BRIGHTNESS_IOS 5 // max brightness suitable for iOS devices + #define _BL 0 #define _FN1 1 #define _FN2 2 @@ -61,8 +64,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) */ -uint8_t current_level = 8; -uint8_t prev_current_level = 8; +uint8_t current_level = 2; +uint8_t prev_current_level = 2; int is_on = 0; enum macro_id { @@ -90,7 +93,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { } break; case RGB_LEVEL_UP: - if (event.pressed && current_level < 15) { + if (event.pressed && current_level < MAX_BRIGHTNESS_IOS) { current_level++; prev_current_level++; } From 0b7df9f2ef27b2bc26203e1d3ea027b80172b763 Mon Sep 17 00:00:00 2001 From: krusli Date: Sat, 16 Sep 2017 12:02:06 +1000 Subject: [PATCH 19/45] Update on/off toggle behaviour for RGB LEDs --- keyboards/mechmini/keymaps/default/keymap.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/keyboards/mechmini/keymaps/default/keymap.c b/keyboards/mechmini/keymaps/default/keymap.c index b3d2345e95f3..d9753d011807 100644 --- a/keyboards/mechmini/keymaps/default/keymap.c +++ b/keyboards/mechmini/keymaps/default/keymap.c @@ -65,7 +65,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { */ uint8_t current_level = 2; -uint8_t prev_current_level = 2; int is_on = 0; enum macro_id { @@ -89,13 +88,11 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { case RGB_LEVEL_DOWN: if (event.pressed && current_level > 0) { current_level--; - prev_current_level--; } break; case RGB_LEVEL_UP: if (event.pressed && current_level < MAX_BRIGHTNESS_IOS) { current_level++; - prev_current_level++; } break; } @@ -121,8 +118,8 @@ void user_setrgb(uint8_t r, uint8_t g, uint8_t b) { } void matrix_scan_user(void) { - if (is_on) { - current_level = prev_current_level; + if (!is_on) { + current_level = 2; user_setrgb(0xFF, 0xFF, 0xFF); } else { current_level = 0; From 6cfb85f32f4789fbfbb0a12e0bf3ae8a26d86ce6 Mon Sep 17 00:00:00 2001 From: krusli Date: Sat, 16 Sep 2017 12:18:19 +1000 Subject: [PATCH 20/45] Fixes for RGB, more colours --- keyboards/mechmini/keymaps/default/keymap.c | 46 +++++++++++++++++---- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/keyboards/mechmini/keymaps/default/keymap.c b/keyboards/mechmini/keymaps/default/keymap.c index d9753d011807..2a7c5f6c2879 100644 --- a/keyboards/mechmini/keymaps/default/keymap.c +++ b/keyboards/mechmini/keymaps/default/keymap.c @@ -37,7 +37,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_FN1] = KEYMAP( _____, _____, KC_UP, KC_MUTE, KC_VOLD, KC_VOLU, KC_MRWD, KC_MPLY, KC_MFFD, KC_SLCK, KC_PAUS, KC_DEL, KC_CAPS, KC_LEFT, KC_DOWN, KC_RIGHT, _____, _____, _____, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, - _____, _____, M(0), M(1), M(2), _____, _____, KC_END, KC_PGDN, _____, _____, + _____, _____, M(0), M(1), M(2), _____, _____, KC_END, KC_PGDN, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____ ), [_FN2] = KEYMAP( @@ -48,8 +48,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_FN3] = KEYMAP( KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, - _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, - _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, + _____, M(3), M(4), M(5), _____, _____, _____, _____, _____, _____, _____, + _____, M(6), _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____ ) }; @@ -67,10 +67,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { uint8_t current_level = 2; int is_on = 0; +uint8_t r = 0xFF; +uint8_t g = 0xFF; +uint8_t b = 0xFF; + +uint8_t max_brightness = MAX_BRIGHTNESS_IOS; + enum macro_id { TOGGLE_RGB, RGB_LEVEL_DOWN, - RGB_LEVEL_UP + RGB_LEVEL_UP, + RGB_PURPLE, + RGB_CYAN, + RGB_WHITE, + ENABLE_MAX_BRIGHTNESS }; const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { @@ -80,6 +90,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { case TOGGLE_RGB: if (event.pressed) { if (!is_on) { + current_level = 2; is_on = 1; } else { is_on = 0; @@ -91,10 +102,28 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { } break; case RGB_LEVEL_UP: - if (event.pressed && current_level < MAX_BRIGHTNESS_IOS) { + if (event.pressed && current_level < max_brightness) { current_level++; } break; + case RGB_PURPLE: + r = 0xFF; + g = 0x81; + b = 0xC2; + break; + case RGB_CYAN: + r = 0x00; + g = 0xDC; + b = 0xFF; + break; + case RGB_WHITE: + r = 0xFF; + g = 0xFF; + b = 0xFF; + break; + case ENABLE_MAX_BRIGHTNESS: + max_brightness = MAX_BRIGHTNESS; + break; } return MACRO_NONE; @@ -119,10 +148,9 @@ void user_setrgb(uint8_t r, uint8_t g, uint8_t b) { void matrix_scan_user(void) { if (!is_on) { - current_level = 2; - user_setrgb(0xFF, 0xFF, 0xFF); - } else { current_level = 0; - user_setrgb(0xFF, 0xFF, 0xFF); + user_setrgb(r, g, b); + } else { + user_setrgb(r, g, b); } } From a8a02455f54fe550214713e8494e279e938c598e Mon Sep 17 00:00:00 2001 From: krusli Date: Sat, 16 Sep 2017 17:26:02 +1000 Subject: [PATCH 21/45] Keymap updates --- keyboards/mechmini/keymaps/default/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/mechmini/keymaps/default/keymap.c b/keyboards/mechmini/keymaps/default/keymap.c index 2a7c5f6c2879..2d46a4aae81f 100644 --- a/keyboards/mechmini/keymaps/default/keymap.c +++ b/keyboards/mechmini/keymaps/default/keymap.c @@ -113,7 +113,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { break; case RGB_CYAN: r = 0x00; - g = 0xDC; + g = 0xE0; b = 0xFF; break; case RGB_WHITE: From c7ebb0f950ea2d98db05b36fcf1b5de3120431cc Mon Sep 17 00:00:00 2001 From: krusli Date: Sat, 16 Sep 2017 17:41:38 +1000 Subject: [PATCH 22/45] Add RGB code (from ps2avrgb and luizribeiro/qmk_firmware) --- keyboards/mechmini/keymaps/default/keymap.c | 106 ++++++++++---------- 1 file changed, 51 insertions(+), 55 deletions(-) diff --git a/keyboards/mechmini/keymaps/default/keymap.c b/keyboards/mechmini/keymaps/default/keymap.c index 2d46a4aae81f..31279ffe93d6 100644 --- a/keyboards/mechmini/keymaps/default/keymap.c +++ b/keyboards/mechmini/keymaps/default/keymap.c @@ -15,7 +15,6 @@ along with this program. If not, see . #include "mechmini.h" #include "rgblight.h" -#include "action_layer.h" #include "quantum.h" #define MAX_BRIGHTNESS 15 @@ -35,7 +34,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LCTL, KC_LGUI, KC_LALT, _____, KC_SPC, _____, MO(_FN1), MO(_FN3) ), [_FN1] = KEYMAP( - _____, _____, KC_UP, KC_MUTE, KC_VOLD, KC_VOLU, KC_MRWD, KC_MPLY, KC_MFFD, KC_SLCK, KC_PAUS, KC_DEL, + KC_GRAVE, _____, KC_UP, KC_MUTE, KC_VOLD, KC_VOLU, KC_MRWD, KC_MPLY, KC_MFFD, KC_SLCK, KC_PAUS, KC_DEL, KC_CAPS, KC_LEFT, KC_DOWN, KC_RIGHT, _____, _____, _____, KC_INS, KC_HOME, KC_PGUP, KC_PSCR, _____, _____, M(0), M(1), M(2), _____, _____, KC_END, KC_PGDN, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____ @@ -74,65 +73,62 @@ uint8_t b = 0xFF; uint8_t max_brightness = MAX_BRIGHTNESS_IOS; enum macro_id { - TOGGLE_RGB, - RGB_LEVEL_DOWN, - RGB_LEVEL_UP, - RGB_PURPLE, - RGB_CYAN, - RGB_WHITE, - ENABLE_MAX_BRIGHTNESS + TOGGLE_RGB, + BRIGHTNESS_DOWN, + BRIGHTNESS_UP, + COLOR_1, + COLOR_2, + COLOR_3, + ENABLE_MAX_BRIGHTNESS }; const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { - keyevent_t event = record->event; - - switch (id) { - case TOGGLE_RGB: - if (event.pressed) { - if (!is_on) { - current_level = 2; - is_on = 1; - } else { - is_on = 0; - } - } - case RGB_LEVEL_DOWN: - if (event.pressed && current_level > 0) { - current_level--; - } - break; - case RGB_LEVEL_UP: - if (event.pressed && current_level < max_brightness) { - current_level++; - } - break; - case RGB_PURPLE: - r = 0xFF; - g = 0x81; - b = 0xC2; - break; - case RGB_CYAN: - r = 0x00; - g = 0xE0; - b = 0xFF; - break; - case RGB_WHITE: - r = 0xFF; - g = 0xFF; - b = 0xFF; - break; - case ENABLE_MAX_BRIGHTNESS: - max_brightness = MAX_BRIGHTNESS; - break; - } - - return MACRO_NONE; + keyevent_t event = record->event; + + switch (id) { + case TOGGLE_RGB: + if (event.pressed) { + if (!is_on) { + current_level = 4; + is_on = 1; + } else { + is_on = 0; + } + } + case BRIGHTNESS_DOWN: + if (event.pressed && current_level > 0) { + current_level--; + } + break; + case BRIGHTNESS_UP: + if (event.pressed && current_level < max_brightness) { + current_level++; + } + break; + case COLOR_1: // set to pink + r = 0xFF; + g = 0x81; + b = 0xC2; + break; + case COLOR_2: // set to cyan + r = 0x00; + g = 0xE0; + b = 0xFF; + break; + case COLOR_3: // set to white + r = 0xFF; + g = 0xFF; + b = 0xFF; + break; + case ENABLE_MAX_BRIGHTNESS: // enable all 16 brightness steps + max_brightness = MAX_BRIGHTNESS; + break; + } + + return MACRO_NONE; } const uint16_t fn_actions[] PROGMEM = { - [0] = ACTION_MACRO(TOGGLE_RGB), - [1] = ACTION_MACRO(RGB_LEVEL_DOWN), - [2] = ACTION_MACRO(RGB_LEVEL_UP) }; void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b); From 25aa474246409bb407545e93ad6eb8f810f2e54d Mon Sep 17 00:00:00 2001 From: krusli Date: Sat, 16 Sep 2017 18:30:52 +1000 Subject: [PATCH 23/45] Updated RGB code to use event.pressed --- keyboards/mechmini/keymaps/default/keymap.c | 30 +++++++++++++-------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/keyboards/mechmini/keymaps/default/keymap.c b/keyboards/mechmini/keymaps/default/keymap.c index 31279ffe93d6..5cae1bc815d0 100644 --- a/keyboards/mechmini/keymaps/default/keymap.c +++ b/keyboards/mechmini/keymaps/default/keymap.c @@ -63,7 +63,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ) */ -uint8_t current_level = 2; +uint8_t current_level = 4; int is_on = 0; uint8_t r = 0xFF; @@ -106,22 +106,30 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { } break; case COLOR_1: // set to pink - r = 0xFF; - g = 0x81; - b = 0xC2; + if (event.pressed) { + r = 0xFF; + g = 0x81; + b = 0xC2; + } break; case COLOR_2: // set to cyan - r = 0x00; - g = 0xE0; - b = 0xFF; + if (event.pressed) { + r = 0x00; + g = 0xE0; + b = 0xFF; + } break; case COLOR_3: // set to white - r = 0xFF; - g = 0xFF; - b = 0xFF; + if (event.pressed) { + r = 0xFF; + g = 0xFF; + b = 0xFF; + } break; case ENABLE_MAX_BRIGHTNESS: // enable all 16 brightness steps - max_brightness = MAX_BRIGHTNESS; + if (event.pressed) { + max_brightness = MAX_BRIGHTNESS; + } break; } From 2a02df84b647b23916ce48e0beb413507001d630 Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Sat, 16 Sep 2017 20:08:21 -0700 Subject: [PATCH 24/45] Improve readme and PID codes for Atreus. --- keyboards/atreus/config.h | 6 +++--- keyboards/atreus/readme.md | 6 ++---- keyboards/atreus/rules.mk | 3 --- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/keyboards/atreus/config.h b/keyboards/atreus/config.h index 51162cde3af0..f8808892c314 100644 --- a/keyboards/atreus/config.h +++ b/keyboards/atreus/config.h @@ -22,9 +22,9 @@ along with this program. If not, see . /* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x6060 -#define DEVICE_VER 0x0001 +#define VENDOR_ID 0x1209 +#define PRODUCT_ID 0xA1E5 +#define DEVICE_VER 0x0008 #define MANUFACTURER Technomancy #define PRODUCT Atreus #define DESCRIPTION q.m.k. keyboard firmware for Atreus diff --git a/keyboards/atreus/readme.md b/keyboards/atreus/readme.md index 64ad4ba98a29..ef464a1b492c 100644 --- a/keyboards/atreus/readme.md +++ b/keyboards/atreus/readme.md @@ -3,9 +3,7 @@ Atreus A small mechanical keyboard that is based around the shape of the human hand. -These configuration files are specifically for the Atreus keyboards created by Phil Hagelberg (@technomancy). This keyboard is available in two variants: one powered by a Teensy 2, one powered by an A-Star. This repository currently assumes that you have an A-Star powered Atreus. If you are using a Teensy2, specify that by adding `TEENSY2=yes` to your `make` commands. - -If you are coming from the [atreus-firmware](https://github.com/technomancy/atreus-firmware), we've also brought forward the `make upload` command for you to use. +These configuration files are specifically for the Atreus keyboards created by Phil Hagelberg (@technomancy). This keyboard is available in two variants: one powered by a Teensy 2, (usually hand-wired) one powered by an A-Star. (usually using a PCB) This repository currently assumes that you have an A-Star powered Atreus. If you are using a Teensy2, specify that by adding `TEENSY2=yes` to your `make` commands. Keyboard Maintainer: QMK Community Hardware Supported: Atreus PCB @@ -13,6 +11,6 @@ Hardware Availability: https://atreus.technomancy.us Make example for this keyboard (after setting up your build environment): - make atreus-default + make atreus-default-avrdude See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. diff --git a/keyboards/atreus/rules.mk b/keyboards/atreus/rules.mk index 2362395569c7..0a254d0e7962 100644 --- a/keyboards/atreus/rules.mk +++ b/keyboards/atreus/rules.mk @@ -77,6 +77,3 @@ UNICODE_ENABLE = YES # Unicode # BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID USB = /dev/cu.usbmodem1411 - -# upload: build -# $(ATREUS_UPLOAD_COMMAND) From da887ea41228ea9cd59e88d4d2c12c2b371e4cb4 Mon Sep 17 00:00:00 2001 From: Dylan Khor Date: Sun, 17 Sep 2017 14:53:45 -0400 Subject: [PATCH 25/45] Address issue #1713 (#1728) --- quantum/rgblight.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 9ac1893d2301..0f02b9a64c7b 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -490,7 +490,7 @@ void rgblight_effect_rainbow_swirl(uint8_t interval) { static uint16_t last_timer = 0; uint16_t hue; uint8_t i; - if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_RAINBOW_MOOD_INTERVALS[interval / 2])) { + if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_RAINBOW_SWIRL_INTERVALS[interval / 2])) { return; } last_timer = timer_read(); From 87021371e6273258a9385a0a5ed4cfd344f9de8f Mon Sep 17 00:00:00 2001 From: Daniel Shields Date: Mon, 18 Sep 2017 10:36:26 +0100 Subject: [PATCH 26/45] Remove redundant Makefile. --- keyboards/planck/keymaps/dshields/Makefile | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 keyboards/planck/keymaps/dshields/Makefile diff --git a/keyboards/planck/keymaps/dshields/Makefile b/keyboards/planck/keymaps/dshields/Makefile deleted file mode 100644 index 57144283e9a3..000000000000 --- a/keyboards/planck/keymaps/dshields/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -ifndef QUANTUM_DIR - include ../../../../Makefile -endif - -MOUSEKEY_ENABLE = yes # Mouse keys(+4700) -COMMAND_ENABLE = yes # Commands for debug and configuration -CONSOLE_ENABLE = yes # Console for debug(+400) -BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality -# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE -SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend -TAP_DANCE_ENABLE = yes -AUDIO_ENABLE = no -API_SYSEX_ENABLE = no From abba393f57fdfb9b7abd92cc7925a605619902b2 Mon Sep 17 00:00:00 2001 From: Jeremy Cowgar Date: Sun, 17 Sep 2017 01:33:28 -0400 Subject: [PATCH 27/45] Added Auto Shift, tap key = normal, hold key = shifted state. --- common_features.mk | 5 + docs/feature_auto_shift.md | 161 ++++++++++++++++++ docs/understanding_qmk.md | 1 + quantum/process_keycode/process_auto_shift.c | 168 +++++++++++++++++++ quantum/process_keycode/process_auto_shift.h | 28 ++++ quantum/quantum.c | 3 + quantum/quantum.h | 4 + quantum/quantum_keycodes.h | 5 + 8 files changed, 375 insertions(+) create mode 100644 docs/feature_auto_shift.md create mode 100644 quantum/process_keycode/process_auto_shift.c create mode 100644 quantum/process_keycode/process_auto_shift.h diff --git a/common_features.mk b/common_features.mk index 117f84260ba7..bae23bb87352 100644 --- a/common_features.mk +++ b/common_features.mk @@ -119,6 +119,11 @@ ifeq ($(strip $(PRINTING_ENABLE)), yes) SRC += $(TMK_DIR)/protocol/serial_uart.c endif +ifeq ($(strip $(AUTO_SHIFT_ENABLE)), yes) + OPT_DEFS += -DAUTO_SHIFT_ENABLE + SRC += $(QUANTUM_DIR)/process_keycode/process_auto_shift.c +endif + ifeq ($(strip $(SERIAL_LINK_ENABLE)), yes) SRC += $(patsubst $(QUANTUM_PATH)/%,%,$(SERIAL_SRC)) OPT_DEFS += $(SERIAL_DEFS) diff --git a/docs/feature_auto_shift.md b/docs/feature_auto_shift.md new file mode 100644 index 000000000000..a054c36528f7 --- /dev/null +++ b/docs/feature_auto_shift.md @@ -0,0 +1,161 @@ +# Auto Shift: Why do we need a shift key? + +Tap a key and you get its character. Tap a key, but hold it *slightly* longer +and you get its shifted state. Viola! No shift key needeed! + +## Why Auto Shift? + +Many people suffer from various forms of RSI. A common cause is stretching your +fingers repeitively long distances. For us on the keyboard, the pinky does that +all too often when reaching for the shift key. Auto Shift looks to aliviate that +problem. + +## How does it work? + +When you tap a key, it stays depressed for a short period of time before it is +then released. This depressed time is a different length everyone. Auto Shift +defines a constant `AUTO_SHIFT_TIMEOUT` which is typically set to twice your +normal pressed state time. When you press a key, a timer starts and then stops +when you release the key. If the time depressed is greater than or equal to the +`AUTO_SHIFT_TIMEOUT` then a shifted version of the key is emitted. If the time +is less than the `AUTO_SHIFT_TIMEOUT` time, then the normal state is emitted. + +## Are there limitations to Auto Shift? + +Yes, unfortunately. + +1. Key repeat will cease to work. For example, before if you wanted 20 'a' + characters, you could press and hold the 'a' key for a second or two. This no + longer works with Auto Shift because it is timing your depressed time instead + of emitting a depressed key state to your operating system. +2. Auto Shift is disabled for any key press that is accompanied by one or more + modifiers. Thus, Ctrl+A that you hold for a really long time is not the same + as Ctrl+Shift+A. +3. You will have characters that are shifted you did not intend on shifting, and + other characters you wanted shifted, but were not. This simply comes down to + practice. As we get in a hurry, we think we might have hit the key long enough + for a shifted version, but we did not. On the other hand, we may think we are + tapping the keys, but really we have held it for a little longer than + anticipated. + +## How do I enable Auto Shift? + +Add to your `rules.mk` in the keymap folder: + + AUTO_SHIFT_ENABLE = YES + +If no `rules.mk` exists, you can create one. + +Then compile and install your new firmware with Auto Key enabled! That's it! + +## Configuring Auto Shift + +If desired, there is some configuration that can be done to change the +behavior of Auto Shift. This is done by setting various variables the +`config.h` file located in your keymap folder. + +If no `config.h` file exists, you can create one. A sample is + + #ifndef CONFIG_USER_H + #define CONFIG_USER_H + + #include "../../config.h" + + #define AUTO_SHIFT_TIMEOUT 150 + #define NO_AUTO_SHIFT_SPECIAL + + #endif + +### AUTO_SHIFT_TIMEOUT (value in ms) + +This controls how long you have to hold a key before you get the shifted state. +Obviously, this is different for everyone. For the common person a setting of +135 to 150 works great but one should start with a value of at least 175, which +is the default value. Then work down from there. The idea is to have as short +of a time required to get the shifted state without having false positives. + +Play with this value until things are perfect. Many find that all will work well +at a given value, but one or two keys will still emit the shifted state on +occassion. This is simply due to habit and holding some keys a little longer +than others. Once you find this value, work on tapping your problem keys a little +quicker than normal and you will be set. + +{% hint style='info' %} +Auto Shift has three special keys that can help you get this value right very +quick. See "Auto Shift Setup" for more details! +{% endhint %} + +### NO_AUTO_SHIFT_SPECIAL (simple define) + +Do not Auto Shift special keys, which include -_, =+, [{, ]}, ;:, '", ,<, .>, +and /? + +### NO_AUTO_SHIFT_NUMERIC (simple define) + +Do not Auto Shift numeric keys, zero through nine. + +### NO_AUTO_SHIFT_ALPHA (simple define) + +Do not Auto Shift alpha characters, which include A through Z. + +## Using Auto Shift Setup + +This will enable you to define three keys temporailiy to increase, decrease and report your `AUTO_SHIFT_TIMEOUT`. + +### Setup + +Map three keys temporarily in your keymap: + +| Key Name | Description | +|----------|-----------------------------------------------------| +| KC_ASDN | Lower the Auto Shift timeout variable (down) | +| KC_ASUP | Raise the Auto Shift timeout variable (up) | +| KC_ASRP | Report your current Auto Shift timeout value | + +Compile and upload your new firmware. + +### Use + +It is important to note that during these tests, you should be typing +completely normal and with no intention of shifted keys. + +1. Type multiple sentences of alphabetical letters. +2. Observe any upper case letters. +3. If there are none, press the key you have mapped to `KC_ASDN` to decrease + time Auto Shift timeout value and go back to step 1. +4. If there are some upper case letters, decide if you need to work on tapping + those keys with less down time, or if you need to increase the timeout. +5. If you decide to increase the timeout, press the key you have mapped to + `KC_ASUP` and go back to step 1. +6. Once you are happy with your results, press the key you have mapped to + `KC_ASRP`. The keyboard will type by itself the value of your + `AUTO_SHIFT_TIMEOUT`. +7. Update `AUTO_SHIFT_TIMEOUT` in your `config.h` with the value reported. +8. Remove `AUTO_SHIFT_SETUP` from your `config.h`. +9. Remove the key bindings `KC_ASDN`, `KC_ASUP` and `KC_ASRP`. +10. Compile and upload your new firmware. + +#### An example run + +\'\'\' +hello world. my name is john doe. i am a computer programmer playing with +keyboards right now. + +[PRESS KC_ASDN quite a few times] + +heLLo woRLd. mY nAMe is JOHn dOE. i AM A compUTeR proGRaMMER PlAYiNG witH +KEYboArDS RiGHT NOw. + +[PRESS KC_ASUP a few times] + +hello world. my name is john Doe. i am a computer programmer play with +keyboarDs right now. + +[PRESS KC_ASRP] + +115 +\'\'\' + +The keyboard typed `115` which represents your current `AUTO_SHIFT_TIMEOUT` +value. You are now set! Practice on the *D* key a little bit that showed up +in the testing and you'll be golden. diff --git a/docs/understanding_qmk.md b/docs/understanding_qmk.md index 2ac4f3036504..99c2306d66ff 100644 --- a/docs/understanding_qmk.md +++ b/docs/understanding_qmk.md @@ -147,6 +147,7 @@ The `process_record()` function itself is deceptively simple, but hidden within * [`bool process_unicode(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_unicode.c#L22) * [`bool process_ucis(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_ucis.c#L91) * [`bool process_printer(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_printer.c#L77) + * [`bool process_auto_shift(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_auto_shift.c#L47) * [`bool process_unicode_map(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_unicodemap.c#L47) * [Identify and process quantum specific keycodes](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L211) diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c new file mode 100644 index 000000000000..55b5244501af --- /dev/null +++ b/quantum/process_keycode/process_auto_shift.c @@ -0,0 +1,168 @@ +/* Copyright 2017 Jeremy Cowgar + * + * 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 . + */ + +#ifdef AUTO_SHIFT_ENABLE + +#include + +#include "process_auto_shift.h" + +#define TAP(key) \ + register_code(key); \ + unregister_code(key) + +#define TAP_WITH_MOD(mod, key) \ + register_code(mod); \ + register_code(key); \ + unregister_code(key); \ + unregister_code(mod) + +uint16_t autoshift_time = 0; +uint16_t autoshift_timeout = AUTO_SHIFT_TIMEOUT; +uint16_t autoshift_lastkey = KC_NO; + +void autoshift_timer_report(void) { + char display[8]; + + snprintf(display, 8, "\n%d\n", autoshift_timeout); + + send_string((const char *)display); +} + +void autoshift_on(uint16_t keycode) { + autoshift_time = timer_read(); + autoshift_lastkey = keycode; +} + +void autoshift_flush(void) { + if (autoshift_lastkey != KC_NO) { + uint16_t elapsed = timer_elapsed(autoshift_time); + + if (elapsed > autoshift_timeout) { + register_code(KC_LSFT); + } + + register_code(autoshift_lastkey); + unregister_code(autoshift_lastkey); + + if (elapsed > autoshift_timeout) { + unregister_code(KC_LSFT); + } + + autoshift_time = 0; + autoshift_lastkey = KC_NO; + } +} + +bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { + static uint8_t any_mod_pressed; + + if (record->event.pressed) { + switch (keycode) { + case KC_ASUP: + autoshift_timeout += 5; + return false; + + case KC_ASDN: + autoshift_timeout -= 5; + return false; + + case KC_ASRP: + autoshift_timer_report(); + return false; + +#ifndef NO_AUTO_SHIFT_ALPHA + case KC_A: + case KC_B: + case KC_C: + case KC_D: + case KC_E: + case KC_F: + case KC_G: + case KC_H: + case KC_I: + case KC_J: + case KC_K: + case KC_L: + case KC_M: + case KC_N: + case KC_O: + case KC_P: + case KC_Q: + case KC_R: + case KC_S: + case KC_T: + case KC_U: + case KC_V: + case KC_W: + case KC_X: + case KC_Y: + case KC_Z: +#endif +#ifndef NO_AUTO_SHIFT_NUMERIC + case KC_1: + case KC_2: + case KC_3: + case KC_4: + case KC_5: + case KC_6: + case KC_7: + case KC_8: + case KC_9: + case KC_0: +#endif +#ifndef NO_AUTO_SHIFT_SPECIAL + case KC_TILD: + case KC_MINUS: + case KC_EQL: + case KC_TAB: + case KC_LBRC: + case KC_RBRC: + case KC_BSLS: + case KC_SCLN: + case KC_QUOT: + case KC_COMM: + case KC_DOT: + case KC_SLSH: +#endif + autoshift_flush(); + + any_mod_pressed = get_mods() & ( + MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)| + MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT)| + MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTL)| + MOD_BIT(KC_LSFT)|MOD_BIT(KC_RSFT) + ); + + if (any_mod_pressed) { + return true; + } + + autoshift_on(keycode); + return false; + + default: + autoshift_flush(); + return true; + } + } else { + autoshift_flush(); + } + + return true; +} + +#endif diff --git a/quantum/process_keycode/process_auto_shift.h b/quantum/process_keycode/process_auto_shift.h new file mode 100644 index 000000000000..a0361346bd32 --- /dev/null +++ b/quantum/process_keycode/process_auto_shift.h @@ -0,0 +1,28 @@ +/* Copyright 2017 Jeremy Cowgar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef PROCESS_AUTO_SHIFT_H +#define PROCESS_AUTO_SHIFT_H + +#include "quantum.h" + +#ifndef AUTO_SHIFT_TIMEOUT + #define AUTO_SHIFT_TIMEOUT 175 +#endif + +bool process_auto_shift(uint16_t keycode, keyrecord_t *record); + +#endif diff --git a/quantum/quantum.c b/quantum/quantum.c index 1fccaa7d5a02..a1a1a9d1cb0b 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -235,6 +235,9 @@ bool process_record_quantum(keyrecord_t *record) { #ifdef PRINTING_ENABLE process_printer(keycode, record) && #endif + #ifdef AUTO_SHIFT_ENABLE + process_auto_shift(keycode, record) && + #endif #ifdef UNICODEMAP_ENABLE process_unicode_map(keycode, record) && #endif diff --git a/quantum/quantum.h b/quantum/quantum.h index f3333a002af3..534819c818bf 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -95,6 +95,10 @@ extern uint32_t default_layer_state; #include "process_printer.h" #endif +#ifdef AUTO_SHIFT_ENABLE + #include "process_auto_shift.h" +#endif + #ifdef COMBO_ENABLE #include "process_combo.h" #endif diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index 26c3c41a73b0..212fdc67d6b4 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -121,6 +121,11 @@ enum quantum_keycodes { KC_LEAD, #endif + // Auto Shift setup + KC_ASUP, + KC_ASDN, + KC_ASRP, + // Audio on/off/toggle AU_ON, AU_OFF, From d0ca713eb4abb14d5709341b8db88a8ad04719ab Mon Sep 17 00:00:00 2001 From: Jeremy Cowgar Date: Mon, 18 Sep 2017 08:46:35 -0400 Subject: [PATCH 28/45] KC_TILD should not have been listed as an auto shift key --- quantum/process_keycode/process_auto_shift.c | 1 - 1 file changed, 1 deletion(-) diff --git a/quantum/process_keycode/process_auto_shift.c b/quantum/process_keycode/process_auto_shift.c index 55b5244501af..d096cde567ea 100644 --- a/quantum/process_keycode/process_auto_shift.c +++ b/quantum/process_keycode/process_auto_shift.c @@ -125,7 +125,6 @@ bool process_auto_shift(uint16_t keycode, keyrecord_t *record) { case KC_0: #endif #ifndef NO_AUTO_SHIFT_SPECIAL - case KC_TILD: case KC_MINUS: case KC_EQL: case KC_TAB: From a89183591c8dc5e7a814c1429a66fdadf58a7b49 Mon Sep 17 00:00:00 2001 From: Jeremy Cowgar Date: Mon, 18 Sep 2017 08:49:45 -0400 Subject: [PATCH 29/45] Fixed a few typos and spelling errors in auto shift feature document --- docs/feature_auto_shift.md | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/docs/feature_auto_shift.md b/docs/feature_auto_shift.md index a054c36528f7..54052a74dbcb 100644 --- a/docs/feature_auto_shift.md +++ b/docs/feature_auto_shift.md @@ -1,23 +1,23 @@ # Auto Shift: Why do we need a shift key? Tap a key and you get its character. Tap a key, but hold it *slightly* longer -and you get its shifted state. Viola! No shift key needeed! +and you get its shifted state. Viola! No shift key needed! ## Why Auto Shift? Many people suffer from various forms of RSI. A common cause is stretching your -fingers repeitively long distances. For us on the keyboard, the pinky does that -all too often when reaching for the shift key. Auto Shift looks to aliviate that +fingers repetitively long distances. For us on the keyboard, the pinky does that +all too often when reaching for the shift key. Auto Shift looks to alleviate that problem. ## How does it work? When you tap a key, it stays depressed for a short period of time before it is -then released. This depressed time is a different length everyone. Auto Shift +then released. This depressed time is a different length for everyone. Auto Shift defines a constant `AUTO_SHIFT_TIMEOUT` which is typically set to twice your normal pressed state time. When you press a key, a timer starts and then stops when you release the key. If the time depressed is greater than or equal to the -`AUTO_SHIFT_TIMEOUT` then a shifted version of the key is emitted. If the time +`AUTO_SHIFT_TIMEOUT`, then a shifted version of the key is emitted. If the time is less than the `AUTO_SHIFT_TIMEOUT` time, then the normal state is emitted. ## Are there limitations to Auto Shift? @@ -31,9 +31,9 @@ Yes, unfortunately. 2. Auto Shift is disabled for any key press that is accompanied by one or more modifiers. Thus, Ctrl+A that you hold for a really long time is not the same as Ctrl+Shift+A. -3. You will have characters that are shifted you did not intend on shifting, and +3. You will have characters that are shifted when you did not intend on shifting, and other characters you wanted shifted, but were not. This simply comes down to - practice. As we get in a hurry, we think we might have hit the key long enough + practice. As we get in a hurry, we think we have hit the key long enough for a shifted version, but we did not. On the other hand, we may think we are tapping the keys, but really we have held it for a little longer than anticipated. @@ -52,9 +52,9 @@ Then compile and install your new firmware with Auto Key enabled! That's it! If desired, there is some configuration that can be done to change the behavior of Auto Shift. This is done by setting various variables the -`config.h` file located in your keymap folder. +`config.h` file located in your keymap folder. If no `config.h` file exists, you can create one. -If no `config.h` file exists, you can create one. A sample is +A sample is #ifndef CONFIG_USER_H #define CONFIG_USER_H @@ -69,10 +69,9 @@ If no `config.h` file exists, you can create one. A sample is ### AUTO_SHIFT_TIMEOUT (value in ms) This controls how long you have to hold a key before you get the shifted state. -Obviously, this is different for everyone. For the common person a setting of -135 to 150 works great but one should start with a value of at least 175, which -is the default value. Then work down from there. The idea is to have as short -of a time required to get the shifted state without having false positives. +Obviously, this is different for everyone. For the common person, a setting of +135 to 150 works great. However, one should start with a value of at least 175, which +is the default value. Then work down from there. The idea is to have the shortest time required to get the shifted state without having false positives. Play with this value until things are perfect. Many find that all will work well at a given value, but one or two keys will still emit the shifted state on @@ -137,7 +136,7 @@ completely normal and with no intention of shifted keys. #### An example run -\'\'\' +''' hello world. my name is john doe. i am a computer programmer playing with keyboards right now. @@ -148,14 +147,14 @@ KEYboArDS RiGHT NOw. [PRESS KC_ASUP a few times] -hello world. my name is john Doe. i am a computer programmer play with +hello world. my name is john Doe. i am a computer programmer playing with keyboarDs right now. [PRESS KC_ASRP] 115 -\'\'\' +''' The keyboard typed `115` which represents your current `AUTO_SHIFT_TIMEOUT` value. You are now set! Practice on the *D* key a little bit that showed up -in the testing and you'll be golden. +in the testing and you'll be golden. \ No newline at end of file From 31739244219a797c666269ddf3b653c981ed39f9 Mon Sep 17 00:00:00 2001 From: Nicolas Guelpa Date: Mon, 18 Sep 2017 17:13:01 -0400 Subject: [PATCH 30/45] Adding a new layout for the planck that helps when coming from the pok3r (#1701) * adding new layout for the planck that helps when coming from the pok3r * Fixing the function layer * Update readme.md * Update keymap.c Making some small adjustments * Update keymap.c switching GUI and Esc * Update keymap.c --- keyboards/planck/keymaps/pok3r/Makefile | 3 + keyboards/planck/keymaps/pok3r/config.h | 42 ++++ keyboards/planck/keymaps/pok3r/keymap.c | 288 +++++++++++++++++++++++ keyboards/planck/keymaps/pok3r/readme.md | 15 ++ 4 files changed, 348 insertions(+) create mode 100644 keyboards/planck/keymaps/pok3r/Makefile create mode 100644 keyboards/planck/keymaps/pok3r/config.h create mode 100644 keyboards/planck/keymaps/pok3r/keymap.c create mode 100644 keyboards/planck/keymaps/pok3r/readme.md diff --git a/keyboards/planck/keymaps/pok3r/Makefile b/keyboards/planck/keymaps/pok3r/Makefile new file mode 100644 index 000000000000..457a3d01d4a4 --- /dev/null +++ b/keyboards/planck/keymaps/pok3r/Makefile @@ -0,0 +1,3 @@ +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/planck/keymaps/pok3r/config.h b/keyboards/planck/keymaps/pok3r/config.h new file mode 100644 index 000000000000..b406e2fed97b --- /dev/null +++ b/keyboards/planck/keymaps/pok3r/config.h @@ -0,0 +1,42 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#ifdef AUDIO_ENABLE + #define STARTUP_SONG SONG(PLANCK_SOUND) + // #define STARTUP_SONG SONG(NO_SOUND) + + #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ + SONG(COLEMAK_SOUND), \ + SONG(DVORAK_SOUND) \ + } +#endif + +#define MUSIC_MASK (keycode != KC_NO) + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ + +#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 + +#endif \ No newline at end of file diff --git a/keyboards/planck/keymaps/pok3r/keymap.c b/keyboards/planck/keymaps/pok3r/keymap.c new file mode 100644 index 000000000000..b5848a9b6199 --- /dev/null +++ b/keyboards/planck/keymaps/pok3r/keymap.c @@ -0,0 +1,288 @@ +/* Copyright 2015-2017 Jack Humbert + * + * 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 . + */ + +#include "planck.h" +#include "action_layer.h" + +extern keymap_config_t keymap_config; + +enum planck_layers { + _QWERTY, + _COLEMAK, + _DVORAK, + _LOWER, + _RAISE, + _PLOVER, + _ADJUST, + _FUNCTION +}; + +enum planck_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + PLOVER, + LOWER, + RAISE, + BACKLIT, + EXT_PLV, + FUNCTION +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Func | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Ctrl | GUI | Esc | Alt |Lower | Space |Raise | Left | Up | Down |Right | + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = { + {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, + {FUNCTION,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, + {KC_LCTL, KC_LGUI, KC_ESC, KC_LALT, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_UP, KC_DOWN, KC_RGHT} +}, + +/* Colemak + * ,-----------------------------------------------------------------------------------. + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Func | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Ctrl | GUI | Esc | Alt |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_COLEMAK] = { + {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, + {FUNCTION,KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, + {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, + {KC_LCTL, KC_LGUI, KC_ESC, KC_LALT, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +/* Dvorak + * ,-----------------------------------------------------------------------------------. + * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Func | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Ctrl | GUI | Esc | Alt |Lower | Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_DVORAK] = { + {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, + {FUNCTION,KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, + {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, + {KC_LCTL, KC_LGUI, KC_ESC, KC_LALT, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} +}, + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | Home | End | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Home |Pg Up |Pg Dn | End | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = { + {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL }, + {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_PGDN, KC_END} +}, + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / |Pg Up |Pg Dn | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Home |Pg Up |Pg Dn | End | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = { + {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL }, + {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, + {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGUP, KC_PGDN, KC_END} +}, + +/* Plover layer (http://opensteno.org) + * ,-----------------------------------------------------------------------------------. + * | # | # | # | # | # | # | # | # | # | # | # | # | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | S | T | P | H | * | * | F | P | L | T | D | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | S | K | W | R | * | * | R | B | G | S | Z | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Exit | | | A | O | | E | U | | | | + * `-----------------------------------------------------------------------------------' + */ + +[_PLOVER] = { + {KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 }, + {XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC}, + {XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, + {EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX} +}, + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Caps |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = { + {_______, RESET, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL }, + {_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______}, + {KC_CAPS, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} +}, + +/* Function + * ,-----------------------------------------------------------------------------------. + * | Esc | | Prev | Play | Next | | |Pg Up | Up |Pg Dn |Prt Sc| Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | Vol- | Mute | Vol+ | | Home | Left | Down |Right | End | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | Esc | | Esc | Home |Pg Up |Pg Dn | End | + * `-----------------------------------------------------------------------------------' + */ +[_FUNCTION] = { + {KC_ESC , _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, KC_PGUP, KC_UP, KC_PGDN, KC_PSCR, KC_DEL}, + {_______, _______, KC_VOLD, KC_MUTE, KC_VOLU, _______, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END , _______}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, + {_______, _______, _______, _______, KC_ESC , _______, _______, KC_ESC , KC_HOME, KC_PGUP, KC_PGDN, KC_END} +} + +}; + +#ifdef AUDIO_ENABLE + float plover_song[][2] = SONG(PLOVER_SOUND); + float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); +#endif + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + set_single_persistent_default_layer(_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + set_single_persistent_default_layer(_DVORAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case BACKLIT: + if (record->event.pressed) { + register_code(KC_RSFT); + #ifdef BACKLIGHT_ENABLE + backlight_step(); + #endif + } else { + unregister_code(KC_RSFT); + } + return false; + break; + case PLOVER: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + stop_all_notes(); + PLAY_SONG(plover_song); + #endif + layer_off(_RAISE); + layer_off(_LOWER); + layer_off(_ADJUST); + layer_on(_PLOVER); + if (!eeconfig_is_enabled()) { + eeconfig_init(); + } + keymap_config.raw = eeconfig_read_keymap(); + keymap_config.nkro = 1; + eeconfig_update_keymap(keymap_config.raw); + } + return false; + break; + case EXT_PLV: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_SONG(plover_gb_song); + #endif + layer_off(_PLOVER); + } + return false; + break; + case FUNCTION: + if (record->event.pressed) { + layer_on(_FUNCTION); + } else { + layer_off(_FUNCTION); + } + return false; + break; + } + return true; +} diff --git a/keyboards/planck/keymaps/pok3r/readme.md b/keyboards/planck/keymaps/pok3r/readme.md new file mode 100644 index 000000000000..66320e9916ee --- /dev/null +++ b/keyboards/planck/keymaps/pok3r/readme.md @@ -0,0 +1,15 @@ +This layout adds a new function layer similar to the default one from the pok3r: + + /* Function + * ,-----------------------------------------------------------------------------------. + * | Esc | | Prev | Play | Next | | |Pg Up | Up |Pg Dn |Prt Sc| Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | Vol- | Mute | Vol+ | | Home | Left | Down |Right | End | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Home |Pg Up |Pg Dn | End | + * `-----------------------------------------------------------------------------------' + */ + +You can acces this layer by holding the first key on the second line from the top. From 62a02af9150e45cd0b6e5e5f128be7596d2fedcd Mon Sep 17 00:00:00 2001 From: Rozakiin Date: Tue, 19 Sep 2017 05:44:43 +0100 Subject: [PATCH 31/45] Fixed uk78 and turned Bootmagic off (#1725) * Add files via upload * Update readme.md * Update readme.md * Add files via upload * Add files via upload * Update config.h --- keyboards/uk78/config.h | 152 +++++++-------- keyboards/uk78/keymaps/default/keymap.c | 240 ++++++++++++------------ keyboards/uk78/readme.md | 32 ++-- keyboards/uk78/rules.mk | 2 +- 4 files changed, 215 insertions(+), 211 deletions(-) diff --git a/keyboards/uk78/config.h b/keyboards/uk78/config.h index e538ad33b77d..ffd62f3d4b0e 100644 --- a/keyboards/uk78/config.h +++ b/keyboards/uk78/config.h @@ -1,76 +1,76 @@ -/* -Copyright 2012 Jun Wako - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#ifndef CONFIG_H -#define CONFIG_H - -#include "config_common.h" - -/* USB Device descriptor parameter */ -#define VENDOR_ID 0x554B /* Ascii */ -#define PRODUCT_ID 0x004E -#define DEVICE_VER 0x0002 -#define MANUFACTURER UK Keyboards -#define PRODUCT UK78 -#define DESCRIPTION QMK keyboard firmware for UK78 - -/* key matrix size */ -#define MATRIX_ROWS 5 -#define MATRIX_COLS 19 - -/* key matrix pins */ -#define MATRIX_ROW_PINS { F3, F2, F1, F0, A0 } -#define MATRIX_COL_PINS { A2, A1, F5, F4, E6, E7, E5, E4, B7, D0, D1, D2, D3, D4, D5, D6, D7, B5, E0 } -#define UNUSED_PINS - -/* COL2ROW or ROW2COL */ -#define DIODE_DIRECTION COL2ROW - -/* number of backlight levels */ -#define BACKLIGHT_PIN B6 -#ifdef BACKLIGHT_PIN -#define BACKLIGHT_LEVELS 3 -#endif - -/* Set 0 if debouncing isn't needed */ -#define DEBOUNCING_DELAY 5 - -/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ -#define LOCKING_SUPPORT_ENABLE - -/* Locking resynchronize hack */ -#define LOCKING_RESYNC_ENABLE - -/* key combination for command */ -#define IS_COMMAND() ( \ - keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ -) - -/* prevent stuck modifiers */ -#define PREVENT_STUCK_MODIFIERS - -/* ws2812b options */ -#define RGB_DI_PIN F6 -#ifdef RGB_DI_PIN -#define RGBLIGHT_ANIMATIONS -#define RGBLED_NUM 20 -#define RGBLIGHT_HUE_STEP 8 -#define RGBLIGHT_SAT_STEP 8 -#define RGBLIGHT_VAL_STEP 8 -#endif - -#endif +/* +Copyright 2017 Ruari Armstrong + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x554B /* Ascii */ +#define PRODUCT_ID 0x004E +#define DEVICE_VER 0x0002 +#define MANUFACTURER UK Keyboards +#define PRODUCT UK78 +#define DESCRIPTION QMK keyboard firmware for UK78 + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 19 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { F3, F2, F1, F0, A0 } +#define MATRIX_COL_PINS { A2, A1, F5, F4, E6, E7, E5, E4, B7, D0, D1, D2, D3, D4, D5, D6, D7, B5, E0 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* number of backlight levels */ +#define BACKLIGHT_PIN B6 +#ifdef BACKLIGHT_PIN +#define BACKLIGHT_LEVELS 3 +#endif + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE + +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* prevent stuck modifiers */ +#define PREVENT_STUCK_MODIFIERS + +/* ws2812b options */ +#define RGB_DI_PIN F6 +#ifdef RGB_DI_PIN +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 20 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 +#endif + +#endif diff --git a/keyboards/uk78/keymaps/default/keymap.c b/keyboards/uk78/keymaps/default/keymap.c index b01beae18226..256386d86188 100644 --- a/keyboards/uk78/keymaps/default/keymap.c +++ b/keyboards/uk78/keymaps/default/keymap.c @@ -1,119 +1,123 @@ -#include "uk78.h" - -// Helpful defines -#define _______ KC_TRNS - -// Each layer gets a name for readability, which is then used in the keymap matrix below. -// The underscores don't mean anything - you can have a layer called STUFF or any other name. -// Layer names don't all need to be of the same length, obviously, and you can also skip them -// entirely and just use numbers. -#define _BL 0 -#define _FL1 1 -#define _FL2 2 - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* _BL: Base Layer(Default) - For ISO enter use ANSI \ - * ,-------------------------------------------------------------------------------. - * |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| /|BSpc| Del| P/| P*| P-| - * |-------------------------------------------------------------------------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | P7| P8| P9| P=| - * |-------------------------------------------------------------------------------| - * |CAPS | A| S| D| F| G| H| J| K| L| ;| '| #| Ent| P4| P5| P6| P+| - * |-------------------------------------------------------------------------------| - * |Shift| \| Z| X| C| V| B| N| M| ,| .| /|Shift | Up| P1| P2| P3|SLck| - * |-------------------------------------------------------------------------------| - * |Ctrl|Win |Alt | Space |Alt|Mo(1)|Ctrl|Lef|Dow| Rig| P0| P.|PEnt| - * `-------------------------------------------------------------------------------' - */ - [_BL] = KEYMAP( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_BSPC, KC_DEL, KC_PSLS, KC_PAST, KC_PMNS, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_PEQL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, - KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_SLCK, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(_FL1), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), - /* _FL1: Function Layer 1 - For ISO enter use ANSI \ - * ,-------------------------------------------------------------------------------. - * | `|F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|PScr|Ins|NLck| | | | - * |-------------------------------------------------------------------------------| - * | | | | |RST| | | | | | | | | | | | | | - * |-------------------------------------------------------------------------------| - * | | | | | | |Hu+|Va+|Sa+| | | | | | | | | | - * |-------------------------------------------------------------------------------| - * | | | | | |RGB|Hu-|Va-|Sa-|Bl-|Bl+| |Mute|Vol+| | | | | - * |-------------------------------------------------------------------------------| - * | | | | BL_Toggle | | | | |Vol-| | | | | - * `-------------------------------------------------------------------------------' - */ - [_FL1] = KEYMAP( - KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_INS, KC_NLCK, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, 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, RGB_HUI, RGB_SAI, RGB_VAI, 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, RGB_TOG, RGB_HUD, RGB_SAD, RGB_VAD, BL_DEC, BL_INC, KC_TRNS, KC_MUTE, KC_MUTE, KC_VOLU, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, BL_TOGG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), - /* _FL2: Function Layer 2 - For ISO enter use ANSI \ - * ,-------------------------------------------------------------------------------. - * | | | | | | | | | | | | | | | | | | | | - * |-------------------------------------------------------------------------------| - * | | | | | | | | | | | | | | | | | | | - * |-------------------------------------------------------------------------------| - * | | | | | | | | | | | | | | | | | | | - * |-------------------------------------------------------------------------------| - * | | | | | | | | | | | | | | | | | | | - * |-------------------------------------------------------------------------------| - * | | | | | | | | | | | | | | - * `-------------------------------------------------------------------------------' - */ - [_FL2] = KEYMAP( - 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_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_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_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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), - - -}; - - -void matrix_init_user(void) { -} - -void matrix_scan_user(void) { -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - return true; -} - -void led_set_user(uint8_t usb_led) { - - if (usb_led & (1 << USB_LED_NUM_LOCK)) { - - } else { - - } - - if (usb_led & (1 << USB_LED_CAPS_LOCK)) { - DDRA |= (1 << 3); PORTA |= (1 << 3); - } else { - DDRA &= ~(1 << 3); PORTA &= ~(1 << 3); - } - - if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { - - } else { - - } - - if (usb_led & (1 << USB_LED_COMPOSE)) { - - } else { - - } - - if (usb_led & (1 << USB_LED_KANA)) { - - } else { - - } - +#include "uk78.h" + +// Helpful defines +#define _______ KC_TRNS + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _BL 0 +#define _FL1 1 +#define _FL2 2 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* _BL: Base Layer(Default) - For ISO enter use ANSI \ + * ,-------------------------------------------------------------------------------. + * |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| /|BSpc| Del| P/| P*| P-| + * |-------------------------------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | P7| P8| P9| P=| + * |-------------------------------------------------------------------------------| + * |CAPS | A| S| D| F| G| H| J| K| L| ;| '| #| Ent| P4| P5| P6| P+| + * |-------------------------------------------------------------------------------| + * |Shift| \| Z| X| C| V| B| N| M| ,| .| /|Shift | Up| P1| P2| P3|SLck| + * |-------------------------------------------------------------------------------| + * |Ctrl|Win |Alt | Space |Alt|Ctrl|Mo(1)|Lef|Dow| Rig| P0| P.|PEnt| + * `-------------------------------------------------------------------------------' + */ + [_BL] = KEYMAP( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_BSPC, KC_DEL, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_PEQL, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_SLCK, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, MO(_FL1), KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), + /* _FL1: Function Layer 1 - For ISO enter use ANSI \ + * ,-------------------------------------------------------------------------------. + * | `|F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|PScr|Ins|NLck| | | | + * |-------------------------------------------------------------------------------| + * | | | | |RST| | | | | | | | | | | | | | + * |-------------------------------------------------------------------------------| + * | | | | | | |Hu+|Va+|Sa+| | | | | | | | | | + * |-------------------------------------------------------------------------------| + * | | | | | |RGB|Hu-|Va-|Sa-|Bl-|Bl+| |Mute|Vol+| | | | | + * |-------------------------------------------------------------------------------| + * | | | | BL_Toggle | | | | |Vol-| | | | | + * `-------------------------------------------------------------------------------' + */ + [_FL1] = KEYMAP( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_INS, KC_NLCK, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, 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, RGB_HUI, RGB_SAI, RGB_VAI, 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, RGB_TOG, RGB_HUD, RGB_SAD, RGB_VAD, BL_DEC, BL_INC, KC_TRNS, KC_MUTE, KC_MUTE, KC_VOLU, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, BL_TOGG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + /* _FL2: Function Layer 2 - For ISO enter use ANSI \ + * ,-------------------------------------------------------------------------------. + * | | | | | | | | | | | | | | | | | | | | + * |-------------------------------------------------------------------------------| + * | | | | | | | | | | | | | | | | | | | + * |-------------------------------------------------------------------------------| + * | | | | | | | | | | | | | | | | | | | + * |-------------------------------------------------------------------------------| + * | | | | | | | | | | | | | | | | | | | + * |-------------------------------------------------------------------------------| + * | | | | | | | | | | | | | | + * `-------------------------------------------------------------------------------' + */ + [_FL2] = KEYMAP( + 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_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_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_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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + +}; + + +void matrix_init_user(void) { +} + +void matrix_scan_user(void) { +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + + if (usb_led & (1 << USB_LED_NUM_LOCK)) { + + } + else { + + } + + if (usb_led & (1 << USB_LED_CAPS_LOCK)) { + DDRA |= (1 << 3); PORTA |= (1 << 3); + } + else { + DDRA &= ~(1 << 3); PORTA &= ~(1 << 3); + } + + if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { + + } + else { + + } + + if (usb_led & (1 << USB_LED_COMPOSE)) { + + } + else { + + } + + if (usb_led & (1 << USB_LED_KANA)) { + + } + else { + + } } \ No newline at end of file diff --git a/keyboards/uk78/readme.md b/keyboards/uk78/readme.md index 46f2936143b8..9387cbefeb59 100644 --- a/keyboards/uk78/readme.md +++ b/keyboards/uk78/readme.md @@ -1,16 +1,16 @@ -# UK78 - -![UK78](http://i.imgur.com/42pg6RS.png) - -A fully customizable 60%+numpad keyboard. - -* Keyboard Maintainer: [Rozakiin](https://github.com/rozakiin) -* Hardware Supported: UK78 PCB - * rev2 -* Hardware Availability: [ukkeyboards.](http://ukkeyboards.bigcartel.com/) - -Make example for this keyboard (after setting up your build environment): - - make uk78-default - -See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. +# UK78 + +![UK78](https://imgur.com/6pUQkKP.jpg) + +A fully customizable 60%+numpad keyboard. + +* Keyboard Maintainer: [Rozakiin](https://github.com/rozakiin) +* Hardware Supported: UK78 PCB + * rev2 +* Hardware Availability: [ukkeyboards.](http://ukkeyboards.bigcartel.com/) + +Make example for this keyboard (after setting up your build environment): + + make uk78-default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. \ No newline at end of file diff --git a/keyboards/uk78/rules.mk b/keyboards/uk78/rules.mk index 4e8d14812fda..5c2691823f84 100644 --- a/keyboards/uk78/rules.mk +++ b/keyboards/uk78/rules.mk @@ -44,7 +44,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=8192 # Build Options # comment out to disable the options. # -BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration(+1000) +BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration(+1000) MOUSEKEY_ENABLE ?= yes # Mouse keys(+4700) EXTRAKEY_ENABLE ?= yes # Audio control and System control(+450) CONSOLE_ENABLE ?= no # Console for debug(+400) From 0c335270bdb8cae19d7fc00fbab3aa1027aabbcb Mon Sep 17 00:00:00 2001 From: QMK Bot Date: Tue, 19 Sep 2017 04:47:16 +0000 Subject: [PATCH 32/45] convert to unix line-endings [skip ci] --- keyboards/uk78/config.h | 152 +++++++-------- keyboards/uk78/keymaps/default/keymap.c | 244 ++++++++++++------------ keyboards/uk78/readme.md | 30 +-- 3 files changed, 213 insertions(+), 213 deletions(-) diff --git a/keyboards/uk78/config.h b/keyboards/uk78/config.h index ffd62f3d4b0e..35f5bf70b323 100644 --- a/keyboards/uk78/config.h +++ b/keyboards/uk78/config.h @@ -1,76 +1,76 @@ -/* -Copyright 2017 Ruari Armstrong - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#ifndef CONFIG_H -#define CONFIG_H - -#include "config_common.h" - -/* USB Device descriptor parameter */ -#define VENDOR_ID 0x554B /* Ascii */ -#define PRODUCT_ID 0x004E -#define DEVICE_VER 0x0002 -#define MANUFACTURER UK Keyboards -#define PRODUCT UK78 -#define DESCRIPTION QMK keyboard firmware for UK78 - -/* key matrix size */ -#define MATRIX_ROWS 5 -#define MATRIX_COLS 19 - -/* key matrix pins */ -#define MATRIX_ROW_PINS { F3, F2, F1, F0, A0 } -#define MATRIX_COL_PINS { A2, A1, F5, F4, E6, E7, E5, E4, B7, D0, D1, D2, D3, D4, D5, D6, D7, B5, E0 } -#define UNUSED_PINS - -/* COL2ROW or ROW2COL */ -#define DIODE_DIRECTION COL2ROW - -/* number of backlight levels */ -#define BACKLIGHT_PIN B6 -#ifdef BACKLIGHT_PIN -#define BACKLIGHT_LEVELS 3 -#endif - -/* Set 0 if debouncing isn't needed */ -#define DEBOUNCING_DELAY 5 - -/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ -#define LOCKING_SUPPORT_ENABLE - -/* Locking resynchronize hack */ -#define LOCKING_RESYNC_ENABLE - -/* key combination for command */ -#define IS_COMMAND() ( \ - keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ -) - -/* prevent stuck modifiers */ -#define PREVENT_STUCK_MODIFIERS - -/* ws2812b options */ -#define RGB_DI_PIN F6 -#ifdef RGB_DI_PIN -#define RGBLIGHT_ANIMATIONS -#define RGBLED_NUM 20 -#define RGBLIGHT_HUE_STEP 8 -#define RGBLIGHT_SAT_STEP 8 -#define RGBLIGHT_VAL_STEP 8 -#endif - -#endif +/* +Copyright 2017 Ruari Armstrong + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0x554B /* Ascii */ +#define PRODUCT_ID 0x004E +#define DEVICE_VER 0x0002 +#define MANUFACTURER UK Keyboards +#define PRODUCT UK78 +#define DESCRIPTION QMK keyboard firmware for UK78 + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 19 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { F3, F2, F1, F0, A0 } +#define MATRIX_COL_PINS { A2, A1, F5, F4, E6, E7, E5, E4, B7, D0, D1, D2, D3, D4, D5, D6, D7, B5, E0 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* number of backlight levels */ +#define BACKLIGHT_PIN B6 +#ifdef BACKLIGHT_PIN +#define BACKLIGHT_LEVELS 3 +#endif + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE + +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* prevent stuck modifiers */ +#define PREVENT_STUCK_MODIFIERS + +/* ws2812b options */ +#define RGB_DI_PIN F6 +#ifdef RGB_DI_PIN +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 20 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 +#endif + +#endif diff --git a/keyboards/uk78/keymaps/default/keymap.c b/keyboards/uk78/keymaps/default/keymap.c index 256386d86188..ded77aeeb9b1 100644 --- a/keyboards/uk78/keymaps/default/keymap.c +++ b/keyboards/uk78/keymaps/default/keymap.c @@ -1,123 +1,123 @@ -#include "uk78.h" - -// Helpful defines -#define _______ KC_TRNS - -// Each layer gets a name for readability, which is then used in the keymap matrix below. -// The underscores don't mean anything - you can have a layer called STUFF or any other name. -// Layer names don't all need to be of the same length, obviously, and you can also skip them -// entirely and just use numbers. -#define _BL 0 -#define _FL1 1 -#define _FL2 2 - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - /* _BL: Base Layer(Default) - For ISO enter use ANSI \ - * ,-------------------------------------------------------------------------------. - * |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| /|BSpc| Del| P/| P*| P-| - * |-------------------------------------------------------------------------------| - * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | P7| P8| P9| P=| - * |-------------------------------------------------------------------------------| - * |CAPS | A| S| D| F| G| H| J| K| L| ;| '| #| Ent| P4| P5| P6| P+| - * |-------------------------------------------------------------------------------| - * |Shift| \| Z| X| C| V| B| N| M| ,| .| /|Shift | Up| P1| P2| P3|SLck| - * |-------------------------------------------------------------------------------| - * |Ctrl|Win |Alt | Space |Alt|Ctrl|Mo(1)|Lef|Dow| Rig| P0| P.|PEnt| - * `-------------------------------------------------------------------------------' - */ - [_BL] = KEYMAP( - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_BSPC, KC_DEL, KC_PSLS, KC_PAST, KC_PMNS, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_PEQL, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, - KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_SLCK, - KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, MO(_FL1), KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), - /* _FL1: Function Layer 1 - For ISO enter use ANSI \ - * ,-------------------------------------------------------------------------------. - * | `|F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|PScr|Ins|NLck| | | | - * |-------------------------------------------------------------------------------| - * | | | | |RST| | | | | | | | | | | | | | - * |-------------------------------------------------------------------------------| - * | | | | | | |Hu+|Va+|Sa+| | | | | | | | | | - * |-------------------------------------------------------------------------------| - * | | | | | |RGB|Hu-|Va-|Sa-|Bl-|Bl+| |Mute|Vol+| | | | | - * |-------------------------------------------------------------------------------| - * | | | | BL_Toggle | | | | |Vol-| | | | | - * `-------------------------------------------------------------------------------' - */ - [_FL1] = KEYMAP( - KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_INS, KC_NLCK, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, 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, RGB_HUI, RGB_SAI, RGB_VAI, 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, RGB_TOG, RGB_HUD, RGB_SAD, RGB_VAD, BL_DEC, BL_INC, KC_TRNS, KC_MUTE, KC_MUTE, KC_VOLU, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, - KC_TRNS, KC_TRNS, KC_TRNS, BL_TOGG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), - /* _FL2: Function Layer 2 - For ISO enter use ANSI \ - * ,-------------------------------------------------------------------------------. - * | | | | | | | | | | | | | | | | | | | | - * |-------------------------------------------------------------------------------| - * | | | | | | | | | | | | | | | | | | | - * |-------------------------------------------------------------------------------| - * | | | | | | | | | | | | | | | | | | | - * |-------------------------------------------------------------------------------| - * | | | | | | | | | | | | | | | | | | | - * |-------------------------------------------------------------------------------| - * | | | | | | | | | | | | | | - * `-------------------------------------------------------------------------------' - */ - [_FL2] = KEYMAP( - 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_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_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_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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), - - -}; - - -void matrix_init_user(void) { -} - -void matrix_scan_user(void) { -} - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - return true; -} - -void led_set_user(uint8_t usb_led) { - - if (usb_led & (1 << USB_LED_NUM_LOCK)) { - - } - else { - - } - - if (usb_led & (1 << USB_LED_CAPS_LOCK)) { - DDRA |= (1 << 3); PORTA |= (1 << 3); - } - else { - DDRA &= ~(1 << 3); PORTA &= ~(1 << 3); - } - - if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { - - } - else { - - } - - if (usb_led & (1 << USB_LED_COMPOSE)) { - - } - else { - - } - - if (usb_led & (1 << USB_LED_KANA)) { - - } - else { - - } +#include "uk78.h" + +// Helpful defines +#define _______ KC_TRNS + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _BL 0 +#define _FL1 1 +#define _FL2 2 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* _BL: Base Layer(Default) - For ISO enter use ANSI \ + * ,-------------------------------------------------------------------------------. + * |Esc | 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| /|BSpc| Del| P/| P*| P-| + * |-------------------------------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | P7| P8| P9| P=| + * |-------------------------------------------------------------------------------| + * |CAPS | A| S| D| F| G| H| J| K| L| ;| '| #| Ent| P4| P5| P6| P+| + * |-------------------------------------------------------------------------------| + * |Shift| \| Z| X| C| V| B| N| M| ,| .| /|Shift | Up| P1| P2| P3|SLck| + * |-------------------------------------------------------------------------------| + * |Ctrl|Win |Alt | Space |Alt|Ctrl|Mo(1)|Lef|Dow| Rig| P0| P.|PEnt| + * `-------------------------------------------------------------------------------' + */ + [_BL] = KEYMAP( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_BSPC, KC_DEL, KC_PSLS, KC_PAST, KC_PMNS, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_PEQL, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_SLCK, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RCTL, MO(_FL1), KC_LEFT, KC_DOWN, KC_RGHT, KC_P0, KC_PDOT, KC_PENT), + /* _FL1: Function Layer 1 - For ISO enter use ANSI \ + * ,-------------------------------------------------------------------------------. + * | `|F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|PScr|Ins|NLck| | | | + * |-------------------------------------------------------------------------------| + * | | | | |RST| | | | | | | | | | | | | | + * |-------------------------------------------------------------------------------| + * | | | | | | |Hu+|Va+|Sa+| | | | | | | | | | + * |-------------------------------------------------------------------------------| + * | | | | | |RGB|Hu-|Va-|Sa-|Bl-|Bl+| |Mute|Vol+| | | | | + * |-------------------------------------------------------------------------------| + * | | | | BL_Toggle | | | | |Vol-| | | | | + * `-------------------------------------------------------------------------------' + */ + [_FL1] = KEYMAP( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_INS, KC_NLCK, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, 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, RGB_HUI, RGB_SAI, RGB_VAI, 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, RGB_TOG, RGB_HUD, RGB_SAD, RGB_VAD, BL_DEC, BL_INC, KC_TRNS, KC_MUTE, KC_MUTE, KC_VOLU, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_TRNS, KC_TRNS, BL_TOGG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + /* _FL2: Function Layer 2 - For ISO enter use ANSI \ + * ,-------------------------------------------------------------------------------. + * | | | | | | | | | | | | | | | | | | | | + * |-------------------------------------------------------------------------------| + * | | | | | | | | | | | | | | | | | | | + * |-------------------------------------------------------------------------------| + * | | | | | | | | | | | | | | | | | | | + * |-------------------------------------------------------------------------------| + * | | | | | | | | | | | | | | | | | | | + * |-------------------------------------------------------------------------------| + * | | | | | | | | | | | | | | + * `-------------------------------------------------------------------------------' + */ + [_FL2] = KEYMAP( + 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_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_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_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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + + +}; + + +void matrix_init_user(void) { +} + +void matrix_scan_user(void) { +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + + if (usb_led & (1 << USB_LED_NUM_LOCK)) { + + } + else { + + } + + if (usb_led & (1 << USB_LED_CAPS_LOCK)) { + DDRA |= (1 << 3); PORTA |= (1 << 3); + } + else { + DDRA &= ~(1 << 3); PORTA &= ~(1 << 3); + } + + if (usb_led & (1 << USB_LED_SCROLL_LOCK)) { + + } + else { + + } + + if (usb_led & (1 << USB_LED_COMPOSE)) { + + } + else { + + } + + if (usb_led & (1 << USB_LED_KANA)) { + + } + else { + + } } \ No newline at end of file diff --git a/keyboards/uk78/readme.md b/keyboards/uk78/readme.md index 9387cbefeb59..2f29ca48c025 100644 --- a/keyboards/uk78/readme.md +++ b/keyboards/uk78/readme.md @@ -1,16 +1,16 @@ -# UK78 - -![UK78](https://imgur.com/6pUQkKP.jpg) - -A fully customizable 60%+numpad keyboard. - -* Keyboard Maintainer: [Rozakiin](https://github.com/rozakiin) -* Hardware Supported: UK78 PCB - * rev2 -* Hardware Availability: [ukkeyboards.](http://ukkeyboards.bigcartel.com/) - -Make example for this keyboard (after setting up your build environment): - - make uk78-default - +# UK78 + +![UK78](https://imgur.com/6pUQkKP.jpg) + +A fully customizable 60%+numpad keyboard. + +* Keyboard Maintainer: [Rozakiin](https://github.com/rozakiin) +* Hardware Supported: UK78 PCB + * rev2 +* Hardware Availability: [ukkeyboards.](http://ukkeyboards.bigcartel.com/) + +Make example for this keyboard (after setting up your build environment): + + make uk78-default + See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. \ No newline at end of file From 32d6a8b7ecdc653bd032e2bd32cfb8bb3183c904 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 19 Sep 2017 10:27:46 -0400 Subject: [PATCH 33/45] adds DZ60 support (#1734) * adds support for dz60 * fix dz60 readme --- keyboards/dz60/config.h | 54 ++++++++++++++++++++ keyboards/dz60/dz60.c | 9 ++++ keyboards/dz60/dz60.h | 65 +++++++++++++++++++++++++ keyboards/dz60/keymaps/default/keymap.c | 61 +++++++++++++++++++++++ keyboards/dz60/readme.md | 15 ++++++ keyboards/dz60/rules.mk | 56 +++++++++++++++++++++ 6 files changed, 260 insertions(+) create mode 100644 keyboards/dz60/config.h create mode 100644 keyboards/dz60/dz60.c create mode 100644 keyboards/dz60/dz60.h create mode 100644 keyboards/dz60/keymaps/default/keymap.c create mode 100644 keyboards/dz60/readme.md create mode 100644 keyboards/dz60/rules.mk diff --git a/keyboards/dz60/config.h b/keyboards/dz60/config.h new file mode 100644 index 000000000000..a282196b339e --- /dev/null +++ b/keyboards/dz60/config.h @@ -0,0 +1,54 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x2260 +#define DEVICE_VER 0x0001 +#define MANUFACTURER KBDFans +#define PRODUCT DZ60 +#define DESCRIPTION DZ60 Keyboard + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 15 + +/* key matrix pins */ +#define MATRIX_ROW_PINS { D0, D1, D2, D3, D5 } +#define MATRIX_COL_PINS { F0, F1, E6, C7, C6, B7, D4, B1, B0, B5, B4, D7, D6, B3, F4 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* number of backlight levels */ +#define BACKLIGHT_PIN B6 +#define BACKLIGHT_LEVELS 5 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE + +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* prevent stuck modifiers */ +#define PREVENT_STUCK_MODIFIERS + +#define RGB_DI_PIN E2 +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 20 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +#endif \ No newline at end of file diff --git a/keyboards/dz60/dz60.c b/keyboards/dz60/dz60.c new file mode 100644 index 000000000000..fbe39248c79b --- /dev/null +++ b/keyboards/dz60/dz60.c @@ -0,0 +1,9 @@ +#include "dz60.h" + +void led_set_kb(uint8_t usb_led) { + if (usb_led & (1 << USB_LED_CAPS_LOCK)) { + DDRB |= (1 << 2); PORTB &= ~(1 << 2); + } else { + DDRB &= ~(1 << 2); PORTB &= ~(1 << 2); + } +} \ No newline at end of file diff --git a/keyboards/dz60/dz60.h b/keyboards/dz60/dz60.h new file mode 100644 index 000000000000..1465963a7527 --- /dev/null +++ b/keyboards/dz60/dz60.h @@ -0,0 +1,65 @@ +#ifndef DZ60_H +#define DZ60_H + +#include "quantum.h" + +// 标准配列 +#define KEYMAP( \ + K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \ + K100, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \ + K200, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, \ + K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K313, K314, \ + K400, K401, K403, K404, K406, K408, K410, K411, K412, K413, K414 \ +) { \ + { K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \ + { K100, KC_NO, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114 }, \ + { K200, KC_NO, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, KC_NO }, \ + { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, KC_NO, K313, K314 }, \ + { K400, K401, KC_NO, K403, K404, KC_NO, K406, KC_NO, K408, KC_NO, K410, K411, K412, K413, K414 } \ +} + +#define KEYMAP_HHKB( \ + K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \ + K100, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \ + K200, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, \ + K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K313, K314, \ + K401, K403, K406, K410, K411 \ +) { \ + { K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \ + { K100, KC_NO, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114 }, \ + { K200, KC_NO, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, KC_NO }, \ + { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, KC_NO, K313, K314 }, \ + { KC_NO, K401, KC_NO, K403, KC_NO, KC_NO, K406, KC_NO, KC_NO, KC_NO, K410, K411, KC_NO, KC_NO, KC_NO } \ +} + +#define KEYMAP_2_SHIFTS( \ + K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \ + K100, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \ + K200, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, \ + K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, K314, \ + K400, K401, K403, K404, K406, K408, K410, K411, K412, K413, K414 \ +) { \ + { K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \ + { K100, KC_NO, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114 }, \ + { K200, KC_NO, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, KC_NO }, \ + { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, K314 }, \ + { K400, K401, KC_NO, K403, K404, KC_NO, K406, KC_NO, K408, KC_NO, K410, K411, K412, K413, K414 } \ +} + +// 带方向配列 +#define KEYMAP_DIRECTIONAL( \ + K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \ + K100, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \ + K200, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, \ + K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K312, K313, K314, \ + K400, K401, K403, K404, K406, K408, K410, K411, K412, K413, K414 \ +) { \ + { K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014 }, \ + { K100, KC_NO, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114 }, \ + { K200, KC_NO, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213, KC_NO }, \ + { K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, KC_NO, K312, K313, K314 }, \ + { K400, K401, KC_NO, K403, K404, KC_NO, K406, KC_NO, K408, KC_NO, K410, K411, K412, K413, K414 } \ +} + + +#endif \ No newline at end of file diff --git a/keyboards/dz60/keymaps/default/keymap.c b/keyboards/dz60/keymaps/default/keymap.c new file mode 100644 index 000000000000..81bce53da226 --- /dev/null +++ b/keyboards/dz60/keymaps/default/keymap.c @@ -0,0 +1,61 @@ +#include "dz60.h" + +#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + KEYMAP( + F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_NO, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, KC_NO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_NO, + KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(2), KC_NO, MO(1), KC_RCTL), + + KEYMAP( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_DEL, + KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, + 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, BL_DEC, BL_TOGG, BL_INC, BL_STEP, 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), + + KEYMAP( + KC_TRNS, M(1), M(2), M(3), M(4), M(5), M(6), M(7), M(8), M(9), M(10), M(11), M(12), 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_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_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), +}; + +enum function_id { + SHIFT_ESC, +}; + +const uint16_t PROGMEM fn_actions[] = { + [0] = ACTION_FUNCTION(SHIFT_ESC), +}; + +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { + static uint8_t shift_esc_shift_mask; + switch (id) { + case SHIFT_ESC: + shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; + if (record->event.pressed) { + if (shift_esc_shift_mask) { + add_key(KC_GRV); + send_keyboard_report(); + } else { + add_key(KC_ESC); + send_keyboard_report(); + } + } else { + if (shift_esc_shift_mask) { + del_key(KC_GRV); + send_keyboard_report(); + } else { + del_key(KC_ESC); + send_keyboard_report(); + } + } + break; + } +} \ No newline at end of file diff --git a/keyboards/dz60/readme.md b/keyboards/dz60/readme.md new file mode 100644 index 000000000000..d14af7a5caf1 --- /dev/null +++ b/keyboards/dz60/readme.md @@ -0,0 +1,15 @@ +# DZ60 + +![dz60](https://cdn.shopify.com/s/files/1/1473/3902/files/1_6525343b-ee62-47e8-882a-05e316136a3f.jpg?v=1501657073) + +A customizable 60% keyboard. + +Keyboard Maintainer: QMK Community +Hardware Supported: DZ60 +Hardware Availability: [kbdfans](https://kbdfans.myshopify.com/collections/pcb/products/dz60-60-pcb?variant=40971616717) + +Make example for this keyboard (after setting up your build environment): + + make dz60-default + +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. diff --git a/keyboards/dz60/rules.mk b/keyboards/dz60/rules.mk new file mode 100644 index 000000000000..9c4082da29f4 --- /dev/null +++ b/keyboards/dz60/rules.mk @@ -0,0 +1,56 @@ +# MCU name +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = no # Commands for debug and configuration +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +AUDIO_ENABLE = no +RGBLIGHT_ENABLE = yes \ No newline at end of file From 064f682103dff1bd7b1dfea4d44ca34827d061a1 Mon Sep 17 00:00:00 2001 From: Jeremy Cowgar Date: Wed, 20 Sep 2017 13:38:27 -0400 Subject: [PATCH 34/45] Instruct VSCode to indent using spaces, also ignore two temp files created by VSCode. --- .gitignore | 4 +++- .vscode/settings.json | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e76661909877..e77127268bea 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,8 @@ util/Win_Check_Output.txt # Let these ones be user specific, since we have so many different configurations .vscode/launch.json .vscode/tasks.json +.vscode/last.sql +.vscode/temp.sql .stfolder # ignore image files @@ -47,7 +49,7 @@ util/Win_Check_Output.txt *.gif # Do not ignore MiniDox left/right hand eeprom files -!keyboards/minidox/*.eep +!keyboards/minidox/*.eep # things travis sees secrets.tar diff --git a/.vscode/settings.json b/.vscode/settings.json index be0b85b78ffa..afe8341d0e2e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,7 @@ // Place your settings in this file to overwrite default and user settings. { + // Unofficially, QMK uses spaces for indentation + "editor.insertSpaces": true, // Configure glob patterns for excluding files and folders. "files.exclude": { "**/.build": true, From b1d6005c52984403ab4815a705eab0da371082a3 Mon Sep 17 00:00:00 2001 From: "Michael F. Lamb" Date: Tue, 19 Sep 2017 22:37:26 -0700 Subject: [PATCH 35/45] add layout mitosis-datagrok (workman variant) --- keyboards/mitosis/keymaps/datagrok/keymap.c | 104 ++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 keyboards/mitosis/keymaps/datagrok/keymap.c diff --git a/keyboards/mitosis/keymaps/datagrok/keymap.c b/keyboards/mitosis/keymaps/datagrok/keymap.c new file mode 100644 index 000000000000..e4460a9b6941 --- /dev/null +++ b/keyboards/mitosis/keymaps/datagrok/keymap.c @@ -0,0 +1,104 @@ +#include "mitosis.h" + +// Arrows in a layer in the home position. +// Fn+Arrows = PgUp PgDn Home End, which is intuitive for me +// +// Since QWERTY and WORKMAN keep angle brackets together, I wanted to place +// other enclosing symbols on the same keys. So, 9 and 0 and [ and ] land there +// in other layers. That informed the numbers placement, which informed the +// function-key placement. +// +// To do: +// - Improve LED indications (may require modding bluetooth firmware): +// - Is any board nonresponsive (which one?) +// - Does either board have a low battery? +// - Use "shifted keys" hack to make programming symbols easier to type +// - Add "media" keysyms, Insert, PrintScr, Pause/Break +// - Dynamically toggle QWERTY or other layouts +// - See if the henkans placement is at all useful for Japanese speakers, or +// abuse different keysyms +// - Overlay a 10key numpad somewhere +// - Mod a speaker onto my receiver and enable tones +// - Mod more indicator LEDs onto my receiver +// - Do something with Num/Caps/Scroll lock? +// - Improve tri-layer behavior + +enum mitosis_layers +{ + _WORKMAN, + _FUNC, + _NUMS, + _NMFN +}; + +// Fillers to make layering more clear +#define XXXXXXX KC_NO // No-op (no key in this location on Mitosis' fake matrix) +#define _______ KC_TRNS // Transparent, because I haven't decided a mapping yet +#define ___M___ KC_TRNS // Transparent, as required by modifier key on another layer +#define KC_LMTA KC_LALT // For fun, name the mods like the space cadet keyboard does +#define KC_RMTA KC_RALT // META +#define KC_LSUP KC_LGUI // SUPER +#define KC_RSUP KC_RGUI // +#define KC_RHYP KC_INT4 // HYPER (actually muhenkan 無変換 and henkan 変換) +#define KC_LHYP KC_INT5 // or NFER/XFER. + +// I didn't want to mess about with new keymappings and custom logic etc. to +// enable tri-state layers like mitosis default does. This layout accomplishes +// it with a small quirk that triggering both layers then releasing one +// out-of-order will leave the tri-state triggered. Which doesn't bother me. + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_WORKMAN] = { + {KC_Q, KC_D, KC_R, KC_W, KC_B, KC_J, KC_F, KC_U, KC_P, KC_SCLN}, + {KC_A, KC_S, KC_H, KC_T, KC_G, KC_Y, KC_N, KC_E, KC_O, KC_I}, + {KC_Z, KC_X, KC_M, KC_C, KC_V, KC_K, KC_L, KC_COMM, KC_DOT, KC_SLSH}, + {XXXXXXX, MO(_NUMS), KC_LCTL, KC_LSFT, KC_BSPC, KC_SPC, KC_RSFT, KC_RCTL, MO(_NUMS), XXXXXXX}, + {XXXXXXX, KC_LHYP, KC_LSUP, KC_LMTA, MO(_FUNC), MO(_FUNC), KC_RMTA, KC_RSUP, KC_RHYP, XXXXXXX} + }, + [_FUNC] = { + {KC_ESC, _______, KC_UP, _______, _______, _______, _______, _______, _______, KC_QUOT}, + {KC_TAB, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, _______, _______, KC_GRV}, + {_______, _______, _______, _______, _______, _______, _______, KC_LBRC, KC_RBRC, KC_BSLS}, + {XXXXXXX, MO(_NMFN), _______, _______, KC_DEL, KC_ENT, _______, _______, MO(_NMFN), XXXXXXX}, + {XXXXXXX, _______, _______, _______, ___M___, ___M___, _______, _______, _______, XXXXXXX}, + }, + [_NUMS] = { + {_______, _______, _______, _______, _______, _______, KC_1, KC_2, KC_3, KC_4}, + {_______, _______, _______, _______, _______, _______, KC_5, KC_6, KC_7, KC_8}, + {_______, _______, _______, _______, _______, _______, KC_MINS, KC_9, KC_0, KC_EQL}, + {XXXXXXX, ___M___, _______, _______, _______, _______, _______, _______, ___M___, XXXXXXX}, + {XXXXXXX, _______, _______, _______, MO(_NMFN), MO(_NMFN), _______, _______, _______, XXXXXXX}, + }, + [_NMFN] = { + {_______, _______, KC_PGUP, _______, _______, _______, KC_F1, KC_F2, KC_F3, KC_F4}, + {_______, KC_HOME, KC_PGDN, KC_END, _______, _______, KC_F5, KC_F6, KC_F7, KC_F8}, + {_______, _______, _______, _______, _______, _______, KC_F8, KC_F9, KC_F10, KC_F12}, + {XXXXXXX, ___M___, _______, _______, _______, _______, _______, _______, ___M___, XXXXXXX}, + {XXXXXXX, _______, _______, _______, ___M___, ___M___, _______, _______, _______, XXXXXXX}, + }, +}; + +void matrix_scan_user(void) { + uint8_t layer = biton32(layer_state); + + switch (layer) { + case _WORKMAN: + red_led_off; + grn_led_off; + break; + case _FUNC: + red_led_off; + grn_led_on; + break; + case _NUMS: + red_led_on; + grn_led_off; + break; + case _NMFN: + red_led_on; + grn_led_on; + break; + default: + break; + } +}; From ea7792b6c6a09d98598f25989e08b262641b9b26 Mon Sep 17 00:00:00 2001 From: "U-SALTY-WINTENDO\\Haj Okuda" Date: Mon, 18 Sep 2017 23:38:31 -0400 Subject: [PATCH 36/45] Adding my keymap with Colemak Mod-DH --- keyboards/kinesis/keymaps/salty/Makefile | 22 + keyboards/kinesis/keymaps/salty/config.h | 10 + keyboards/kinesis/keymaps/salty/keymap.c | 527 +++++++++++++++++++++++ keyboards/kinesis/keymaps/salty/rules.mk | 22 + 4 files changed, 581 insertions(+) create mode 100644 keyboards/kinesis/keymaps/salty/Makefile create mode 100644 keyboards/kinesis/keymaps/salty/config.h create mode 100644 keyboards/kinesis/keymaps/salty/keymap.c create mode 100644 keyboards/kinesis/keymaps/salty/rules.mk diff --git a/keyboards/kinesis/keymaps/salty/Makefile b/keyboards/kinesis/keymaps/salty/Makefile new file mode 100644 index 000000000000..4346cf00958c --- /dev/null +++ b/keyboards/kinesis/keymaps/salty/Makefile @@ -0,0 +1,22 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +TAP_DANCE_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/kinesis/keymaps/salty/config.h b/keyboards/kinesis/keymaps/salty/config.h new file mode 100644 index 000000000000..5afb80435027 --- /dev/null +++ b/keyboards/kinesis/keymaps/salty/config.h @@ -0,0 +1,10 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + + +#include "../../config.h" + +// place overrides here +#define TAPPING_TERM 200 + +#endif diff --git a/keyboards/kinesis/keymaps/salty/keymap.c b/keyboards/kinesis/keymaps/salty/keymap.c new file mode 100644 index 000000000000..e6cf61bfa31f --- /dev/null +++ b/keyboards/kinesis/keymaps/salty/keymap.c @@ -0,0 +1,527 @@ +#include "kinesis.h" +#include "action_layer.h" +#include "eeconfig.h" + +#define _CMD 0 // Base Colemak Mod-DH +#define _QW 1 // Base QWERTY +#define _CG 2 // Colemak Mod-DH gaming layer +#define _QG 3 // QWERTY gaming layer +#define _NM 4 // Number layer +#define _MD 5 // Media Layer +#define _KP 6 // KP layer +#define _LY 7 // Layer switcher +#define _FN 8 // Function layer +#define _FN2 9 // Function layer (identical as _FN; used to deal with minor key interaction issue) + +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +//Tap Dance Declarations +enum { + LPN_LBC, + RPN_RBC +}; + +qk_tap_dance_action_t tap_dance_actions[] = { +[LPN_LBC] = ACTION_TAP_DANCE_DOUBLE(KC_LPRN, KC_LBRC), +[RPN_RBC] = ACTION_TAP_DANCE_DOUBLE(KC_RPRN, KC_RBRC) +}; + +/* + + Function Keys on All Layers (Keypad toggles): + ,-----------------------------------------------------------------. + | ESC | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | + `-----------------------------------------------------------------' + ,---------------------------------------------------------------- --------------. + | F9 | F10 | F11 | F12 | PScr | SLck | Paus | Keypad | Layer/ | + | | | | | | | | | RESET (in Fn layer) | + `-------------------------------------------------------------------------------' + + Colemak Mod-DH layer: + ,-------------------------------------------.,-------------------------------------------. + | = | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | - | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | Tab | Q | W | F | P | B || J | L | U | Y | ; | \ | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | Ctl/Esc| A | R | S | T | G || M | N | E | I | O | ' | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | ( [ | Z | X | C | D | V || K | H | , | . | / | ) ] | + `--------+------+------+------+------+------'`------+------+------+------+------+--------' + | ` | | [ | ] | | Left | Down | Up | Right| + `---------------------------' `---------------------------' + ,--------------.,--------------. + |Ctl/Esc| LAlt || RAlt | RCtl | + ,------|-------|------||------+-------+-------. + | | Enter |Number|| RGUI | Delete| | + | Space| / |------||------| / | Bspc | + | /Fn | LShift| Bspc || Media| RShift| /Fn | + `---------------------'`----------------------' + + + QWERTY layer: + ,-------------------------------------------.,-------------------------------------------. + | = | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | - | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | Tab | Q | W | E | R | T || Y | U | I | O | P | \ | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | Ctl/Esc| A | S | D | F | G || H | J | K | L | ; | ' | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | ( [ | Z | X | C | V | B || N | M | , | . | / | ) ] | + `--------+------+------+------+------+------'`------+------+------+------+------+--------' + | ` | | [ | ] | | Left | Down | Up | Right| + `---------------------------' `---------------------------' + ,--------------.,--------------. + |Ctl/Esc| LAlt || RAlt | RCtl | + ,------|-------|------||------+-------+-------. + | | Enter |Number|| RGUI | Delete| | + | Space| / |------||------| / | Bspc | + | /Fn | LShift| Bspc || Media| RShift| /Fn | + `---------------------'`----------------------' + + + Colemak Mod-DH Gaming layer: + ,-------------------------------------------.,-------------------------------------------. + | = | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | - | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | Tab | Q | W | F | P | B || J | L | U | Y | ; | \ | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | Ctl/Esc| A | R | S | T | G || M | N | E | I | O | ' | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | LShift | Z | X | C | D | V || K | H | , | . | / | RShift | + `--------+------+------+------+------+------'`------+------+------+------+------+--------' + | ` | | [ | ] | | Left | Down | Up | Right| + `---------------------------' `---------------------------' + ,--------------.,--------------. + |Ctl/Esc| LAlt || RAlt | RCtl | + ,------|-------|------||------+-------+-------. + | | Enter |Number|| RGUI | Delete| | + | Space| / |------||------| / | Bspc | + | | LShift| Bspc || Media| RShift| | + `---------------------'`----------------------' + + + QWERTY Gaming layer: + ,-------------------------------------------.,-------------------------------------------. + | = | 1 | 2 | 3 | 4 | 5 || 6 | 7 | 8 | 9 | 0 | - | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | Tab | Q | W | E | R | T || Y | U | I | O | P | \ | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | Ctl/Esc| A | S | D | F | G || H | J | K | L | ; | ' | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | LShift | Z | X | C | V | B || N | M | , | . | / | RShift | + `--------+------+------+------+------+------'`------+------+------+------+------+--------' + | ` | | [ | ] | | Left | Down | Up | Right| + `---------------------------' `---------------------------' + ,--------------.,--------------. + |Ctl/Esc| LAlt || RAlt | RCtl | + ,------|-------|------||------+-------+-------. + | | Enter |Number|| RGUI | Delete| | + | Space| / |------||------| / | Bspc | + | | LShift| Bspc || Media| RShift| | + `---------------------'`----------------------' + + + Media layer: + ,-------------------------------------------.,-------------------------------------------. + | | | | | | || | | | | | | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | | | | | | || | | | | | | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | | | Mute | Vol- | Vol+ | || | | | | | | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | | | Prev | Play | Next | Stop || | | | | | | + `--------+------+------+------+------+------'`------+------+------+------+------+--------' + | | | | | | | | | | + `---------------------------' `---------------------------' + ,-------------.,-------------. + | | || | | + ,------|------|------||------+------+------. + | | | || | | | + | | |------||------| | | + | | | || | | | + `--------------------'`--------------------' + + Keypad layer: + ,-------------------------------------------.,-------------------------------------------. + | | | | | | || | | KP = | KP / | KP * | | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | | | | Up | | || | KP 7 | KP 8 | KP 9 | KP - | | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | | | Left | Down | Right| || | KP 4 | KP 5 | KP 6 | KP + | | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | | | | | | || | KP 1 | KP 2 | KP 3 |KP Ent| | + `--------+------+------+------+------+------'`------+------+------+------+------+--------' + | | INS | | | | | | KP . |KP Ent| + `---------------------------' `---------------------------' + ,-------------.,-------------. + | | || | | + ,------|------|------||------+------+------. + | | | || | | | + | | |------||------| | KP 0 | + | | | || | | | + `--------------------'`--------------------' + + Layer switch layer: + ,-------------------------------------------.,-------------------------------------------. + | |Col DH|QWERTY|Col GM|QW GM | || | | | | | | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | | | | | | || | | | | | | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | | | | | | || | | | | | | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | | | | | | || | | | | | | + `--------+------+------+------+------+------'`------+------+------+------+------+--------' + | | | | | | | | | | + `---------------------------' `---------------------------' + ,-------------.,-------------. + | | || | | + ,------|------|------||------+------+------. + | | | || | | | + | | |------||------| | | + | | | || | | | + `--------------------'`--------------------' + + Function layer: + ,-------------------------------------------.,-------------------------------------------. + | F11 | F1 | F2 | F3 | F4 | F5 || F6 | F7 | F8 | F9 | F10 | F12 | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | | | | Up | | || | Home | Up | End | | | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | | | Left | Down | Right| || PgUp | Right| Down | Left | | | + |--------+------+------+------+------+------||------+------+------+------+------+--------| + | | | | | | || PgDn | | | | | | + `--------+------+------+------+------+------'`------+------+------+------+------+--------' + | | INS | | | | | | | | + `---------------------------' `---------------------------' + ,-------------.,-------------. + | | || | | + ,------|------|------||------+------+------. + | | | || | | | + | | |------||------| | | + | | | || | | | + `--------------------'`--------------------' + + +*/ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +[_CMD] = KEYMAP( + // Left Hand + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, + CTL_T(KC_ESC), KC_A, KC_R, KC_S, KC_T, KC_G, + TD(LPN_LBC), KC_Z, KC_X, KC_C, KC_D, KC_V, + KC_GRV, XXXXXXX, KC_LBRC, KC_RBRC, + + //Left Thumb + CTL_T(KC_ESC), KC_LALT, + MO(_NM), + LT(_FN, KC_SPC), LSFT_T(KC_ENT), KC_BSPC, + + //Right Hand + KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, TG(_KP), MO(_LY), + KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS, + KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, TD(RPN_RBC), + KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, + + //Right Thumb + KC_RALT, KC_RCTL, + KC_RGUI, + MO(_MD), RSFT_T(KC_DEL), LT(_FN2, KC_BSPC) + ), + +[_QW] = KEYMAP( + // Left Hand + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, + CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, + TD(LPN_LBC), KC_Z, KC_X, KC_C, KC_V, KC_B, + KC_GRV, XXXXXXX, KC_LBRC, KC_RBRC, + + //Left Thumb + CTL_T(KC_ESC), KC_LALT, + MO(_NM), + LT(_FN, KC_SPC), LSFT_T(KC_ENT), KC_BSPC, + + //Right Hand + KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, TG(_KP), MO(_LY), + KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, TD(RPN_RBC), + KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, + + //Right Thumb + KC_RALT, KC_RCTL, + KC_RGUI, + MO(_MD), RSFT_T(KC_DEL), LT(_FN2, KC_BSPC) + + ), + +[_CG] = KEYMAP( + // Left Hand + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, + KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_B, + CTL_T(KC_ESC), KC_A, KC_R, KC_S, KC_T, KC_G, + KC_LSFT, KC_Z, KC_X, KC_C, KC_D, KC_V, + KC_GRV, XXXXXXX, KC_LBRC, KC_RBRC, + + //Left Thumb + CTL_T(KC_ESC), KC_LALT, + MO(_NM), + KC_SPC, LSFT_T(KC_ENT), KC_BSPC, + + //Right Hand + KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, TG(_KP), MO(_LY), + KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSLS, + KC_M, KC_N, KC_E, KC_I, KC_O, KC_QUOT, + KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, + + //Right Thumb + KC_RALT, KC_RCTL, + KC_RGUI, + MO(_MD), RSFT_T(KC_DEL), KC_BSPC + ), + +[_QG] = KEYMAP( + // Left Hand + KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, + CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, + KC_GRV, XXXXXXX, KC_LBRC, KC_RBRC, + + //Left Thumb + CTL_T(KC_ESC), KC_LALT, + MO(_NM), + KC_SPC, LSFT_T(KC_ENT), KC_BSPC, + + //Right Hand + KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS, TG(_KP), MO(_LY), + KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, + KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, + KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, + KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, + + //Right Thumb + KC_RALT, KC_RCTL, + KC_RGUI, + MO(_MD), RSFT_T(KC_DEL), KC_BSPC + ), + +[_NM] = KEYMAP( + // Left Hand + _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, + + // Left Thumb + _______, _______, + _______, + _______, _______, _______, + + // Right Hand + _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, + + // Right Thumb + _______, _______, + _______, + _______, _______, _______ + ), + +[_MD] = KEYMAP( + // Left Hand + _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, + _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, KC_MSTP, + _______, _______, _______, _______, + + // Left Thumb + _______, _______, + _______, + _______, _______, _______, + + // Right Hand + _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, + + // Right Thumb + _______, _______, + _______, + _______, _______, _______ + ), + +[_KP] = KEYMAP( + // Left Hand + _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, KC_UP, _______, _______, + _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, + _______, _______, _______, _______, _______, _______, + _______, KC_INS, _______, _______, + + // Left Thumb + _______, _______, + _______, + _______, _______, _______, + + // Right Hand + _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, KC_PEQL, KC_PSLS, KC_PAST, _______, + _______, KC_P7, KC_P8, KC_P9, KC_PMNS, _______, + _______, KC_P4, KC_P5, KC_P6, KC_PPLS, _______, + _______, KC_P1, KC_P2, KC_P3, KC_PENT, _______, + _______, _______, KC_PDOT, KC_PENT, + + // Right Thumb + _______, _______, + _______, + _______, _______, KC_P0 + ), + +[_LY] = KEYMAP( + // Left Hand + _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, DF(_CMD), DF(_QW), DF(_CG), DF(_QG), _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, + + // Left Thumb + _______, _______, + _______, + _______, _______, _______, + + // Right Hand + _______, _______, _______, _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, _______, _______, + _______, _______, _______, _______, + + // Right Thumb + _______, _______, + _______, + _______, _______, _______ + ), + +[_FN] = KEYMAP( + // Left Hand + _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_F11, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, + _______, _______, _______, KC_UP, _______, _______, + _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, + _______, _______, _______, _______, _______, _______, + _______, KC_INS, _______, _______, + + // Left Thumb + _______, _______, + _______, + _______, _______, _______, + + // Right Hand + _______, _______, _______, _______, _______, _______, _______, _______, RESET, + KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F12, + _______, KC_HOME, KC_UP, KC_END, _______, _______, + KC_PGUP, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, + KC_PGDN, _______, _______, _______, _______, _______, + _______, _______, _______, _______, + + // Right Thumb + _______, _______, + _______, + _______, _______, _______ + ), + +[_FN2] = KEYMAP( + // Left Hand + _______, _______, _______, _______, _______, _______, _______, _______, _______, + KC_F11, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, + _______, _______, _______, KC_UP, _______, _______, + _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, + _______, _______, _______, _______, _______, _______, + _______, KC_INS, _______, _______, + + // Left Thumb + _______, _______, + _______, + _______, _______, _______, + + // Right Hand + _______, _______, _______, _______, _______, _______, _______, _______, RESET, + KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F12, + _______, KC_HOME, KC_UP, KC_END, _______, _______, + KC_PGUP, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, + KC_PGDN, _______, _______, _______, _______, _______, + _______, _______, _______, _______, + + // Right Thumb + _______, _______, + _______, + _______, _______, _______ + ) + +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +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; +}; + + +void matrix_init_user(void) { + +} + +void matrix_scan_user(void) { + +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} + +void led_set_user(uint8_t usb_led) { + +} diff --git a/keyboards/kinesis/keymaps/salty/rules.mk b/keyboards/kinesis/keymaps/salty/rules.mk new file mode 100644 index 000000000000..4346cf00958c --- /dev/null +++ b/keyboards/kinesis/keymaps/salty/rules.mk @@ -0,0 +1,22 @@ +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +TAP_DANCE_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif From 31e78d22b47fb78b1adaf12f5330ac169e90add0 Mon Sep 17 00:00:00 2001 From: Batuhan Baserdem Date: Thu, 21 Sep 2017 00:19:57 -0400 Subject: [PATCH 37/45] Turkish planck keymap (#1675) * Adding keymap * Adding keymap * Compiles now, but doesn't flash * Fixes issues with compilation * Trying to fix issues with tap-dance layer * Trying to fix issues with tap-dance layer * Trying to fix issues with tap-dance layer * Fixed bbaserdem layout * Added keyboard layout image * Edited README.md * Changed layout and removed image from README.md * Changed tapping terms * Changed layout a bit --- keyboards/planck/keymaps/bbaserdem/Makefile | 23 ++ keyboards/planck/keymaps/bbaserdem/README.md | 35 ++ keyboards/planck/keymaps/bbaserdem/config.h | 44 ++ keyboards/planck/keymaps/bbaserdem/keymap.c | 413 +++++++++++++++++++ 4 files changed, 515 insertions(+) create mode 100644 keyboards/planck/keymaps/bbaserdem/Makefile create mode 100644 keyboards/planck/keymaps/bbaserdem/README.md create mode 100644 keyboards/planck/keymaps/bbaserdem/config.h create mode 100644 keyboards/planck/keymaps/bbaserdem/keymap.c diff --git a/keyboards/planck/keymaps/bbaserdem/Makefile b/keyboards/planck/keymaps/bbaserdem/Makefile new file mode 100644 index 000000000000..9c6bd8e19bf9 --- /dev/null +++ b/keyboards/planck/keymaps/bbaserdem/Makefile @@ -0,0 +1,23 @@ +# Build options + +# ENABLE +TAP_DANCE_ENABLE = yes +UNICODE_ENABLE = yes +MOUSEKEY_ENABLE = yes +EXTRAKEY_ENABLE = yes +NKRO_ENABLE = yes +BACKLIGHT_ENABLE = yes +AUDIO_ENABLE = yes + +# DISABLE +BOOTMAGIC_ENABLE = no +MIDI_ENABLE = no + +# Not for planck +RGBLIGHT_ENABLE = no #Clashes with audio +BLUETOOTH_ENABLE = no #No bluetooth +SLEEP_LED_ENABLE = no #Uses BACKLIGHT_ENABLE rimer + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/planck/keymaps/bbaserdem/README.md b/keyboards/planck/keymaps/bbaserdem/README.md new file mode 100644 index 000000000000..881307566213 --- /dev/null +++ b/keyboards/planck/keymaps/bbaserdem/README.md @@ -0,0 +1,35 @@ +# Planck Layout + +Built this planck layout to use DVORAK with an unorthodox Turkish layout. +If you used a previous layout with a persistent base layer change, +change it to 0 before proceeding. +The layout has the following functionality + +* **QWERTY** can be toggled on/off from **Function** layer. +* **Mouse** layer allows manipulation of the mouse. +* **Function** layer has F and special keys. +* **Symbol** layer has numericals and symbols. +* **Game** layout can be toggled on/off from **Function** layer. +* **Music** layer allows playing sounds like a keyboard. + +Double tapping **Mouse**, **Function** and **Symbol** layers activate them until deacivation. +Topleftmost key turns off **Function**, **Symbol**, **Game** and **Music** layers, +and puts the board into *reset* mode from the **Mouse** layer. + +# Using Turkish letters + +Instead of a turkish F keyboard layout (very inconvenient to code in), +I opted to modulate characters like an *AltGr* impleentation. +Tap and holding *Alt* on **DVORAK** and **QWERTY** layer will change some letters +to Turkish equivelants. +Shifting these letters will work. +The keycodes should transmit the correct unicode characters combined with shift. +The turkish letters are sent via the unicode implementation. +No software layout change is neccessary (hence making coding easier). +By default, the unicode is set to Linux mode. Switch to windows (non-persistent) +can be done from the associated key in **Function** layer. +**Symbol** layer also has the symbol for Turkish Lira. + +# To improve + +I want to write a couple pieces of my own music for layer switching. diff --git a/keyboards/planck/keymaps/bbaserdem/config.h b/keyboards/planck/keymaps/bbaserdem/config.h new file mode 100644 index 000000000000..d7632aecda21 --- /dev/null +++ b/keyboards/planck/keymaps/bbaserdem/config.h @@ -0,0 +1,44 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#ifdef AUDIO_ENABLE + // Compose own song in future + #define STARTUP_SONG SONG(PLANCK_SOUND) + + #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ + SONG(COLEMAK_SOUND), \ + SONG(DVORAK_SOUND) \ + } +#endif + +// Enables tap magic +#define TAPPING_TERM 300 +#define TAPPING_TOGGLE 1 + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ + +#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 2 + +#endif diff --git a/keyboards/planck/keymaps/bbaserdem/keymap.c b/keyboards/planck/keymaps/bbaserdem/keymap.c new file mode 100644 index 000000000000..74dfabdecf8e --- /dev/null +++ b/keyboards/planck/keymaps/bbaserdem/keymap.c @@ -0,0 +1,413 @@ +/* Copyright 2015-2017 Jack Humbert + * + * 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 . + */ + +#include "planck.h" + +#define _______ KC_TRNS +#define XXX KC_NO + +#define _DV 0 +#define _TD 1 +#define _GM 2 +#define _MO 3 +#define _SY 4 +#define _FN 5 +#define _MS 6 + +#define PARAN TD(PAR) +#define CURLY TD(CUR) +#define SQUAR TD(SQU) +#define ANGUL TD(ANG) + +#define UNDO LCTL(KC_Z) +#define REDO LCTL(KC_Y) +#define COPYCUT TD(CPC) +#define PASTE LCTL(KC_V) + +#define MO_SC_U KC_MS_WH_UP +#define MO_SC_D KC_MS_WH_DOWN +#define MO_SC_L KC_MS_WH_LEFT +#define MO_SC_R KC_MS_WH_RIGHT +#define MO_U KC_MS_UP +#define MO_D KC_MS_DOWN +#define MO_L KC_MS_LEFT +#define MO_R KC_MS_RIGHT +#define MO_CL_L KC_MS_BTN1 +#define MO_CL_R KC_MS_BTN2 +#define MO_CL_M KC_MS_BTN3 +#define MO_CL_1 KC_MS_BTN4 +#define MO_CL_2 KC_MS_BTN5 +#define MO_AC_0 KC_MS_ACCEL0 +#define MO_AC_1 KC_MS_ACCEL1 +#define MO_AC_2 KC_MS_ACCEL2 + +#define PHY_HB UC(0x0127) +#define PHY_DE UC(0xc2b0) +#define TUR_TL UC(0x20ba) +#define EUR_ER UC(0x20ac) +#define EUR_PN UC(0x00a3) + +enum custom_keycodes { + TUR_A = SAFE_RANGE, + TUR_C, + TUR_G, + TUR_I, + TUR_O, + TUR_S, + TUR_U, + UNI_LI, + UNI_WN +}; + +// Tap dance +enum { + ATD = 0, + CLS, + SCL, + QUO, + PAR, + CUR, + SQU, + ANG, + CPC +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Dvorak + * ,------------------------------------------------------------------------. + * | Blt | " | , | . | P | Y || F | G | C | R | L | Bkp | + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * | Esc | A | O | E | U | I || D | H | T | N | S | Del | + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * |Sh\CL| ; : | Q | J | K | X || B | M | W | V | Z |MOUSE| + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * | Ctl | Alt | Meta| Tab | SYM | Spc || Ent | FUN | Lft | Dwn | Up | Rgt | + * `------------------------------------------------------------------------' + */ +[_DV] = { + {BL_STEP,TD(QUO),KC_COMM,KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, + {KC_ESC ,KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_DEL }, + {TD(CLS),TD(SCL),KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, TT(_MO)}, + {KC_LCTL,TD(ATD),KC_LGUI,KC_TAB, TT(_SY),KC_SPC, KC_ENT, TT(_FN),KC_LEFT,KC_DOWN,KC_UP, KC_RGHT} +}, +[_TD] = { + {_______,_______,_______,_______,_______,_______,_______, TUR_G, TUR_C, _______,_______,_______}, + {_______, TUR_A, TUR_O, _______, TUR_U, TUR_I, _______, PHY_HB,_______,_______, TUR_S, _______}, + {_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______}, + {_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______} +}, + +/* Game layer + * ,------------------------------------------------------------------------. + * | OFF | Q | W | E | R | T || F1 | F2 | Ctrl| ^ |Shift| Esc | + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * | ~ | A | S | D | F | G || F3 | F4 | < | v | > |Enter| + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * | Shf | Z | X | C | V | B || F5 | F6 | , | . | / ? | Alt | + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * | Alt | Ctrl| ` ~ | - _ | | Spc || Spc | | 1 | 2 | 3 | 4 | + * `------------------------------------------------------------------------' + */ +[_GM] = { + {TG(_GM),KC_Q, KC_W, KC_E, KC_R, KC_T, KC_F1, KC_F2, KC_RCTL,KC_UP, KC_RSFT,KC_ESC }, + {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_F3, KC_F4, KC_LEFT,KC_DOWN,KC_RGHT,KC_ENT }, + {KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_F5, KC_F6, KC_COMM,KC_DOT, KC_SLSH,KC_RALT}, + {KC_LALT,KC_LCTL,KC_GRV, KC_MINS,_______,KC_SPC, KC_SPC, _______,KC_1, KC_2, KC_3, KC_4 } +}, + +/* Mouse control layer + * ,------------------------------------------------------------------------. + * | |.....| ^ |.....|.....|Acc 2||.....|.....|.....| |^| |.....| | + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * | | < | v | > |.....|Acc 1||.....|.....| <-- | |v| | --> | | + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * | | Left| Mid |Right|.....|Acc 0||.....|.....|Btn 4|.....|Btn 5| | + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * | | | | | | || | | | | | | + * `------------------------------------------------------------------------' + */ +[_MO] = { + {TG(_MO),XXX, MO_U, XXX, XXX, MO_AC_2,XXX, XXX, XXX, MO_SC_U,XXX, _______}, + {_______,MO_L, MO_D, MO_R, XXX, MO_AC_1,XXX, XXX, MO_SC_L,MO_SC_D,MO_SC_R,_______}, + {_______,MO_CL_L,MO_CL_M,MO_CL_R,XXX, MO_AC_0,XXX, XXX, MO_CL_1,XXX, MO_CL_2,_______}, + {_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______} +}, + +/* Symbols layer + * ,------------------------------------------------------------------------. + * | OFF | ! | 1 | 2 | 3 | & || = | + | - | * | % | | + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * | _ | ( ) | 4 | 5 | 6 | \ || / | [ ] | { } | < > | | | | + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * |degre| ? | 7 | 8 | 9 | ~ || ` | @ | # | $ | ^ | | + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * | | | | 0 | | || | |TLira| Euro|Pound| | + * `------------------------------------------------------------------------' + */ + +[_SY] = { + {TG(_SY),KC_EXLM,KC_1, KC_2, KC_3, KC_AMPR,KC_EQL, KC_PLUS,KC_MINS,KC_ASTR,KC_PERC,_______}, + {KC_UNDS,PARAN, KC_4, KC_5, KC_6, KC_BSLS,KC_SLSH,SQUAR, CURLY, ANGUL, KC_PIPE,_______}, + {PHY_DE, KC_QUES,KC_7, KC_8, KC_9, KC_TILD,KC_GRV, KC_AT, KC_HASH,KC_DLR, KC_CIRC,_______}, + {_______,_______,_______,KC_0, _______,_______,_______,_______,TUR_TL, EUR_ER, EUR_PN, _______} +}, + +/* Function layer + * ,------------------------------------------------------------------------. + * | OFF | game|music| | |RESET||RESET| win | lin | wake|sleep|power| + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * | F1 | F2 | F3 | F4 | F5 | F6 || F7 | F8 | F9 | F10 | F11 | F12 | + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * | | undo| redo|cutcp|paste|vol 0||prtsc| ins | rev.| stop| play| next| + * |-----+-----+-----+-----+-----+-----++-----+-----+-----+-----+-----+-----| + * | | | | | |vol -||vol +| | home|pg dn|pg up| end | + * `------------------------------------------------------------------------' + */ + +[_FN] = { + {TG(_FN),TG(_GM),MU_ON, _______,_______,RESET, RESET, UNI_LI, UNI_WN ,KC_WAKE,KC_SLEP,KC_PWR }, + {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12 }, + {_______,UNDO, REDO, COPYCUT,PASTE, KC_MUTE,KC_PSCR,KC_INS, KC_MPRV,KC_MSTP,KC_MPLY,KC_MNXT}, + {_______,_______,_______,_______,_______,KC_VOLD,KC_VOLU,_______,KC_HOME,KC_PGDN,KC_PGUP,KC_END } +}, + +/* Music layer + * ,-----------------------------------------------------------------------. + * | OFF |rec S| stop| play|sped^|spedv|cycle|.....|.....|.....|.....|.....| + * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + * |.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....| + * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + * |.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....| + * |-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----| + * |.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....|.....| + * `-----------------------------------------------------------------------' + */ +[_MS] = { + { MU_OFF, KC_LCTL, KC_LALT, KC_LGUI, KC_UP, KC_DOWN, MU_MOD, XXX, XXX, XXX, XXX, XXX }, + { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, + { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, + { XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX } +} +}; + +// Set unicode method to linux. +void matrix_init_user(){ + set_unicode_input_mode(UC_LNX); +} + +// User defined keys +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + // This section is a bit tedious in VIM, so I shortened lines + // Check for shift letter + bool is_capital = ( keyboard_report->mods & + (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) ) ^ + ( keyboard_report->mods & MOD_BIT(KC_CAPS) ); + switch (keycode) { + // Add music layer to music functionality + case MU_ON: + if (record->event.pressed) { layer_on(_MS); } + return true; break; + case MU_OFF: + if (record->event.pressed) { layer_off(_MS); } + return true; break; + // Turkish letters keycodes + case TUR_A: + if (record->event.pressed) { + if ( is_capital ) { + unicode_input_start(); register_hex(0x00c2); unicode_input_finish(); + } else { + unicode_input_start(); register_hex(0x00e2); unicode_input_finish(); + } + } + return false; break; + case TUR_U: + if (record->event.pressed) { + if ( is_capital ) { + unicode_input_start(); register_hex(0x00dc); unicode_input_finish(); + } else { + unicode_input_start(); register_hex(0x00fc); unicode_input_finish(); + } + } + return false; break; + case TUR_I: + if (record->event.pressed) { + if ( is_capital ) { + unicode_input_start(); register_hex(0x0130); unicode_input_finish(); + } else { + unicode_input_start(); register_hex(0x0131); unicode_input_finish(); + } + } + return false; break; + case TUR_O: + if (record->event.pressed) { + if ( is_capital ) { + unicode_input_start(); register_hex(0x00d6); unicode_input_finish(); + } else { + unicode_input_start(); register_hex(0x00f6); unicode_input_finish(); + } + } + return false; break; + case TUR_S: + if (record->event.pressed) { + if ( is_capital ) { + unicode_input_start(); register_hex(0x015e); unicode_input_finish(); + } else { + unicode_input_start(); register_hex(0x015f); unicode_input_finish(); + } + } + return false; break; + case TUR_G: + if (record->event.pressed) { + if ( is_capital ) { + unicode_input_start(); register_hex(0x011e); unicode_input_finish(); + } else { + unicode_input_start(); register_hex(0x011f); unicode_input_finish(); + } + } + return false; break; + case TUR_C: + if (record->event.pressed) { + if ( is_capital ) { + unicode_input_start(); register_hex(0x00c7); unicode_input_finish(); + } else { + unicode_input_start(); register_hex(0x00e7); unicode_input_finish(); + } + } + return false; break; + // Keys to change unicode mode + case UNI_LI: + if( record->event.pressed ) { + set_unicode_input_mode(UC_LNX); + } + return false; break; + case UNI_WN: + if( record->event.pressed ) { + set_unicode_input_mode(UC_WIN); + } + return false; break; + } + return true; +} + +// Tap dance feature for the altgr implementation +void altgr_dvo_tap (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + register_code (KC_RALT); + } else if (state->count == 2) { + unregister_code (KC_RALT); + layer_on(_TD); + } else if (state->count == 3) { + layer_off(_TD); + } +} +void altgr_dvo_end (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + unregister_code (KC_RALT); + } else if (state->count == 2) { + layer_off(_TD); + } +} + +// Shift vs capslock function +void caps_tap (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + register_code (KC_LSFT); + } else if (state->count == 2) { + unregister_code (KC_LSFT); + register_code (KC_CAPS); + } +} +void caps_tap_end (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + unregister_code (KC_LSFT); + } else { + unregister_code (KC_CAPS); + } +} + +// Parantheses +void paranthesis_dance (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + SEND_STRING("()"); register_code(KC_LEFT); unregister_code(KC_LEFT); + } else if (state->count == 2) { + SEND_STRING("("); + } else if (state->count == 3) { + SEND_STRING(")"); + } +} +void curly_dance (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + SEND_STRING("{}"); register_code(KC_LEFT); unregister_code(KC_LEFT); + } else if (state->count == 2) { + SEND_STRING("{"); + } else if (state->count == 3) { + SEND_STRING("}"); + } +} + +void square_dance (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + SEND_STRING("[]"); register_code(KC_LEFT); unregister_code(KC_LEFT); + } else if (state->count == 2) { + SEND_STRING("["); + } else if (state->count == 3) { + SEND_STRING("]"); + } +} + +void angular_dance (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + SEND_STRING("<>"); register_code(KC_LEFT); unregister_code(KC_LEFT); + } else if (state->count == 2) { + SEND_STRING("<"); + } else if (state->count == 3) { + SEND_STRING(">"); + } +} + +// Copy or cut feature +void copy_cut (qk_tap_dance_state_t *state, void *user_data) { + if (state->count == 1) { + register_code (KC_LCTL); + register_code (KC_C); + unregister_code (KC_C); + unregister_code (KC_LCTL); + } else if (state->count == 2) { + register_code (KC_LCTL); + register_code (KC_X); + unregister_code (KC_X); + unregister_code (KC_LCTL); + } +} + +// Tap dance feature +qk_tap_dance_action_t tap_dance_actions[] = { + // Tap once for Left Ctrl, second one is momentory switch to layer TUR + [ATD] = ACTION_TAP_DANCE_FN_ADVANCED( altgr_dvo_tap, NULL, altgr_dvo_end ) + // Advanced tap dance feature allows for immediate response to shift + ,[CLS] = ACTION_TAP_DANCE_FN_ADVANCED( caps_tap, NULL, caps_tap_end ) + // Shifting for double quote and semicolon + ,[SCL] = ACTION_TAP_DANCE_DOUBLE( KC_SCLN, KC_COLN ) + ,[QUO] = ACTION_TAP_DANCE_DOUBLE( KC_QUOT, KC_DQUO ) + // Tap dances for paranthesis, which sends macros + ,[PAR] = ACTION_TAP_DANCE_FN_ADVANCED( NULL, NULL, paranthesis_dance ) + ,[CUR] = ACTION_TAP_DANCE_FN_ADVANCED( NULL, NULL, curly_dance ) + ,[SQU] = ACTION_TAP_DANCE_FN_ADVANCED( NULL, NULL, square_dance ) + ,[ANG] = ACTION_TAP_DANCE_FN_ADVANCED( NULL, NULL, angular_dance ) + // Tap dance for copy/cutting + ,[CPC] = ACTION_TAP_DANCE_FN( copy_cut ) +}; From d77e55d31e4fdb44156119c047d690a6700059f6 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Thu, 21 Sep 2017 00:27:14 -0400 Subject: [PATCH 38/45] move keymap to rules.mk --- keyboards/planck/keymaps/bbaserdem/Makefile | 23 --------------------- 1 file changed, 23 deletions(-) delete mode 100644 keyboards/planck/keymaps/bbaserdem/Makefile diff --git a/keyboards/planck/keymaps/bbaserdem/Makefile b/keyboards/planck/keymaps/bbaserdem/Makefile deleted file mode 100644 index 9c6bd8e19bf9..000000000000 --- a/keyboards/planck/keymaps/bbaserdem/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# Build options - -# ENABLE -TAP_DANCE_ENABLE = yes -UNICODE_ENABLE = yes -MOUSEKEY_ENABLE = yes -EXTRAKEY_ENABLE = yes -NKRO_ENABLE = yes -BACKLIGHT_ENABLE = yes -AUDIO_ENABLE = yes - -# DISABLE -BOOTMAGIC_ENABLE = no -MIDI_ENABLE = no - -# Not for planck -RGBLIGHT_ENABLE = no #Clashes with audio -BLUETOOTH_ENABLE = no #No bluetooth -SLEEP_LED_ENABLE = no #Uses BACKLIGHT_ENABLE rimer - -ifndef QUANTUM_DIR - include ../../../../Makefile -endif From 4c75285816f4b128950d90cf0a45a4f1cb5018d8 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Thu, 21 Sep 2017 00:32:01 -0400 Subject: [PATCH 39/45] add filess --- keyboards/planck/keymaps/bbaserdem/rules.mk | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 keyboards/planck/keymaps/bbaserdem/rules.mk diff --git a/keyboards/planck/keymaps/bbaserdem/rules.mk b/keyboards/planck/keymaps/bbaserdem/rules.mk new file mode 100644 index 000000000000..9c6bd8e19bf9 --- /dev/null +++ b/keyboards/planck/keymaps/bbaserdem/rules.mk @@ -0,0 +1,23 @@ +# Build options + +# ENABLE +TAP_DANCE_ENABLE = yes +UNICODE_ENABLE = yes +MOUSEKEY_ENABLE = yes +EXTRAKEY_ENABLE = yes +NKRO_ENABLE = yes +BACKLIGHT_ENABLE = yes +AUDIO_ENABLE = yes + +# DISABLE +BOOTMAGIC_ENABLE = no +MIDI_ENABLE = no + +# Not for planck +RGBLIGHT_ENABLE = no #Clashes with audio +BLUETOOTH_ENABLE = no #No bluetooth +SLEEP_LED_ENABLE = no #Uses BACKLIGHT_ENABLE rimer + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif From 72e99391439c1d8abd0aed112b06982b94be03c6 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Tue, 15 Aug 2017 15:37:01 -0400 Subject: [PATCH 40/45] Clone Nyquist keyboard for Viterbi --- keyboards/viterbi/Makefile | 5 + keyboards/viterbi/config.h | 27 ++ keyboards/viterbi/i2c.c | 162 ++++++++++++ keyboards/viterbi/i2c.h | 49 ++++ keyboards/viterbi/matrix.c | 464 +++++++++++++++++++++++++++++++++ keyboards/viterbi/nyquist.c | 1 + keyboards/viterbi/nyquist.h | 26 ++ keyboards/viterbi/readme.md | 169 ++++++++++++ keyboards/viterbi/rules.mk | 75 ++++++ keyboards/viterbi/serial.c | 228 ++++++++++++++++ keyboards/viterbi/serial.h | 26 ++ keyboards/viterbi/split_rgb.c | 41 +++ keyboards/viterbi/split_rgb.h | 6 + keyboards/viterbi/split_util.c | 86 ++++++ keyboards/viterbi/split_util.h | 24 ++ 15 files changed, 1389 insertions(+) create mode 100644 keyboards/viterbi/Makefile create mode 100644 keyboards/viterbi/config.h create mode 100644 keyboards/viterbi/i2c.c create mode 100644 keyboards/viterbi/i2c.h create mode 100644 keyboards/viterbi/matrix.c create mode 100644 keyboards/viterbi/nyquist.c create mode 100644 keyboards/viterbi/nyquist.h create mode 100644 keyboards/viterbi/readme.md create mode 100644 keyboards/viterbi/rules.mk create mode 100644 keyboards/viterbi/serial.c create mode 100644 keyboards/viterbi/serial.h create mode 100644 keyboards/viterbi/split_rgb.c create mode 100644 keyboards/viterbi/split_rgb.h create mode 100644 keyboards/viterbi/split_util.c create mode 100644 keyboards/viterbi/split_util.h diff --git a/keyboards/viterbi/Makefile b/keyboards/viterbi/Makefile new file mode 100644 index 000000000000..0c519b323b79 --- /dev/null +++ b/keyboards/viterbi/Makefile @@ -0,0 +1,5 @@ +SUBPROJECT_DEFAULT = rev1 + +ifndef MAKEFILE_INCLUDED + include ../../Makefile +endif diff --git a/keyboards/viterbi/config.h b/keyboards/viterbi/config.h new file mode 100644 index 000000000000..55500df79bb2 --- /dev/null +++ b/keyboards/viterbi/config.h @@ -0,0 +1,27 @@ +/* +Copyright 2017 Danny Nguyen + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "config_common.h" + +#ifdef SUBPROJECT_rev1 + #include "rev1/config.h" +#endif + +#endif // CONFIG_H diff --git a/keyboards/viterbi/i2c.c b/keyboards/viterbi/i2c.c new file mode 100644 index 000000000000..084c890c405f --- /dev/null +++ b/keyboards/viterbi/i2c.c @@ -0,0 +1,162 @@ +#include +#include +#include +#include +#include +#include +#include "i2c.h" + +#ifdef USE_I2C + +// Limits the amount of we wait for any one i2c transaction. +// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is +// 9 bits, a single transaction will take around 90μs to complete. +// +// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit +// poll loop takes at least 8 clock cycles to execute +#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8 + +#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE) + +volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; + +static volatile uint8_t slave_buffer_pos; +static volatile bool slave_has_register_set = false; + +// Wait for an i2c operation to finish +inline static +void i2c_delay(void) { + uint16_t lim = 0; + while(!(TWCR & (1<10. + // Check datasheets for more info. + TWBR = ((F_CPU/SCL_CLOCK)-16)/2; +} + +// Start a transaction with the given i2c slave address. The direction of the +// transfer is set with I2C_READ and I2C_WRITE. +// returns: 0 => success +// 1 => error +uint8_t i2c_master_start(uint8_t address) { + TWCR = (1< slave ACK +// 1 => slave NACK +uint8_t i2c_master_write(uint8_t data) { + TWDR = data; + TWCR = (1<= SLAVE_BUFFER_SIZE ) { + ack = 0; + slave_buffer_pos = 0; + } + slave_has_register_set = true; + } else { + i2c_slave_buffer[slave_buffer_pos] = TWDR; + BUFFER_POS_INC(); + } + break; + + case TW_ST_SLA_ACK: + case TW_ST_DATA_ACK: + // master has addressed this device as a slave transmitter and is + // requesting data. + TWDR = i2c_slave_buffer[slave_buffer_pos]; + BUFFER_POS_INC(); + break; + + case TW_BUS_ERROR: // something went wrong, reset twi state + TWCR = 0; + default: + break; + } + // Reset everything, so we are ready for the next TWI interrupt + TWCR |= (1< + +#ifndef F_CPU +#define F_CPU 16000000UL +#endif + +#define I2C_READ 1 +#define I2C_WRITE 0 + +#define I2C_ACK 1 +#define I2C_NACK 0 + +#define SLAVE_BUFFER_SIZE 0x10 + +// i2c SCL clock frequency +#define SCL_CLOCK 100000L + +extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE]; + +void i2c_master_init(void); +uint8_t i2c_master_start(uint8_t address); +void i2c_master_stop(void); +uint8_t i2c_master_write(uint8_t data); +uint8_t i2c_master_read(int); +void i2c_reset_state(void); +void i2c_slave_init(uint8_t address); + + +static inline unsigned char i2c_start_read(unsigned char addr) { + return i2c_master_start((addr << 1) | I2C_READ); +} + +static inline unsigned char i2c_start_write(unsigned char addr) { + return i2c_master_start((addr << 1) | I2C_WRITE); +} + +// from SSD1306 scrips +extern unsigned char i2c_rep_start(unsigned char addr); +extern void i2c_start_wait(unsigned char addr); +extern unsigned char i2c_readAck(void); +extern unsigned char i2c_readNak(void); +extern unsigned char i2c_read(unsigned char ack); + +#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak(); + +#endif diff --git a/keyboards/viterbi/matrix.c b/keyboards/viterbi/matrix.c new file mode 100644 index 000000000000..21eef94564e3 --- /dev/null +++ b/keyboards/viterbi/matrix.c @@ -0,0 +1,464 @@ +/* +Copyright 2017 Danny Nguyen + +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 . +*/ + +/* + * scan matrix + */ +#include +#include +#include +#include "wait.h" +#include "print.h" +#include "debug.h" +#include "util.h" +#include "matrix.h" +#include "split_util.h" +#include "pro_micro.h" +#include "config.h" +#include "timer.h" + +#ifdef USE_I2C +# include "i2c.h" +#else // USE_SERIAL +# include "serial.h" +#endif + +#ifndef DEBOUNCING_DELAY +# define DEBOUNCING_DELAY 5 +#endif + +#if (DEBOUNCING_DELAY > 0) + static uint16_t debouncing_time; + static bool debouncing = false; +#endif + +#if (MATRIX_COLS <= 8) +# define print_matrix_header() print("\nr/c 01234567\n") +# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row)) +# define matrix_bitpop(i) bitpop(matrix[i]) +# define ROW_SHIFTER ((uint8_t)1) +#else +# error "Currently only supports 8 COLS" +#endif +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +#define ERROR_DISCONNECT_COUNT 5 + +#define ROWS_PER_HAND (MATRIX_ROWS/2) + +static uint8_t error_count = 0; + +static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS; +static const uint8_t col_pins[MATRIX_COLS] = MATRIX_COL_PINS; + +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; + +#if (DIODE_DIRECTION == COL2ROW) + static void init_cols(void); + static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row); + static void unselect_rows(void); + static void select_row(uint8_t row); + static void unselect_row(uint8_t row); +#elif (DIODE_DIRECTION == ROW2COL) + static void init_rows(void); + static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col); + static void unselect_cols(void); + static void unselect_col(uint8_t col); + static void select_col(uint8_t col); +#endif +__attribute__ ((weak)) +void matrix_init_quantum(void) { + matrix_init_kb(); +} + +__attribute__ ((weak)) +void matrix_scan_quantum(void) { + matrix_scan_kb(); +} + +__attribute__ ((weak)) +void matrix_init_kb(void) { + matrix_init_user(); +} + +__attribute__ ((weak)) +void matrix_scan_kb(void) { + matrix_scan_user(); +} + +__attribute__ ((weak)) +void matrix_init_user(void) { +} + +__attribute__ ((weak)) +void matrix_scan_user(void) { +} + +inline +uint8_t matrix_rows(void) +{ + return MATRIX_ROWS; +} + +inline +uint8_t matrix_cols(void) +{ + return MATRIX_COLS; +} + +void matrix_init(void) +{ + debug_enable = true; + debug_matrix = true; + debug_mouse = true; + // initialize row and col + unselect_rows(); + init_cols(); + + TX_RX_LED_INIT; + + // initialize matrix state: all keys off + for (uint8_t i=0; i < MATRIX_ROWS; i++) { + matrix[i] = 0; + matrix_debouncing[i] = 0; + } + + matrix_init_quantum(); + +} + +uint8_t _matrix_scan(void) +{ + int offset = isLeftHand ? 0 : (ROWS_PER_HAND); +#if (DIODE_DIRECTION == COL2ROW) + // Set row, read cols + for (uint8_t current_row = 0; current_row < ROWS_PER_HAND; current_row++) { +# if (DEBOUNCING_DELAY > 0) + bool matrix_changed = read_cols_on_row(matrix_debouncing+offset, current_row); + + if (matrix_changed) { + debouncing = true; + debouncing_time = timer_read(); + PORTD ^= (1 << 2); + } + +# else + read_cols_on_row(matrix+offset, current_row); +# endif + + } + +#elif (DIODE_DIRECTION == ROW2COL) + // Set col, read rows + for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) { +# if (DEBOUNCING_DELAY > 0) + bool matrix_changed = read_rows_on_col(matrix_debouncing+offset, current_col); + if (matrix_changed) { + debouncing = true; + debouncing_time = timer_read(); + } +# else + read_rows_on_col(matrix+offset, current_col); +# endif + + } +#endif + +# if (DEBOUNCING_DELAY > 0) + if (debouncing && (timer_elapsed(debouncing_time) > DEBOUNCING_DELAY)) { + for (uint8_t i = 0; i < ROWS_PER_HAND; i++) { + matrix[i+offset] = matrix_debouncing[i+offset]; + } + debouncing = false; + } +# endif + + return 1; +} + +#ifdef USE_I2C + +// Get rows from other half over i2c +int i2c_transaction(void) { + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + + int err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_WRITE); + if (err) goto i2c_error; + + // start of matrix stored at 0x00 + err = i2c_master_write(0x00); + if (err) goto i2c_error; + + // Start read + err = i2c_master_start(SLAVE_I2C_ADDRESS + I2C_READ); + if (err) goto i2c_error; + + if (!err) { + int i; + for (i = 0; i < ROWS_PER_HAND-1; ++i) { + matrix[slaveOffset+i] = i2c_master_read(I2C_ACK); + } + matrix[slaveOffset+i] = i2c_master_read(I2C_NACK); + i2c_master_stop(); + } else { +i2c_error: // the cable is disconnceted, or something else went wrong + i2c_reset_state(); + return err; + } + + return 0; +} + +#else // USE_SERIAL + +int serial_transaction(void) { + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + + if (serial_update_buffers()) { + return 1; + } + + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[slaveOffset+i] = serial_slave_buffer[i]; + } + return 0; +} +#endif + +uint8_t matrix_scan(void) +{ + uint8_t ret = _matrix_scan(); + +#ifdef USE_I2C + if( i2c_transaction() ) { +#else // USE_SERIAL + if( serial_transaction() ) { +#endif + // turn on the indicator led when halves are disconnected + TXLED1; + + error_count++; + + if (error_count > ERROR_DISCONNECT_COUNT) { + // reset other half if disconnected + int slaveOffset = (isLeftHand) ? (ROWS_PER_HAND) : 0; + for (int i = 0; i < ROWS_PER_HAND; ++i) { + matrix[slaveOffset+i] = 0; + } + } + } else { + // turn off the indicator led on no error + TXLED0; + error_count = 0; + } + matrix_scan_quantum(); + return ret; +} + +void matrix_slave_scan(void) { + _matrix_scan(); + + int offset = (isLeftHand) ? 0 : ROWS_PER_HAND; + +#ifdef USE_I2C + for (int i = 0; i < ROWS_PER_HAND; ++i) { + i2c_slave_buffer[i] = matrix[offset+i]; + } +#else // USE_SERIAL + for (int i = 0; i < ROWS_PER_HAND; ++i) { + serial_slave_buffer[i] = matrix[offset+i]; + } +#endif +} + +bool matrix_is_modified(void) +{ + if (debouncing) return false; + return true; +} + +inline +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & ((matrix_row_t)1<> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +static bool read_cols_on_row(matrix_row_t current_matrix[], uint8_t current_row) +{ + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[current_row]; + + // Clear data in matrix row + current_matrix[current_row] = 0; + + // Select row and wait for row selecton to stabilize + select_row(current_row); + wait_us(30); + + // For each col... + for(uint8_t col_index = 0; col_index < MATRIX_COLS; col_index++) { + + // Select the col pin to read (active low) + uint8_t pin = col_pins[col_index]; + uint8_t pin_state = (_SFR_IO8(pin >> 4) & _BV(pin & 0xF)); + + // Populate the matrix row with the state of the col pin + current_matrix[current_row] |= pin_state ? 0 : (ROW_SHIFTER << col_index); + } + + // Unselect row + unselect_row(current_row); + + return (last_row_value != current_matrix[current_row]); +} + +static void select_row(uint8_t row) +{ + uint8_t pin = row_pins[row]; + _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW +} + +static void unselect_row(uint8_t row) +{ + uint8_t pin = row_pins[row]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI +} + +static void unselect_rows(void) +{ + for(uint8_t x = 0; x < ROWS_PER_HAND; x++) { + uint8_t pin = row_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +#elif (DIODE_DIRECTION == ROW2COL) + +static void init_rows(void) +{ + for(uint8_t x = 0; x < ROWS_PER_HAND; x++) { + uint8_t pin = row_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col) +{ + bool matrix_changed = false; + + // Select col and wait for col selecton to stabilize + select_col(current_col); + wait_us(30); + + // For each row... + for(uint8_t row_index = 0; row_index < ROWS_PER_HAND; row_index++) + { + + // Store last value of row prior to reading + matrix_row_t last_row_value = current_matrix[row_index]; + + // Check row pin state + if ((_SFR_IO8(row_pins[row_index] >> 4) & _BV(row_pins[row_index] & 0xF)) == 0) + { + // Pin LO, set col bit + current_matrix[row_index] |= (ROW_SHIFTER << current_col); + } + else + { + // Pin HI, clear col bit + current_matrix[row_index] &= ~(ROW_SHIFTER << current_col); + } + + // Determine if the matrix changed state + if ((last_row_value != current_matrix[row_index]) && !(matrix_changed)) + { + matrix_changed = true; + } + } + + // Unselect col + unselect_col(current_col); + + return matrix_changed; +} + +static void select_col(uint8_t col) +{ + uint8_t pin = col_pins[col]; + _SFR_IO8((pin >> 4) + 1) |= _BV(pin & 0xF); // OUT + _SFR_IO8((pin >> 4) + 2) &= ~_BV(pin & 0xF); // LOW +} + +static void unselect_col(uint8_t col) +{ + uint8_t pin = col_pins[col]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI +} + +static void unselect_cols(void) +{ + for(uint8_t x = 0; x < MATRIX_COLS; x++) { + uint8_t pin = col_pins[x]; + _SFR_IO8((pin >> 4) + 1) &= ~_BV(pin & 0xF); // IN + _SFR_IO8((pin >> 4) + 2) |= _BV(pin & 0xF); // HI + } +} + +#endif diff --git a/keyboards/viterbi/nyquist.c b/keyboards/viterbi/nyquist.c new file mode 100644 index 000000000000..2face09d4204 --- /dev/null +++ b/keyboards/viterbi/nyquist.c @@ -0,0 +1 @@ +#include "nyquist.h" diff --git a/keyboards/viterbi/nyquist.h b/keyboards/viterbi/nyquist.h new file mode 100644 index 000000000000..e8cccecf5f6f --- /dev/null +++ b/keyboards/viterbi/nyquist.h @@ -0,0 +1,26 @@ +#ifndef NYQUIST_H +#define NYQUIST_H + +#ifdef SUBPROJECT_rev1 + #include "rev1.h" +#endif + +// Used to create a keymap using only KC_ prefixed keys +#define KC_KEYMAP( \ + L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ + L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ + L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ + L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35, \ + L40, L41, L42, L43, L44, L45, R40, R41, R42, R43, R44, R45 \ + ) \ + KEYMAP( \ + KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \ + KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \ + KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \ + KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35, \ + KC_##L40, KC_##L41, KC_##L42, KC_##L43, KC_##L44, KC_##L45, KC_##R40, KC_##R41, KC_##R42, KC_##R43, KC_##R44, KC_##R45 \ + ) + +#include "quantum.h" + +#endif \ No newline at end of file diff --git a/keyboards/viterbi/readme.md b/keyboards/viterbi/readme.md new file mode 100644 index 000000000000..61b9317d5239 --- /dev/null +++ b/keyboards/viterbi/readme.md @@ -0,0 +1,169 @@ +The Nyquist Keyboard +==================== + +The Nyquist is a 60% split ortholinear board by [Keebio](https://keeb.io). It has been designed in a similar manner to the Let's Split v2 by /u/wootpatoot. Each half of the keyboard is arranged in a 5x6 grid. There is an option to use a 2u key with PCB mounted MX stablizers, in place of the two innermost 1u keys on the bottom row. + + +## Build Guide + +A build log of the Nyquist can be found here: [Nyquist Build Log](http://imgur.com/a/dD4sX). + +Since the design is very similar to the Let's Split v2, the build guide for that can be used while the build guide for the Nyquist is being fully developed. A build guide for putting together the Let's Split v2 can be found here: [An Overly Verbose Guide to Building a Let's Split Keyboard](https://github.com/nicinabox/lets-split-guide) + +There is additional information there about flashing and adding RGB underglow. + +## First Time Setup + +Download or clone the whole firmware and navigate to the keyboards/nyquist directory. Once your development environment is setup, you'll be able to generate the default .hex using: + +``` +$ make serial +``` + +You will see a lot of output and if everything worked correctly you will see the built hex file: + +``` +nyquist_rev1_serial.hex +``` + +If you would like to use one of the alternative keymaps, or create your own, copy one of the existing [keymaps](keymaps/) and run make like so: + + +``` +$ make YOUR_KEYMAP_NAME +``` + +If everything worked correctly you will see a file: + +``` +nyquist_rev1_YOUR_KEYMAP_NAME.hex +``` + +For more information on customizing keymaps, take a look at the primary documentation for [Customizing Your Keymap](/readme.md##customizing-your-keymap) in the main readme.md. + +Features +-------- + +For the full Quantum Mechanical Keyboard feature list, see [the parent readme.md](/readme.md). + +Some features supported by the firmware: + +* Either half can connect to the computer via USB, or both halves can be used + independently. +* You only need 3 wires to connect the two halves. Two for VCC and GND and one + for serial communication. +* Optional support for I2C connection between the two halves if for some + reason you require a faster connection between the two halves. Note this + requires an extra wire between halves and pull-up resistors on the data lines. + +### 2u Support +In place of the two innermost 1u keys on the bottom row, a single 2u key can be used. If you choose to use this option, then in your keymap, set the innermost key on the bottom row to what you want the 2u key to be. For example, if using the 2u key on the left half of the board, set the keycode for the lower right key. + +Required Hardware +----------------- + +Apart from diodes and key switches for the keyboard matrix in each half, you +will need: + +* 2 Arduino Pro Micro's. You can find theses on aliexpress for ≈3.50USD each. +* 2 TRRS sockets and 1 TRRS cable, or 2 TRS sockets and 1 TRS cable + +Alternatively, you can use any sort of cable and socket that has at least 3 +wires. If you want to use I2C to communicate between halves, you will need a +cable with at least 4 wires and 2x 4.7kΩ pull-up resistors + +Optional Hardware +----------------- + +A speaker can be hooked-up to either side to the `5` (`C6`) pin and `GND`, and turned on via `AUDIO_ENABLE`. + +Wiring +------ + +The 3 wires of the TRS/TRRS cable need to connect GND, VCC, and digital pin 3 (i.e. +PD0 on the ATmega32u4) between the two Pro Micros. + +Then wire your key matrix to any of the remaining 17 IO pins of the pro micro +and modify the `matrix.c` accordingly. + +The wiring for serial: + +![serial wiring](http://imgur.com/BnCGU1Y) + +The wiring for i2c: + +![i2c wiring](http://imgur.com/5eiArDA) + +The pull-up resistors may be placed on either half. It is also possible +to use 4 resistors and have the pull-ups in both halves, but this is +unnecessary in simple use cases. + +Flashing +------- +From the `nyquist` directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. +Example: `make rev1-serial-avrdude` + + +Choosing which board to plug the USB cable into (choosing Master) +-------- +Because the two boards are identical, the firmware has logic to differentiate the left and right board. + +It uses two strategies to figure things out: look at the EEPROM (memory on the chip) or looks if the current board has the usb cable. + +The EEPROM approach requires additional setup (flashing the eeeprom) but allows you to swap the usb cable to either side. + +The USB cable approach is easier to setup and if you just want the usb cable on the left board, you do not need to do anything extra. + +### Setting the left hand as master +If you always plug the usb cable into the left board, nothing extra is needed as this is the default. Comment out `EE_HANDS` and comment out `I2C_MASTER_RIGHT` or `MASTER_RIGHT` if for some reason it was set. + +### Setting the right hand as master +If you always plug the usb cable into the right board, add an extra flag to your `config.h` +``` + #define MASTER_RIGHT +``` + +### Setting EE_hands to use either hands as master +If you define `EE_HANDS` in your `config.h`, you will need to set the +EEPROM for the left and right halves. + +The EEPROM is used to store whether the +half is left handed or right handed. This makes it so that the same firmware +file will run on both hands instead of having to flash left and right handed +versions of the firmware to each half. To flash the EEPROM file for the left +half run: +``` +avrdude -p atmega32u4 -P $(COM_PORT) -c avr109 -U eeprom:w:eeprom-lefthand.eep +// or the equivalent in dfu-programmer + +``` +and similarly for right half +``` +avrdude -p atmega32u4 -P $(COM_PORT) -c avr109 -U eeprom:w:eeprom-righhand.eep +// or the equivalent in dfu-programmer +``` + +NOTE: replace `$(COM_PORT)` with the port of your device (e.g. `/dev/ttyACM0`) + +After you have flashed the EEPROM, you then need to set `EE_HANDS` in your config.h, rebuild the hex files and reflash. + +Note that you need to program both halves, but you have the option of using +different keymaps for each half. You could program the left half with a QWERTY +layout and the right half with a Colemak layout using bootmagic's default layout option. +Then if you connect the left half to a computer by USB the keyboard will use QWERTY and Colemak when the +right half is connected. + + +Notes on Using Pro Micro 3.3V +----------------------------- + +Do update the `F_CPU` parameter in `rules.mk` to `8000000` which reflects +the frequency on the 3.3V board. + +Also, if the slave board is producing weird characters in certain columns, +update the following line in `matrix.c` to the following: + +``` +// _delay_us(30); // without this wait read unstable value. +_delay_us(300); // without this wait read unstable value. +``` diff --git a/keyboards/viterbi/rules.mk b/keyboards/viterbi/rules.mk new file mode 100644 index 000000000000..3f40ff2f827e --- /dev/null +++ b/keyboards/viterbi/rules.mk @@ -0,0 +1,75 @@ +SRC += matrix.c \ + i2c.c \ + split_util.c \ + serial.c + +# MCU name +#MCU = at90usb1287 +MCU = atmega32u4 + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_USB below, as it is sourced by +# F_USB after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + +# +# LUFA specific +# +# Target architecture (see library "Board Types" documentation). +ARCH = AVR8 + +# Input clock frequency. +# This will define a symbol, F_USB, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_USB = $(F_CPU) + +# Interrupt driven control endpoint task(+60) +OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT + + +# Boot Section Size in *bytes* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + +# Build Options +# change to "no" to disable the options, or define them in the Makefile in +# the appropriate keymap folder that will get included automatically +# +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) +MOUSEKEY_ENABLE = yes # Mouse keys(+4700) +EXTRAKEY_ENABLE = yes # Audio control and System control(+450) +CONSOLE_ENABLE = no # Console for debug(+400) +COMMAND_ENABLE = yes # Commands for debug and configuration +NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +MIDI_ENABLE = no # MIDI controls +AUDIO_ENABLE = no # Audio output on port C6 +UNICODE_ENABLE = no # Unicode +BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID +RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SUBPROJECT_rev1 = yes +USE_I2C = yes +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend + +CUSTOM_MATRIX = yes diff --git a/keyboards/viterbi/serial.c b/keyboards/viterbi/serial.c new file mode 100644 index 000000000000..6faed09ce077 --- /dev/null +++ b/keyboards/viterbi/serial.c @@ -0,0 +1,228 @@ +/* + * WARNING: be careful changing this code, it is very timing dependent + */ + +#ifndef F_CPU +#define F_CPU 16000000 +#endif + +#include +#include +#include +#include +#include "serial.h" + +#ifdef USE_SERIAL + +// Serial pulse period in microseconds. Its probably a bad idea to lower this +// value. +#define SERIAL_DELAY 24 + +uint8_t volatile serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH] = {0}; +uint8_t volatile serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH] = {0}; + +#define SLAVE_DATA_CORRUPT (1<<0) +volatile uint8_t status = 0; + +inline static +void serial_delay(void) { + _delay_us(SERIAL_DELAY); +} + +inline static +void serial_output(void) { + SERIAL_PIN_DDR |= SERIAL_PIN_MASK; +} + +// make the serial pin an input with pull-up resistor +inline static +void serial_input(void) { + SERIAL_PIN_DDR &= ~SERIAL_PIN_MASK; + SERIAL_PIN_PORT |= SERIAL_PIN_MASK; +} + +inline static +uint8_t serial_read_pin(void) { + return !!(SERIAL_PIN_INPUT & SERIAL_PIN_MASK); +} + +inline static +void serial_low(void) { + SERIAL_PIN_PORT &= ~SERIAL_PIN_MASK; +} + +inline static +void serial_high(void) { + SERIAL_PIN_PORT |= SERIAL_PIN_MASK; +} + +void serial_master_init(void) { + serial_output(); + serial_high(); +} + +void serial_slave_init(void) { + serial_input(); + + // Enable INT0 + EIMSK |= _BV(INT0); + // Trigger on falling edge of INT0 + EICRA &= ~(_BV(ISC00) | _BV(ISC01)); +} + +// Used by the master to synchronize timing with the slave. +static +void sync_recv(void) { + serial_input(); + // This shouldn't hang if the slave disconnects because the + // serial line will float to high if the slave does disconnect. + while (!serial_read_pin()); + serial_delay(); +} + +// Used by the slave to send a synchronization signal to the master. +static +void sync_send(void) { + serial_output(); + + serial_low(); + serial_delay(); + + serial_high(); +} + +// Reads a byte from the serial line +static +uint8_t serial_read_byte(void) { + uint8_t byte = 0; + serial_input(); + for ( uint8_t i = 0; i < 8; ++i) { + byte = (byte << 1) | serial_read_pin(); + serial_delay(); + _delay_us(1); + } + + return byte; +} + +// Sends a byte with MSB ordering +static +void serial_write_byte(uint8_t data) { + uint8_t b = 8; + serial_output(); + while( b-- ) { + if(data & (1 << b)) { + serial_high(); + } else { + serial_low(); + } + serial_delay(); + } +} + +// interrupt handle to be used by the slave device +ISR(SERIAL_PIN_INTERRUPT) { + sync_send(); + + uint8_t checksum = 0; + for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { + serial_write_byte(serial_slave_buffer[i]); + sync_send(); + checksum += serial_slave_buffer[i]; + } + serial_write_byte(checksum); + sync_send(); + + // wait for the sync to finish sending + serial_delay(); + + // read the middle of pulses + _delay_us(SERIAL_DELAY/2); + + uint8_t checksum_computed = 0; + for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { + serial_master_buffer[i] = serial_read_byte(); + sync_send(); + checksum_computed += serial_master_buffer[i]; + } + uint8_t checksum_received = serial_read_byte(); + sync_send(); + + serial_input(); // end transaction + + if ( checksum_computed != checksum_received ) { + status |= SLAVE_DATA_CORRUPT; + } else { + status &= ~SLAVE_DATA_CORRUPT; + } +} + +inline +bool serial_slave_DATA_CORRUPT(void) { + return status & SLAVE_DATA_CORRUPT; +} + +// Copies the serial_slave_buffer to the master and sends the +// serial_master_buffer to the slave. +// +// Returns: +// 0 => no error +// 1 => slave did not respond +int serial_update_buffers(void) { + // this code is very time dependent, so we need to disable interrupts + cli(); + + // signal to the slave that we want to start a transaction + serial_output(); + serial_low(); + _delay_us(1); + + // wait for the slaves response + serial_input(); + serial_high(); + _delay_us(SERIAL_DELAY); + + // check if the slave is present + if (serial_read_pin()) { + // slave failed to pull the line low, assume not present + sei(); + return 1; + } + + // if the slave is present syncronize with it + sync_recv(); + + uint8_t checksum_computed = 0; + // receive data from the slave + for (int i = 0; i < SERIAL_SLAVE_BUFFER_LENGTH; ++i) { + serial_slave_buffer[i] = serial_read_byte(); + sync_recv(); + checksum_computed += serial_slave_buffer[i]; + } + uint8_t checksum_received = serial_read_byte(); + sync_recv(); + + if (checksum_computed != checksum_received) { + sei(); + return 1; + } + + uint8_t checksum = 0; + // send data to the slave + for (int i = 0; i < SERIAL_MASTER_BUFFER_LENGTH; ++i) { + serial_write_byte(serial_master_buffer[i]); + sync_recv(); + checksum += serial_master_buffer[i]; + } + serial_write_byte(checksum); + sync_recv(); + + // always, release the line when not in use + serial_output(); + serial_high(); + + sei(); + return 0; +} + +#endif diff --git a/keyboards/viterbi/serial.h b/keyboards/viterbi/serial.h new file mode 100644 index 000000000000..15fe4db7b4c6 --- /dev/null +++ b/keyboards/viterbi/serial.h @@ -0,0 +1,26 @@ +#ifndef MY_SERIAL_H +#define MY_SERIAL_H + +#include "config.h" +#include + +/* TODO: some defines for interrupt setup */ +#define SERIAL_PIN_DDR DDRD +#define SERIAL_PIN_PORT PORTD +#define SERIAL_PIN_INPUT PIND +#define SERIAL_PIN_MASK _BV(PD0) +#define SERIAL_PIN_INTERRUPT INT0_vect + +#define SERIAL_SLAVE_BUFFER_LENGTH MATRIX_ROWS/2 +#define SERIAL_MASTER_BUFFER_LENGTH 1 + +// Buffers for master - slave communication +extern volatile uint8_t serial_slave_buffer[SERIAL_SLAVE_BUFFER_LENGTH]; +extern volatile uint8_t serial_master_buffer[SERIAL_MASTER_BUFFER_LENGTH]; + +void serial_master_init(void); +void serial_slave_init(void); +int serial_update_buffers(void); +bool serial_slave_data_corrupt(void); + +#endif diff --git a/keyboards/viterbi/split_rgb.c b/keyboards/viterbi/split_rgb.c new file mode 100644 index 000000000000..6d7cb44cf0d2 --- /dev/null +++ b/keyboards/viterbi/split_rgb.c @@ -0,0 +1,41 @@ +#include +#include +#include "split_util.h" +#include "progmem.h" +#include "print.h" +#include "rgblight.h" + +#ifdef USE_I2C +# include "i2c.h" +#else // USE_SERIAL +# include "serial.h" +#endif + + +rgblight_config_t rgblight_config; + +void rgblight_slave_update(void) { + //rgblight_effect_christmas(); +} + + +void rgblight_set(void) { + if (rgblight_config.enable) { + #ifdef RGBW + ws2812_setleds_rgbw(led, RGBLED_NUM); + #else + ws2812_setleds(led, RGBLED_NUM); + #endif + } else { + for (uint8_t i = 0; i < RGBLED_NUM; i++) { + led[i].r = 0; + led[i].g = 0; + led[i].b = 0; + } + #ifdef RGBW + ws2812_setleds_rgbw(led, RGBLED_NUM); + #else + ws2812_setleds(led, RGBLED_NUM); + #endif + } +} diff --git a/keyboards/viterbi/split_rgb.h b/keyboards/viterbi/split_rgb.h new file mode 100644 index 000000000000..5f552890afdb --- /dev/null +++ b/keyboards/viterbi/split_rgb.h @@ -0,0 +1,6 @@ +#ifndef SPLIT_RGB_H +#define SPLIT_RGB_H + +void rgblight_slave_update(void); + +#endif diff --git a/keyboards/viterbi/split_util.c b/keyboards/viterbi/split_util.c new file mode 100644 index 000000000000..346cbc908949 --- /dev/null +++ b/keyboards/viterbi/split_util.c @@ -0,0 +1,86 @@ +#include +#include +#include +#include +#include +#include +#include "split_util.h" +#include "matrix.h" +#include "keyboard.h" +#include "config.h" +#include "timer.h" + +#ifdef USE_I2C +# include "i2c.h" +#else +# include "serial.h" +#endif + +volatile bool isLeftHand = true; + +static void setup_handedness(void) { + #ifdef EE_HANDS + isLeftHand = eeprom_read_byte(EECONFIG_HANDEDNESS); + #else + // I2C_MASTER_RIGHT is deprecated, use MASTER_RIGHT instead, since this works for both serial and i2c + #if defined(I2C_MASTER_RIGHT) || defined(MASTER_RIGHT) + isLeftHand = !has_usb(); + #else + isLeftHand = has_usb(); + #endif + #endif +} + +static void keyboard_master_setup(void) { +#ifdef USE_I2C + i2c_master_init(); +#ifdef SSD1306OLED + matrix_master_OLED_init (); +#endif +#else + serial_master_init(); +#endif +} + +static void keyboard_slave_setup(void) { + timer_init(); +#ifdef USE_I2C + i2c_slave_init(SLAVE_I2C_ADDRESS); +#else + serial_slave_init(); +#endif +} + +bool has_usb(void) { + USBCON |= (1 << OTGPADE); //enables VBUS pad + _delay_us(5); + return (USBSTA & (1< + +#ifdef EE_HANDS + #define EECONFIG_BOOTMAGIC_END (uint8_t *)10 + #define EECONFIG_HANDEDNESS EECONFIG_BOOTMAGIC_END +#endif + +#define SLAVE_I2C_ADDRESS 0x32 + +extern volatile bool isLeftHand; + +// slave version of matix scan, defined in matrix.c +void matrix_slave_scan(void); + +void split_keyboard_setup(void); +bool has_usb(void); +void keyboard_slave_loop(void); + +void matrix_master_OLED_init (void); + +#endif From 92b74e2d3612884237ecbdbea18bc5b70d859234 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Tue, 15 Aug 2017 16:28:19 -0400 Subject: [PATCH 41/45] Rename cloned Nyquist files to Viterbi, create temporary keymaps Add WIP keymap for dwallace --- keyboards/viterbi/keymaps/default/Makefile | 5 + keyboards/viterbi/keymaps/default/config.h | 41 ++++ keyboards/viterbi/keymaps/default/keymap.c | 232 ++++++++++++++++++++ keyboards/viterbi/keymaps/dwallace/Makefile | 5 + keyboards/viterbi/keymaps/dwallace/config.h | 43 ++++ keyboards/viterbi/keymaps/dwallace/keymap.c | 83 +++++++ keyboards/viterbi/keymaps/hexwire/Makefile | 5 + keyboards/viterbi/keymaps/hexwire/README.md | 116 ++++++++++ keyboards/viterbi/keymaps/hexwire/config.h | 43 ++++ keyboards/viterbi/keymaps/hexwire/keymap.c | 218 ++++++++++++++++++ keyboards/viterbi/nyquist.c | 1 - keyboards/viterbi/nyquist.h | 26 --- keyboards/viterbi/readme.md | 169 +------------- keyboards/viterbi/rev1/Makefile | 3 + keyboards/viterbi/rev1/config.h | 89 ++++++++ keyboards/viterbi/rev1/rev1.c | 39 ++++ keyboards/viterbi/rev1/rev1.h | 66 ++++++ keyboards/viterbi/rev1/rules.mk | 5 + keyboards/viterbi/viterbi.c | 1 + keyboards/viterbi/viterbi.h | 26 +++ 20 files changed, 1032 insertions(+), 184 deletions(-) create mode 100644 keyboards/viterbi/keymaps/default/Makefile create mode 100644 keyboards/viterbi/keymaps/default/config.h create mode 100644 keyboards/viterbi/keymaps/default/keymap.c create mode 100644 keyboards/viterbi/keymaps/dwallace/Makefile create mode 100644 keyboards/viterbi/keymaps/dwallace/config.h create mode 100644 keyboards/viterbi/keymaps/dwallace/keymap.c create mode 100644 keyboards/viterbi/keymaps/hexwire/Makefile create mode 100644 keyboards/viterbi/keymaps/hexwire/README.md create mode 100644 keyboards/viterbi/keymaps/hexwire/config.h create mode 100644 keyboards/viterbi/keymaps/hexwire/keymap.c delete mode 100644 keyboards/viterbi/nyquist.c delete mode 100644 keyboards/viterbi/nyquist.h create mode 100644 keyboards/viterbi/rev1/Makefile create mode 100644 keyboards/viterbi/rev1/config.h create mode 100644 keyboards/viterbi/rev1/rev1.c create mode 100644 keyboards/viterbi/rev1/rev1.h create mode 100644 keyboards/viterbi/rev1/rules.mk create mode 100644 keyboards/viterbi/viterbi.c create mode 100644 keyboards/viterbi/viterbi.h diff --git a/keyboards/viterbi/keymaps/default/Makefile b/keyboards/viterbi/keymaps/default/Makefile new file mode 100644 index 000000000000..1e5761278801 --- /dev/null +++ b/keyboards/viterbi/keymaps/default/Makefile @@ -0,0 +1,5 @@ +RGBLIGHT_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/viterbi/keymaps/default/config.h b/keyboards/viterbi/keymaps/default/config.h new file mode 100644 index 000000000000..6d409cd2e76a --- /dev/null +++ b/keyboards/viterbi/keymaps/default/config.h @@ -0,0 +1,41 @@ +/* +Copyright 2017 Danny Nguyen + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define _MASTER_RIGHT +// #define EE_HANDS + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 12 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +#endif diff --git a/keyboards/viterbi/keymaps/default/keymap.c b/keyboards/viterbi/keymaps/default/keymap.c new file mode 100644 index 000000000000..261a59b2a694 --- /dev/null +++ b/keyboards/viterbi/keymaps/default/keymap.c @@ -0,0 +1,232 @@ +#include "viterbi.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. +// The underscores don't mean anything - you can have a layer called STUFF or any other name. +// Layer names don't all need to be of the same length, obviously, and you can also skip them +// entirely and just use numbers. +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + LOWER, + RAISE, + ADJUST, +}; + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Qwerty + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | Q | W | E | R | T | Y | U | I | O | P | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | S | D | F | G | H | J | K | L | ; | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_QWERTY] = KEYMAP( \ + KC_NO, KC_NO, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ + KC_NO, KC_NO, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, \ + KC_NO, KC_NO, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ + KC_NO, KC_NO, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ + KC_NO, KC_NO, ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ +), + +/* Colemak + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | R | S | T | D | H | N | E | I | O | " | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_COLEMAK] = KEYMAP( \ + KC_NO, KC_NO, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ + KC_NO, KC_NO, KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_DEL, \ + KC_NO, KC_NO, KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ + KC_NO, KC_NO, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ + KC_NO, KC_NO, ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ +), + +/* Dvorak + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Tab | " | , | . | P | Y | F | G | C | R | L | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Esc | A | O | E | U | I | D | H | T | N | S | / | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right | + * `-----------------------------------------------------------------------------------' + */ +[_DVORAK] = KEYMAP( \ + KC_NO, KC_NO, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ + KC_NO, KC_NO, KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, \ + KC_NO, KC_NO, KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ + KC_NO, KC_NO, KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \ + KC_NO, KC_NO, ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ +), + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = KEYMAP( \ + KC_NO, KC_NO, KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ + KC_NO, KC_NO, KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ + KC_NO, KC_NO, KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ + KC_NO, KC_NO, _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \ + KC_NO, KC_NO, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ +), + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | Next | Vol- | Vol+ | Play | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = KEYMAP( \ + KC_NO, KC_NO, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ + KC_NO, KC_NO, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ + KC_NO, KC_NO, KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ + KC_NO, KC_NO, _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ + KC_NO, KC_NO, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ +), + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | Reset|RGB Tg|RGB Md|Hue Up|Hue Dn|Sat Up|Sat Dn|Val Up|Val Dn| | Del | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = KEYMAP( \ + KC_NO, KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ + KC_NO, KC_NO, _______, RESET , RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, KC_DEL, \ + KC_NO, KC_NO, _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ + KC_NO, KC_NO, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + KC_NO, KC_NO, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ +) + + +}; + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +#endif + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + persistent_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + #endif + persistent_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + } + return true; +} diff --git a/keyboards/viterbi/keymaps/dwallace/Makefile b/keyboards/viterbi/keymaps/dwallace/Makefile new file mode 100644 index 000000000000..1e5761278801 --- /dev/null +++ b/keyboards/viterbi/keymaps/dwallace/Makefile @@ -0,0 +1,5 @@ +RGBLIGHT_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/viterbi/keymaps/dwallace/config.h b/keyboards/viterbi/keymaps/dwallace/config.h new file mode 100644 index 000000000000..558ae0627ec5 --- /dev/null +++ b/keyboards/viterbi/keymaps/dwallace/config.h @@ -0,0 +1,43 @@ +/* +Copyright 2017 Danny Nguyen + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define _MASTER_RIGHT +// #define EE_HANDS + +#define TAPPING_TERM 150 + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 12 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +#endif diff --git a/keyboards/viterbi/keymaps/dwallace/keymap.c b/keyboards/viterbi/keymaps/dwallace/keymap.c new file mode 100644 index 000000000000..c884c8a37413 --- /dev/null +++ b/keyboards/viterbi/keymaps/dwallace/keymap.c @@ -0,0 +1,83 @@ +#include "viterbi.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +#define _QWERTY 0 +#define _FN 1 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + FN, +}; + +#define KC_ KC_TRNS +#define _______ KC_TRNS + +#define KC_SWIN LGUI(KC_TILD) // Switch between windows +#define KC_SAPP LGUI(KC_TAB) // Switch between applications +#define KC_FN1 MO(_FN) +#define KC_LCAG LCAG(KC_NO) +#define KC_RVAD RGB_VAD +#define KC_RVAI RGB_VAI +#define KC_CLRM KC_NO // TODO: Clear sticky modifiers +#define KC_RST RESET + +// TODO: Make modifiers sticky + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = KC_KEYMAP( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + GRV , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,MINS,EQL ,BSPC, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + TAB , Q , W , E , R , T ,LBRC, Y , U , I , O , P ,BSLS,PGUP, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + ESC , A , S , D , F , G ,RBRC, H , J , K , L ,SCLN,QUOT,ENT , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + LSFT, Z , X , C , V , B ,SWIN, N , M ,COMM,DOT , UP ,SLSH,RSFT, + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + LCTL,LCAG,LALT,LGUI,SPC ,CLRM,SAPP, FN1 ,SPC ,RGUI,LEFT,DOWN,RGHT,PGDN + //`----+----+----+----+----+----+----' `----+----+----+----+----+----+----' + ), + + [_FN] = KC_KEYMAP( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,F12 , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , ,RST , , , , , , , , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , , ,RVAD,RVAI, , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , ,MUTE,VOLD,VOLU, , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , , , , , , , + //`----+----+----+----+----+----+----' `----+----+----+----+----+----+----' + ) + +}; + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +#endif + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + } + return true; +} diff --git a/keyboards/viterbi/keymaps/hexwire/Makefile b/keyboards/viterbi/keymaps/hexwire/Makefile new file mode 100644 index 000000000000..1e5761278801 --- /dev/null +++ b/keyboards/viterbi/keymaps/hexwire/Makefile @@ -0,0 +1,5 @@ +RGBLIGHT_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/viterbi/keymaps/hexwire/README.md b/keyboards/viterbi/keymaps/hexwire/README.md new file mode 100644 index 000000000000..3ce3f6af330a --- /dev/null +++ b/keyboards/viterbi/keymaps/hexwire/README.md @@ -0,0 +1,116 @@ +Hexwire's Nyquist Layout +============================ + +### Changes from default layout + +- Main layer + - The right space bar key has been changed to backspace, as I only hit space with my left thumb + - Backtick is at the lower right and also serves goes to the 3rd function layer when held + - Enter key acts as shift when held + - Escape key acts as control when held + - Minus key at upper right +- Lower layer + - Numbers are on the lower layer, to make it easier to use a numpad on the right hand + - Arrow keys + - Straight and curly brackets in the middle two columns + - Screenshot keys for MacOS +- Upper layer + - Symbols are on the upper layer + - Media keys + - Page Up/Down, Home/End +- 3rd function layer + - Function keys + +## Layouts + +### QWERTY + +``` +,----+----+----+----+----+----. ,----+----+----+----+----+----. +|ESC , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,BSPC| +|----+----+----+----+----+----| |----+----+----+----+----+----| +|TAB , Q , W , E , R , T , Y , U , I , O , P ,MINS| +|----+----+----+----+----+----| |----+----+----+----+----+----| +| X0 , A , S , D , F , G , H , J , K , L ,SCLN,QUOT| +|----+----+----+----+----+----| |----+----+----+----+----+----| +|LSFT, Z , X , C , V , B , N , M ,COMM,DOT ,SLSH, X4 | +|----+----+----+----+----+----| |----+----+----+----+----+----| +| X3 ,LCTL,LALT,LGUI, X1 ,SPC , BSPC, X2 ,LEFT,DOWN, UP ,RGHT| +`----+----+----+----+----+----' `----+----+----+----+----+----' +``` + +### Colemak +``` +,----+----+----+----+----+----. ,----+----+----+----+----+----. +|ESC , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,BSPC| +|----+----+----+----+----+----| |----+----+----+----+----+----| +|TAB , Q , W , F , P , G , J , L , U , Y ,SCLN,MINS| +|----+----+----+----+----+----| |----+----+----+----+----+----| +| X0 , A , R , S , T , D , H , N , E , I , O ,QUOT| +|----+----+----+----+----+----| |----+----+----+----+----+----| +|LSFT, Z , X , C , V , B , K , M ,COMM,DOT ,SLSH, X4 | +|----+----+----+----+----+----| |----+----+----+----+----+----| +| X3 ,LCTL,LALT,LGUI, X1 ,SPC , BSPC, X2 ,LEFT,DOWN, UP ,RGHT| +`----+----+----+----+----+----' `----+----+----+----+----+----' +``` + +### Dvorak +``` +,----+----+----+----+----+----. ,----+----+----+----+----+----. +|ESC , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,BSPC| +|----+----+----+----+----+----| |----+----+----+----+----+----| +|TAB ,QUOT,COMM,DOT , P , Y , F , G , C , R , L ,MINS| +|----+----+----+----+----+----| |----+----+----+----+----+----| +| X0 , A , O , E , U , I , D , H , T , N , S ,SLSH| +|----+----+----+----+----+----| |----+----+----+----+----+----| +|LSFT,SCLN, Q , J , K , X , B , M , W , V , Z , X4 | +|----+----+----+----+----+----| |----+----+----+----+----+----| +| X3 ,LCTL,LALT,LGUI, X1 ,SPC , BSPC, X2 ,LEFT,DOWN, UP ,RGHT| +`----+----+----+----+----+----' `----+----+----+----+----+----' +``` + +### Lower +``` +,----+----+----+----+----+----. ,----+----+----+----+----+----. +|TILD,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN,BSPC| +|----+----+----+----+----+----| |----+----+----+----+----+----| +| , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 , | +|----+----+----+----+----+----| |----+----+----+----+----+----| +|DEL ,CAPP,LEFT,RGHT, UP ,LBRC, RBRC, P4 , P5 , P6 ,PLUS,PIPE| +|----+----+----+----+----+----| |----+----+----+----+----+----| +| ,CPYP, , ,DOWN,LCBR, RCBR, P1 , P2 , P3 ,MINS, | +|----+----+----+----+----+----| |----+----+----+----+----+----| +| , , , , , , DEL , , P0 ,PDOT, , | +`----+----+----+----+----+----' `----+----+----+----+----+----' +``` + +### Raise +``` +,----+----+----+----+----+----. ,----+----+----+----+----+----. +|TILD,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN,BSPC| +|----+----+----+----+----+----| |----+----+----+----+----+----| +| ,EXLM, AT ,HASH,DLR ,PERC, CIRC,AMPR,ASTR,LPRN,RPRN, | +|----+----+----+----+----+----| |----+----+----+----+----+----| +|DEL ,MPRV,MNXT,VOLU,PGUP,UNDS, EQL ,HOME, , , ,BSLS| +|----+----+----+----+----+----| |----+----+----+----+----+----| +|MUTE,MSTP,MPLY,VOLD,PGDN,MINS, PLUS,END , , , , | +|----+----+----+----+----+----| |----+----+----+----+----+----| +| , , , , , , , , , , , | +`----+----+----+----+----+----' `----+----+----+----+----+----' +``` + +### 3rd function layer + +``` +,----+----+----+----+----+----. ,----+----+----+----+----+----. +|F12 , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 | +|----+----+----+----+----+----| |----+----+----+----+----+----| +| , , , , , , , , , , , | +|----+----+----+----+----+----| |----+----+----+----+----+----| +| , , , , , , , , , , , | +|----+----+----+----+----+----| |----+----+----+----+----+----| +| , , , , , , , , , , , | +|----+----+----+----+----+----| |----+----+----+----+----+----| +| , , , , , , , , , , , | +`----+----+----+----+----+----' `----+----+----+----+----+----' +``` diff --git a/keyboards/viterbi/keymaps/hexwire/config.h b/keyboards/viterbi/keymaps/hexwire/config.h new file mode 100644 index 000000000000..558ae0627ec5 --- /dev/null +++ b/keyboards/viterbi/keymaps/hexwire/config.h @@ -0,0 +1,43 @@ +/* +Copyright 2017 Danny Nguyen + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* Use I2C or Serial, not both */ + +#define USE_SERIAL +// #define USE_I2C + +/* Select hand configuration */ + +#define MASTER_LEFT +// #define _MASTER_RIGHT +// #define EE_HANDS + +#define TAPPING_TERM 150 + +#undef RGBLED_NUM +#define RGBLIGHT_ANIMATIONS +#define RGBLED_NUM 12 +#define RGBLIGHT_HUE_STEP 8 +#define RGBLIGHT_SAT_STEP 8 +#define RGBLIGHT_VAL_STEP 8 + +#endif diff --git a/keyboards/viterbi/keymaps/hexwire/keymap.c b/keyboards/viterbi/keymaps/hexwire/keymap.c new file mode 100644 index 000000000000..5c80f94d5f84 --- /dev/null +++ b/keyboards/viterbi/keymaps/hexwire/keymap.c @@ -0,0 +1,218 @@ +#include "viterbi.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + +#define _QWERTY 0 +#define _COLEMAK 1 +#define _DVORAK 2 +#define _LOWER 3 +#define _RAISE 4 +#define _FN3 5 +#define _FN4 6 +#define _ADJUST 16 + +enum custom_keycodes { + QWERTY = SAFE_RANGE, + COLEMAK, + DVORAK, + LOWER, + RAISE, + FN3, + FN4, + ADJUST, +}; + +#define KC_ KC_TRNS +#define _______ KC_TRNS + +#define KC_CAPW LGUI(LSFT(KC_3)) // Capture whole screen +#define KC_CPYW LGUI(LSFT(LCTL(KC_3))) // Copy whole screen +#define KC_CAPP LGUI(LSFT(KC_4)) // Capture portion of screen +#define KC_CPYP LGUI(LSFT(LCTL(KC_4))) // Copy portion of screen +#define KC_X0 MT(MOD_LCTL, KC_ESC) +#define KC_X1 LOWER +#define KC_X2 RAISE +#define KC_X3 LT(_FN3, KC_GRV) +#define KC_X4 MT(MOD_LSFT, KC_ENT) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + [_QWERTY] = KC_KEYMAP( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + ESC , 1 , 2 , 3 , 4 , 5 , , 6 , 7 , 8 , 9 , 0 ,BSPC, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + TAB , Q , W , E , R , T , , Y , U , I , O , P ,MINS, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + X0 , A , S , D , F , G , , H , J , K , L ,SCLN,QUOT, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + LSFT, Z , X , C , V , B , , N , M ,COMM,DOT ,SLSH, X4 , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + X3 ,LCTL,LALT,LGUI, X1 ,SPC , , BSPC, X2 ,LEFT,DOWN, UP ,RGHT, + //`----+----+----+----+----+----+----' `----+----+----+----+----+----+----' + ), + + [_COLEMAK] = KC_KEYMAP( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + ESC , 1 , 2 , 3 , 4 , 5 , , 6 , 7 , 8 , 9 , 0 ,BSPC, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + TAB , Q , W , F , P , G , , J , L , U , Y ,SCLN,MINS, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + X0 , A , R , S , T , D , , H , N , E , I , O ,QUOT, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + LSFT, Z , X , C , V , B , , K , M ,COMM,DOT ,SLSH, X4 , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + X3 ,LCTL,LALT,LGUI, X1 ,SPC , , BSPC, X2 ,LEFT,DOWN, UP ,RGHT, + //`----+----+----+----+----+----+----' `----+----+----+----+----+----+----' + ), + + [_DVORAK] = KC_KEYMAP( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + ESC , 1 , 2 , 3 , 4 , 5 , , 6 , 7 , 8 , 9 , 0 ,BSPC, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + TAB ,QUOT,COMM,DOT , P , Y , , F , G , C , R , L ,MINS, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + X0 , A , O , E , U , I , , D , H , T , N , S ,SLSH, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + LSFT,SCLN, Q , J , K , X , , B , M , W , V , Z , X4 , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + X3 ,LCTL,LALT,LGUI, X1 ,SPC , , BSPC, X2 ,LEFT,DOWN, UP ,RGHT, + //`----+----+----+----+----+----+----' `----+----+----+----+----+----+----' + ), + + [_LOWER] = KC_KEYMAP( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + TILD,EXLM, AT ,HASH,DLR ,PERC, , CIRC,AMPR,ASTR,LPRN,RPRN,BSPC, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , 1 , 2 , 3 , 4 , 5 , , 6 , 7 , 8 , 9 , 0 , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + DEL ,CAPP,LEFT,RGHT, UP ,LBRC, , RBRC, P4 , P5 , P6 ,PLUS,PIPE, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + ,CPYP, , ,DOWN,LCBR, , RCBR, P1 , P2 , P3 ,MINS, , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , DEL , , P0 ,PDOT, , , + //`----+----+----+----+----+----+----' `----+----+----+----+----+----+----' + ), + + [_RAISE] = KC_KEYMAP( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + TILD,EXLM, AT ,HASH,DLR ,PERC, , CIRC,AMPR,ASTR,LPRN,RPRN,BSPC, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + ,EXLM, AT ,HASH,DLR ,PERC, , CIRC,AMPR,ASTR,LPRN,RPRN, , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + DEL ,MPRV,MNXT,VOLU,PGUP,UNDS, , EQL ,HOME, , , ,BSLS, , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + MUTE,MSTP,MPLY,VOLD,PGDN,MINS, , PLUS,END , , , , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , , , , , , , + //`----+----+----+----+----+----+----' `----+----+----+----+----+----+----' + ), + + [_FN3] = KC_KEYMAP( + //,----+----+----+----+----+----+----. ,----+----+----+----+----+----+----. + F12 , F1 , F2 , F3 , F4 , F5 , , F6 , F7 , F8 , F9 ,F10 ,F11 , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , , , , , , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , , , , , , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , , , , , , , , + //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| + , , , , , , , , , , , , , + //`----+----+----+----+----+----+----' `----+----+----+----+----+----+----' + ), + +/* Adjust (Lower + Raise) + * ,-----------------------------------------------------------------------------------. + * | | Reset|RGB Tg|RGB Md|Hue Up|Hue Dn|Sat Up|Sat Dn|Val Up|Val Dn| | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ + [_ADJUST] = KEYMAP( \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, RESET , RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, _______, _______, _______, \ + _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + ) + + +}; + +#ifdef AUDIO_ENABLE +float tone_qwerty[][2] = SONG(QWERTY_SOUND); +float tone_dvorak[][2] = SONG(DVORAK_SOUND); +float tone_colemak[][2] = SONG(COLEMAK_SOUND); +#endif + +void persistent_default_layer_set(uint16_t default_layer) { + eeconfig_update_default_layer(default_layer); + default_layer_set(default_layer); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case QWERTY: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_qwerty, false, 0); + #endif + persistent_default_layer_set(1UL<<_QWERTY); + } + return false; + break; + case COLEMAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_colemak, false, 0); + #endif + persistent_default_layer_set(1UL<<_COLEMAK); + } + return false; + break; + case DVORAK: + if (record->event.pressed) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_dvorak, false, 0); + #endif + persistent_default_layer_set(1UL<<_DVORAK); + } + return false; + break; + case LOWER: + if (record->event.pressed) { + layer_on(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case RAISE: + if (record->event.pressed) { + layer_on(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } else { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + return false; + break; + case ADJUST: + if (record->event.pressed) { + layer_on(_ADJUST); + } else { + layer_off(_ADJUST); + } + return false; + break; + } + return true; +} diff --git a/keyboards/viterbi/nyquist.c b/keyboards/viterbi/nyquist.c deleted file mode 100644 index 2face09d4204..000000000000 --- a/keyboards/viterbi/nyquist.c +++ /dev/null @@ -1 +0,0 @@ -#include "nyquist.h" diff --git a/keyboards/viterbi/nyquist.h b/keyboards/viterbi/nyquist.h deleted file mode 100644 index e8cccecf5f6f..000000000000 --- a/keyboards/viterbi/nyquist.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef NYQUIST_H -#define NYQUIST_H - -#ifdef SUBPROJECT_rev1 - #include "rev1.h" -#endif - -// Used to create a keymap using only KC_ prefixed keys -#define KC_KEYMAP( \ - L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \ - L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \ - L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \ - L30, L31, L32, L33, L34, L35, R30, R31, R32, R33, R34, R35, \ - L40, L41, L42, L43, L44, L45, R40, R41, R42, R43, R44, R45 \ - ) \ - KEYMAP( \ - KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, \ - KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, \ - KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, \ - KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35, \ - KC_##L40, KC_##L41, KC_##L42, KC_##L43, KC_##L44, KC_##L45, KC_##R40, KC_##R41, KC_##R42, KC_##R43, KC_##R44, KC_##R45 \ - ) - -#include "quantum.h" - -#endif \ No newline at end of file diff --git a/keyboards/viterbi/readme.md b/keyboards/viterbi/readme.md index 61b9317d5239..d3bf49c56914 100644 --- a/keyboards/viterbi/readme.md +++ b/keyboards/viterbi/readme.md @@ -1,169 +1,24 @@ -The Nyquist Keyboard -==================== +Viterbi +======= -The Nyquist is a 60% split ortholinear board by [Keebio](https://keeb.io). It has been designed in a similar manner to the Let's Split v2 by /u/wootpatoot. Each half of the keyboard is arranged in a 5x6 grid. There is an option to use a 2u key with PCB mounted MX stablizers, in place of the two innermost 1u keys on the bottom row. +A split 5x14 ortholinear keyboard kit made and sold by Keebio. [More info at Keebio](https://keeb.io) +Keyboard Maintainer: [Bakingpy](https://github.com/nooges) -## Build Guide +Hardware Supported: Pro Micro -A build log of the Nyquist can be found here: [Nyquist Build Log](http://imgur.com/a/dD4sX). +Hardware Availability: [Keebio](https://keeb.io) -Since the design is very similar to the Let's Split v2, the build guide for that can be used while the build guide for the Nyquist is being fully developed. A build guide for putting together the Let's Split v2 can be found here: [An Overly Verbose Guide to Building a Let's Split Keyboard](https://github.com/nicinabox/lets-split-guide) -There is additional information there about flashing and adding RGB underglow. +Make example for this keyboard (after setting up your build environment): -## First Time Setup + make viterbi-rev1-default -Download or clone the whole firmware and navigate to the keyboards/nyquist directory. Once your development environment is setup, you'll be able to generate the default .hex using: -``` -$ make serial -``` +Example of flashing this keyboard: -You will see a lot of output and if everything worked correctly you will see the built hex file: + make viterbi-rev1-default-avrdude -``` -nyquist_rev1_serial.hex -``` +See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information. -If you would like to use one of the alternative keymaps, or create your own, copy one of the existing [keymaps](keymaps/) and run make like so: - - -``` -$ make YOUR_KEYMAP_NAME -``` - -If everything worked correctly you will see a file: - -``` -nyquist_rev1_YOUR_KEYMAP_NAME.hex -``` - -For more information on customizing keymaps, take a look at the primary documentation for [Customizing Your Keymap](/readme.md##customizing-your-keymap) in the main readme.md. - -Features --------- - -For the full Quantum Mechanical Keyboard feature list, see [the parent readme.md](/readme.md). - -Some features supported by the firmware: - -* Either half can connect to the computer via USB, or both halves can be used - independently. -* You only need 3 wires to connect the two halves. Two for VCC and GND and one - for serial communication. -* Optional support for I2C connection between the two halves if for some - reason you require a faster connection between the two halves. Note this - requires an extra wire between halves and pull-up resistors on the data lines. - -### 2u Support -In place of the two innermost 1u keys on the bottom row, a single 2u key can be used. If you choose to use this option, then in your keymap, set the innermost key on the bottom row to what you want the 2u key to be. For example, if using the 2u key on the left half of the board, set the keycode for the lower right key. - -Required Hardware ------------------ - -Apart from diodes and key switches for the keyboard matrix in each half, you -will need: - -* 2 Arduino Pro Micro's. You can find theses on aliexpress for ≈3.50USD each. -* 2 TRRS sockets and 1 TRRS cable, or 2 TRS sockets and 1 TRS cable - -Alternatively, you can use any sort of cable and socket that has at least 3 -wires. If you want to use I2C to communicate between halves, you will need a -cable with at least 4 wires and 2x 4.7kΩ pull-up resistors - -Optional Hardware ------------------ - -A speaker can be hooked-up to either side to the `5` (`C6`) pin and `GND`, and turned on via `AUDIO_ENABLE`. - -Wiring ------- - -The 3 wires of the TRS/TRRS cable need to connect GND, VCC, and digital pin 3 (i.e. -PD0 on the ATmega32u4) between the two Pro Micros. - -Then wire your key matrix to any of the remaining 17 IO pins of the pro micro -and modify the `matrix.c` accordingly. - -The wiring for serial: - -![serial wiring](http://imgur.com/BnCGU1Y) - -The wiring for i2c: - -![i2c wiring](http://imgur.com/5eiArDA) - -The pull-up resistors may be placed on either half. It is also possible -to use 4 resistors and have the pull-ups in both halves, but this is -unnecessary in simple use cases. - -Flashing -------- -From the `nyquist` directory run `make SUBPROJECT-KEYMAP-avrdude` for automatic serial port resolution and flashing. -Example: `make rev1-serial-avrdude` - - -Choosing which board to plug the USB cable into (choosing Master) --------- -Because the two boards are identical, the firmware has logic to differentiate the left and right board. - -It uses two strategies to figure things out: look at the EEPROM (memory on the chip) or looks if the current board has the usb cable. - -The EEPROM approach requires additional setup (flashing the eeeprom) but allows you to swap the usb cable to either side. - -The USB cable approach is easier to setup and if you just want the usb cable on the left board, you do not need to do anything extra. - -### Setting the left hand as master -If you always plug the usb cable into the left board, nothing extra is needed as this is the default. Comment out `EE_HANDS` and comment out `I2C_MASTER_RIGHT` or `MASTER_RIGHT` if for some reason it was set. - -### Setting the right hand as master -If you always plug the usb cable into the right board, add an extra flag to your `config.h` -``` - #define MASTER_RIGHT -``` - -### Setting EE_hands to use either hands as master -If you define `EE_HANDS` in your `config.h`, you will need to set the -EEPROM for the left and right halves. - -The EEPROM is used to store whether the -half is left handed or right handed. This makes it so that the same firmware -file will run on both hands instead of having to flash left and right handed -versions of the firmware to each half. To flash the EEPROM file for the left -half run: -``` -avrdude -p atmega32u4 -P $(COM_PORT) -c avr109 -U eeprom:w:eeprom-lefthand.eep -// or the equivalent in dfu-programmer - -``` -and similarly for right half -``` -avrdude -p atmega32u4 -P $(COM_PORT) -c avr109 -U eeprom:w:eeprom-righhand.eep -// or the equivalent in dfu-programmer -``` - -NOTE: replace `$(COM_PORT)` with the port of your device (e.g. `/dev/ttyACM0`) - -After you have flashed the EEPROM, you then need to set `EE_HANDS` in your config.h, rebuild the hex files and reflash. - -Note that you need to program both halves, but you have the option of using -different keymaps for each half. You could program the left half with a QWERTY -layout and the right half with a Colemak layout using bootmagic's default layout option. -Then if you connect the left half to a computer by USB the keyboard will use QWERTY and Colemak when the -right half is connected. - - -Notes on Using Pro Micro 3.3V ------------------------------ - -Do update the `F_CPU` parameter in `rules.mk` to `8000000` which reflects -the frequency on the 3.3V board. - -Also, if the slave board is producing weird characters in certain columns, -update the following line in `matrix.c` to the following: - -``` -// _delay_us(30); // without this wait read unstable value. -_delay_us(300); // without this wait read unstable value. -``` +A build guide for this keyboard can be found here: [Viterbi Build Guide](https://docs.keeb.io) diff --git a/keyboards/viterbi/rev1/Makefile b/keyboards/viterbi/rev1/Makefile new file mode 100644 index 000000000000..57b2ef62e5f3 --- /dev/null +++ b/keyboards/viterbi/rev1/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../Makefile +endif diff --git a/keyboards/viterbi/rev1/config.h b/keyboards/viterbi/rev1/config.h new file mode 100644 index 000000000000..d9d944087bae --- /dev/null +++ b/keyboards/viterbi/rev1/config.h @@ -0,0 +1,89 @@ +/* +Copyright 2017 Danny Nguyen + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef REV1_CONFIG_H +#define REV1_CONFIG_H + +#include "../config.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xCEEB +#define PRODUCT_ID 0x1157 +#define DEVICE_VER 0x0100 +#define MANUFACTURER Keebio +#define PRODUCT The Viterbi Keyboard +#define DESCRIPTION Split 5x14 ortholinear keyboard + +/* key matrix size */ +// Rows are doubled-up +#define MATRIX_ROWS 10 +#define MATRIX_COLS 7 + +// wiring of each half +#define MATRIX_ROW_PINS { D4, D7, E6, B4, B5 } +#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6, B6 } + +#define CATERINA_BOOTLOADER + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ +// #define BACKLIGHT_LEVELS 3 + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCING_DELAY 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +/* key combination for command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* ws2812 RGB LED */ +#define RGB_DI_PIN D3 +#define RGBLIGHT_TIMER +#define RGBLED_NUM 16 // Number of LEDs +#define ws2812_PORTREG PORTD +#define ws2812_DDRREG DDRD + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +// #define NO_DEBUG + +/* disable print */ +// #define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +#endif diff --git a/keyboards/viterbi/rev1/rev1.c b/keyboards/viterbi/rev1/rev1.c new file mode 100644 index 000000000000..760fdebf39f5 --- /dev/null +++ b/keyboards/viterbi/rev1/rev1.c @@ -0,0 +1,39 @@ +#include "viterbi.h" + +#ifdef AUDIO_ENABLE + float tone_startup[][2] = SONG(STARTUP_SOUND); + float tone_goodbye[][2] = SONG(GOODBYE_SOUND); +#endif + +#ifdef SSD1306OLED +void led_set_kb(uint8_t usb_led) { + // put your keyboard LED indicator (ex: Caps Lock LED) toggling code here + led_set_user(usb_led); +} +#endif + +void matrix_init_kb(void) { + + #ifdef AUDIO_ENABLE + _delay_ms(20); // gets rid of tick + PLAY_NOTE_ARRAY(tone_startup, false, 0); + #endif + + // // green led on + // DDRD |= (1<<5); + // PORTD &= ~(1<<5); + + // // orange led on + // DDRB |= (1<<0); + // PORTB &= ~(1<<0); + + matrix_init_user(); +}; + +void shutdown_user(void) { + #ifdef AUDIO_ENABLE + PLAY_NOTE_ARRAY(tone_goodbye, false, 0); + _delay_ms(150); + stop_all_notes(); + #endif +} diff --git a/keyboards/viterbi/rev1/rev1.h b/keyboards/viterbi/rev1/rev1.h new file mode 100644 index 000000000000..a8210123b3a6 --- /dev/null +++ b/keyboards/viterbi/rev1/rev1.h @@ -0,0 +1,66 @@ +#ifndef REV1_H +#define REV1_H + +#include "../viterbi.h" + +//void promicro_bootloader_jmp(bool program); +#include "quantum.h" + + +#ifdef USE_I2C +#include +#ifdef __AVR__ + #include + #include +#endif +#endif + +//void promicro_bootloader_jmp(bool program); + +#ifndef FLIP_HALF +// Standard Keymap +// (TRRS jack on the left half is to the right, TRRS jack on the right half is to the left) +#define KEYMAP( \ + L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \ + L10, L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16, \ + L20, L21, L22, L23, L24, L25, L26, R20, R21, R22, R23, R24, R25, R26, \ + L30, L31, L32, L33, L34, L35, L36, R30, R31, R32, R33, R34, R35, R36, \ + L40, L41, L42, L43, L44, L45, L46, R40, R41, R42, R43, R44, R45, R46 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05, L06 }, \ + { L10, L11, L12, L13, L14, L15, L16 }, \ + { L20, L21, L22, L23, L24, L25, L26 }, \ + { L30, L31, L32, L33, L34, L35, L36 }, \ + { L40, L41, L42, L43, L44, L45, L46 }, \ + { R06, R05, R04, R03, R02, R01, R00 }, \ + { R16, R15, R14, R13, R12, R11, R10 }, \ + { R26, R25, R24, R23, R22, R21, R20 }, \ + { R36, R35, R34, R33, R32, R31, R30 }, \ + { R46, R45, R44, R43, R42, R41, R40 } \ + } +#else +// Keymap with right side flipped +// (TRRS jack on both halves are to the right) +#define KEYMAP( \ + L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \ + L10, L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16, \ + L20, L21, L22, L23, L24, L25, L26, R20, R21, R22, R23, R24, R25, R26, \ + L30, L31, L32, L33, L34, L35, L36, R30, R31, R32, R33, R34, R35, R36, \ + L40, L41, L42, L43, L44, L45, L46, R40, R41, R42, R43, R44, R45, R46 \ + ) \ + { \ + { L00, L01, L02, L03, L04, L05, L06 }, \ + { L10, L11, L12, L13, L14, L15, L16 }, \ + { L20, L21, L22, L23, L24, L25, L26 }, \ + { L30, L31, L32, L33, L34, L35, L36 }, \ + { L40, L41, L42, L43, L44, L45, L46 }, \ + { R00, R01, R02, R03, R04, R05, R06 }, \ + { R10, R11, R12, R13, R14, R15, R16 }, \ + { R20, R21, R22, R23, R24, R25, R26 }, \ + { R30, R31, R32, R33, R34, R35, R36 }, \ + { R40, R41, R42, R43, R44, R45, R46 } \ + } +#endif + +#endif diff --git a/keyboards/viterbi/rev1/rules.mk b/keyboards/viterbi/rev1/rules.mk new file mode 100644 index 000000000000..80a942d06f7c --- /dev/null +++ b/keyboards/viterbi/rev1/rules.mk @@ -0,0 +1,5 @@ +BACKLIGHT_ENABLE = no + +ifndef QUANTUM_DIR + include ../../../Makefile +endif diff --git a/keyboards/viterbi/viterbi.c b/keyboards/viterbi/viterbi.c new file mode 100644 index 000000000000..509e42dc515d --- /dev/null +++ b/keyboards/viterbi/viterbi.c @@ -0,0 +1 @@ +#include "viterbi.h" diff --git a/keyboards/viterbi/viterbi.h b/keyboards/viterbi/viterbi.h new file mode 100644 index 000000000000..d3d0f64eb723 --- /dev/null +++ b/keyboards/viterbi/viterbi.h @@ -0,0 +1,26 @@ +#ifndef VITERBI_H +#define VITERBI_H + +#ifdef SUBPROJECT_rev1 + #include "rev1.h" +#endif + +// Used to create a keymap using only KC_ prefixed keys +#define KC_KEYMAP( \ + L00, L01, L02, L03, L04, L05, L06, R00, R01, R02, R03, R04, R05, R06, \ + L10, L11, L12, L13, L14, L15, L16, R10, R11, R12, R13, R14, R15, R16, \ + L20, L21, L22, L23, L24, L25, L26, R20, R21, R22, R23, R24, R25, R26, \ + L30, L31, L32, L33, L34, L35, L36, R30, R31, R32, R33, R34, R35, R36, \ + L40, L41, L42, L43, L44, L45, L46, R40, R41, R42, R43, R44, R45, R46 \ + ) \ + KEYMAP( \ + KC_##L00, KC_##L01, KC_##L02, KC_##L03, KC_##L04, KC_##L05, KC_##L06, KC_##R00, KC_##R01, KC_##R02, KC_##R03, KC_##R04, KC_##R05, KC_##R06, \ + KC_##L10, KC_##L11, KC_##L12, KC_##L13, KC_##L14, KC_##L15, KC_##L16, KC_##R10, KC_##R11, KC_##R12, KC_##R13, KC_##R14, KC_##R15, KC_##R16, \ + KC_##L20, KC_##L21, KC_##L22, KC_##L23, KC_##L24, KC_##L25, KC_##L26, KC_##R20, KC_##R21, KC_##R22, KC_##R23, KC_##R24, KC_##R25, KC_##R26, \ + KC_##L30, KC_##L31, KC_##L32, KC_##L33, KC_##L34, KC_##L35, KC_##L36, KC_##R30, KC_##R31, KC_##R32, KC_##R33, KC_##R34, KC_##R35, KC_##R36, \ + KC_##L40, KC_##L41, KC_##L42, KC_##L43, KC_##L44, KC_##L45, KC_##L46, KC_##R40, KC_##R41, KC_##R42, KC_##R43, KC_##R44, KC_##R45, KC_##R46 \ + ) + +#include "quantum.h" + +#endif From 94823176c5a9ff87c618872d0076b4f60088ece0 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Tue, 29 Aug 2017 16:14:50 -0400 Subject: [PATCH 42/45] Adjust Viterbi pinout --- keyboards/viterbi/rev1/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/viterbi/rev1/config.h b/keyboards/viterbi/rev1/config.h index d9d944087bae..d48075198d0d 100644 --- a/keyboards/viterbi/rev1/config.h +++ b/keyboards/viterbi/rev1/config.h @@ -35,7 +35,7 @@ along with this program. If not, see . // wiring of each half #define MATRIX_ROW_PINS { D4, D7, E6, B4, B5 } -#define MATRIX_COL_PINS { F6, F7, B1, B3, B2, B6, B6 } +#define MATRIX_COL_PINS { F5, F6, F7, B1, B3, B2, B6 } #define CATERINA_BOOTLOADER From 37b9715cbc5542e76a9aa7c3c8983d65c61e37e0 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Tue, 29 Aug 2017 16:14:29 -0400 Subject: [PATCH 43/45] Update default Viterbi layout --- keyboards/viterbi/keymaps/default/keymap.c | 60 +++++++++++----------- keyboards/viterbi/readme.md | 7 +-- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/keyboards/viterbi/keymaps/default/keymap.c b/keyboards/viterbi/keymaps/default/keymap.c index 261a59b2a694..4b9e605dc1fe 100644 --- a/keyboards/viterbi/keymaps/default/keymap.c +++ b/keyboards/viterbi/keymaps/default/keymap.c @@ -44,11 +44,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_QWERTY] = KEYMAP( \ - KC_NO, KC_NO, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ - KC_NO, KC_NO, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, \ - KC_NO, KC_NO, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ - KC_NO, KC_NO, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ - KC_NO, KC_NO, ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + KC_GRV, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, KC_BSPC, \ + KC_TAB, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, KC_DEL, \ + KC_ESC, KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_QUOT, \ + KC_LSFT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , KC_ENT, \ + ADJUST, ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______ \ ), /* Colemak @@ -65,11 +65,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_COLEMAK] = KEYMAP( \ - KC_NO, KC_NO, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ - KC_NO, KC_NO, KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_DEL, \ - KC_NO, KC_NO, KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ - KC_NO, KC_NO, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \ - KC_NO, KC_NO, ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + KC_GRV, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, _______, \ + KC_TAB, KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_DEL, _______, \ + KC_ESC, KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, _______, \ + KC_LSFT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , _______, \ + ADJUST, ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______ \ ), /* Dvorak @@ -86,11 +86,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_DVORAK] = KEYMAP( \ - KC_NO, KC_NO, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ - KC_NO, KC_NO, KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, \ - KC_NO, KC_NO, KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ - KC_NO, KC_NO, KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \ - KC_NO, KC_NO, ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \ + KC_GRV, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, _______, \ + KC_TAB, KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL, _______, \ + KC_ESC, KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, _______, \ + KC_LSFT, KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , _______, \ + ADJUST, ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______ \ ), /* Lower @@ -107,11 +107,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_LOWER] = KEYMAP( \ - KC_NO, KC_NO, KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, \ - KC_NO, KC_NO, KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \ - KC_NO, KC_NO, KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \ - KC_NO, KC_NO, _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, \ - KC_NO, KC_NO, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + _______, KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, _______, \ + _______, KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, _______, \ + _______, KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, _______, \ + _______, _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______ \ ), /* Raise @@ -128,11 +128,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_RAISE] = KEYMAP( \ - KC_NO, KC_NO, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, \ - KC_NO, KC_NO, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \ - KC_NO, KC_NO, KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \ - KC_NO, KC_NO, _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \ - KC_NO, KC_NO, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \ + _______, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, _______, \ + _______, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, _______, \ + _______, KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, _______, \ + _______, _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______ \ ), /* Adjust (Lower + Raise) @@ -149,11 +149,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_ADJUST] = KEYMAP( \ - KC_NO, KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \ - KC_NO, KC_NO, _______, RESET , RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, KC_DEL, \ - KC_NO, KC_NO, _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ - KC_NO, KC_NO, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ - KC_NO, KC_NO, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ + _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, \ + _______, _______, RESET , RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, _______, KC_DEL, _______, \ + _______, _______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \ + _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ ) diff --git a/keyboards/viterbi/readme.md b/keyboards/viterbi/readme.md index d3bf49c56914..bc8451ba3095 100644 --- a/keyboards/viterbi/readme.md +++ b/keyboards/viterbi/readme.md @@ -3,13 +3,10 @@ Viterbi A split 5x14 ortholinear keyboard kit made and sold by Keebio. [More info at Keebio](https://keeb.io) -Keyboard Maintainer: [Bakingpy](https://github.com/nooges) - -Hardware Supported: Pro Micro - +Keyboard Maintainer: [Bakingpy](https://github.com/nooges) +Hardware Supported: Pro Micro Hardware Availability: [Keebio](https://keeb.io) - Make example for this keyboard (after setting up your build environment): make viterbi-rev1-default From 8c02748c8121c083a907abc1b0b9388c4cf851a3 Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Tue, 19 Sep 2017 13:23:34 -0400 Subject: [PATCH 44/45] Update Viterbi keymaps --- keyboards/viterbi/Makefile | 5 ----- keyboards/viterbi/keymaps/default/{Makefile => rules.mk} | 0 keyboards/viterbi/keymaps/dwallace/config.h | 2 +- keyboards/viterbi/keymaps/dwallace/keymap.c | 4 +++- keyboards/viterbi/keymaps/dwallace/{Makefile => rules.mk} | 0 keyboards/viterbi/keymaps/hexwire/{Makefile => rules.mk} | 0 6 files changed, 4 insertions(+), 7 deletions(-) delete mode 100644 keyboards/viterbi/Makefile rename keyboards/viterbi/keymaps/default/{Makefile => rules.mk} (100%) rename keyboards/viterbi/keymaps/dwallace/{Makefile => rules.mk} (100%) rename keyboards/viterbi/keymaps/hexwire/{Makefile => rules.mk} (100%) diff --git a/keyboards/viterbi/Makefile b/keyboards/viterbi/Makefile deleted file mode 100644 index 0c519b323b79..000000000000 --- a/keyboards/viterbi/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -SUBPROJECT_DEFAULT = rev1 - -ifndef MAKEFILE_INCLUDED - include ../../Makefile -endif diff --git a/keyboards/viterbi/keymaps/default/Makefile b/keyboards/viterbi/keymaps/default/rules.mk similarity index 100% rename from keyboards/viterbi/keymaps/default/Makefile rename to keyboards/viterbi/keymaps/default/rules.mk diff --git a/keyboards/viterbi/keymaps/dwallace/config.h b/keyboards/viterbi/keymaps/dwallace/config.h index 558ae0627ec5..79bd8fd352be 100644 --- a/keyboards/viterbi/keymaps/dwallace/config.h +++ b/keyboards/viterbi/keymaps/dwallace/config.h @@ -35,7 +35,7 @@ along with this program. If not, see . #undef RGBLED_NUM #define RGBLIGHT_ANIMATIONS -#define RGBLED_NUM 12 +#define RGBLED_NUM 14 #define RGBLIGHT_HUE_STEP 8 #define RGBLIGHT_SAT_STEP 8 #define RGBLIGHT_VAL_STEP 8 diff --git a/keyboards/viterbi/keymaps/dwallace/keymap.c b/keyboards/viterbi/keymaps/dwallace/keymap.c index c884c8a37413..38d63ffaa907 100644 --- a/keyboards/viterbi/keymaps/dwallace/keymap.c +++ b/keyboards/viterbi/keymaps/dwallace/keymap.c @@ -19,6 +19,8 @@ enum custom_keycodes { #define KC_SAPP LGUI(KC_TAB) // Switch between applications #define KC_FN1 MO(_FN) #define KC_LCAG LCAG(KC_NO) +#define KC_RTOG RGB_TOG +#define KC_RMOD RGB_MOD #define KC_RVAD RGB_VAD #define KC_RVAI RGB_VAI #define KC_CLRM KC_NO // TODO: Clear sticky modifiers @@ -48,7 +50,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| , , , ,RST , , , , , , , , , , //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| - , , , , , , , , ,RVAD,RVAI, , , , + , , , , , , , RTOG,RMOD,RVAD,RVAI, , , , //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| , , , , , , , ,MUTE,VOLD,VOLU, , , , //|----+----+----+----+----+----+----| |----+----+----+----+----+----+----| diff --git a/keyboards/viterbi/keymaps/dwallace/Makefile b/keyboards/viterbi/keymaps/dwallace/rules.mk similarity index 100% rename from keyboards/viterbi/keymaps/dwallace/Makefile rename to keyboards/viterbi/keymaps/dwallace/rules.mk diff --git a/keyboards/viterbi/keymaps/hexwire/Makefile b/keyboards/viterbi/keymaps/hexwire/rules.mk similarity index 100% rename from keyboards/viterbi/keymaps/hexwire/Makefile rename to keyboards/viterbi/keymaps/hexwire/rules.mk From 878774b24e262785d553428543b72a233b1e4c9f Mon Sep 17 00:00:00 2001 From: Yan-Fa Li Date: Wed, 20 Sep 2017 13:04:31 -0700 Subject: [PATCH 45/45] Contribute a DZ60 keymap for 67 key configuration --- keyboards/dz60/config.h | 4 +- keyboards/dz60/keymaps/model42/keymap.c | 65 ++++++++++++++++++++++++ keyboards/dz60/keymaps/model42/readme.md | 42 +++++++++++++++ 3 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 keyboards/dz60/keymaps/model42/keymap.c create mode 100644 keyboards/dz60/keymaps/model42/readme.md diff --git a/keyboards/dz60/config.h b/keyboards/dz60/config.h index a282196b339e..8e1a5ae5f583 100644 --- a/keyboards/dz60/config.h +++ b/keyboards/dz60/config.h @@ -46,9 +46,9 @@ #define RGB_DI_PIN E2 #define RGBLIGHT_ANIMATIONS -#define RGBLED_NUM 20 +#define RGBLED_NUM 16 #define RGBLIGHT_HUE_STEP 8 #define RGBLIGHT_SAT_STEP 8 #define RGBLIGHT_VAL_STEP 8 -#endif \ No newline at end of file +#endif diff --git a/keyboards/dz60/keymaps/model42/keymap.c b/keyboards/dz60/keymaps/model42/keymap.c new file mode 100644 index 000000000000..b87141bee9e2 --- /dev/null +++ b/keyboards/dz60/keymaps/model42/keymap.c @@ -0,0 +1,65 @@ +#include "dz60.h" +#include "action_layer.h" + +// Hard Reload Chrome +enum dz60_keycodes { + LT_1_OR_RELOAD_CHROME = SAFE_RANGE +}; + +const uint16_t PROGMEM keymaps[][5][15] = { +// layer 0 +KEYMAP_DIRECTIONAL(KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_PGUP, KC_PGDN, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, + KC_LSFT, LT(3, KC_Z), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, MT(MOD_RSFT, KC_SLSH), KC_UP, KC_SLSH, + KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, LT(4, KC_SPC), KC_BSPC, MO(2), LT_1_OR_RELOAD_CHROME, KC_LEFT, KC_DOWN, KC_RGHT), + +// layer 1 +KEYMAP_DIRECTIONAL(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, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RESET, + 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, BL_DEC, BL_TOGG, BL_INC, BL_STEP, 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), + +// layer 2 +KEYMAP_DIRECTIONAL(KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_HOME, KC_END, + 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_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_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), + +// layer 3 +KEYMAP_DIRECTIONAL(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_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_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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), + +// layer 4 +KEYMAP_DIRECTIONAL(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_MS_BTN1, KC_MS_UP, KC_MS_BTN2, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, + KC_TRNS, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, 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_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), +}; + +uint16_t custom_lt_timer; +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if(LT_1_OR_RELOAD_CHROME == keycode) { + if(record->event.pressed) { + custom_lt_timer = timer_read(); + layer_on(1); + } else { + layer_off(1); + if (timer_elapsed(custom_lt_timer) < 200) { + register_code(KC_LGUI); + register_code(KC_RSHIFT); + register_code(KC_R); + unregister_code(KC_R); + unregister_code(KC_RSHIFT); + unregister_code(KC_LGUI); + } + } + } + return true; +} diff --git a/keyboards/dz60/keymaps/model42/readme.md b/keyboards/dz60/keymaps/model42/readme.md new file mode 100644 index 000000000000..af8407506842 --- /dev/null +++ b/keyboards/dz60/keymaps/model42/readme.md @@ -0,0 +1,42 @@ +# yanfali's keymap for KBDFans DZ60 PCB + +## 4 Layers + +### Layer 0 + +![layer 0](https://imgur.com/bOiQI69.png) +Conventional ANSI layout. Except: + + - Backspace has been replaced with 2 keys + - PGUP + - PGDN + - 2.25U Left shift is now 1.25U with 1U key LT(layer 3, KC_Z) + - Bottom right shift is 1.75U. Has arrow cluster. Tap right shift for / and dedicated / key is to far right. + - Bottom row, split space bar + - 2.75U (Space) + - 1.25U (mouse key + WASD) with LT(4, KC_SPC) + - 2.25U (backspace) + - 1U MO(layer 2) + - 1U LT(layer 1, SHIFT+LGUI+R) + - arrows. + +### Layer 1 + +![layer 1](https://imgur.com/X7iKNxQ.png) +RGB underglow and backlight controls, Reset + +### Layer 2 + +![layer 1](https://imgur.com/gELh7Se.png) +F1-F12, PGUP -> HOME, PGDN -> END + +### Layer 3 + +Unused at this time but tied to 3 FN key to right of 1.25U left shift. + +### Layer 4 + + * WASD - Mouse controls + * Q - Btn 1 + * E - Btn 2 +