From 6037cede2ce66dd8ce4df82d6d9a347c1de3110a Mon Sep 17 00:00:00 2001 From: Luiz Ribeiro Date: Sun, 28 May 2017 12:40:03 -0400 Subject: [PATCH 01/51] 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 9fa8c31263..dc9e5dad63 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 b5c696f3f8..fc17b5d5e2 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 0000000000..c27f3e3d17 --- /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 3e4cebc81e..60929ac997 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 beaa54c400..140026013f 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 e69de29bb2..89e437786b 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 e2b5922ea2..9fb27efed9 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/51] 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 89e437786b..7ff8998544 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/51] 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 dc9e5dad63..550440cbcf 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 a88d9cd9b0..081a8219ce 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 9fb27efed9..9e76993c4a 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 60924a0fb6..f7e0c31440 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 4eec2a7762..49420de376 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 92130192ce..6b609da7fc 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 0000000000..1d1467a12a --- /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/51] 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 081a8219ce..b45bff8e5f 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 1d1467a12a..b1aa7026c4 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/51] 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 7ff8998544..701c5847f5 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/51] 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 550440cbcf..b4f1c1cfff 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 60929ac997..4650ff633f 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 b45bff8e5f..a88d9cd9b0 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 813f31f804..35902cff4d 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 68b6de60e06cf01aa1b98a817fa6613bc4e30715 Mon Sep 17 00:00:00 2001 From: Ptomerty Date: Thu, 24 Aug 2017 17:23:21 -0400 Subject: [PATCH 07/51] fix for toggle tap dance --- quantum/process_keycode/process_tap_dance.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c index 00870c4e7f..f1f28e0166 100644 --- a/quantum/process_keycode/process_tap_dance.c +++ b/quantum/process_keycode/process_tap_dance.c @@ -47,7 +47,7 @@ void qk_tap_dance_dual_role_finished (qk_tap_dance_state_t *state, void *user_da if (state->count == 1) { register_code16 (pair->kc); } else if (state->count == 2) { - layer_invert (pair->layer); + layer_move (pair->layer); } } From 349e0012ba2f378a3de3ac12966bfa6ea9b679ad Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 25 Aug 2017 18:48:40 +0200 Subject: [PATCH 08/51] Basic support for JM60 keyboard This adds basic support for JM60 RGB PCB that was sold by KBDfans https://kbdfans.myshopify.com/ https://www.aliexpress.com/store/product/JM60-RGB60-Custom-mechanical-keyboard-PCB-ANSI/2230037_32810956675.html No support for RGB Backlight yet. --- keyboards/jm60/Makefile | 3 + keyboards/jm60/boards/JM60_BOARD/board.c | 51 +++ keyboards/jm60/boards/JM60_BOARD/board.h | 142 ++++++ keyboards/jm60/boards/JM60_BOARD/board.mk | 5 + keyboards/jm60/chconf.h | 524 ++++++++++++++++++++++ keyboards/jm60/config.h | 80 ++++ keyboards/jm60/halconf.h | 353 +++++++++++++++ keyboards/jm60/jm60.c | 17 + keyboards/jm60/jm60.h | 53 +++ keyboards/jm60/keymaps/default/keymap.c | 79 ++++ keyboards/jm60/keymaps/poker3/keymap.c | 67 +++ keyboards/jm60/ld/jm60_bootloader.ld | 85 ++++ keyboards/jm60/led.c | 24 + keyboards/jm60/matrix.c | 128 ++++++ keyboards/jm60/mcuconf.h | 209 +++++++++ keyboards/jm60/readme.md | 27 ++ keyboards/jm60/rules.mk | 56 +++ 17 files changed, 1903 insertions(+) create mode 100644 keyboards/jm60/Makefile create mode 100644 keyboards/jm60/boards/JM60_BOARD/board.c create mode 100644 keyboards/jm60/boards/JM60_BOARD/board.h create mode 100644 keyboards/jm60/boards/JM60_BOARD/board.mk create mode 100644 keyboards/jm60/chconf.h create mode 100644 keyboards/jm60/config.h create mode 100644 keyboards/jm60/halconf.h create mode 100644 keyboards/jm60/jm60.c create mode 100644 keyboards/jm60/jm60.h create mode 100644 keyboards/jm60/keymaps/default/keymap.c create mode 100644 keyboards/jm60/keymaps/poker3/keymap.c create mode 100644 keyboards/jm60/ld/jm60_bootloader.ld create mode 100644 keyboards/jm60/led.c create mode 100644 keyboards/jm60/matrix.c create mode 100644 keyboards/jm60/mcuconf.h create mode 100644 keyboards/jm60/readme.md create mode 100644 keyboards/jm60/rules.mk diff --git a/keyboards/jm60/Makefile b/keyboards/jm60/Makefile new file mode 100644 index 0000000000..4e2a6f00fd --- /dev/null +++ b/keyboards/jm60/Makefile @@ -0,0 +1,3 @@ +ifndef MAKEFILE_INCLUDED + include ../../Makefile +endif \ No newline at end of file diff --git a/keyboards/jm60/boards/JM60_BOARD/board.c b/keyboards/jm60/boards/JM60_BOARD/board.c new file mode 100644 index 0000000000..d953d6a135 --- /dev/null +++ b/keyboards/jm60/boards/JM60_BOARD/board.c @@ -0,0 +1,51 @@ +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include "hal.h" + +/** + * @brief PAL setup. + * @details Digital I/O ports static configuration as defined in @p board.h. + * This variable is used by the HAL when initializing the PAL driver. + */ +#if HAL_USE_PAL || defined(__DOXYGEN__) +const PALConfig pal_default_config = +{ + {VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH}, + {VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH}, + {VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH}, + {VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH}, + {VAL_GPIOEODR, VAL_GPIOECRL, VAL_GPIOECRH}, +}; +#endif + +/* + * Early initialization code. + * This initialization must be performed just after stack setup and before + * any other initialization. + */ +void __early_init(void) { + + stm32_clock_init(); +} + +/* + * Board-specific initialization code. + */ +void boardInit(void) { + AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE; + +} diff --git a/keyboards/jm60/boards/JM60_BOARD/board.h b/keyboards/jm60/boards/JM60_BOARD/board.h new file mode 100644 index 0000000000..74815122c3 --- /dev/null +++ b/keyboards/jm60/boards/JM60_BOARD/board.h @@ -0,0 +1,142 @@ +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +/* + * Board identifier. + */ +#define BOARD_JM60 +#define BOARD_NAME "JM60 keyboard" + +/* + * Board frequencies. + */ +#define STM32_LSECLK 32768 +#define STM32_HSECLK 8000000 + +/* + * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h. + * + * Only xB (128KB Flash) is defined, but it's identical to the + * x8 version (64KB Flash) except for the Flash region size in the + * linker script. For x8 parts use xB here and change to the x8 linker + * script in the project Makefile. + */ +#define STM32F103xB + +/* + * IO pins assignments + * + * numbering is sorted by onboard/connectors, as from the schematics in + * http://www.vcc-gnd.com/read.php?tid=369 + */ + +/* on-board */ +#define GPIOA_USBDM 11 // pin 8 +#define GPIOA_USBDP 12 // pin 9 + +#define GPIOC_OSC32_IN 14 +#define GPIOC_OSC32_OUT 15 + +/* + * I/O ports initial setup, this configuration is established soon after reset + * in the initialization code. + * + * The digits have the following meaning: + * 0 - Analog input. + * 1 - Push Pull output 10MHz. + * 2 - Push Pull output 2MHz. + * 3 - Push Pull output 50MHz. + * 4 - Digital input. + * 5 - Open Drain output 10MHz. + * 6 - Open Drain output 2MHz. + * 7 - Open Drain output 50MHz. + * 8 - Digital input with PullUp or PullDown resistor depending on ODR. + * 9 - Alternate Push Pull output 10MHz. + * A - Alternate Push Pull output 2MHz. + * B - Alternate Push Pull output 50MHz. + * C - Reserved. + * D - Alternate Open Drain output 10MHz. + * E - Alternate Open Drain output 2MHz. + * F - Alternate Open Drain output 50MHz. + * Please refer to the STM32 Reference Manual for details. + */ + +/* + * Port A setup. + * Everything input with pull-up except: + */ +#define VAL_GPIOACRL 0x88888888 /* PA7...PA0 */ +#define VAL_GPIOACRH 0x88888888 /* PA15...PA8 */ +#define VAL_GPIOAODR 0xFFFFFFFF + +/* + * Port B setup. + * Everything input with pull-up except: + */ +#define VAL_GPIOBCRL 0x88888888 /* PB7...PB0 */ +#define VAL_GPIOBCRH 0x88888888 /* PB15...PB8 */ +#define VAL_GPIOBODR 0xFFFFFFFF + +/* + * Port C setup. + * Everything input with pull-up except: + */ +#define VAL_GPIOCCRL 0x88888888 /* PC7...PC0 */ +#define VAL_GPIOCCRH 0x88888888 /* PC15...PC8 */ +#define VAL_GPIOCODR 0xFFFFFFFF + +/* + * Port D setup. + * Everything input with pull-up except: + * PD0 - Normal input (XTAL). + * PD1 - Normal input (XTAL). + */ +#define VAL_GPIODCRL 0x88888844 /* PD7...PD0 */ +#define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */ +#define VAL_GPIODODR 0xFFFFFFFF + +/* + * Port E setup. + * Everything input with pull-up except: + */ +#define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */ +#define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */ +#define VAL_GPIOEODR 0xFFFFFFFF + +/* + * USB bus activation macro, required by the USB driver. + */ +#define usb_lld_connect_bus(usbp) /* always connected */ + +/* + * USB bus de-activation macro, required by the USB driver. + */ +#define usb_lld_disconnect_bus(usbp) /* always connected */ + +#if !defined(_FROM_ASM_) +#ifdef __cplusplus +extern "C" { +#endif + void boardInit(void); +#ifdef __cplusplus +} +#endif +#endif /* _FROM_ASM_ */ + +#endif /* _BOARD_H_ */ diff --git a/keyboards/jm60/boards/JM60_BOARD/board.mk b/keyboards/jm60/boards/JM60_BOARD/board.mk new file mode 100644 index 0000000000..46df0ef334 --- /dev/null +++ b/keyboards/jm60/boards/JM60_BOARD/board.mk @@ -0,0 +1,5 @@ +# List of all the board related files. +BOARDSRC = $(KEYBOARD_PATH)/boards/JM60_BOARD/board.c + +# Required include directories +BOARDINC = $(KEYBOARD_PATH)/boards/JM60_BOARD diff --git a/keyboards/jm60/chconf.h b/keyboards/jm60/chconf.h new file mode 100644 index 0000000000..d9114ec858 --- /dev/null +++ b/keyboards/jm60/chconf.h @@ -0,0 +1,524 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @file templates/chconf.h + * @brief Configuration file template. + * @details A copy of this file must be placed in each project directory, it + * contains the application specific kernel settings. + * + * @addtogroup config + * @details Kernel related settings and hooks. + * @{ + */ + +#ifndef CHCONF_H +#define CHCONF_H + +#define _CHIBIOS_RT_CONF_ + +/*===========================================================================*/ +/** + * @name System timers settings + * @{ + */ +/*===========================================================================*/ + +/** + * @brief System time counter resolution. + * @note Allowed values are 16 or 32 bits. + */ +#define CH_CFG_ST_RESOLUTION 32 + +/** + * @brief System tick frequency. + * @details Frequency of the system timer that drives the system ticks. This + * setting also defines the system tick time unit. + */ +#define CH_CFG_ST_FREQUENCY 100000 + +/** + * @brief Time delta constant for the tick-less mode. + * @note If this value is zero then the system uses the classic + * periodic tick. This value represents the minimum number + * of ticks that is safe to specify in a timeout directive. + * The value one is not valid, timeouts are rounded up to + * this value. + */ +#define CH_CFG_ST_TIMEDELTA 0 + +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel parameters and options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Round robin interval. + * @details This constant is the number of system ticks allowed for the + * threads before preemption occurs. Setting this value to zero + * disables the preemption for threads with equal priority and the + * round robin becomes cooperative. Note that higher priority + * threads can still preempt, the kernel is always preemptive. + * @note Disabling the round robin preemption makes the kernel more compact + * and generally faster. + * @note The round robin preemption is not supported in tickless mode and + * must be set to zero in that case. + */ +#define CH_CFG_TIME_QUANTUM 20 + +/** + * @brief Managed RAM size. + * @details Size of the RAM area to be managed by the OS. If set to zero + * then the whole available RAM is used. The core memory is made + * available to the heap allocator and/or can be used directly through + * the simplified core memory allocator. + * + * @note In order to let the OS manage the whole RAM the linker script must + * provide the @p __heap_base__ and @p __heap_end__ symbols. + * @note Requires @p CH_CFG_USE_MEMCORE. + */ +#define CH_CFG_MEMCORE_SIZE 0 + +/** + * @brief Idle thread automatic spawn suppression. + * @details When this option is activated the function @p chSysInit() + * does not spawn the idle thread. The application @p main() + * function becomes the idle thread and must implement an + * infinite loop. + */ +#define CH_CFG_NO_IDLE_THREAD FALSE + +/* Use __WFI in the idle thread for waiting. Does lower the power + * consumption. */ +#define CORTEX_ENABLE_WFI_IDLE TRUE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Performance options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief OS optimization. + * @details If enabled then time efficient rather than space efficient code + * is used when two possible implementations exist. + * + * @note This is not related to the compiler optimization options. + * @note The default is @p TRUE. + */ +#define CH_CFG_OPTIMIZE_SPEED TRUE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Subsystem options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Time Measurement APIs. + * @details If enabled then the time measurement APIs are included in + * the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_TM FALSE + +/** + * @brief Threads registry APIs. + * @details If enabled then the registry APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_REGISTRY TRUE + +/** + * @brief Threads synchronization APIs. + * @details If enabled then the @p chThdWait() function is included in + * the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_WAITEXIT TRUE + +/** + * @brief Semaphores APIs. + * @details If enabled then the Semaphores APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_SEMAPHORES TRUE + +/** + * @brief Semaphores queuing mode. + * @details If enabled then the threads are enqueued on semaphores by + * priority rather than in FIFO order. + * + * @note The default is @p FALSE. Enable this if you have special + * requirements. + * @note Requires @p CH_CFG_USE_SEMAPHORES. + */ +#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE + +/** + * @brief Mutexes APIs. + * @details If enabled then the mutexes APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MUTEXES TRUE + +/** + * @brief Enables recursive behavior on mutexes. + * @note Recursive mutexes are heavier and have an increased + * memory footprint. + * + * @note The default is @p FALSE. + * @note Requires @p CH_CFG_USE_MUTEXES. + */ +#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE + +/** + * @brief Conditional Variables APIs. + * @details If enabled then the conditional variables APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_MUTEXES. + */ +#define CH_CFG_USE_CONDVARS TRUE + +/** + * @brief Conditional Variables APIs with timeout. + * @details If enabled then the conditional variables APIs with timeout + * specification are included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_CONDVARS. + */ +#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE + +/** + * @brief Events Flags APIs. + * @details If enabled then the event flags APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_EVENTS TRUE + +/** + * @brief Events Flags APIs with timeout. + * @details If enabled then the events APIs with timeout specification + * are included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_EVENTS. + */ +#define CH_CFG_USE_EVENTS_TIMEOUT TRUE + +/** + * @brief Synchronous Messages APIs. + * @details If enabled then the synchronous messages APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MESSAGES TRUE + +/** + * @brief Synchronous Messages queuing mode. + * @details If enabled then messages are served by priority rather than in + * FIFO order. + * + * @note The default is @p FALSE. Enable this if you have special + * requirements. + * @note Requires @p CH_CFG_USE_MESSAGES. + */ +#define CH_CFG_USE_MESSAGES_PRIORITY FALSE + +/** + * @brief Mailboxes APIs. + * @details If enabled then the asynchronous messages (mailboxes) APIs are + * included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_SEMAPHORES. + */ +#define CH_CFG_USE_MAILBOXES TRUE + +/** + * @brief Core Memory Manager APIs. + * @details If enabled then the core memory manager APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MEMCORE TRUE + +/** + * @brief Heap Allocator APIs. + * @details If enabled then the memory heap allocator APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or + * @p CH_CFG_USE_SEMAPHORES. + * @note Mutexes are recommended. + */ +#define CH_CFG_USE_HEAP TRUE + +/** + * @brief Memory Pools Allocator APIs. + * @details If enabled then the memory pools allocator APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MEMPOOLS TRUE + +/** + * @brief Dynamic Threads APIs. + * @details If enabled then the dynamic threads creation APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_WAITEXIT. + * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. + */ +#define CH_CFG_USE_DYNAMIC TRUE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Debug options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Debug option, kernel statistics. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_STATISTICS FALSE + +/** + * @brief Debug option, system state check. + * @details If enabled the correct call protocol for system APIs is checked + * at runtime. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_SYSTEM_STATE_CHECK FALSE + +/** + * @brief Debug option, parameters checks. + * @details If enabled then the checks on the API functions input + * parameters are activated. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_CHECKS FALSE + +/** + * @brief Debug option, consistency checks. + * @details If enabled then all the assertions in the kernel code are + * activated. This includes consistency checks inside the kernel, + * runtime anomalies and port-defined checks. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_ASSERTS FALSE + +/** + * @brief Debug option, trace buffer. + * @details If enabled then the trace buffer is activated. + * + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. + */ +#define CH_DBG_TRACE_BUFFER_SIZE 128 + +/** + * @brief Debug option, stack checks. + * @details If enabled then a runtime stack check is performed. + * + * @note The default is @p FALSE. + * @note The stack check is performed in a architecture/port dependent way. + * It may not be implemented or some ports. + * @note The default failure mode is to halt the system with the global + * @p panic_msg variable set to @p NULL. + */ +#define CH_DBG_ENABLE_STACK_CHECK FALSE + +/** + * @brief Debug option, stacks initialization. + * @details If enabled then the threads working area is filled with a byte + * value when a thread is created. This can be useful for the + * runtime measurement of the used stack. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_FILL_THREADS FALSE + +/** + * @brief Debug option, threads profiling. + * @details If enabled then a field is added to the @p thread_t structure that + * counts the system ticks occurred while executing the thread. + * + * @note The default is @p FALSE. + * @note This debug option is not currently compatible with the + * tickless mode. + */ +#define CH_DBG_THREADS_PROFILING FALSE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel hooks + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Threads descriptor structure extension. + * @details User fields added to the end of the @p thread_t structure. + */ +#define CH_CFG_THREAD_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief Threads initialization hook. + * @details User initialization code added to the @p chThdInit() API. + * + * @note It is invoked from within @p chThdInit() and implicitly from all + * the threads creation APIs. + */ +#define CH_CFG_THREAD_INIT_HOOK(tp) { \ + /* Add threads initialization code here.*/ \ +} + +/** + * @brief Threads finalization hook. + * @details User finalization code added to the @p chThdExit() API. + */ +#define CH_CFG_THREAD_EXIT_HOOK(tp) { \ + /* Add threads finalization code here.*/ \ +} + +/** + * @brief Context switch hook. + * @details This hook is invoked just before switching between threads. + */ +#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ + /* Context switch code here.*/ \ +} + +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + +/** + * @brief Idle thread enter hook. + * @note This hook is invoked within a critical zone, no OS functions + * should be invoked from here. + * @note This macro can be used to activate a power saving mode. + */ +#define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ +} + +/** + * @brief Idle thread leave hook. + * @note This hook is invoked within a critical zone, no OS functions + * should be invoked from here. + * @note This macro can be used to deactivate a power saving mode. + */ +#define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ +} + +/** + * @brief Idle Loop hook. + * @details This hook is continuously invoked by the idle thread loop. + */ +#define CH_CFG_IDLE_LOOP_HOOK() { \ + /* Idle loop code here.*/ \ +} + +/** + * @brief System tick event hook. + * @details This hook is invoked in the system tick handler immediately + * after processing the virtual timers queue. + */ +#define CH_CFG_SYSTEM_TICK_HOOK() { \ + /* System tick event code here.*/ \ +} + +/** + * @brief System halt hook. + * @details This hook is invoked in case to a system halting error before + * the system is halted. + */ +#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ + /* System halt code here.*/ \ +} + +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + +/** @} */ + +/*===========================================================================*/ +/* Port-specific settings (override port settings defaulted in chcore.h). */ +/*===========================================================================*/ + +#endif /* CHCONF_H */ + +/** @} */ diff --git a/keyboards/jm60/config.h b/keyboards/jm60/config.h new file mode 100644 index 0000000000..a88a411f21 --- /dev/null +++ b/keyboards/jm60/config.h @@ -0,0 +1,80 @@ +/* +Copyright 2015 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 + +#define PREVENT_STUCK_MODIFIERS + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6464 +#define DEVICE_VER 0x0001 +/* in python2: list(u"whatever".encode('utf-16-le')) */ +/* at most 32 characters or the ugly hack in usb_main.c borks */ +#define MANUFACTURER "QMK" +#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', '\xc6', '\x00' +#define PRODUCT "JM60" +#define USBSTR_PRODUCT 'J', '\x00', 'M', '\x00', '6', '\x00', '0', '\x00' +#define DESCRIPTION "QMK keyboard firmware for JM60" + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 14 + +/* number of backlight levels */ +//#define BACKLIGHT_LEVELS 1 + +//#define LED_BRIGHTNESS_LO 100 +//#define LED_BRIGHTNESS_HI 255 + +/* define if matrix has ghost */ +//#define MATRIX_HAS_GHOST + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 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/jm60/halconf.h b/keyboards/jm60/halconf.h new file mode 100644 index 0000000000..1a450d6327 --- /dev/null +++ b/keyboards/jm60/halconf.h @@ -0,0 +1,353 @@ +/* + ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * @file templates/halconf.h + * @brief HAL configuration header. + * @details HAL configuration file, this file allows to enable or disable the + * various device drivers from your application. You may also use + * this file in order to override the device drivers default settings. + * + * @addtogroup HAL_CONF + * @{ + */ + +#ifndef _HALCONF_H_ +#define _HALCONF_H_ + +#include "mcuconf.h" + +/** + * @brief Enables the PAL subsystem. + */ +#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) +#define HAL_USE_PAL TRUE +#endif + +/** + * @brief Enables the ADC subsystem. + */ +#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) +#define HAL_USE_ADC FALSE +#endif + +/** + * @brief Enables the CAN subsystem. + */ +#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) +#define HAL_USE_CAN FALSE +#endif + +/** + * @brief Enables the DAC subsystem. + */ +#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) +#define HAL_USE_DAC FALSE +#endif + +/** + * @brief Enables the EXT subsystem. + */ +#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) +#define HAL_USE_EXT FALSE +#endif + +/** + * @brief Enables the GPT subsystem. + */ +#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) +#define HAL_USE_GPT FALSE +#endif + +/** + * @brief Enables the I2C subsystem. + */ +#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) +#define HAL_USE_I2C FALSE +#endif + +/** + * @brief Enables the I2S subsystem. + */ +#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) +#define HAL_USE_I2S FALSE +#endif + +/** + * @brief Enables the ICU subsystem. + */ +#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) +#define HAL_USE_ICU FALSE +#endif + +/** + * @brief Enables the MAC subsystem. + */ +#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) +#define HAL_USE_MAC FALSE +#endif + +/** + * @brief Enables the MMC_SPI subsystem. + */ +#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) +#define HAL_USE_MMC_SPI FALSE +#endif + +/** + * @brief Enables the PWM subsystem. + */ +#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) +#define HAL_USE_PWM FALSE +#endif + +/** + * @brief Enables the RTC subsystem. + */ +#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) +#define HAL_USE_RTC FALSE +#endif + +/** + * @brief Enables the SDC subsystem. + */ +#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) +#define HAL_USE_SDC FALSE +#endif + +/** + * @brief Enables the SERIAL subsystem. + */ +#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL FALSE +#endif + +/** + * @brief Enables the SERIAL over USB subsystem. + */ +#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL_USB FALSE +#endif + +/** + * @brief Enables the SPI subsystem. + */ +#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) +#define HAL_USE_SPI FALSE +#endif + +/** + * @brief Enables the UART subsystem. + */ +#if !defined(HAL_USE_UART) || defined(__DOXYGEN__) +#define HAL_USE_UART FALSE +#endif + +/** + * @brief Enables the USB subsystem. + */ +#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) +#define HAL_USE_USB TRUE +#endif + +/** + * @brief Enables the WDG subsystem. + */ +#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) +#define HAL_USE_WDG FALSE +#endif + +/*===========================================================================*/ +/* ADC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) +#define ADC_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define ADC_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* CAN driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Sleep mode related APIs inclusion switch. + */ +#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) +#define CAN_USE_SLEEP_MODE TRUE +#endif + +/*===========================================================================*/ +/* I2C driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the mutual exclusion APIs on the I2C bus. + */ +#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define I2C_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* MAC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) +#define MAC_USE_ZERO_COPY FALSE +#endif + +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) +#define MAC_USE_EVENTS TRUE +#endif + +/*===========================================================================*/ +/* MMC_SPI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + * This option is recommended also if the SPI driver does not + * use a DMA channel and heavily loads the CPU. + */ +#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) +#define MMC_NICE_WAITING TRUE +#endif + +/*===========================================================================*/ +/* SDC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Number of initialization attempts before rejecting the card. + * @note Attempts are performed at 10mS intervals. + */ +#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) +#define SDC_INIT_RETRY 100 +#endif + +/** + * @brief Include support for MMC cards. + * @note MMC support is not yet implemented so this option must be kept + * at @p FALSE. + */ +#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) +#define SDC_MMC_SUPPORT FALSE +#endif + +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + */ +#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) +#define SDC_NICE_WAITING TRUE +#endif + +/*===========================================================================*/ +/* SERIAL driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Default bit rate. + * @details Configuration parameter, this is the baud rate selected for the + * default configuration. + */ +#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) +#define SERIAL_DEFAULT_BITRATE 38400 +#endif + +/** + * @brief Serial buffers size. + * @details Configuration parameter, you can change the depth of the queue + * buffers depending on the requirements of your application. + * @note The default is 64 bytes for both the transmission and receive + * buffers. + */ +#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_BUFFERS_SIZE 16 +#endif + +/*===========================================================================*/ +/* SERIAL_USB driver related setting. */ +/*===========================================================================*/ + +/** + * @brief Serial over USB buffers size. + * @details Configuration parameter, the buffer size must be a multiple of + * the USB data endpoint maximum packet size. + * @note The default is 64 bytes for both the transmission and receive + * buffers. + */ +#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_USB_BUFFERS_SIZE 256 +#endif + +/*===========================================================================*/ +/* SPI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) +#define SPI_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define SPI_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* USB driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) +#define USB_USE_WAIT TRUE +#endif + +#endif /* _HALCONF_H_ */ + +/** @} */ diff --git a/keyboards/jm60/jm60.c b/keyboards/jm60/jm60.c new file mode 100644 index 0000000000..3c8b43db9d --- /dev/null +++ b/keyboards/jm60/jm60.c @@ -0,0 +1,17 @@ +/* +Copyright 2012,2013 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 . +*/ +#include QMK_KEYBOARD_H diff --git a/keyboards/jm60/jm60.h b/keyboards/jm60/jm60.h new file mode 100644 index 0000000000..f83b94f902 --- /dev/null +++ b/keyboards/jm60/jm60.h @@ -0,0 +1,53 @@ +/* +Copyright 2014 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 JM60_H +#define JM60_H + +#include "quantum.h" + +// readability +#define XXX KC_NO + +/* Satan GH60 ANSI layout + * ,-----------------------------------------------------------. + * | 00 |01| 02| 03| 04| 05| 06| 07| 08| 09| 0a| 0b| 0c| 0d | + * |-----------------------------------------------------------| + * | 10 | 11| 12| 13| 14| 15| 16| 17| 18| 19| 1a| 1b| 1c| 1d | + * |-----------------------------------------------------------| + * | 20 | 21| 22| 23| 24| 25| 26| 27| 28| 29| 2a| 2c| 2d | + * |-----------------------------------------------------------| + * | 30 | 31| 32| 33| 34| 35| 36| 37| 38| 39| 3b| 3d | + * |-----------------------------------------------------------| + * | 40 | 41 | 42 | 46 | 4a | 4b | 4c | 4d | + * `-----------------------------------------------------------' + */ +#define KEYMAP_ANSI( \ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2c, k2d, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3b, k3d, \ + k40, k41, k42, k46, k4a, k4b, k4c, k4d \ +) \ +{ \ + {k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d}, \ + {k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d}, \ + {k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, XXX, k2c, k2d}, \ + {k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, XXX, k3b, XXX, k3d}, \ + {k40, k41, k42, XXX, XXX, XXX, k46, XXX, XXX, XXX, k4a, k4b, k4c, k4d} \ +} + +#endif diff --git a/keyboards/jm60/keymaps/default/keymap.c b/keyboards/jm60/keymaps/default/keymap.c new file mode 100644 index 0000000000..30e6495fd0 --- /dev/null +++ b/keyboards/jm60/keymaps/default/keymap.c @@ -0,0 +1,79 @@ +#include QMK_KEYBOARD_H + + +// Used for SHIFT_ESC +#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) + +// 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 _FL 1 + +#define _______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap _BL: (Base Layer) Default Layer + * ,-----------------------------------------------------------. + * |Esc~| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|Backsp | + * |-----------------------------------------------------------| + * |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| \ | + * |-----------------------------------------------------------| + * |CAPS | A| S| D| F| G| H| J| K| L| ;| '|Return | + * |-----------------------------------------------------------| + * |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift | + * |-----------------------------------------------------------| + * |Ctrl|Gui |Alt | Space |Alt |Gui |FN |Ctrl | + * `-----------------------------------------------------------' + */ +[_BL] = KEYMAP_ANSI( + 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_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_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, \ + KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, MO(_FL),KC_RCTL), + + /* Keymap _FL: Function Layer + */ +[_FL] = KEYMAP_ANSI( + KC_GRV, _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,RESET, \ + _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, BL_DEC, BL_INC,BL_TOGG, \ + _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \ + _______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______,_______, \ + _______,_______,_______, _______, _______,_______,_______,_______), +}; + +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; + } +} diff --git a/keyboards/jm60/keymaps/poker3/keymap.c b/keyboards/jm60/keymaps/poker3/keymap.c new file mode 100644 index 0000000000..67e7838cdc --- /dev/null +++ b/keyboards/jm60/keymaps/poker3/keymap.c @@ -0,0 +1,67 @@ +#include QMK_KEYBOARD_H + +// Used for SHIFT_ESC +#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) + +// 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 _FL 1 + +#define _______ KC_TRNS + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* Keymap _BL: (Base Layer) Default Layer + */ +[_BL] = KEYMAP_ANSI( + 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_BSPC, \ + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,KC_BSLS, \ + MO(_FL), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_ENT, \ + KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, \ + KC_LCTL, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI, MO(_FL),KC_RCTL), + + /* Keymap _FL: Function Layer + */ +[_FL] = KEYMAP_ANSI( + 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_DEL, \ + _______,KC_MPRV,KC_MPLY,KC_MNXT,_______,_______,_______,KC_PGUP,KC_UP,KC_PGDN,KC_PSCR, KC_SLCK, KC_PAUS,_______, \ + KC_CAPS,_______,KC_VOLD,KC_VOLU,KC_MUTE,_______,KC_HOME,KC_LEFT,KC_DOWN,KC_RGHT,KC_INS,KC_DEL,_______, \ + _______,KC_APP,_______,_______,_______,_______,KC_END,_______,_______,_______,_______,_______, \ + _______,_______,_______, _______, _______,_______,_______,_______), +}; + +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; + } +} diff --git a/keyboards/jm60/ld/jm60_bootloader.ld b/keyboards/jm60/ld/jm60_bootloader.ld new file mode 100644 index 0000000000..2a0ab2e8e7 --- /dev/null +++ b/keyboards/jm60/ld/jm60_bootloader.ld @@ -0,0 +1,85 @@ +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* + * ST32F103xB memory setup for use with the originaljm60 bootloader. + */ +MEMORY +{ + flash0 : org = 0x08009000, len = 128k - 0x9000 + flash1 : org = 0x00000000, len = 0 + flash2 : org = 0x00000000, len = 0 + flash3 : org = 0x00000000, len = 0 + flash4 : org = 0x00000000, len = 0 + flash5 : org = 0x00000000, len = 0 + flash6 : org = 0x00000000, len = 0 + flash7 : org = 0x00000000, len = 0 + ram0 : org = 0x20000000, len = 20k + ram1 : org = 0x00000000, len = 0 + ram2 : org = 0x00000000, len = 0 + ram3 : org = 0x00000000, len = 0 + ram4 : org = 0x00000000, len = 0 + ram5 : org = 0x00000000, len = 0 + ram6 : org = 0x00000000, len = 0 + ram7 : org = 0x00000000, len = 0 +} + +/* For each data/text section two region are defined, a virtual region + and a load region (_LMA suffix).*/ + +/* Flash region to be used for exception vectors.*/ +REGION_ALIAS("VECTORS_FLASH", flash0); +REGION_ALIAS("VECTORS_FLASH_LMA", flash0); + +/* Flash region to be used for constructors and destructors.*/ +REGION_ALIAS("XTORS_FLASH", flash0); +REGION_ALIAS("XTORS_FLASH_LMA", flash0); + +/* Flash region to be used for code text.*/ +REGION_ALIAS("TEXT_FLASH", flash0); +REGION_ALIAS("TEXT_FLASH_LMA", flash0); + +/* Flash region to be used for read only data.*/ +REGION_ALIAS("RODATA_FLASH", flash0); +REGION_ALIAS("RODATA_FLASH_LMA", flash0); + +/* Flash region to be used for various.*/ +REGION_ALIAS("VARIOUS_FLASH", flash0); +REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); + +/* Flash region to be used for RAM(n) initialization data.*/ +REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); + +/* RAM region to be used for Main stack. This stack accommodates the processing + of all exceptions and interrupts.*/ +REGION_ALIAS("MAIN_STACK_RAM", ram0); + +/* RAM region to be used for the process stack. This is the stack used by + the main() function.*/ +REGION_ALIAS("PROCESS_STACK_RAM", ram0); + +/* RAM region to be used for data segment.*/ +REGION_ALIAS("DATA_RAM", ram0); +REGION_ALIAS("DATA_RAM_LMA", flash0); + +/* RAM region to be used for BSS segment.*/ +REGION_ALIAS("BSS_RAM", ram0); + +/* RAM region to be used for the default heap.*/ +REGION_ALIAS("HEAP_RAM", ram0); + +/* Generic rules inclusion.*/ +INCLUDE rules.ld diff --git a/keyboards/jm60/led.c b/keyboards/jm60/led.c new file mode 100644 index 0000000000..aed66c7c03 --- /dev/null +++ b/keyboards/jm60/led.c @@ -0,0 +1,24 @@ +/* +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 . +*/ + +#include "hal.h" + +#include "led.h" + + +void led_set(uint8_t usb_led) { +} diff --git a/keyboards/jm60/matrix.c b/keyboards/jm60/matrix.c new file mode 100644 index 0000000000..8430a5843b --- /dev/null +++ b/keyboards/jm60/matrix.c @@ -0,0 +1,128 @@ +#include +#include +#include +#include "hal.h" +#include "timer.h" +#include "wait.h" +#include "print.h" +#include "matrix.h" + + +/* + * JM60 + * Column pins are input with internal pull-down. Row pins are output and strobe with high. + * Key is high or 1 when it turns on. + * + * col: { PTA15, PTC10, PTC11, PTC12, PTD2, PTB3, PTB4, PTB5, PTB6, PTB7, PTB8, PTB9, PTA2, PTA3 } + * row: { PTB11, PTB10, PTB2, PTB1, PTB0} + */ +/* matrix state(1:on, 0:off) */ +static matrix_row_t matrix[MATRIX_ROWS]; +static matrix_row_t matrix_debouncing[MATRIX_ROWS]; +static bool debouncing = false; +static uint16_t debouncing_time = 0; + + +void matrix_init(void) +{ +//debug_matrix = true; + /* Column(sense) */ + palSetPadMode(GPIOA, 15, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOC, 10, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOC, 11, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOC, 12, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOD, 2, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOB, 3, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOB, 4, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOB, 5, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOB, 6, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOB, 7, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOB, 8, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOB, 9, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOA, 2, PAL_MODE_INPUT_PULLDOWN); + palSetPadMode(GPIOA, 3, PAL_MODE_INPUT_PULLDOWN); + + /* Row(strobe) */ + palSetPadMode(GPIOB, 11, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOB, 10, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOB, 2, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL); + palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL); + + memset(matrix, 0, MATRIX_ROWS); + memset(matrix_debouncing, 0, MATRIX_ROWS); +} + +uint8_t matrix_scan(void) +{ + for (int row = 0; row < MATRIX_ROWS; row++) { + matrix_row_t data = 0; + + // strobe row + switch (row) { + case 0: palSetPad(GPIOB, 11); break; + case 1: palSetPad(GPIOB, 10); break; + case 2: palSetPad(GPIOB, 2); break; + case 3: palSetPad(GPIOB, 1); break; + case 4: palSetPad(GPIOB, 0); break; + } + + wait_us(20); // need wait to settle pin state + + // read col data: { PTA15, PTC10, PTC11, PTC12, PTD2, PTB3, PTB4, PTB5, PTB6, PTB7, PTB8, PTB9, PTA2, PTA3 } + data = ((palReadPort(GPIOA) & 0x8000UL) >> 15) | // 0 + ((palReadPort(GPIOC) & 0x1C00UL) >> 9) | // 1, 2, 3 + ((palReadPort(GPIOD) & 0x0004UL) << 2) | // 4 + ((palReadPort(GPIOB) & 0x03F8UL) << 2) | // 5, 6, 7, 8, 9, 10, 11 + ((palReadPort(GPIOA) & 0x000CUL) << 10); // 12, 13 + + // un-strobe row + switch (row) { + case 0: palClearPad(GPIOB, 11); break; + case 1: palClearPad(GPIOB, 10); break; + case 2: palClearPad(GPIOB, 2); break; + case 3: palClearPad(GPIOB, 1); break; + case 4: palClearPad(GPIOB, 0); break; + } + + if (matrix_debouncing[row] != data) { + matrix_debouncing[row] = data; + debouncing = true; + debouncing_time = timer_read(); + } + } + + if (debouncing && timer_elapsed(debouncing_time) > DEBOUNCE) { + for (int row = 0; row < MATRIX_ROWS; row++) { + matrix[row] = matrix_debouncing[row]; + } + debouncing = false; + } + return 1; +} + +bool matrix_is_on(uint8_t row, uint8_t col) +{ + return (matrix[row] & (1</os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) +MCU_FAMILY = STM32 +MCU_SERIES = STM32F1xx + +# Linker script to use +# - it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ +# or /ld/ +# - NOTE: a custom ld script is needed for EEPROM on Teensy LC +MCU_LDSCRIPT = jm60_bootloader + +# Startup code to use +# - it should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/ +MCU_STARTUP = stm32f1xx + +# Board: it should exist either in /os/hal/boards/ +# or /boards +BOARD = JM60_BOARD + +# Cortex version +# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 +MCU = cortex-m3 + +# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 +# I.e. 6 for Teensy LC; 7 for Teensy 3.x +ARMV = 7 + +# Vector table for application +# 0x00000000-0x00001000 area is occupied by bootlaoder.*/ +# The CORTEX_VTOR... is needed only for MCHCK/Infinity KB +#OPT_DEFS = -DCORTEX_VTOR_INIT=0x00001000 +OPT_DEFS = + +# Build Options +# comment out to disable the options. +# +BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration +## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) +MOUSEKEY_ENABLE = no # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover +CUSTOM_MATRIX = yes # Custom matrix file +BACKLIGHT_ENABLE = no +VISUALIZER_ENABLE = no + +#LED_DRIVER = is31fl3731c +#LED_WIDTH = 16 +#LED_HEIGHT = 5 From d331e274b3f5b1e76a4c390746225b394046f38d Mon Sep 17 00:00:00 2001 From: Marco Date: Thu, 7 Sep 2017 13:09:30 +0200 Subject: [PATCH 09/51] Use KC_GESC keycode instead of custom function --- keyboards/jm60/keymaps/default/keymap.c | 35 +----------------------- keyboards/jm60/keymaps/poker3/keymap.c | 36 +------------------------ 2 files changed, 2 insertions(+), 69 deletions(-) diff --git a/keyboards/jm60/keymaps/default/keymap.c b/keyboards/jm60/keymaps/default/keymap.c index 30e6495fd0..091a214f5b 100644 --- a/keyboards/jm60/keymaps/default/keymap.c +++ b/keyboards/jm60/keymaps/default/keymap.c @@ -28,7 +28,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------' */ [_BL] = KEYMAP_ANSI( - 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_BSPC, \ + KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,KC_BSLS, \ 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_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, \ @@ -44,36 +44,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______,_______,_______, _______, _______,_______,_______,_______), }; -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; - } -} diff --git a/keyboards/jm60/keymaps/poker3/keymap.c b/keyboards/jm60/keymaps/poker3/keymap.c index 67e7838cdc..422ab30236 100644 --- a/keyboards/jm60/keymaps/poker3/keymap.c +++ b/keyboards/jm60/keymaps/poker3/keymap.c @@ -16,7 +16,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* Keymap _BL: (Base Layer) Default Layer */ [_BL] = KEYMAP_ANSI( - 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_BSPC, \ + KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,KC_BSLS, \ MO(_FL), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT, KC_ENT, \ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT, \ @@ -31,37 +31,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______,KC_APP,_______,_______,_______,_______,KC_END,_______,_______,_______,_______,_______, \ _______,_______,_______, _______, _______,_______,_______,_______), }; - -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; - } -} From 63cde006c54886f7995d40a285099fedb9f8fc83 Mon Sep 17 00:00:00 2001 From: Marco Date: Thu, 7 Sep 2017 13:47:18 +0200 Subject: [PATCH 10/51] Changed USB manufacturer to "JMWS" Don`t know, if this is 100% correct, but the original software refers to "JMWS JM60 Driver". --- keyboards/jm60/config.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/keyboards/jm60/config.h b/keyboards/jm60/config.h index a88a411f21..2596413313 100644 --- a/keyboards/jm60/config.h +++ b/keyboards/jm60/config.h @@ -26,11 +26,11 @@ along with this program. If not, see . #define DEVICE_VER 0x0001 /* in python2: list(u"whatever".encode('utf-16-le')) */ /* at most 32 characters or the ugly hack in usb_main.c borks */ -#define MANUFACTURER "QMK" -#define USBSTR_MANUFACTURER 'T', '\x00', 'M', '\x00', 'K', '\x00', ' ', '\x00', '\xc6', '\x00' -#define PRODUCT "JM60" -#define USBSTR_PRODUCT 'J', '\x00', 'M', '\x00', '6', '\x00', '0', '\x00' -#define DESCRIPTION "QMK keyboard firmware for JM60" +#define MANUFACTURER "JMWS" +#define USBSTR_MANUFACTURER 'J', '\x00', 'M', '\x00', 'W', '\x00', 'S', '\x00' +#define PRODUCT "JM60 RGB Keyboard(QMK)" +#define USBSTR_PRODUCT 'J', '\x00', 'M', '\x00', '6', '\x00', '0', '\x00', ' ', '\x00', 'R', '\x00', 'G', '\x00', 'B', '\x00', ' ', '\x00', 'K', '\x00', 'e', '\x00', 'y', '\x00', 'b', '\x00', 'o', '\x00', 'a', '\x00', 'r', '\x00', 'd', '\x00', '(', '\x00', 'Q', '\x00', 'M', '\x00', 'K', '\x00', ')', '\x00' +#define DESCRIPTION "QMK keyboard firmware for JM60 RGB Keyboard" /* key matrix size */ #define MATRIX_ROWS 5 From a4ff8b91f74df9fb1d87f52c0ded23935344d2eb Mon Sep 17 00:00:00 2001 From: Kaleb Elwert Date: Wed, 6 Sep 2017 11:57:40 -0700 Subject: [PATCH 11/51] Update tv44-belak keymap --- keyboards/tv44/keymaps/belak/config.h | 8 ++++++++ keyboards/tv44/keymaps/belak/keymap.c | 14 +++++++------- keyboards/tv44/keymaps/belak/readme.md | 8 ++++++++ 3 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 keyboards/tv44/keymaps/belak/config.h diff --git a/keyboards/tv44/keymaps/belak/config.h b/keyboards/tv44/keymaps/belak/config.h new file mode 100644 index 0000000000..47d96a29d8 --- /dev/null +++ b/keyboards/tv44/keymaps/belak/config.h @@ -0,0 +1,8 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +#define TAPPING_TERM 500 + +#endif diff --git a/keyboards/tv44/keymaps/belak/keymap.c b/keyboards/tv44/keymaps/belak/keymap.c index 703a1c2dd3..7a99679864 100644 --- a/keyboards/tv44/keymaps/belak/keymap.c +++ b/keyboards/tv44/keymaps/belak/keymap.c @@ -52,27 +52,27 @@ uint16_t tap_dance_keys[] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_QW] = KEYMAP_ARROW_COMMAND( /* Qwerty */ L2_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, - L1_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, L3_QUOT, + L1_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, L2_SLSH, - TD_LCTL, MO(_L3), TD_LALT, TD_LGUI, KC_ENT, KC_SPC, MO(_L1), KC_LEFT, KC_DOWN, KC_RGHT + TD_LCTL, MO(_L3), TD_LALT, TD_LGUI, KC_SPC, KC_SPC, MO(_L1), KC_LEFT, KC_DOWN, KC_RGHT ), [_L1] = KEYMAP_ARROW_COMMAND( /* LAYER 1 */ KC_GRV, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, - _______, KC_BSLS, KC_QUOT, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_DOWN, KC_UP, KC_LEFT, KC_RGHT, _______, + _______, KC_BSLS, KC_QUOT, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_DOWN, KC_UP, KC_LEFT, KC_RGHT, KC_QUOT, _______, KC_ESC, _______, KC_PSCR, _______, _______, _______, KC_MSTP, KC_MPLY, KC_MPRV, KC_MNXT, KC_RSFT, _______, KC_LGUI, _______, _______, _______, _______, _______, _______, _______, _______ ), [_L2] = KEYMAP_ARROW_COMMAND( /* LAYER 2 */ _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, - KC_ESC, KC_PIPE, KC_DQUO, KC_UNDS, KC_PLUS, L_CURBR, R_CURBR, KC_4, KC_5, KC_6, KC_VOLU, KC_ENT, + KC_ESC, KC_PIPE, KC_DQUO, KC_UNDS, KC_PLUS, L_CURBR, R_CURBR, KC_4, KC_5, KC_6, KC_VOLU, _______, _______, _______, _______, _______, _______, _______, KC_0, KC_1, KC_2, KC_3, KC_VOLD, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ + _______, _______, _______, _______, _______, _______, KC_RALT, _______, _______, _______ ), [_L3] = KEYMAP_ARROW_COMMAND( /* LAYER 3 */ _______, _______, _______, _______, _______, _______, _______, KC_F1, KC_F2, KC_F3, KC_F4, _______, KC_ESC, _______, _______, _______, _______, _______, _______, KC_F5, KC_F6, KC_F7, KC_F8, _______, - _______, _______, _______, _______, _______, _______, _______, KC_F9, KC_F10, KC_F11, KC_F12, _______, - _______, KC_LGUI, _______, _______, _______, _______, _______, _______, _______, _______ + _______, _______, _______, _______, _______, _______, _______, KC_F9, KC_F10, KC_F11, KC_F12, KC_RSFT, + _______, _______, _______, _______, _______, _______, KC_RALT, _______, _______, _______ ) }; diff --git a/keyboards/tv44/keymaps/belak/readme.md b/keyboards/tv44/keymaps/belak/readme.md index f990c578a1..b0a505c4ae 100644 --- a/keyboards/tv44/keymaps/belak/readme.md +++ b/keyboards/tv44/keymaps/belak/readme.md @@ -4,3 +4,11 @@ This layout is roughly based on the low-rider arrow-southpaw layout from [the configurator](http://minivan.config.thevankeyboards.com) with a number of changes to make it easier to use and add in missing keys (like adding / and ' to the main layer) + +## Rev1 + +* Moved enter to a more standard location to have a full spacebar +* Quote is now on L1 +* Small tweaks to make modifiers work a little more consistently +* Greatly increase the tapping term to make the tap-dance mods easier to use + From 7ad924bae5519e981c57495e481db62741aa4376 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 12 Sep 2017 00:43:10 -0400 Subject: [PATCH 12/51] Updates send_string functionality, adds terminal feature (#1657) * implement basic terminal stuff * modify send_string to read normal strings too * add files bc yeah. working pgm detected * pgm detection apparently not working * adds send string keycodes, additional keycode support in send string * implement arguments * [terminal] add help command * [terminal] adds keycode and keymap functions * [terminal] adds nop.h, documentation * update macro docs --- common_features.mk | 5 + docs/_summary.md | 1 + docs/feature_terminal.md | 80 ++++++ docs/macros.md | 136 +++++++--- keyboards/planck/keymaps/default/keymap.c | 2 +- keyboards/planck/rules.mk | 2 +- quantum/audio/song_list.h | 3 + quantum/process_keycode/process_terminal.c | 252 ++++++++++++++++++ quantum/process_keycode/process_terminal.h | 27 ++ .../process_keycode/process_terminal_nop.h | 25 ++ quantum/quantum.c | 73 ++++- quantum/quantum.h | 25 +- quantum/quantum_keycodes.h | 5 + quantum/send_string_keycodes.h | 168 ++++++++++++ 14 files changed, 748 insertions(+), 56 deletions(-) create mode 100644 docs/feature_terminal.md create mode 100644 quantum/process_keycode/process_terminal.c create mode 100644 quantum/process_keycode/process_terminal.h create mode 100644 quantum/process_keycode/process_terminal_nop.h create mode 100644 quantum/send_string_keycodes.h diff --git a/common_features.mk b/common_features.mk index f405d5c07b..d499d1f0b7 100644 --- a/common_features.mk +++ b/common_features.mk @@ -153,6 +153,11 @@ ifeq ($(strip $(LED_TABLES)), yes) SRC += $(QUANTUM_DIR)/led_tables.c endif +ifeq ($(strip $(TERMINAL_ENABLE)), yes) + SRC += $(QUANTUM_DIR)/process_keycode/process_terminal.c + OPT_DEFS += -DTERMINAL_ENABLE +endif + QUANTUM_SRC:= \ $(QUANTUM_DIR)/quantum.c \ $(QUANTUM_DIR)/keymap_common.c \ diff --git a/docs/_summary.md b/docs/_summary.md index 77d208fc3c..ce02220fbf 100644 --- a/docs/_summary.md +++ b/docs/_summary.md @@ -28,6 +28,7 @@ * [Thermal Printer](feature_thermal_printer.md) * [Stenography](stenography.md) * [Unicode](unicode.md) + * [Terminal](feature_terminal.md) * Reference * [Glossary](glossary.md) diff --git a/docs/feature_terminal.md b/docs/feature_terminal.md new file mode 100644 index 0000000000..2c5f2c486b --- /dev/null +++ b/docs/feature_terminal.md @@ -0,0 +1,80 @@ +# Terminal + +> This feature is currently *huge* at 4400 bytes, and should probably only be put on boards with a lot of memory, or for fun. + +The terminal feature is a command-line-like interface designed to communicate through a text editor with keystrokes. It's beneficial to turn off auto-indent features in your editor. + +To enable, stick this in your `rules.mk` or `Makefile`: + + TERMINAL_ENABLE = yes + +And use the `TERM_ON` and `TERM_OFF` keycodes to turn it on or off. + +When enabled, a `> ` prompt will appear, where you'll be able to type, backspace (a bell will ding if you reach the beginning and audio is enabled), and hit enter to send the command. Arrow keys are currently disabled so it doesn't get confused. Moving your cursor around with the mouse is discouraged. + +`#define TERMINAL_HELP` enables some other output helpers that aren't really needed with this page. + +## Future ideas + +* Keyboard/user-extendable commands +* Smaller footprint +* Arrow key support +* Command history +* SD card support +* LCD support for buffer display +* Keycode -> name string LUT +* Layer status +* *Analog/digital port read/write* +* RGB mode stuff +* Macro definitions +* EEPROM read/write +* Audio control + +## Current commands + +### `about` + +Prints out the current version of QMK with a build date: + +``` +> about +QMK Firmware + v0.5.115-7-g80ed73-dirty + Built: 2017-08-29-20:24:44 +``` + +### `help` + +Prints out the available commands: + +``` +> help +commands available: + about help keycode keymap exit +``` + +### `keycode ` + +Prints out the keycode value of a certain layer, row, and column: + +``` +> keycode 0 1 0 +0x29 (41) +``` + +### `keymap ` + +Prints out the entire keymap for a certain layer + +``` +> keymap 0 +0x002b, 0x0014, 0x001a, 0x0008, 0x0015, 0x0017, 0x001c, 0x0018, 0x000c, 0x0012, 0x0013, 0x002a, +0x0029, 0x0004, 0x0016, 0x0007, 0x0009, 0x000a, 0x000b, 0x000d, 0x000e, 0x000f, 0x0033, 0x0034, +0x00e1, 0x001d, 0x001b, 0x0006, 0x0019, 0x0005, 0x0011, 0x0010, 0x0036, 0x0037, 0x0038, 0x0028, +0x5cd6, 0x00e0, 0x00e2, 0x00e3, 0x5cd4, 0x002c, 0x002c, 0x5cd5, 0x0050, 0x0051, 0x0052, 0x004f, +> +``` + +### `exit` + +Exits the terminal - same as `TERM_OFF`. \ No newline at end of file diff --git a/docs/macros.md b/docs/macros.md index c7a9b2e7a6..66d2bc090a 100644 --- a/docs/macros.md +++ b/docs/macros.md @@ -1,72 +1,126 @@ # Macros -Macros allow you to send multiple keystrokes when pressing just one key. QMK has a number of ways to define and use macros. These can do anything you want- type common phrases for you, copypasta, repetitive game movements, or even help you code. +Macros allow you to send multiple keystrokes when pressing just one key. QMK has a number of ways to define and use macros. These can do anything you want: type common phrases for you, copypasta, repetitive game movements, or even help you code. {% hint style='danger' %} **Security Note**: While it is possible to use macros to send passwords, credit card numbers, and other sensitive information it is a supremely bad idea to do so. Anyone who gets ahold of your keyboard will be able to access that information by opening a text editor. {% endhint %} -# Macro Definitions +## The new way: `SEND_STRING()` & `process_record_user` -By default QMK assumes you don't have any macros. To define your macros you create an `action_get_macro()` function. For example: +Sometimes you just want a key to type out words or phrases. For the most common situations we've provided `SEND_STRING()`, which will type out your string for you. All ascii that is easily translated to a keycode is supported (eg `\n\t`). + +For example: ```c -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { +enum custom_keycodes { + PRINT_TRUTH = SAFE_RANGE +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { - switch(id) { - case 0: - return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END); - case 1: - return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END); + switch(keycode) { + case PRINT_TRUTH: + SEND_STRING("QMK is the best thing ever!"); + return false; break; } } - return MACRO_NONE; + return true; }; ``` -This defines two macros which will be run when the key they are assigned to is pressed. If instead you'd like them to run when the key is released you can change the if statement: +### Tap/down/up + +You can send arbitary keycodes by wrapping them in: + +* `SS_TAP()` +* `SS_DOWN()` +* `SS_UP()` + +For example: + + SEND_STRING(SS_TAP(X_HOME)); + +Would tap `KC_HOME` - note how the prefix is now `X_`, and not `KC_`. You can also combine this with other strings, like this: + + SEND_STRING("VE"SS_TAP(X_HOME)"LO"); + +Which would send "VE" followed by a `KC_HOME` tap, and "LO" (spelling "LOVE" if on a newline). + +There's also a couple of mod shortcuts you can use: + +* `SS_LCTRL(string)` +* `SS_LGUI(string)` +* `SS_LALT(string)` + +That can be used like this: + + SEND_STRING(SS_LCTRL("a")); + +Which would send LCTRL+a (LTRL down, a, LTRL up) - notice that they take strings (eg `"k"`), and not the `X_K` keycodes. + +### Alternative keymaps + +By default, it assumes a US keymap with a QWERTY layout; if you want to change that (e.g. if your OS uses software Colemak), include this somewhere in your keymap: + + #include + +### Strings in memory + +If for some reason you're manipulating strings and need to print out something you just generated (instead of being a literal, constant string), you can use `send_string()`, like this: ```c - if (!record->event.pressed) { +char my_str[4] = "ok."; +send_string(my_str); ``` -## Macro Commands - -A macro can include the following commands: +The shortcuts defined above won't work with `send_string()`, but you can separate things out to different lines if needed: -* I() change interval of stroke in milliseconds. -* D() press key. -* U() release key. -* T() type key(press and release). -* W() wait (milliseconds). -* END end mark. +```c +char my_str[4] = "ok."; +SEND_STRING("I said: "); +send_string(my_str); +SEND_STRING(".."SS_TAP(X_END)); +``` -## Sending strings +## The old way: `MACRO()` & `action_get_macro` -Sometimes you just want a key to type out words or phrases. For the most common situations we've provided `SEND_STRING()`, which will type out your string for you instead of having to build a `MACRO()`. +{% hint style='info' %} +This is inherited from TMK, and hasn't been updated - it's recommend that you use `SEND_STRING` and `process_record_user` instead. +{% endhint %} -For example: +By default QMK assumes you don't have any macros. To define your macros you create an `action_get_macro()` function. For example: ```c const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { if (record->event.pressed) { switch(id) { case 0: - SEND_STRING("QMK is the best thing ever!"); - return false; + return MACRO(D(LSFT), T(H), U(LSFT), T(I), D(LSFT), T(1), U(LSFT), END); + case 1: + return MACRO(D(LSFT), T(B), U(LSFT), T(Y), T(E), D(LSFT), T(1), U(LSFT), END); } } return MACRO_NONE; }; ``` -By default, it assumes a US keymap with a QWERTY layout; if you want to change that (e.g. if your OS uses software Colemak), include this somewhere in your keymap: +This defines two macros which will be run when the key they are assigned to is pressed. If instead you'd like them to run when the key is released you can change the if statement: -``` -#include -``` + if (!record->event.pressed) { + +### Macro Commands + +A macro can include the following commands: + +* I() change interval of stroke in milliseconds. +* D() press key. +* U() release key. +* T() type key(press and release). +* W() wait (milliseconds). +* END end mark. -## Mapping a Macro to a key +### Mapping a Macro to a key Use the `M()` function within your `KEYMAP()` to call a macro. For example, here is the keymap for a 2-key keyboard: @@ -92,7 +146,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) { When you press the key on the left it will type "Hi!" and when you press the key on the right it will type "Bye!". -## Naming your macros +### Naming your macros If you have a bunch of macros you want to refer to from your keymap while keeping the keymap easily readable you can name them using `#define` at the top of your file. @@ -107,11 +161,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { }; ``` -# Advanced macro functions +## Advanced macro functions -While working within the `action_get_macro()` function block there are some functions you may find useful. Keep in mind that while you can write some fairly advanced code within a macro if your functionality gets too complex you may want to define a custom keycode instead. Macros are meant to be simple. +There are some functions you may find useful in macro-writing. Keep in mind that while you can write some fairly advanced code within a macro if your functionality gets too complex you may want to define a custom keycode instead. Macros are meant to be simple. -#### `record->event.pressed` +### `record->event.pressed` This is a boolean value that can be tested to see if the switch is being pressed or released. An example of this is @@ -123,27 +177,27 @@ This is a boolean value that can be tested to see if the switch is being pressed } ``` -#### `register_code();` +### `register_code();` This sends the `` keydown event to the computer. Some examples would be `KC_ESC`, `KC_C`, `KC_4`, and even modifiers such as `KC_LSFT` and `KC_LGUI`. -#### `unregister_code();` +### `unregister_code();` Parallel to `register_code` function, this sends the `` keyup event to the computer. If you don't use this, the key will be held down until it's sent. -#### `clear_keyboard();` +### `clear_keyboard();` This will clear all mods and keys currently pressed. -#### `clear_mods();` +### `clear_mods();` This will clear all mods currently pressed. -#### `clear_keyboard_but_mods();` +### `clear_keyboard_but_mods();` This will clear all keys besides the mods currently pressed. -# Advanced Example: Single-key copy/paste +## Advanced Example: Single-key copy/paste This example defines a macro which sends `Ctrl-C` when pressed down, and `Ctrl-V` when released. diff --git a/keyboards/planck/keymaps/default/keymap.c b/keyboards/planck/keymaps/default/keymap.c index 5449517801..48b02de38e 100644 --- a/keyboards/planck/keymaps/default/keymap.c +++ b/keyboards/planck/keymaps/default/keymap.c @@ -163,7 +163,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { * `-----------------------------------------------------------------------------------' */ [_ADJUST] = { - {_______, RESET, DEBUG, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL }, + {_______, RESET, DEBUG, _______, _______, _______, _______, TERM_ON, TERM_OFF,_______, _______, KC_DEL }, {_______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______}, {_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______}, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______} diff --git a/keyboards/planck/rules.mk b/keyboards/planck/rules.mk index 32a9a26c75..c4091f0117 100644 --- a/keyboards/planck/rules.mk +++ b/keyboards/planck/rules.mk @@ -57,7 +57,7 @@ CONSOLE_ENABLE = yes # Console for debug(+400) COMMAND_ENABLE = no # 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 = yes # MIDI controls +MIDI_ENABLE = no # MIDI controls AUDIO_ENABLE = yes # Audio output on port C6 UNICODE_ENABLE = no # Unicode BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h index 5ad543ca76..25e66e67c1 100644 --- a/quantum/audio/song_list.h +++ b/quantum/audio/song_list.h @@ -248,4 +248,7 @@ Q__NOTE(_GS5), \ HD_NOTE(_C6), +#define TERMINAL_SOUND \ + E__NOTE(_C5 ) + #endif diff --git a/quantum/process_keycode/process_terminal.c b/quantum/process_keycode/process_terminal.c new file mode 100644 index 0000000000..deb1543e3d --- /dev/null +++ b/quantum/process_keycode/process_terminal.c @@ -0,0 +1,252 @@ +/* Copyright 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 "process_terminal.h" +#include +#include "version.h" +#include +#include + +bool terminal_enabled = false; +char buffer[80] = ""; +char newline[2] = "\n"; +char arguments[6][20]; + +__attribute__ ((weak)) +const char terminal_prompt[8] = "> "; + +#ifdef AUDIO_ENABLE + #ifndef TERMINAL_SONG + #define TERMINAL_SONG SONG(TERMINAL_SOUND) + #endif + float terminal_song[][2] = TERMINAL_SONG; + #define TERMINAL_BELL() PLAY_SONG(terminal_song) +#else + #define TERMINAL_BELL() +#endif + +__attribute__ ((weak)) +const char keycode_to_ascii_lut[58] = { + 0, 0, 0, 0, + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', + 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', + '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', 0, 0, 0, '\t', + ' ', '-', '=', '[', ']', '\\', 0, ';', '\'', '`', ',', '.', '/' +}; + +__attribute__ ((weak)) +const char shifted_keycode_to_ascii_lut[58] = { + 0, 0, 0, 0, + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', 0, 0, 0, '\t', + ' ', '_', '+', '{', '}', '|', 0, ':', '\'', '~', '<', '>', '?' +}; + +struct stringcase { + char* string; + void (*func)(void); +} typedef stringcase; + +void enable_terminal(void) { + terminal_enabled = true; + strcpy(buffer, ""); + for (int i = 0; i < 6; i++) + strcpy(arguments[i], ""); + // select all text to start over + // SEND_STRING(SS_LCTRL("a")); + send_string(terminal_prompt); +} + +void disable_terminal(void) { + terminal_enabled = false; +} + +void terminal_about(void) { + SEND_STRING("QMK Firmware\n"); + SEND_STRING(" v"); + SEND_STRING(QMK_VERSION); + SEND_STRING("\n"SS_TAP(X_HOME)" Built: "); + SEND_STRING(QMK_BUILDDATE); + send_string(newline); + #ifdef TERMINAL_HELP + if (strlen(arguments[1]) != 0) { + SEND_STRING("You entered: "); + send_string(arguments[1]); + send_string(newline); + } + #endif +} + +void terminal_help(void); + +extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; + +void terminal_keycode(void) { + if (strlen(arguments[1]) != 0 && strlen(arguments[2]) != 0 && strlen(arguments[3]) != 0) { + char keycode_dec[5]; + char keycode_hex[5]; + uint16_t layer = strtol(arguments[1], (char **)NULL, 10); + uint16_t row = strtol(arguments[2], (char **)NULL, 10); + uint16_t col = strtol(arguments[3], (char **)NULL, 10); + uint16_t keycode = pgm_read_word(&keymaps[layer][row][col]); + itoa(keycode, keycode_dec, 10); + itoa(keycode, keycode_hex, 16); + SEND_STRING("0x"); + send_string(keycode_hex); + SEND_STRING(" ("); + send_string(keycode_dec); + SEND_STRING(")\n"); + } else { + #ifdef TERMINAL_HELP + SEND_STRING("usage: keycode \n"); + #endif + } +} + +void terminal_keymap(void) { + if (strlen(arguments[1]) != 0) { + uint16_t layer = strtol(arguments[1], (char **)NULL, 10); + for (int r = 0; r < MATRIX_ROWS; r++) { + for (int c = 0; c < MATRIX_COLS; c++) { + uint16_t keycode = pgm_read_word(&keymaps[layer][r][c]); + char keycode_s[8]; + sprintf(keycode_s, "0x%04x, ", keycode); + send_string(keycode_s); + } + send_string(newline); + } + } else { + #ifdef TERMINAL_HELP + SEND_STRING("usage: keymap \n"); + #endif + } +} + +stringcase terminal_cases[] = { + { "about", terminal_about }, + { "help", terminal_help }, + { "keycode", terminal_keycode }, + { "keymap", terminal_keymap }, + { "exit", disable_terminal } +}; + +void terminal_help(void) { + SEND_STRING("commands available:\n "); + for( stringcase* case_p = terminal_cases; case_p != terminal_cases + sizeof( terminal_cases ) / sizeof( terminal_cases[0] ); case_p++ ) { + send_string(case_p->string); + SEND_STRING(" "); + } + send_string(newline); +} + +void command_not_found(void) { + SEND_STRING("command \""); + send_string(buffer); + SEND_STRING("\" not found\n"); +} + +void process_terminal_command(void) { + // we capture return bc of the order of events, so we need to manually send a newline + send_string(newline); + + char * pch; + uint8_t i = 0; + pch = strtok(buffer, " "); + while (pch != NULL) { + strcpy(arguments[i], pch); + pch = strtok(NULL, " "); + i++; + } + + bool command_found = false; + for( stringcase* case_p = terminal_cases; case_p != terminal_cases + sizeof( terminal_cases ) / sizeof( terminal_cases[0] ); case_p++ ) { + if( 0 == strcmp( case_p->string, buffer ) ) { + command_found = true; + (*case_p->func)(); + break; + } + } + + if (!command_found) + command_not_found(); + + if (terminal_enabled) { + strcpy(buffer, ""); + for (int i = 0; i < 6; i++) + strcpy(arguments[i], ""); + SEND_STRING(SS_TAP(X_HOME)); + send_string(terminal_prompt); + } +} + +bool process_terminal(uint16_t keycode, keyrecord_t *record) { + + if (keycode == TERM_ON && record->event.pressed) { + enable_terminal(); + return false; + } + + if (terminal_enabled && record->event.pressed) { + if (keycode == TERM_OFF && record->event.pressed) { + disable_terminal(); + return false; + } + if (keycode < 256) { + uint8_t str_len; + char char_to_add; + switch (keycode) { + case KC_ENTER: + process_terminal_command(); + return false; break; + case KC_ESC: + SEND_STRING("\n"); + enable_terminal(); + return false; break; + case KC_BSPC: + str_len = strlen(buffer); + if (str_len > 0) { + buffer[str_len-1] = 0; + return true; + } else { + TERMINAL_BELL(); + return false; + } break; + case KC_LEFT: + case KC_RIGHT: + case KC_UP: + case KC_DOWN: + return false; break; + default: + if (keycode <= 58) { + char_to_add = 0; + if (get_mods() & (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT))) { + char_to_add = shifted_keycode_to_ascii_lut[keycode]; + } else if (get_mods() == 0) { + char_to_add = keycode_to_ascii_lut[keycode]; + } + if (char_to_add != 0) { + strncat(buffer, &char_to_add, 1); + } + } break; + } + + + + } + } + return true; +} \ No newline at end of file diff --git a/quantum/process_keycode/process_terminal.h b/quantum/process_keycode/process_terminal.h new file mode 100644 index 0000000000..d945949a41 --- /dev/null +++ b/quantum/process_keycode/process_terminal.h @@ -0,0 +1,27 @@ +/* Copyright 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 . + */ + +#ifndef PROCESS_TERMINAL_H +#define PROCESS_TERMINAL_H + +#include "quantum.h" + +extern const char keycode_to_ascii_lut[58]; +extern const char shifted_keycode_to_ascii_lut[58]; +extern const char terminal_prompt[8]; +bool process_terminal(uint16_t keycode, keyrecord_t *record); + +#endif \ No newline at end of file diff --git a/quantum/process_keycode/process_terminal_nop.h b/quantum/process_keycode/process_terminal_nop.h new file mode 100644 index 0000000000..56895b33c3 --- /dev/null +++ b/quantum/process_keycode/process_terminal_nop.h @@ -0,0 +1,25 @@ +/* Copyright 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 . + */ + +#ifndef PROCESS_TERMINAL_H +#define PROCESS_TERMINAL_H + +#include "quantum.h" + +#define TERM_ON KC_NO +#define TERM_OFF KC_NO + +#endif \ No newline at end of file diff --git a/quantum/quantum.c b/quantum/quantum.c index 285e1e81ee..1fccaa7d5a 100644 --- a/quantum/quantum.c +++ b/quantum/quantum.c @@ -237,6 +237,9 @@ bool process_record_quantum(keyrecord_t *record) { #endif #ifdef UNICODEMAP_ENABLE process_unicode_map(keycode, record) && + #endif + #ifdef TERMINAL_ENABLE + process_terminal(keycode, record) && #endif true)) { return false; @@ -600,21 +603,55 @@ void send_string(const char *str) { send_string_with_delay(str, 0); } +void send_string_P(const char *str) { + send_string_with_delay_P(str, 0); +} + void send_string_with_delay(const char *str, uint8_t interval) { while (1) { - uint8_t keycode; - uint8_t ascii_code = pgm_read_byte(str); + char ascii_code = *str; if (!ascii_code) break; - keycode = pgm_read_byte(&ascii_to_keycode_lut[ascii_code]); - if (pgm_read_byte(&ascii_to_shift_lut[ascii_code])) { - register_code(KC_LSFT); - register_code(keycode); - unregister_code(keycode); - unregister_code(KC_LSFT); + if (ascii_code == 1) { + // tap + uint8_t keycode = *(++str); + register_code(keycode); + unregister_code(keycode); + } else if (ascii_code == 2) { + // down + uint8_t keycode = *(++str); + register_code(keycode); + } else if (ascii_code == 3) { + // up + uint8_t keycode = *(++str); + unregister_code(keycode); + } else { + send_char(ascii_code); } - else { - register_code(keycode); - unregister_code(keycode); + ++str; + // interval + { uint8_t ms = interval; while (ms--) wait_ms(1); } + } +} + +void send_string_with_delay_P(const char *str, uint8_t interval) { + while (1) { + char ascii_code = pgm_read_byte(str); + if (!ascii_code) break; + if (ascii_code == 1) { + // tap + uint8_t keycode = pgm_read_byte(++str); + register_code(keycode); + unregister_code(keycode); + } else if (ascii_code == 2) { + // down + uint8_t keycode = pgm_read_byte(++str); + register_code(keycode); + } else if (ascii_code == 3) { + // up + uint8_t keycode = pgm_read_byte(++str); + unregister_code(keycode); + } else { + send_char(ascii_code); } ++str; // interval @@ -622,6 +659,20 @@ void send_string_with_delay(const char *str, uint8_t interval) { } } +void send_char(char ascii_code) { + uint8_t keycode; + keycode = pgm_read_byte(&ascii_to_keycode_lut[(uint8_t)ascii_code]); + if (pgm_read_byte(&ascii_to_shift_lut[(uint8_t)ascii_code])) { + register_code(KC_LSFT); + register_code(keycode); + unregister_code(keycode); + unregister_code(KC_LSFT); + } else { + register_code(keycode); + unregister_code(keycode); + } +} + void set_single_persistent_default_layer(uint8_t default_layer) { #if defined(AUDIO_ENABLE) && defined(DEFAULT_LAYER_SONGS) PLAY_SONG(default_layer_songs[default_layer]); diff --git a/quantum/quantum.h b/quantum/quantum.h index 9a6d691a15..f3333a002a 100644 --- a/quantum/quantum.h +++ b/quantum/quantum.h @@ -40,7 +40,7 @@ #include "action_util.h" #include #include "print.h" - +#include "send_string_keycodes.h" extern uint32_t default_layer_state; @@ -103,11 +103,32 @@ extern uint32_t default_layer_state; #include "process_key_lock.h" #endif -#define SEND_STRING(str) send_string(PSTR(str)) +#ifdef TERMINAL_ENABLE + #include "process_terminal.h" +#else + #include "process_terminal_nop.h" +#endif + +#define STRINGIZE(z) #z +#define ADD_SLASH_X(y) STRINGIZE(\x ## y) +#define SYMBOL_STR(x) ADD_SLASH_X(x) + +#define SS_TAP(keycode) "\1" SYMBOL_STR(keycode) +#define SS_DOWN(keycode) "\2" SYMBOL_STR(keycode) +#define SS_UP(keycode) "\3" SYMBOL_STR(keycode) + +#define SS_LCTRL(string) SS_DOWN(X_LCTRL) string SS_UP(X_LCTRL) +#define SS_LGUI(string) SS_DOWN(X_LGUI) string SS_UP(X_LGUI) +#define SS_LALT(string) SS_DOWN(X_LALT) string SS_UP(X_LALT) + +#define SEND_STRING(str) send_string_P(PSTR(str)) extern const bool ascii_to_shift_lut[0x80]; extern const uint8_t ascii_to_keycode_lut[0x80]; void send_string(const char *str); void send_string_with_delay(const char *str, uint8_t interval); +void send_string_P(const char *str); +void send_string_with_delay_P(const char *str, uint8_t interval); +void send_char(char ascii_code); // For tri-layer void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3); diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h index ccd4565f53..26c3c41a73 100644 --- a/quantum/quantum_keycodes.h +++ b/quantum/quantum_keycodes.h @@ -431,6 +431,11 @@ enum quantum_keycodes { KC_LOCK, #endif +#ifdef TERMINAL_ENABLE + TERM_ON, + TERM_OFF, +#endif + // always leave at the end SAFE_RANGE }; diff --git a/quantum/send_string_keycodes.h b/quantum/send_string_keycodes.h new file mode 100644 index 0000000000..0e308be508 --- /dev/null +++ b/quantum/send_string_keycodes.h @@ -0,0 +1,168 @@ +#ifndef SEND_STRING_KEYCODES +#define SEND_STRING_KEYCODES + +#define X_NO 00 +#define X_ROLL_OVER 01 +#define X_POST_FAIL 02 +#define X_UNDEFINED 03 +#define X_A 04 +#define X_B 05 +#define X_C 06 +#define X_D 07 +#define X_E 08 +#define X_F 09 +#define X_G 0A +#define X_H 0B +#define X_I 0C +#define X_J 0D +#define X_K 0E +#define X_L 0F +#define X_M 10 +#define X_N 11 +#define X_O 12 +#define X_P 13 +#define X_Q 14 +#define X_R 15 +#define X_S 16 +#define X_T 17 +#define X_U 18 +#define X_V 19 +#define X_W 1A +#define X_X 1B +#define X_Y 1C +#define X_Z 1D +#define X_1 1E +#define X_2 1F +#define X_3 20 +#define X_4 21 +#define X_5 22 +#define X_6 23 +#define X_7 24 +#define X_8 25 +#define X_9 26 +#define X_0 27 +#define X_ENTER 28 +#define X_ESCAPE 29 +#define X_BSPACE 2A +#define X_TAB 2B +#define X_SPACE 2C +#define X_MINUS 2D +#define X_EQUAL 2E +#define X_LBRACKET 2F +#define X_RBRACKET 30 +#define X_BSLASH 31 +#define X_NONUS_HASH 32 +#define X_SCOLON 33 +#define X_QUOTE 34 +#define X_GRAVE 35 +#define X_COMMA 36 +#define X_DOT 37 +#define X_SLASH 38 +#define X_CAPSLOCK 39 +#define X_F1 3A +#define X_F2 3B +#define X_F3 3C +#define X_F4 3D +#define X_F5 3E +#define X_F6 3F +#define X_F7 40 +#define X_F8 41 +#define X_F9 42 +#define X_F10 43 +#define X_F11 44 +#define X_F12 45 +#define X_PSCREEN 46 +#define X_SCROLLLOCK 47 +#define X_PAUSE 48 +#define X_INSERT 49 +#define X_HOME 4A +#define X_PGUP 4B +#define X_DELETE 4C +#define X_END 4D +#define X_PGDOWN 4E +#define X_RIGHT 4F +#define X_LEFT 50 +#define X_DOWN 51 +#define X_UP 52 +#define X_NUMLOCK 53 +#define X_KP_SLASH 54 +#define X_KP_ASTERISK 55 +#define X_KP_MINUS 56 +#define X_KP_PLUS 57 +#define X_KP_ENTER 58 +#define X_KP_1 59 +#define X_KP_2 5A +#define X_KP_3 5B +#define X_KP_4 5C +#define X_KP_5 5D +#define X_KP_6 5E +#define X_KP_7 5F +#define X_KP_8 60 +#define X_KP_9 61 +#define X_KP_0 62 +#define X_KP_DOT 63 +#define X_NONUS_BSLASH 64 +#define X_APPLICATION 65 +#define X_POWER 66 +#define X_KP_EQUAL 67 +#define X_F13 68 +#define X_F14 69 +#define X_F15 6A +#define X_F16 6B +#define X_F17 6C +#define X_F18 6D +#define X_F19 6E +#define X_F20 6F +#define X_F21 70 +#define X_F22 71 +#define X_F23 72 +#define X_F24 73 +#define X_EXECUTE 74 +#define X_HELP 75 +#define X_MENU 76 +#define X_SELECT 77 +#define X_STOP 78 +#define X_AGAIN 79 +#define X_UNDO 7A +#define X_CUT 7B +#define X_COPY 7C +#define X_PASTE 7D +#define X_FIND 7E +#define X__MUTE 7F +#define X__VOLUP 80 +#define X__VOLDOWN 81 +#define X_LOCKING_CAPS 82 +#define X_LOCKING_NUM 83 +#define X_LOCKING_SCROLL 84 +#define X_KP_COMMA 85 +#define X_KP_EQUAL_AS400 86 +#define X_INT1 87 +#define X_INT2 88 +#define X_INT3 89 +#define X_INT4 8A +#define X_INT5 8B +#define X_INT6 8C +#define X_INT7 8D +#define X_INT8 8E +#define X_INT9 8F +#define X_LANG1 90 +#define X_LANG2 91 +#define X_LANG3 92 +#define X_LANG4 93 +#define X_LANG5 94 +#define X_LANG6 95 +#define X_LANG7 96 +#define X_LANG8 97 +#define X_LANG9 98 + +/* Modifiers */ +#define X_LCTRL e0 +#define X_LSHIFT e1 +#define X_LALT e2 +#define X_LGUI e3 +#define X_RCTRL e4 +#define X_RSHIFT e5 +#define X_RALT e6 +#define X_RGUI e7 + +#endif \ No newline at end of file From 63028dde82bcb47ea3fe960d94821cb88d277e0c Mon Sep 17 00:00:00 2001 From: Danny Nguyen Date: Wed, 13 Sep 2017 13:01:06 -0400 Subject: [PATCH 13/51] Add jojiichan keymap --- keyboards/nyquist/keymaps/jojiichan/config.h | 42 ++++++++++++++++ keyboards/nyquist/keymaps/jojiichan/keymap.c | 53 ++++++++++++++++++++ keyboards/nyquist/keymaps/jojiichan/rules.mk | 5 ++ 3 files changed, 100 insertions(+) create mode 100644 keyboards/nyquist/keymaps/jojiichan/config.h create mode 100644 keyboards/nyquist/keymaps/jojiichan/keymap.c create mode 100644 keyboards/nyquist/keymaps/jojiichan/rules.mk diff --git a/keyboards/nyquist/keymaps/jojiichan/config.h b/keyboards/nyquist/keymaps/jojiichan/config.h new file mode 100644 index 0000000000..ce60a257ea --- /dev/null +++ b/keyboards/nyquist/keymaps/jojiichan/config.h @@ -0,0 +1,42 @@ +/* +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/nyquist/keymaps/jojiichan/keymap.c b/keyboards/nyquist/keymaps/jojiichan/keymap.c new file mode 100644 index 0000000000..9617cf9fb0 --- /dev/null +++ b/keyboards/nyquist/keymaps/jojiichan/keymap.c @@ -0,0 +1,53 @@ +#include "nyquist.h" +#include "action_layer.h" +#include "eeconfig.h" + +extern keymap_config_t keymap_config; + + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + + KEYMAP( + KC_ESC, 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_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL, + 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_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_LALT, TG(4), MO(1), KC_SPC, KC_SPC, MO(2), KC_LEFT, KC_RGHT, KC_UP, KC_DOWN), + + KEYMAP( + KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + KC_PAUS, KC_TRNS, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, + KC_TRNS, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_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_HOME, KC_PGUP, + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_DEL, KC_END, KC_PGDN), + + 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_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, + KC_MINS, KC_EQL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LBRC, KC_RBRC, KC_PIPE, + KC_UNDS, KC_PLUS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LCBR, KC_RCBR, KC_BSLS, + 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( + LALT(KC_F4), LSFT(KC_EXLM), LSFT(KC_AT), LSFT(KC_HASH), LSFT(KC_DLR), LSFT(KC_PERC), LSFT(KC_CIRC), LSFT(KC_AMPR), LSFT(KC_ASTR), LSFT(KC_LPRN), LSFT(KC_RPRN), LSFT(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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT(KC_COLN), LSFT(KC_DQUO), + KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, LSFT(KC_LABK), LSFT(KC_RABK), LSFT(KC_QUES), KC_TRNS, + 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_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_F11, KC_PGDN, KC_SLSH, KC_ASTR, KC_MINS, + KC_TAB, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_O, KC_7, KC_8, KC_9, KC_PLUS, + KC_TRNS, KC_A, KC_S, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_4, KC_5, KC_6, KC_PLUS, + KC_LSFT, KC_TRNS, KC_X, KC_C, KC_TRNS, KC_TRNS, KC_N, KC_TRNS, KC_1, KC_2, KC_3, KC_ENT, + RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_SPC, KC_TRNS, KC_0, KC_0, KC_DOT, KC_ENT) + +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + return true; +} diff --git a/keyboards/nyquist/keymaps/jojiichan/rules.mk b/keyboards/nyquist/keymaps/jojiichan/rules.mk new file mode 100644 index 0000000000..1e57612788 --- /dev/null +++ b/keyboards/nyquist/keymaps/jojiichan/rules.mk @@ -0,0 +1,5 @@ +RGBLIGHT_ENABLE = yes + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif From cf001300b31ead107179f0b56014326bb87537be Mon Sep 17 00:00:00 2001 From: Sean Hunter Date: Wed, 13 Sep 2017 22:47:48 +0100 Subject: [PATCH 14/51] [planck] Adds Sean Hunter keymap(#1706) * Sean Hunter initial keymap * Update old map to sync it up with new one * Add TODO fix a few minor things * small doc fixes * Minor fixups --- keyboards/planck/keymaps/sean/Makefile | 4 + keyboards/planck/keymaps/sean/config.h | 29 ++ keyboards/planck/keymaps/sean/keymap.c | 306 ++++++++++++++++++ keyboards/planck/keymaps/sean/mymappings.h | 39 +++ keyboards/planck/keymaps/sean/readme.md | 130 ++++++++ .../common_keymaps/keymap_sean.c | 131 +++++--- 6 files changed, 599 insertions(+), 40 deletions(-) create mode 100644 keyboards/planck/keymaps/sean/Makefile create mode 100644 keyboards/planck/keymaps/sean/config.h create mode 100644 keyboards/planck/keymaps/sean/keymap.c create mode 100644 keyboards/planck/keymaps/sean/mymappings.h create mode 100644 keyboards/planck/keymaps/sean/readme.md diff --git a/keyboards/planck/keymaps/sean/Makefile b/keyboards/planck/keymaps/sean/Makefile new file mode 100644 index 0000000000..09b127dc05 --- /dev/null +++ b/keyboards/planck/keymaps/sean/Makefile @@ -0,0 +1,4 @@ +ifndef QUANTUM_DIR + include ../../../../Makefile +endif +MOUSEKEY_ENABLE = yes diff --git a/keyboards/planck/keymaps/sean/config.h b/keyboards/planck/keymaps/sean/config.h new file mode 100644 index 0000000000..4c61581993 --- /dev/null +++ b/keyboards/planck/keymaps/sean/config.h @@ -0,0 +1,29 @@ +#ifndef CONFIG_USER_H +#define CONFIG_USER_H + +#include "../../config.h" + +/* + * 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/sean/keymap.c b/keyboards/planck/keymaps/sean/keymap.c new file mode 100644 index 0000000000..d61d802b0b --- /dev/null +++ b/keyboards/planck/keymaps/sean/keymap.c @@ -0,0 +1,306 @@ +// This is Sean Hunter's keymap file, customized from the canonical layout file for the Quantum project. +// If you want to add another keyboard, that is the style you want to emulate. + +#include "planck.h" +#include "action_layer.h" +#include "eeconfig.h" +#include "mymappings.h" + +extern keymap_config_t keymap_config; + +// Each layer gets a name for readability, which is then used in the keymap matrix below. + +enum planck_layers { + _DVRK, + _LOWER, + _RAISE, + _SDRK, + _SLWER, + _SRAIS, + _NMPD, + _MVMT, + _ADJUST +}; + +enum planck_keycodes { + DVRK = SAFE_RANGE, + LOWER, + RAISE, + SDRK, + SLWER, + SRAIS, + BACKLIT, + BACKTOG, + CUT, + COPY, + PASTE +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* Dvorak + * ,-----------------------------------------------------------------------------------. + * | " | , | . | P | Y | / | = | F | G | C | R | L | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | A | O | E | U | I | ESC | BSPC | D | H | T | N | S | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | ; | Q | J | K | X | TAB | ENT | B | M | W | V | Z | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Sft | Ctl | Alt | Gui |Lower | Space |Raise | < | v | ^ | > | + * `-----------------------------------------------------------------------------------' + */ +[_DVRK] = { + {KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_SLSH, KC_EQL, KC_F, KC_G, KC_C, KC_R, KC_L}, + {KC_A, KC_O, KC_E, KC_U, KC_I, KC_ESC, KC_BSPC, KC_D, KC_H, KC_T, KC_N, KC_S}, + {KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_TAB, KC_ENT, KC_B, KC_M, KC_W, KC_V, KC_Z}, + {KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT} +}, + + +/* Lower + * ,-----------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | { | } | F6 | F7 | F8 | F9 | F10 | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | 1 | 2 | 3 | 4 | 5 | [ | ] | 6 | 7 | 8 | 9 | 0 | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | ~ | | | ` | - | _ | INS | DEL | ( | ) | + | = | \ | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Sft | Ctl | Alt | Gui |Lower | |Raise | Home | PgDn | PgUp | End | + * `-----------------------------------------------------------------------------------' + */ +[_LOWER] = { + {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_LCBR, KC_RCBR, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10}, + {KC_1, KC_2, KC_3, KC_4, KC_5, KC_LBRC, KC_RBRC, KC_6, KC_7, KC_8, KC_9, KC_0}, + {KC_TILD, KC_PIPE, KC_GRV, KC_MINS, KC_UNDS, KC_INS, KC_DEL, KC_LPRN, KC_RPRN, KC_PLUS, KC_EQL, KC_BSLS}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END} +}, + + +/* Raise + * ,-----------------------------------------------------------------------------------. + * | F11 | F12 | F13 | F14 | F15 | | | F16 | F17 | F18 | F19 | F20 | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ! | @ | # | $ | % |Sleep | Wake | ^ | & | * | ( | ) | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | GUI1 | GUI2 | GUI3 | GUI4 | GUI5 | | GUI6 | GUI7 | GUI8 | GUI9 |GUI10 | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Sft | Ctl | Alt | Gui |Lower | |Raise | Gui | Alt | Ctl | Sft | + * `-----------------------------------------------------------------------------------' + */ +[_RAISE] = { + { KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, _______, _______, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20}, + {KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_SLEP, KC_WAKE, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN}, + { GUI_1, GUI_2, GUI_3, GUI_4, GUI_5, _______, _______, GUI_6, GUI_7, GUI_8, GUI_9, GUI_10}, + {KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_RGUI, KC_RALT, KC_RCTL, KC_RSFT} +}, + +/* 'Software Dvorak': Designed to look like dvorak in the mapping but depend on software + * dvorak (ie the OS keymapping changed to dvorak). + * ,-----------------------------------------------------------------------------------. + * | " | , | . | P | Y | / | = | F | G | C | R | L | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | A | O | E | U | I | ESC | BSPC | D | H | T | N | S | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | ; | Q | J | K | X | TAB | ENT | B | M | W | V | Z | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Sft | Ctl | Alt | Gui |SLower| Space |SRaise| < | v | ^ | > | + * `-----------------------------------------------------------------------------------' + */ +[_SDRK] = { + {DV_QUOT, DV_COMM, DV_DOT, DV_P, DV_Y, DV_SLSH, DV_EQL, DV_F, DV_G, DV_C, DV_R, DV_L}, + {DV_A, DV_O, DV_E, DV_U, DV_I, KC_ESC, KC_BSPC, DV_D, DV_H, DV_T, DV_N, DV_S}, + {DV_SCLN, DV_Q, DV_J, DV_K, DV_X, KC_TAB, KC_ENT, DV_B, DV_M, DV_W, DV_V, DV_Z}, + {KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, SLWER, KC_SPC, KC_SPC, SRAIS, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT} +}, + + +/* 'Software dvorak lower mode': Puts all the braces etc in the right places so it works + * just like the lower mode above except that it depends on the OS keymapping being set + * to dvorak. + * ,-----------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | { | } | F6 | F7 | F8 | F9 | F10 | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | 1 | 2 | 3 | 4 | 5 | [ | ] | 6 | 7 | 8 | 9 | 0 | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | ~ | | | ` | - | _ | INS | DEL | ( | ) | + | = | \ | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Sft | Ctl | Alt | Gui |SLower| |SRaise| Home | PgDn | PgUp | End | + * `-----------------------------------------------------------------------------------' + */ +[_SLWER] = { + {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, DV_LCBR, DV_RCBR, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10}, + {DV_1, DV_2, DV_3, DV_4, DV_5, DV_LBRC, DV_RBRC, DV_6, DV_7, DV_8, DV_9, DV_0}, + {DV_TILD, DV_PIPE, DV_GRV, DV_MINS, DV_UNDS, KC_INS, KC_DEL, DV_LPRN, DV_RPRN, DV_PLUS, DV_EQL, DV_BSLS}, + {_______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END} +}, + + +/* 'Software dvorak raise mode' + * ,-----------------------------------------------------------------------------------. + * | F11 | F12 | F13 | F14 | F15 | | | F16 | F17 | F18 | F19 | F20 | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ! | @ | # | $ | % |Sleep | Wake | ^ | & | * | ( | ) | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | GUI1 | GUI2 | GUI3 | GUI4 | GUI5 | | GUI6 | GUI7 | GUI8 | GUI9 |GUI10 | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Sft | Ctl | Alt | Gui |Lower | |Raise | Gui | Alt | Ctl | Sft | + * `-----------------------------------------------------------------------------------' + */ +[_SRAIS] = { + { KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, _______, _______, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20}, + {DV_EXLM, DV_AT, DV_HASH, DV_DLR, DV_PERC, KC_SLEP, KC_WAKE, DV_CIRC, DV_AMPR, DV_ASTR, DV_LPRN, DV_RPRN}, + { GUI_1, GUI_2, GUI_3, GUI_4, GUI_5, _______, _______, GUI_6, GUI_7, GUI_8, GUI_9, GUI_10}, + {KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, SLWER, KC_SPC, KC_SPC, SRAIS, KC_RGUI, KC_RALT, KC_RCTL, KC_RSFT} +}, + + +/* Adjust (Lower + Raise or SLower + SRaise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | |AGnorm|AGswap| | |HRevl |HReset|HMenu | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | PWR | EJCT | CUT | COPY |PASTE |PrScr |SysReq| CAPS | << | >> | Mute | Stop | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * |DVORAK|NUMPAD| MVMT | SDRK | | | | | Next | Vol- | Vol+ | Play | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |Brite |BToggl| | | | | | Gui | Alt | Ctl | Sft | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = { + {_______, RESET, _______, _______, _______, AG_NORM, AG_SWAP, _______, _______, HRVL, HRESET, HMENU}, + { KC_PWR, KC_EJCT, CUT, COPY, PASTE, KC_PSCR, KC_SYSREQ, KC_CAPS, KC_MRWD, KC_MFFD, KC_MUTE, KC_MSTP}, + { DVRK, TO(_NMPD), TO(_MVMT), SDRK, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}, + {BACKLIT, BACKTOG, _______, _______, _______, _______, _______, _______, KC_RGUI, KC_RALT, KC_RCTL, KC_RSFT} +}, + + +/* Numpad + * ,-----------------------------------------------------------------------------------. + * | | | | | | | |NumLck| 7 | 8 | 9 | / | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | |Enter | 4 | 5 | 6 | * | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |DVORAK|NUMPAD| MVMT | SDRK | | | | | 3 | 2 | 1 | - | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | | | | | | 0 | . | + | + * `-----------------------------------------------------------------------------------' + */ +[_NMPD] = { + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_NLCK, KC_P7, KC_P8, KC_P9, KC_PSLS}, + {XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_PENT, KC_P4, KC_P5, KC_P6, KC_PAST}, + {TO(_DVRK),TO(_NMPD),TO(_MVMT),SDRK, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_P1, KC_P2, KC_P3, KC_PMNS}, + {_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_P0, KC_PDOT, KC_PPLS} +}, + + +/* Movement + * ,-----------------------------------------------------------------------------------. + * |MsBut2|MsWhDn|MsWhUp|MsBut1|MsBut3| | | | Home | PgDn | PgUp | End | + * +------+------+------+------+------+------+------+------+------+------+------+------+ + * |Ms Lft|Ms Dn |Ms Up |Ms Rht| | | | | Left | Down | Up | Right| + * |------+------+------+------+------+------+------+------+------+------+------+------| + * |DVORAK|NUMPAD| MVMT | SDRK | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | Sft | Ctl | Alt | Gui | | | | Gui | Alt | Ctl | Sft | + * `-----------------------------------------------------------------------------------' + */ +[_MVMT] = { + {KC_MB2, KC_MWDN, KC_MWUP, KC_MB1, KC_MB3, XXXXXXX, XXXXXXX, XXXXXXX, KC_HOME, KC_PGDN, KC_PGUP, KC_END}, + {KC_MLFT, KC_MDN, KC_MUP, KC_MRGT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}, + {TO(_DVRK),TO(_NMPD),TO(_MVMT),SDRK,XXXXXXX,XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}, + {KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, _______, _______, _______, _______, KC_RGUI, KC_RALT, KC_RCTL, KC_RSFT} +}, +}; + + +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 DVRK: + if (record->event.pressed) { + persistent_default_layer_set(1UL<<_DVRK); + layer_on(_DVRK); + } + 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 SDRK: + if (record->event.pressed) { + persistent_default_layer_set(1UL<<_SDRK); + layer_on(_SDRK); + } + return false; + break; + case SLWER: + if (record->event.pressed) { + layer_on(_SLWER); + update_tri_layer(_SLWER, _SRAIS, _ADJUST); + } else { + layer_off(_SLWER); + update_tri_layer(_SLWER, _SRAIS, _ADJUST); + } + return false; + break; + case SRAIS: + if (record->event.pressed) { + layer_on(_SRAIS); + update_tri_layer(_SLWER, _SRAIS, _ADJUST); + } else { + layer_off(_SRAIS); + update_tri_layer(_SLWER, _SRAIS, _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 BACKTOG: + if (record->event.pressed) { + #ifdef BACKLIGHT_ENABLE + backlight_toggle(); + #endif + } + return false; + break; + case CUT: //cut macro + return MACRODOWN( DOWN(KC_LCTL), TYPE(KC_X), UP(KC_LCTL), END ); + case COPY: // copy macro + return MACRODOWN( DOWN(KC_LCTL), TYPE(KC_C), UP(KC_LCTL), END ); + case PASTE: // paste macro + return MACRODOWN( DOWN(KC_LCTL), TYPE(KC_V), UP(KC_LCTL), END ); + } + return true; +} + +void matrix_init_user(void) { +} diff --git a/keyboards/planck/keymaps/sean/mymappings.h b/keyboards/planck/keymaps/sean/mymappings.h new file mode 100644 index 0000000000..cbb016e38d --- /dev/null +++ b/keyboards/planck/keymaps/sean/mymappings.h @@ -0,0 +1,39 @@ +//Defines etc for Sean Hunter's keymap. + +#include "keymap_extras/keymap_dvorak.h" + +#define PERMISSIVE_HOLD + +//Special hammerspoon keys +#define HMENU LCTL(LSFT(KC_BSLS)) +#define HRESET LCTL(LSFT(KC_EQL)) +#define HRVL LCTL(LSFT(KC_SLSH)) + +//Make virtual desktops a little easier on i3 (otherwise on this keyboard they're awkward +#define GUI_1 LGUI(KC_1) +#define GUI_2 LGUI(KC_2) +#define GUI_3 LGUI(KC_3) +#define GUI_4 LGUI(KC_4) +#define GUI_5 LGUI(KC_5) +#define GUI_6 LGUI(KC_6) +#define GUI_7 LGUI(KC_7) +#define GUI_8 LGUI(KC_8) +#define GUI_9 LGUI(KC_9) +#define GUI_10 LGUI(KC_0) + +//Abbreviations for mouse keys +#define KC_MUP KC_MS_UP +#define KC_MDN KC_MS_DOWN +#define KC_MLFT KC_MS_LEFT +#define KC_MRGT KC_MS_RIGHT +#define KC_MB1 KC_MS_BTN1 +#define KC_MB2 KC_MS_BTN2 +#define KC_MB3 KC_MS_BTN3 +#define KC_MB4 KC_MS_BTN4 +#define KC_MB5 KC_MS_BTN5 +#define KC_MWUP KC_MS_WH_UP +#define KC_MWDN KC_MS_WH_DOWN + +// Fillers to make layering more clear +#define _______ KC_TRNS +#define XXXXXXX KC_NO diff --git a/keyboards/planck/keymaps/sean/readme.md b/keyboards/planck/keymaps/sean/readme.md new file mode 100644 index 0000000000..ac39d185ff --- /dev/null +++ b/keyboards/planck/keymaps/sean/readme.md @@ -0,0 +1,130 @@ +# Sean Hunter's Planck Layout + +## Main layout + +Inspired by my old typematrix dvorak keyboard, with escape, tab, enter and +backspace in the middle. + +``` + ,-----------------------------------------------------------------------------------. + | " | , | . | P | Y | / | = | F | G | C | R | L | + |------+------+------+------+------+------+------+------+------+------+------+------| + | A | O | E | U | I | ESC | BSPC | D | H | T | N | S | + |------+------+------+------+------+------+------+------+------+------+------+------| + | ; | Q | J | K | X | TAB | ENT | B | M | W | V | Z | + |------+------+------+------+------+------+------+------+------+------+------+------| + | Sft | Ctl | Alt | Gui |Lower | Space |Raise | < | v | ^ | > | + `-----------------------------------------------------------------------------------' + ``` + +## Lower + +With Lower, the numbers are on the home row. Brackets and braces are down the +centre of the keyboard when holding lower, and most other special characters, +can be found on the row below home. One row up are the main function keys. +The arrow keys become `Home`, `End` and `Page Up` and `Page Down`. + + ``` + ,-----------------------------------------------------------------------------------. + | F1 | F2 | F3 | F4 | F5 | { | } | F6 | F7 | F8 | F9 | F10 | + |------+------+------+------+------+-------------+------+------+------+------+------| + | 1 | 2 | 3 | 4 | 5 | [ | ] | 6 | 7 | 8 | 9 | 0 | + |------+------+------+------+------+------|------+------+------+------+------+------| + | ~ | | | ` | - | _ | INS | DEL | ( | ) | + | = | \ | + |------+------+------+------+------+------+------+------+------+------+------+------| + | Sft | Ctl | Alt | Gui |Lower | |Raise | Home | PgDn | PgUp | End | + `-----------------------------------------------------------------------------------' +``` + +## Raise + +With Raise, the middle row functions as though we are holding shift and typing +numbers. This makes it a little easier than trying to hold lower and shift at +the same time. The row below home is a set of keys mapped from `Gui-1` to +`Gui-0`. I use these to change virtual desktops on [i3](https://i3wm.org/). I +also include 'right' versions of the modifier keys on here. + + + ``` + ,-----------------------------------------------------------------------------------. + | F11 | F12 | F13 | F14 | F15 | | | F16 | F17 | F18 | F19 | F20 | + |------+------+------+------+------+-------------+------+------+------+------+------| + | ! | @ | # | $ | % |Sleep | Wake | ^ | & | * | ( | ) | + |------+------+------+------+------+-------------+------+------+------+------+------| + | GUI1 | GUI2 | GUI3 | GUI4 | GUI5 | | | GUI6 | GUI7 | GUI8 | GUI9 |GUI10 | + |------+------+------+------+------+------+------+------+------+------+------+------| + | Sft | Ctl | Alt | Gui |Lower | |Raise | Gui | Alt | Ctl | Sft | + `-----------------------------------------------------------------------------------' + +``` + +## Adjust + +Raise and lower at the same time give an adjustment layer, which allows +changing to the numpad and movement layer, and adjusting the backlights +(assuming you have them - I don't yet). I have also added various media keys +and the all-important `Reset` key for programming the keyboard. I've got the +ability to swap `Alt` and `Gui` in hardware and three special keys set up for +[hammerspoon]( http://www.hammerspoon.org/) on mac. If I ever start using this +keyboard seriously on mac again (I'm using it mainly on Windows and Linux atm) +I'll write a special Mac mode and redo all my hammerspoon config to be more +like i3 on Linux. + +``` + Adjust (Lower + Raise) + ,-----------------------------------------------------------------------------------. + | | Reset| | | |AGnorm|AGswap| | |HRevl |HReset|HMenu | + |------+------+------+------+------+-------------+------+------+------+------+------| + | PWR | EJCT | CUT | COPY |PASTE |PrScr |SysReq| CAPS | << | >> | Mute | Stop | + |------+------+------+------+------+------|------+------+------+------+------+------| + |DVORAK|NUMPAD| MVMT | SDRK | | | | | Next | Vol- | Vol+ | Play | + |------+------+------+------+------+------+------+------+------+------+------+------| + |Brite |BToggl| | | | | | Gui | Alt | Ctl | Sft | + `-----------------------------------------------------------------------------------' +``` + +## Numpad + +I have added a numpad, although this is a little annoying at the moment as you +have to first press `NumLock` to use. I guess I could make a macro so as soon as +you go into numpad mode it turns `NumLock` on. + +``` + ,-----------------------------------------------------------------------------------. + | | | | | | | |NumLck| 7 | 8 | 9 | / | + |------+------+------+------+------+------+------+------+------+------+------+------| + | | | | | | | |Enter | 4 | 5 | 6 | * | + |------+------+------+------+------+------+------+------+------+------+------+------| + |DVORAK|NUMPAD| MVMT | SDRK | | | | | 3 | 2 | 1 | - | + |------+------+------+------+------+-------------+------+------+------+------+------| + | | | | | | | | | 0 | . | + | + `-----------------------------------------------------------------------------------' +``` + +## Movement + +I have added a movement layer but at present I seldom use it. + +``` + ,-----------------------------------------------------------------------------------. + |MsBut2|MsWhDn|MsWhUp|MsBut1|MsBut3| | | | Home | PgDn | PgUp | End | + +------+------+------+------+------+------+------+------+------+------+------+------+ + |Ms Lft|Ms Dn |Ms Up |Ms Rht| | | | | Left | Down | Up | Right| + |------+------+------+------+------+------+------+------+------+------+------+------| + |DVORAK|NUMPAD| MVMT | SDRK | | | | | | | | | + |------+------+------+------+------+-------------+------+------+------+------+------| + | Sft | Ctl | Alt | Gui | | | | Gui | Alt | Ctl | Sft | + `-----------------------------------------------------------------------------------' +``` + +## Software Dvorak mode + +I have implemented a version of the main, lower and raise maps that works if +the computer itself is in dvorak mode at the os level. This allows me to work +well on my laptop when I have to take it with me (eg to go to a meeting) and +don't want the keyboard with me. I simply set it in dvorak mode in the os and +then put the keyboard into this mode. + +## TODO + +1. Actually learn to use the media keys diff --git a/keyboards/planck/old_keymap_files/common_keymaps/keymap_sean.c b/keyboards/planck/old_keymap_files/common_keymaps/keymap_sean.c index fb0eb7dadc..27a669e640 100644 --- a/keyboards/planck/old_keymap_files/common_keymaps/keymap_sean.c +++ b/keyboards/planck/old_keymap_files/common_keymaps/keymap_sean.c @@ -1,53 +1,104 @@ -#include "keymap.h" +#define KC_RESET 0x5000 +#include "keymap_common.h" + +enum planck_layers { + _DVRK, + _LOWER, + _RAISE, + _ADJUST +}; const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = KEYMAP( /* Matrix Dvorak */ + +/* Dvorak + * ,-----------------------------------------------------------------------------------. + * | " | , | . | P | Y | / | = | F | G | C | R | L | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | A | O | E | U | I | ESC | BSPC | D | H | T | N | S | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | ; | Q | J | K | X | TAB | ENT | B | M | W | V | Z | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Sft | Ctl | Alt | Gui |Lower | Space |Raise | < | v | ^ | > | + * `-----------------------------------------------------------------------------------' + */ + [_DVRK] = KEYMAP( QUOT, COMM, DOT, P, Y, SLSH, EQL, F, G, C, R, L, A, O, E, U, I, ESC, BSPC, D, H, T, N, S, SCLN, Q, J, K, X, TAB, ENT, B, M, W, V, Z, LSFT, LCTL, LALT, LGUI, FN1, SPC, FN2, LEFT, DOWN, UP, RGHT), - [1] = KEYMAP( /* Matrix Qwerty */ - Q, W, E, R, T, QUOT, EQL, Y, U, I, O, P, - A, S, D, F, G, ESC, BSPC, H, J, K, L, SCLN, - Z, X, C, V, B, TAB, ENT, N, M, COMM, DOT, SLSH, - LSFT, LCTL, LALT, LGUI, FN1, SPC, FN2, LEFT, DOWN, UP, RGHT), - - [2] = KEYMAP( /* fn1 lower */ - F1, F2, F3, F4, F5, NO, NO, F6, F7, F8, F9, F10, - 1, 2, 3, 4, 5, F18, DEL, 6, 7, 8, 9, 0, - FN3, FN4, FN28, GRV, MINS, TRNS, INS, BSLS, LBRC, RBRC, TRNS, TRNS, - TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, HOME, PGDN, PGUP, END), +/* Lower + * ,-----------------------------------------------------------------------------------. + * | F1 | F2 | F3 | F4 | F5 | { | } | F6 | F7 | F8 | F9 | F10 | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | 1 | 2 | 3 | 4 | 5 | [ | ] | 6 | 7 | 8 | 9 | 0 | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * | ~ | | | ` | - | _ | INS | DEL | ( | ) | + | = | \ | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | Sft | Ctl | Alt | Gui |Lower | Space |Raise | | PgDn | PgUp | End | + * `-----------------------------------------------------------------------------------' + */ + [_LOWER] = KEYMAP( /* fn1 lower */ + F1, F2, F3, F4, F5, FN26, FN27, F6, F7, F8, F9, F10, + 1, 2, 3, 4, 5, LBRC, RBRC, 6, 7, 8, 9, 0, + FN23, FN25, GRV,MINS, FN24, INS, DEL, FN19, FN20, FN22, EQL, BSLS, + TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, FN4, HOME, PGDN, PGUP, END), - [3] = KEYMAP( /* fn2 raise */ - MRWD, MPLY, MFFD, NO, NO, FN21, FN22, EJCT, PWR, LSFT,PAUSE, RSFT, - FN11, FN12, FN13, FN14, FN15, F18, DEL, FN16, FN17, FN18, FN19, FN20, - FN3, FN4, FN28, FN23, FN24, TRNS, INS, FN25, FN26, FN27, MPRV, MNXT, - TRNS, TRNS, TRNS, TRNS, FN1, TRNS, FN2, NO, VOLD, VOLU, MUTE), +/* Raise + * ,-----------------------------------------------------------------------------------. + * | F11 | F12 | F13 | F14 | F15 | - | _ | F16 | F17 | F18 | F19 | F20 | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | ! | @ | # | $ | % | | | ^ | & | * | ( | ) | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | | | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | CAPS | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ + [_RAISE] = KEYMAP( /* fn2 raise */ + F11, F12, F13, F14, F15,MINS, FN24, F16, F17, F18, F19, F20, + FN11, FN12, FN13, FN14, FN15, NO, NO, FN16, FN17, FN18, FN19, FN20, + PWR, EJCT, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, + CAPS, TRNS, TRNS, TRNS, FN4, TRNS, FN2, NO, NO, NO, NO), +/* Adjust (Lower + Raise or SLower + SRaise) + * ,-----------------------------------------------------------------------------------. + * | | Reset| | | | | | | | | | | + * |------+------+------+------+------+-------------+------+------+------+------+------| + * | PWR | EJCT | | | | | | CAPS | | | | | + * |------+------+------+------+------+------|------+------+------+------+------+------| + * |DVORAK| | | | | | | | | | | | + * |------+------+------+------+------+------+------+------+------+------+------+------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------------------' + */ +[_ADJUST] = KEYMAP( + NO, RESET, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, + PWR, EJCT, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, + CAPS, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, + NO, NO, NO, NO, NO, NO, NO, NO, NO, NO, NO), }; const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(2), // to Fn overlay LOWER - [2] = ACTION_LAYER_MOMENTARY(3), // to Fn overlay RAISE - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - - [11] = ACTION_MODS_KEY(MOD_LSFT, KC_1), - [12] = ACTION_MODS_KEY(MOD_LSFT, KC_2), - [13] = ACTION_MODS_KEY(MOD_LSFT, KC_3), - [14] = ACTION_MODS_KEY(MOD_LSFT, KC_4), - [15] = ACTION_MODS_KEY(MOD_LSFT, KC_5), - [16] = ACTION_MODS_KEY(MOD_LSFT, KC_6), - [17] = ACTION_MODS_KEY(MOD_LSFT, KC_7), - [18] = ACTION_MODS_KEY(MOD_LSFT, KC_8), - [19] = ACTION_MODS_KEY(MOD_LSFT, KC_9), - [20] = ACTION_MODS_KEY(MOD_LSFT, KC_0), - [21] = ACTION_MODS_KEY(MOD_LSFT, KC_SLSH), - [22] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL), - [23] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), - [24] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), - [25] = ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), - [26] = ACTION_MODS_KEY(MOD_LSFT, KC_LBRC), - [27] = ACTION_MODS_KEY(MOD_LSFT, KC_RBRC), + [1] = ACTION_LAYER_MOMENTARY(_LOWER), // to Fn overlay LOWER + [2] = ACTION_LAYER_MOMENTARY(_RAISE), // to Fn overlay RAISE + [3] = ACTION_DEFAULT_LAYER_SET(_DVRK), + [4] = ACTION_LAYER_MOMENTARY(_ADJUST), // RAISE + LOWER + [11] = ACTION_MODS_KEY(MOD_LSFT, KC_1), //! + [12] = ACTION_MODS_KEY(MOD_LSFT, KC_2), //@ + [13] = ACTION_MODS_KEY(MOD_LSFT, KC_3), //# + [14] = ACTION_MODS_KEY(MOD_LSFT, KC_4), //$ + [15] = ACTION_MODS_KEY(MOD_LSFT, KC_5), //% + [16] = ACTION_MODS_KEY(MOD_LSFT, KC_6), //^ + [17] = ACTION_MODS_KEY(MOD_LSFT, KC_7), //& + [18] = ACTION_MODS_KEY(MOD_LSFT, KC_8), //* + [19] = ACTION_MODS_KEY(MOD_LSFT, KC_9), //( + [20] = ACTION_MODS_KEY(MOD_LSFT, KC_0), //) + [21] = ACTION_MODS_KEY(MOD_LSFT, KC_SLSH), //? + [22] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL), //+ + [23] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), //~ + [24] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), //_ + [25] = ACTION_MODS_KEY(MOD_LSFT, KC_BSLS), //| + [26] = ACTION_MODS_KEY(MOD_LSFT, KC_LBRC), //{ + [27] = ACTION_MODS_KEY(MOD_LSFT, KC_RBRC), //} [28] = ACTION_MODS_KEY(MOD_LSFT | MOD_RSFT, KC_PAUSE), }; From 7da585917b44d51e53482445437fb0bd54209b2a Mon Sep 17 00:00:00 2001 From: Goel Date: Sun, 10 Sep 2017 15:42:10 +0530 Subject: [PATCH 15/51] updated read.md file --- keyboards/ergodone/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/ergodone/readme.md b/keyboards/ergodone/readme.md index 789819e67a..468f0605a6 100644 --- a/keyboards/ergodone/readme.md +++ b/keyboards/ergodone/readme.md @@ -12,7 +12,7 @@ ErgoDone is a modified ErgoDox with pre-soldered components made by K.T.E.C. It Make example for this keyboard (after setting up your build environment): - make ergodox-ergodone-default + make ergodone-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. From 4549dcd21fcc7c3d0dad685df7221599dcb6edb1 Mon Sep 17 00:00:00 2001 From: Danny Date: Wed, 13 Sep 2017 17:53:10 -0400 Subject: [PATCH 16/51] Add support for MF68 replacement PCB for Magicforce 68 (#1698) * Port TMK code for MF68 * Change KEYMAP to KC_KEYMAP and add macro --- keyboards/mf68/README.md | 20 +++ keyboards/mf68/config.h | 162 ++++++++++++++++++++++++ keyboards/mf68/keymaps/default/keymap.c | 68 ++++++++++ keyboards/mf68/mf68.c | 8 ++ keyboards/mf68/mf68.h | 40 ++++++ keyboards/mf68/rules.mk | 66 ++++++++++ 6 files changed, 364 insertions(+) create mode 100644 keyboards/mf68/README.md create mode 100644 keyboards/mf68/config.h create mode 100644 keyboards/mf68/keymaps/default/keymap.c create mode 100644 keyboards/mf68/mf68.c create mode 100644 keyboards/mf68/mf68.h create mode 100644 keyboards/mf68/rules.mk diff --git a/keyboards/mf68/README.md b/keyboards/mf68/README.md new file mode 100644 index 0000000000..1fabd93721 --- /dev/null +++ b/keyboards/mf68/README.md @@ -0,0 +1,20 @@ +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) + +Make example for this keyboard (after setting up your build environment): + + make mf68-default + +Example of flashing this keyboard: + + make mf68-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/mf68/config.h b/keyboards/mf68/config.h new file mode 100644 index 0000000000..07d787eacf --- /dev/null +++ b/keyboards/mf68/config.h @@ -0,0 +1,162 @@ +/* +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 0xCEEB +#define PRODUCT_ID 0x0510 +#define DEVICE_VER 0x0101 +#define MANUFACTURER di0ib +#define PRODUCT MF68 +#define DESCRIPTION Magicforce 68 with programmable PCB replacement + +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 9 + +/* + * Keyboard Matrix Assignments + * + * Change this to how you wired your keyboard + * COLS: AVR pins used for columns, left to right + * ROWS: AVR pins used for rows, top to bottom + * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode) + * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode) + * +*/ +#define MATRIX_ROW_PINS { B6, B2, B3, B1, F7, F6, F5, F4 } +#define MATRIX_COL_PINS { D3, D2, D1, D0, D4, C6, D7, E6, B4 } +#define UNUSED_PINS + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +#define BACKLIGHT_PIN B5 +#define BACKLIGHT_BREATHING +#define BACKLIGHT_LEVELS 3 + + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCING_DELAY 5 + +/* define if matrix has ghost (lacks anti-ghosting diodes) */ +//#define MATRIX_HAS_GHOST + +/* number of backlight levels */ + +/* 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 + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Magic Key Options + * + * Magic keys are hotkey commands that allow control over firmware functions of + * the keyboard. They are best used in combination with the HID Listen program, + * found here: https://www.pjrc.com/teensy/hid_listen.html + * + * The options below allow the magic key functionality to be changed. This is + * useful if your keyboard/keypad is missing keys and you want magic key support. + * + */ + +/* key combination for magic key command */ +#define IS_COMMAND() ( \ + keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ +) + +/* control how magic key switches layers */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false + +/* override magic key keymap */ +//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS +//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM +//#define MAGIC_KEY_HELP1 H +//#define MAGIC_KEY_HELP2 SLASH +//#define MAGIC_KEY_DEBUG D +//#define MAGIC_KEY_DEBUG_MATRIX X +//#define MAGIC_KEY_DEBUG_KBD K +//#define MAGIC_KEY_DEBUG_MOUSE M +//#define MAGIC_KEY_VERSION V +//#define MAGIC_KEY_STATUS S +//#define MAGIC_KEY_CONSOLE C +//#define MAGIC_KEY_LAYER0_ALT1 ESC +//#define MAGIC_KEY_LAYER0_ALT2 GRAVE +//#define MAGIC_KEY_LAYER0 0 +//#define MAGIC_KEY_LAYER1 1 +//#define MAGIC_KEY_LAYER2 2 +//#define MAGIC_KEY_LAYER3 3 +//#define MAGIC_KEY_LAYER4 4 +//#define MAGIC_KEY_LAYER5 5 +//#define MAGIC_KEY_LAYER6 6 +//#define MAGIC_KEY_LAYER7 7 +//#define MAGIC_KEY_LAYER8 8 +//#define MAGIC_KEY_LAYER9 9 +//#define MAGIC_KEY_BOOTLOADER PAUSE +//#define MAGIC_KEY_LOCK CAPS +//#define MAGIC_KEY_EEPROM E +//#define MAGIC_KEY_NKRO N +//#define MAGIC_KEY_SLEEP_LED Z + +/* + * 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/mf68/keymaps/default/keymap.c b/keyboards/mf68/keymaps/default/keymap.c new file mode 100644 index 0000000000..fd8810d528 --- /dev/null +++ b/keyboards/mf68/keymaps/default/keymap.c @@ -0,0 +1,68 @@ +#include "mf68.h" + +#define _QWERTY 0 +#define _FN1 1 +#define _FN2 2 +#define KC_ KC_TRNS +#define KC_X0 LT(_FN2, KC_GRV) +#define KC_X1 MO(_FN1) +#define KC_X2 BL_STEP + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_QWERTY] = KC_KEYMAP( + /*,----+----+----+----+----+----+----+----+----+----+----+----+----+--------. ,----+----. */ + ESC , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 0 ,MINS,EQL , BSPC , INS ,PGUP, + /*|----`----`----`----`----`----`----`----`----`----`----`----`----`--------| |----`----| */ + TAB , Q , W , E , R , T , Y , U , I , O , P ,LBRC,RBRC, BSLS , DEL ,PGDN, + /*|------`----`----`----`----`----`----`----`----`----`----`----`----`------| `----`----' */ + X0 , A , S , D , F , G , H , J , K , L ,SCLN,QUOT, ENTER , + /*|-------`----`----`----`----`----`----`----`----`----`----`----`----------| ,----. */ + LSFT , Z , X , C , V , B , N , M ,COMM,DOT ,SLSH, RSFT , UP , + /*|---------`----`----`----`----`----`----`----`----`----`----`-------------.--|----|----. */ + LCTL ,LGUI ,LALT , SPACE , X1 ,RALT ,RCTL , LEFT,DOWN,RGHT + /*`-----+-----+-----+------------------------------+------+-----+-----' `----+----+----' */ + ), + + [_FN1] = KC_KEYMAP( + /*,----+----+----+----+----+----+----+----+----+----+----+----+----+--------. ,----+----. */ + GRV , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,F12 , BSPC , VOLU,HOME, + /*|esc-`-1--`-2--`-3--`-4--`-5--`-6--`-7--`-8--`-9--`-0--`mnus`plus`--bksp--| |ins-`pgup| */ + , , , UP , , , , , , , , , X2 , , VOLD,END, + /*|tab---`-q--`-w--`-e--`-r--`-t--`-y--`-u--`-i--`-o--`-p--`-{--`-}--`--|---| `del-`pgdn' */ + , ,LEFT,DOWN,RGHT, , , , , , , , , + /*|caps---`-a--`-s--`-d--`-f--`-g--`-h--`-j--`-k--`-l--`-;--`-'--`----enter-| ,----. */ + , , , , , , ,MUTE, , , , , MUTE, + /*|shift----`-z--`-x--`-c--`-v--`-b--`-n--`-m--`-,--`-.--`-/--`-------shift-.--|-up-|----. */ + , , , , , , , MPRV,MPLY,MNXT + /*`ctrl-+-gui-+-alt-+----------space---------------+-fn---+-alt-+ctrl-' `left+down+rght' */ + ), + + [_FN2] = KC_KEYMAP( + /*,----+----+----+----+----+----+----+----+----+----+----+----+----+--------. ,----+----. */ + GRV , F1 , F2 , F3 , F4 , F5 , F6 , F7 , F8 , F9 ,F10 ,F11 ,F12 , BSPC , VOLU,HOME, + /*|esc-`-1--`-2--`-3--`-4--`-5--`-6--`-7--`-8--`-9--`-0--`mnus`plus`--bksp--| |ins-`pgup| */ + , , , UP , , , , 7 , 8 , 9 , , , , , VOLD,END, + /*|tab---`-q--`-w--`-e--`-r--`-t--`-y--`-u--`-i--`-o--`-p--`-{--`-}--`--|---| `del-`pgdn' */ + , ,LEFT,DOWN,RGHT, , , 4 , 5 , 6 , , , , + /*|caps---`-a--`-s--`-d--`-f--`-g--`-h--`-j--`-k--`-l--`-;--`-'--`----enter-| ,----. */ + , , , , , , 0 , 1 , 2 , 3 , , , MUTE, + /*|shift----`-z--`-x--`-c--`-v--`-b--`-n--`-m--`-,--`-.--`-/--`-------shift-.--|-up-|----. */ + , , , , , , , MPRV,MPLY,MNXT + /*`ctrl-+-gui-+-alt-+----------space---------------+-fn---+-alt-+ctrl-' `left+down+rght' */ + ) +}; + +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; +}; diff --git a/keyboards/mf68/mf68.c b/keyboards/mf68/mf68.c new file mode 100644 index 0000000000..1da522e7e1 --- /dev/null +++ b/keyboards/mf68/mf68.c @@ -0,0 +1,8 @@ +#include "mf68.h" + +void matrix_init_kb(void) { + // put your keyboard start-up code here + // runs once when the firmware starts up + + matrix_init_user(); +} diff --git a/keyboards/mf68/mf68.h b/keyboards/mf68/mf68.h new file mode 100644 index 0000000000..316e3b87fc --- /dev/null +++ b/keyboards/mf68/mf68.h @@ -0,0 +1,40 @@ +#ifndef MF68_H +#define MF68_H + +#include "quantum.h" + +#define KEYMAP( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K10, K11, K12, K13, K14, K15, K16, \ + K17, K18, K20, K21, K22, K23, K24, K25, K26, K27, K28, K30, K31, K32, K33, K34, \ + K35, K36, K37, K38, K40, K41, K42, K43, K44, K45, K46, K47, K48, \ + K50, K51, K52, K53, K54, K55, K56, K57, K58, K60, K61, K62, K63, \ + K64, K65, K66, K67, K68, K70, K71, K72, K73, K74 \ +) { \ + { K00, K01, K02, K03, K04, K05, K06, K07, K08 }, \ + { K10, K11, K12, K13, K14, K15, K16, K17, K18 }, \ + { K20, K21, K22, K23, K24, K25, K26, K27, K28 }, \ + { K30, K31, K32, K33, K34, K35, K36, K37, K38 }, \ + { K40, K41, K42, K43, K44, K45, K46, K47, K48 }, \ + { K50, K51, K52, K53, K54, K55, K56, K57, K58 }, \ + { K60, K61, K62, K63, K64, K65, K66, K67, K68 }, \ + { K70, K71, K72, K73, K74 } \ +} + +#define KC_KEYMAP( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K10, K11, K12, K13, K14, K15, K16, \ + K17, K18, K20, K21, K22, K23, K24, K25, K26, K27, K28, K30, K31, K32, K33, K34, \ + K35, K36, K37, K38, K40, K41, K42, K43, K44, K45, K46, K47, K48, \ + K50, K51, K52, K53, K54, K55, K56, K57, K58, K60, K61, K62, K63, \ + K64, K65, K66, K67, K68, K70, K71, K72, K73, K74 \ +) KEYMAP( \ + KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, \ + KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, \ + KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, \ + KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, \ + KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46, KC_##K47, KC_##K48, \ + KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56, KC_##K57, KC_##K58, \ + KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66, KC_##K67, KC_##K68, \ + KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74 \ +) + +#endif diff --git a/keyboards/mf68/rules.mk b/keyboards/mf68/rules.mk new file mode 100644 index 0000000000..a535a9d0e5 --- /dev/null +++ b/keyboards/mf68/rules.mk @@ -0,0 +1,66 @@ + +# 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* +# Teensy halfKay 512 +# Teensy++ halfKay 1024 +# Atmel DFU loader 4096 +# LUFA bootloader 4096 +# USBaspLoader 2048 +OPT_DEFS += -DBOOTLOADER_SIZE=4096 + +# Build Options +# change yes to no to disable +# +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 ?= yes # Console for debug(+400) +COMMAND_ENABLE ?= yes # Commands for debug and configuration +# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE +SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend +# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work +NKRO_ENABLE ?= no # USB Nkey Rollover +BACKLIGHT_ENABLE ?= yes # Enable keyboard backlight functionality on B7 by default +MIDI_ENABLE ?= no # MIDI controls +UNICODE_ENABLE ?= no # Unicode +BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID +AUDIO_ENABLE ?= no # Audio output on port C6 From 23ce0b43b669c4ca4c9217bbb8927af401556650 Mon Sep 17 00:00:00 2001 From: Harshit Goel Date: Thu, 14 Sep 2017 22:35:29 +0530 Subject: [PATCH 17/51] Further updated ergodone readme.md (#1714) * updated read.md file * added image to flash hex on ergodone * corrected image link * updated direct image link * image with larger text --- keyboards/ergodone/readme.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/keyboards/ergodone/readme.md b/keyboards/ergodone/readme.md index 468f0605a6..9d7057a396 100644 --- a/keyboards/ergodone/readme.md +++ b/keyboards/ergodone/readme.md @@ -20,7 +20,8 @@ See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) The ErgoDone uses an HID bootloader rather than the Teensy one, and requires a different way of flashing the firmware. -1. While plugging in the USB cable, hold the two right-most keys on the left half of the ErgoDone to enter FLASH mode. +1. While plugging in the USB cable, hold the two right-most keys on the top row of the left half of the ErgoDone to enter FLASH mode and flash a hex file. +![Ergodone Flash Mode](https://i.imgur.com/sNivAnr.jpg) 2. Use the `hid_bootloader_cli` utlity from [TKG Toolkit](https://github.com/kairyu/tkg-toolkit): hid_bootloader_cli -mmcu=atmega32u4 ergodox_ergodone_default From a07d1f22aa111d3aaf0903a3cbaeb27b98f2c55e Mon Sep 17 00:00:00 2001 From: Christopher Browne Date: Thu, 14 Sep 2017 14:02:49 -0400 Subject: [PATCH 18/51] Some revisions to cbbrowne Planck keymap, and a preliminary xd75 keymap (#1715) * Add HOME/END keys as upper/lower on arrow-up/down * Reduce .hex file size by turning off unneeded options * Put digit keypad onto left hand upon RAISE; this will sometimes be preferable to double-hits of right hand * Latest super latest version merge * cbbrowne keymap for XD75re * starting notes on XD75re keymap plans * First draft of bottom row of QWERTY * Switch my special bottom line over to QCENT * Dunno * Filling in wanted keys, bit by bit... * Add copyright, extra macro * Clean up comments, remove some experimental code I didn't like * TODO plans for xd75re * clean up keyboard layout * QCENT2 is my new experiment for the main keyboard... * Add a few more main layer keys, and modify LOWER to shift things outwards to conform with main layer * Clean up RAISE layer to conform with main layer, remove QCENT layer as QCENT2 is the new thing * More xd75 changes, now that I actually have it in hand * shift keymap around, as original attempt was a bit too aggressive in keeping to the edges * more revs to XD75 * Dropping parts of the centre keypad in favor of Keys I Really Need * Improve documentation to conform with how builds are done now * Improve documentation to conform with how builds are done now * Add cbbrowne rules file as alternative to having the rules in Makefile * Makefile not needed anymore for individual keymap --- keyboards/planck/keymaps/cbbrowne/config.h | 17 ++ keyboards/planck/keymaps/cbbrowne/keymap.c | 146 +++++++++- keyboards/planck/keymaps/cbbrowne/readme.md | 15 +- keyboards/planck/keymaps/cbbrowne/rules.mk | 2 - keyboards/xd75/Makefile | 18 -- keyboards/xd75/keymaps/cbbrowne/Makefile | 38 +++ keyboards/xd75/keymaps/cbbrowne/config.h | 44 +++ keyboards/xd75/keymaps/cbbrowne/keymap.c | 297 ++++++++++++++++++++ keyboards/xd75/keymaps/cbbrowne/readme.md | 22 ++ keyboards/xd75/readme.md | 34 ++- 10 files changed, 596 insertions(+), 37 deletions(-) delete mode 100644 keyboards/xd75/Makefile create mode 100644 keyboards/xd75/keymaps/cbbrowne/Makefile create mode 100644 keyboards/xd75/keymaps/cbbrowne/config.h create mode 100644 keyboards/xd75/keymaps/cbbrowne/keymap.c create mode 100644 keyboards/xd75/keymaps/cbbrowne/readme.md diff --git a/keyboards/planck/keymaps/cbbrowne/config.h b/keyboards/planck/keymaps/cbbrowne/config.h index 3a4ee907f4..d92790635e 100644 --- a/keyboards/planck/keymaps/cbbrowne/config.h +++ b/keyboards/planck/keymaps/cbbrowne/config.h @@ -1,3 +1,19 @@ +/* Copyright 2017 Christopher Browne + * + * 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 @@ -23,6 +39,7 @@ * borrowed from basic keymap */ #define _______ KC_TRNS +#define _____ KC_NO #endif diff --git a/keyboards/planck/keymaps/cbbrowne/keymap.c b/keyboards/planck/keymaps/cbbrowne/keymap.c index 0448a8d11c..d1214dda12 100644 --- a/keyboards/planck/keymaps/cbbrowne/keymap.c +++ b/keyboards/planck/keymaps/cbbrowne/keymap.c @@ -40,11 +40,11 @@ /* Some interesting things implemented - - There is a macro that writes out "cbbrowne" to show that I could + - There is a macro that writes out "cbbrowne" just to show that I + could - There is a (somewhat cruddy) linear congruential random number generator. - - I would like to be seeding it with clock info to make it look - more random + - I seed it somewhat with clock info to make it look more random - There are two macros that use the random number generators - one, M_RANDDIGIT, generates a random digit based on state of the random number generator @@ -59,10 +59,12 @@ - Need to think about what zsh and readline actions I use lots - Ought to ensure that Control-Alt-Delete is convenient enough - - How about Alt-F1 thru Alt-F8? + - How about Alt-F1 thru Alt-F8? Not yet... - What's the keystroke to get from X to console these days? - A layer for doing console switching would not be a bad idea - - I haven't got page-up/page-down, let's have that... + + - I'm messing with jeremy-dev's keymap that shifts everything + outwards. Gotta figure out how to make it sensible... */ enum layers { @@ -71,6 +73,21 @@ enum layers { _RAISE, /* Raised layer, where top line has digits 1234567890 */ _KEYPAD, /* Key pad */ _ADJUST, /* Special Adjust layer coming via tri-placement */ + +}; + +enum my_keycodes { + MY_ABVE = SAFE_RANGE, + MY_BELW, + MY_TERM, + MY_DEQL, // /= + MY_MEQL, // *= + MY_SEQL, // -= + MY_PEQL, // += + MY_NEQL, // != + MY_LTGT, // <> + MY_DPIP, // || + MY_DAMP, // && }; enum macro_id { @@ -132,9 +149,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { {_______, RANDDIG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, {_______, RANDALP, _______, _______, _______, RESET, RESET, _______, _______, _______, _______, _______ }, {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ } -} +} }; + /* What is fn_actions actually used for??? */ const uint16_t PROGMEM fn_actions[] = { }; @@ -233,3 +251,119 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) } return MACRO_NONE; }; + +void press_key(uint16_t key) { + register_code(key); + unregister_code(key); +} + +void press_two_keys(uint16_t key1, uint16_t key2) { + register_code(key1); + register_code(key2); + unregister_code(key2); + unregister_code(key1); +} + +void press_three_keys(uint16_t key1, uint16_t key2, uint16_t key3) { + register_code(key1); + register_code(key2); + register_code(key3); + unregister_code(key3); + unregister_code(key2); + unregister_code(key1); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case MY_BELW: + if (record->event.pressed) { + press_two_keys(KC_LGUI, KC_RGHT); + press_key(KC_ENT); + } + + return false; + + case MY_ABVE: + if (record->event.pressed) { + press_two_keys(KC_LGUI, KC_LEFT); + press_key(KC_ENT); + press_key(KC_UP); + } + + return false; + + case MY_TERM: + if (record->event.pressed) { + press_three_keys(KC_LGUI, KC_LSFT, KC_ENT); + } + + return false; + + case MY_DEQL: // /= + if (record->event.pressed) { + press_key(KC_SLSH); + press_key(KC_EQL); + } + + return false; + + case MY_MEQL: // *= + if (record->event.pressed) { + press_two_keys(KC_LSFT, KC_ASTR); + press_key(KC_EQL); + } + + return false; + + case MY_SEQL: // -= + if (record->event.pressed) { + press_key(KC_MINS); + press_key(KC_EQL); + } + + return false; + + case MY_PEQL: // += + if (record->event.pressed) { + press_two_keys(KC_LSFT, KC_PLUS); + press_key(KC_EQL); + } + + return false; + + case MY_NEQL: // != + if (record->event.pressed) { + press_two_keys(KC_LSFT, KC_EXLM); + press_key(KC_EQL); + } + + return false; + + case MY_LTGT: // <> + if (record->event.pressed) { + press_two_keys(KC_LSFT, KC_LABK); + press_two_keys(KC_LSFT, KC_RABK); + } + + return false; + + case MY_DPIP: // || + if (record->event.pressed) { + press_two_keys(KC_LSFT, KC_PIPE); + press_two_keys(KC_LSFT, KC_PIPE); + } + + return false; + + case MY_DAMP: // && + if (record->event.pressed) { + press_two_keys(KC_LSFT, KC_AMPR); + press_two_keys(KC_LSFT, KC_AMPR); + } + + return false; + } + + return true; +} + diff --git a/keyboards/planck/keymaps/cbbrowne/readme.md b/keyboards/planck/keymaps/cbbrowne/readme.md index 184142e0c1..e55b130eff 100644 --- a/keyboards/planck/keymaps/cbbrowne/readme.md +++ b/keyboards/planck/keymaps/cbbrowne/readme.md @@ -61,7 +61,7 @@ doing sundry experimentation: interesting idea to express the maps rotated 90%, so that you only need to fit 4 symbols onto each line, rather than 12. - I used enums to manage layer IDs and macro IDs so that I don't need + I use enums to manage layer IDs and macro IDs so that I don't need to care (beyond "start at 0", and arguably even that's not needed) about their values. @@ -102,12 +102,21 @@ unwise things again... * I use tmux quite a lot; the mollat keymap seems to have some interesting helpers. It might be interesting to add a "tmux layer," or to have a few keys in a layer oriented towards that + - Keys for... + - Picking windows 0 thru 8 + - next/prev/new window * The mollat tmux layer also suggests some thoughts about Emacs - helpers. + helpers. * I do not presently have anything that handles X11 screen switching, as with Control-Alt-various * I ought to probably look into KC_LEAD, to have some key combos that do not need to be concurrent * The jeebak keymap seems to have some neat ideas: - Number layer which is aggressive about having numbers in several places - - Touch layer seems interesting + - TouchCursor layer seems interesting + - It sets up a layer with cursor keys on the home keys + * The jeremy-dev keymap has some very interesting concepts + - Shift hands outwards; the special keys go in the center + - Symbol layer has some compound keys for C operators like /=, *=, -=, +=, ... + - This is likely what I'll use for my XD75re, and maybe I'll fork a + planck keymap for similar diff --git a/keyboards/planck/keymaps/cbbrowne/rules.mk b/keyboards/planck/keymaps/cbbrowne/rules.mk index 19e5c2a844..d5026e2d9b 100644 --- a/keyboards/planck/keymaps/cbbrowne/rules.mk +++ b/keyboards/planck/keymaps/cbbrowne/rules.mk @@ -1,5 +1,3 @@ - - # 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 diff --git a/keyboards/xd75/Makefile b/keyboards/xd75/Makefile deleted file mode 100644 index 840dc9a286..0000000000 --- a/keyboards/xd75/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2013 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 MAKEFILE_INCLUDED - include ../../Makefile -endif diff --git a/keyboards/xd75/keymaps/cbbrowne/Makefile b/keyboards/xd75/keymaps/cbbrowne/Makefile new file mode 100644 index 0000000000..89b0b9a8e9 --- /dev/null +++ b/keyboards/xd75/keymaps/cbbrowne/Makefile @@ -0,0 +1,38 @@ +# Copyright 2013 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 . + + +# QMK 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 = no # Mouse keys(+4700) +EXTRAKEY_ENABLE = no # 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 support (+2400 to 4200, depending on config) +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 = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +API_SYSEX_ENABLE = no # Enable SYSEX API (+5390) + +ifndef QUANTUM_DIR + include ../../../../Makefile +endif diff --git a/keyboards/xd75/keymaps/cbbrowne/config.h b/keyboards/xd75/keymaps/cbbrowne/config.h new file mode 100644 index 0000000000..cc583f0aed --- /dev/null +++ b/keyboards/xd75/keymaps/cbbrowne/config.h @@ -0,0 +1,44 @@ +/* Copyright 2017 REPLACE_WITH_YOUR_NAME + * + * 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 + +#ifndef NO_DEBUG +#define NO_DEBUG +#endif +#ifndef NO_PRINT +#define NO_PRINT +#endif + +#include "../../config.h" + +#define LEADER_TIMEOUT 300 +#define BACKLIGHT_BREATHING + +/* cbbrowne user configuration */ + +#define randadd 53 +#define randmul 181 +#define randmod 167 + +/* Filler to make layering a bit clearer * + * borrowed from basic keymap */ + +#define _______ KC_TRNS +#define _____ KC_NO + +#endif diff --git a/keyboards/xd75/keymaps/cbbrowne/keymap.c b/keyboards/xd75/keymaps/cbbrowne/keymap.c new file mode 100644 index 0000000000..5496ed40dd --- /dev/null +++ b/keyboards/xd75/keymaps/cbbrowne/keymap.c @@ -0,0 +1,297 @@ +/* Copyright 2017 REPLACE_WITH_YOUR_NAME + * + * 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 "xd75.h" + +/* Fillers to make layering more clear */ +#define _______ KC_TRNS +#define ___T___ KC_TRNS +#define XXXXXXX KC_NO + +/* Layer shorthand */ + +enum layers { + _QWERTY = 0, /* Qwerty mapping */ + _LOWER, /* Lower layer, where top line has symbols !@#$%^&*() */ + _RAISE, /* Raised layer, where top line has digits 1234567890 */ + _ADJUST, /* Special Adjust layer coming via tri-placement */ + _FUNCTION /* Function key layer */ +}; + + +/* Macros need to be uniquely identified; using an enum to do this + automatically + */ + +enum macro_id { + M_LED = 0, + M_USERNAME, + M_RANDDIGIT, + M_RANDLETTER, + M_VERSION, + MACRO_UPPER, + MACRO_LOWER, +}; + +/* I want some short forms for keycodes so that they fit into + limited-width cells */ + +#define M_LOWER M(MACRO_LOWER) +#define M_UPPER M(MACRO_UPPER) +#define ROT_LED M(M_LED) /* Rotate LED */ +#define QWERTY DF(_QWERTY) /* Switch to QWERTY layout */ +#define QCENT2 DF(_QCENT2) /* Switch to QWERTY-with-centre layout */ +#define USERNAME M(M_USERNAME) /* shortcut for username */ +#define RANDDIG M(M_RANDDIGIT) +#define RANDALP M(M_RANDLETTER) +#define CTLENTER MT(MOD_RCTL, KC_ENT) +#define SHIFTQUOTE MT(MOD_RSFT, KC_QUOT) +#define ALTRIGHT MT(MOD_LALT, KC_RGHT) +#define MVERSION M(M_VERSION) +#define ALTSLASH LALT(KC_SLSH) +#define FUNCTION MO(_FUNCTION) +#define MRAISE MO(_RAISE) +#define MLOWER MO(_LOWER) +#define ALTBSP ALT_T(KC_BSPC) + +/* More modifiers for QCENT2... */ +#define PALT MT(KC_RALT, KC_P) +#define SCTL MT(KC_RCTL, KC_SCLN) +#define SSHF MT(KC_RSFT, KC_SLSH) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + +/* QWERTY - MIT ENHANCED / GRID COMPATIBLE + * .---------------------------------------------------------------------------------------------------------------------- 2u ------------. + * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | XXXXXX . BACKSP | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| + * | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | DEL | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------| + * | ESC | A | S | D | F | G | H | J | K | L | ; | ' | XXXXXX . ENTER | PG UP | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------| + * | LSHIFT | Z | X | C | V | B | N | M | , | . | / | XXXXXX . RSHIFT | UP | PG DN | + * |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------| + * | BRITE | LCTRL | LALT | LGUI | RAISE | XXXXXX . SPACE | LOWER | RGUI | RALT | RCTRL | FN | LEFT | DOWN | RIGHT | + * '--------------------------------------------------------------------------------------------------------------------------------------' + */ + + /* layout for centred keypad + qwerty... + +|ESC| 1 | 2 | 3 | 4 | 5 | ? | ? | ? | ? | 6 | 7 | 8 | 9 | 0 | +|TAB| q | w | e | r | t | ? | ? | ? | ? | y | u | i | o | p | +|CTL| a | s | d | f | g | ? | ? | ? | ? | h | j | k | l | ; | +|SHF| z | x | c | v | b | ? | ? | ? | ? | n | m | , | . | / | +|ALT|LED| | | | | | | | | | | | | | + + + + +keys needing to be assigned: +11 - KC_TAB - tab +52 - ROT_LED - rotate LED +15 - KC_LALT - Left ALT + - KC_LGUI - this is the windows/command key, which I think I do not use... + - M_LOWER - switch to LOWER layer + - KC_SPC - space + - M_UPPER - switch to UPPER layer, maybe unneeded for 15x5 + - KC_LEFT - famous arrows + - KC_DOWN - famous arrows + - KC_UP - famous arrows + - KC_RIGHT - famous arrows + - KC_ENT - enter + - KC_GRV - leftwards quote + - KC_QUOT - rightwards quote + - KC_BSPC - backspace + - KC_ESC + +Missing still... + KC_LBRC and KC_LCBR + KC_RBRC and KC_RCBR + + */ + + [_QWERTY] = { /* QWERTY, with keypad in the centre */ + { KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_EQL, KC_MINS, RESET, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC }, + { KC_LALT, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_7, KC_8, KC_EQL, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_PLUS }, + { KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_4, KC_5, KC_MINS, KC_H, KC_J, KC_K, KC_L, KC_SCLN, CTLENTER }, + { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_1, KC_2, KC_BSLS, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SHIFTQUOTE }, + { KC_TAB, FUNCTION, MRAISE, FUNCTION, MRAISE, KC_SPC, KC_0, KC_MINS, KC_SPC, KC_SPC, MLOWER, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT } + }, + +/* LOWER + * .---------------------------------------------------------------------------------------------------------------------- 2u ------------. + * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | XXXXXX . | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| + * | | ! | @ | # | $ | % | ^ | & | * | ( | ) | | | | INS | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------| + * | | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | XXXXXX . | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------| + * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | | XXXXXX . | | | + * |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------| + * | | | | | | XXXXXX . | | | | | | | | | + * '--------------------------------------------------------------------------------------------------------------------------------------' + */ + + [_LOWER] = { /* LOWERED */ + { ___T___, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, _______, _______, _______, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11 }, + { ___T___, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_INS }, + { ___T___, 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, _______, _______, _______, _______, _______, ___T___, ___T___, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + }, + +/* RAISED + * .---------------------------------------------------------------------------------------------------------------------- 2u ------------. + * | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | XXXXXX . | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| + * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | | | | INS | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------| + * | | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | XXXXXX . | | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------| + * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | | XXXXXX . | | | + * |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------| + * | | | | | | XXXXXX . | | | | | | | | | + * '--------------------------------------------------------------------------------------------------------------------------------------' + */ + + [_RAISE] = { /* RAISED */ + { KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___ }, + { KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, _______, _______, KC_7, KC_8, KC_9, KC_0, _______, _______, KC_INS }, + { KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, ___T___, ___T___ }, + { KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ }, + { _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ }, + }, + +/* FUNCTION + * .---------------------------------------------------------------------------------------------------------------------- 2u ------------. + * | NUM LK | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | XXXXXX . | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------| + * | SCR LK | F13 | F14 | F15 | F16 | F17 | F18 | F19 | F20 | F21 | F22 | F23 | F24 | PAUSE | PR SCR | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------| + * | CAP LK | MS BT5 | MS BT4 | MS BT3 | MS BT2 | SLOW M | FAST M | NEXT | VOL+ | VOL- | PLAY | | XXXXXX . | WHEEL+ | + * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------| + * | RGB TG | RGB MD | RGB HI | RGB HD | RGB SI | RGB SD | RGB VI | RGB VD | BL TOG | BL INC | BL DEC | XXXXXX . | MOUS Un | WHEEL- | + * |--------+--------+--------+--------+--------+-- 2u -----------+--------+--------+--------+--------+-----------------+--------+--------| + * | RESET | | QWERTY | COLEMK | DVORAK | XXXXXX . MS BT1 | | | | | | MOUS L | MOUS D | MOUS R | + * '--------------------------------------------------------------------------------------------------------------------------------------' + */ + + [_FUNCTION] = { /* FUNCTION */ + { KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ }, + { KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR }, + { KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U }, + { RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, BL_TOGG, BL_INC, BL_DEC, ___T___, ___T___, KC_MS_U, KC_WH_D }, + { RESET , _______, DF(_QWERTY), DF(_QWERTY), DF(_QWERTY), KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R }, + }, +}; + +const uint16_t PROGMEM fn_actions[] = { + +}; + +/* This bit of logic seeds a wee linear congruential random number generator */ +/* lots of prime numbers everywhere... */ +static uint16_t random_value = 157; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + uint8_t clockbyte=0; + clockbyte = TCNT1 % 256; + uint8_t rval; + /* MACRODOWN only works in this function */ + switch(id) { + case 0: + if (record->event.pressed) { + register_code(KC_RSFT); +#ifdef BACKLIGHT_ENABLE + backlight_step(); +#endif + } else { + unregister_code(KC_RSFT); + } + break; + case M_USERNAME: + if (record->event.pressed) { + SEND_STRING("cbbrowne"); + } + break; + case M_VERSION: + if (record->event.pressed) { + SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP "@"); + // SEND_STRING(QMK_VERSION "@" QMK_BUILDDATE); + } + break; + case M_RANDDIGIT: + /* Generate, based on random number generator, a keystroke for + a numeric digit chosen at random */ + random_value = ((random_value + randadd) * randmul) % randmod; + if (record->event.pressed) { + /* Here, we mix the LCRNG with low bits from one of the system + clocks via XOR in the theory that this may be more random + than either separately */ + rval = (random_value ^ clockbyte) % 10; + /* Note that KC_1 thru KC_0 are a contiguous range */ + register_code (KC_1 + rval); + unregister_code (KC_1 + rval); + } + break; + case M_RANDLETTER: + /* Generate, based on random number generator, a keystroke for + a letter chosen at random */ + /* Here, we mix the LCRNG with low bits from one of the system + clocks via XOR in the theory that this may be more random + than either separately */ + random_value = ((random_value + randadd) * randmul) % randmod; + if (record->event.pressed) { + rval = (random_value ^ clockbyte) % 26; + register_code (KC_A + rval); + unregister_code (KC_A + rval); + } + break; + case MACRO_UPPER: + if (record->event.pressed) + { + layer_on(_RAISE); +#ifdef BACKLIGHT_ENABLE + breathing_speed_set(2); + breathing_pulse(); +#endif + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + else + { + layer_off(_RAISE); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + break; + case MACRO_LOWER: + if (record->event.pressed) + { + layer_on(_LOWER); +#ifdef BACKLIGHT_ENABLE + breathing_speed_set(2); + breathing_pulse(); +#endif + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + else + { + layer_off(_LOWER); + update_tri_layer(_LOWER, _RAISE, _ADJUST); + } + break; + } + return MACRO_NONE; +}; diff --git a/keyboards/xd75/keymaps/cbbrowne/readme.md b/keyboards/xd75/keymaps/cbbrowne/readme.md new file mode 100644 index 0000000000..f2a1306eed --- /dev/null +++ b/keyboards/xd75/keymaps/cbbrowne/readme.md @@ -0,0 +1,22 @@ +cbbrowne custom keyboard +============================== + +Due to cbbrowne@acm.org +Christopher Browne + +Much of this is copied from my Planck keymap... + +1. TODO +-------------------------------------------------- + + * Set up keypad in the middle of the screen? + * Or perhaps I should set up a layer for that? + * Need the Random, version, my name keys + * Almost certainly I want shift/control/alt on the right side, + superimposed on whatever is at the rightmost end + * Need a good place for RESET + * Definitely want the keyboard to "breathe" + * Perhaps nice to have some programming constructs as in jeremy-dev + - It had C operators such as /=, *=, -=, +=, ... + * Should I have some tmux commands like in mollat? + * How about adding some emacs commands? \ No newline at end of file diff --git a/keyboards/xd75/readme.md b/keyboards/xd75/readme.md index 0bc82be91e..28a2523324 100644 --- a/keyboards/xd75/readme.md +++ b/keyboards/xd75/readme.md @@ -9,22 +9,40 @@ For more info on this firmware (and how to make it your own), head over to [qmk. ## Building -Download or clone the whole firmware and navigate to the keyboards/xd75 folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file. - -Depending on which keymap you would like to use, you will have to compile slightly differently. +Download or clone the whole firmware and navigate to the +keyboards/xd75 folder. Once your dev env is setup, you'll be able to +type `make` to generate your .hex - you can then use the Teensy Loader +to install the resulting .hex file, or have the `make` process install +it using DFU. ### Default -To build with the default keymap, simply run `make default`. +To build with the default keymap, simply run `make xd75-default`, and +to install via DFU, `make xd75-default-dfu`. + +Note that DFU is likely to require root permissions, so installing the +firmware likely requires a command line like: + +``` +$ sudo make xd75-default-dfu +``` ### Other Keymaps -The "default" keymap included is basically the OLKB Atomic keymap with a few buttons added for RGB underglow control. This should be usable as a starting point, but most people will be best served creating their own keymap and flashing it - more info on creating your own keymap is available in [the official QMK documentation](https://docs.qmk.fm). +The "default" keymap included is basically the OLKB Atomic keymap with +a few buttons added for RGB underglow control. This should be usable +as a starting point, but most people will be best served creating +their own keymap and flashing it - more info on creating your own +keymap is available in [the official QMK +documentation](https://docs.qmk.fm). + +Keymaps follow the format **__\.c__** and are stored in +subdirectories under `keyboards/xd75/keymaps` -To build the firmware binary hex file with a keymap just do `make` with a keymap like this: +To build the firmware binary hex file for a specific keymap, and +install it, using DFU, just do `make` with a keymap like this: ``` -$ make [default|jack|] +$ make xd75-[default|] ``` -Keymaps follow the format **__\.c__** and are stored in the `keymaps` folder. From 17c84f24cd1d459ce383171537744d556c43e987 Mon Sep 17 00:00:00 2001 From: Florent C Date: Fri, 15 Sep 2017 19:07:26 +0200 Subject: [PATCH 19/51] 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 2d037d1c90..d3277d18b8 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 20/51] 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 1fabd93721..74bbe9b579 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 21/51] "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 0000000000..a615adf966 --- /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 0000000000..e5ff5f5d3f --- /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 22/51] 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 0000000000..591c656a29 --- /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 0000000000..084c890c40 --- /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 0000000000..6b409bf0d5 --- /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 0000000000..bea3f5daa0 --- /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 0000000000..22b6ec4766 --- /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 0000000000..7f33a43630 --- /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 0000000000..4bee2c5e6d --- /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 0000000000..457a3d01d4 --- /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 0000000000..2c993daece --- /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 0000000000..c69a06faba --- /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 0000000000..9d8a14d190 --- /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 0000000000..1fcad3c1b7 --- /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 0000000000..696722cfb3 --- /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 0000000000..f849b5c4e2 --- /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 0000000000..968095cba7 --- /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 0000000000..bd518d8f27 --- /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 0000000000..7b7224fd4d --- /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 0000000000..74bcbb6bf6 --- /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 0000000000..15fe4db7b4 --- /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 0000000000..7f200e6c94 --- /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 0000000000..928b1edd02 --- /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 23/51] 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 66673e889c..d9f850e029 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 83dece50ea..5482aba52f 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 0adda43af9..c0fd464ad4 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 d1caeee933..c248822b23 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 25e66e67c1..afb82a2981 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 24/51] 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 786132f7b1..10f11c5f55 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 4dc1e88878..35c85c839d 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 d2d848fcdc..b6b8cdbbb4 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 25/51] 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 1574803534..d11c78ac71 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 26/51] 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 0000000000..45e3ab75cc --- /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 0000000000..43c51fb2f2 --- /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 0000000000..8f8c319c54 --- /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 0000000000..18af2cdeef --- /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 0000000000..55168e85d5 --- /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 27/51] 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 d3277d18b8..4ad5990b8a 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 28/51] [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 6f29c97c9a..117f84260b 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 29/51] 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 ecd50ca296..96f4bb51e4 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 0000000000..c27f3e3d17 --- /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 10f11c5f55..cf3d174f9c 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 beaa54c400..140026013f 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 e69de29bb2..72b9d624fb 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 26dfe36d0a..626af1d131 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 30/51] 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 cf3d174f9c..b3d2345e95 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 31/51] 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 b3d2345e95..d9753d0118 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 32/51] 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 d9753d0118..2a7c5f6c28 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 33/51] 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 2a7c5f6c28..2d46a4aae8 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 34/51] 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 2d46a4aae8..31279ffe93 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 35/51] 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 31279ffe93..5cae1bc815 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 36/51] 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 51162cde3a..f8808892c3 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 64ad4ba98a..ef464a1b49 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 2362395569..0a254d0e79 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 37/51] 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 9ac1893d23..0f02b9a64c 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 38/51] 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 57144283e9..0000000000 --- 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 39/51] 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 117f84260b..bae23bb873 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 0000000000..a054c36528 --- /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 2ac4f30365..99c2306d66 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 0000000000..55b5244501 --- /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 0000000000..a0361346bd --- /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 1fccaa7d5a..a1a1a9d1cb 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 f3333a002a..534819c818 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 26c3c41a73..212fdc67d6 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 40/51] 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 55b5244501..d096cde567 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 41/51] 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 a054c36528..54052a74db 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 42/51] 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 0000000000..457a3d01d4 --- /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 0000000000..b406e2fed9 --- /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 0000000000..b5848a9b61 --- /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 0000000000..66320e9916 --- /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 43/51] 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 e538ad33b7..ffd62f3d4b 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 b01beae182..256386d861 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 46f2936143..9387cbefeb 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 4e8d14812f..5c2691823f 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 44/51] 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 ffd62f3d4b..35f5bf70b3 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 256386d861..ded77aeeb9 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 9387cbefeb..2f29ca48c0 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 45/51] 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 0000000000..a282196b33 --- /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 0000000000..fbe39248c7 --- /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 0000000000..1465963a75 --- /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 0000000000..81bce53da2 --- /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 0000000000..d14af7a5ca --- /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 0000000000..9c4082da29 --- /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 46/51] 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 e766619098..e77127268b 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 be0b85b78f..afe8341d0e 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 47/51] 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 0000000000..e4460a9b69 --- /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 48/51] 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 0000000000..4346cf0095 --- /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 0000000000..5afb804350 --- /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 0000000000..e6cf61bfa3 --- /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 0000000000..4346cf0095 --- /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 49/51] 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 0000000000..9c6bd8e19b --- /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 0000000000..8813075662 --- /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 0000000000..d7632aecda --- /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 0000000000..74dfabdecf --- /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 50/51] 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 9c6bd8e19b..0000000000 --- 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 51/51] 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 0000000000..9c6bd8e19b --- /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