diff options
author | Jack Humbert <jack.humb@gmail.com> | 2015-08-22 11:10:57 -0400 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2015-08-22 11:10:57 -0400 |
commit | 5d2baede8a4f401e34df9421108a5f350cc0aeeb (patch) | |
tree | 04672f36b95deede2a19fd1c00eb1e1c8f8e1849 | |
parent | 476e29d1190ac45b810109512bbb50cc4769493b (diff) | |
download | qmk_firmware-5d2baede8a4f401e34df9421108a5f350cc0aeeb.tar.gz qmk_firmware-5d2baede8a4f401e34df9421108a5f350cc0aeeb.zip |
making the extended keymap the default - no more 'common'
42 files changed, 507 insertions, 2019 deletions
diff --git a/keyboard/planck/Config/LUFAConfig.h b/keyboard/planck/Config/LUFAConfig.h deleted file mode 100755 index fa9404498f..0000000000 --- a/keyboard/planck/Config/LUFAConfig.h +++ /dev/null @@ -1,93 +0,0 @@ -/*
- LUFA Library
- Copyright (C) Dean Camera, 2012.
-
- dean [at] fourwalledcubicle [dot] com
- www.lufa-lib.org
-*/
-
-/*
- Copyright 2012 Dean Camera (dean [at] fourwalledcubicle [dot] com)
-
- Permission to use, copy, modify, distribute, and sell this
- software and its documentation for any purpose is hereby granted
- without fee, provided that the above copyright notice appear in
- all copies and that both that the copyright notice and this
- permission notice and warranty disclaimer appear in supporting
- documentation, and that the name of the author not be used in
- advertising or publicity pertaining to distribution of the
- software without specific, written prior permission.
-
- The author disclaim all warranties with regard to this
- software, including all implied warranties of merchantability
- and fitness. In no event shall the author be liable for any
- special, indirect or consequential damages or any damages
- whatsoever resulting from loss of use, data or profits, whether
- in an action of contract, negligence or other tortious action,
- arising out of or in connection with the use or performance of
- this software.
-*/
-
-/** \file
- * \brief LUFA Library Configuration Header File
- *
- * This header file is used to configure LUFA's compile time options,
- * as an alternative to the compile time constants supplied through
- * a makefile.
- *
- * For information on what each token does, refer to the LUFA
- * manual section "Summary of Compile Tokens".
- */
-
-#ifndef _LUFA_CONFIG_H_
-#define _LUFA_CONFIG_H_
-
- #if (ARCH == ARCH_AVR8)
-
- /* Non-USB Related Configuration Tokens: */
-// #define DISABLE_TERMINAL_CODES
-
- /* USB Class Driver Related Tokens: */
-// #define HID_HOST_BOOT_PROTOCOL_ONLY
-// #define HID_STATETABLE_STACK_DEPTH {Insert Value Here}
-// #define HID_USAGE_STACK_DEPTH {Insert Value Here}
-// #define HID_MAX_COLLECTIONS {Insert Value Here}
-// #define HID_MAX_REPORTITEMS {Insert Value Here}
-// #define HID_MAX_REPORT_IDS {Insert Value Here}
-// #define NO_CLASS_DRIVER_AUTOFLUSH
-
- /* General USB Driver Related Tokens: */
-// #define ORDERED_EP_CONFIG
- #define USE_STATIC_OPTIONS (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)
- #define USB_DEVICE_ONLY
-// #define USB_HOST_ONLY
-// #define USB_STREAM_TIMEOUT_MS {Insert Value Here}
-// #define NO_LIMITED_CONTROLLER_CONNECT
-// #define NO_SOF_EVENTS
-
- /* USB Device Mode Driver Related Tokens: */
-// #define USE_RAM_DESCRIPTORS
- #define USE_FLASH_DESCRIPTORS
-// #define USE_EEPROM_DESCRIPTORS
-// #define NO_INTERNAL_SERIAL
- #define FIXED_CONTROL_ENDPOINT_SIZE 8
-// #define DEVICE_STATE_AS_GPIOR {Insert Value Here}
- #define FIXED_NUM_CONFIGURATIONS 1
-// #define CONTROL_ONLY_DEVICE
-// #define INTERRUPT_CONTROL_ENDPOINT
-// #define NO_DEVICE_REMOTE_WAKEUP
-// #define NO_DEVICE_SELF_POWER
-
- /* USB Host Mode Driver Related Tokens: */
-// #define HOST_STATE_AS_GPIOR {Insert Value Here}
-// #define USB_HOST_TIMEOUT_MS {Insert Value Here}
-// #define HOST_DEVICE_SETTLE_DELAY_MS {Insert Value Here}
-// #define NO_AUTO_VBUS_MANAGEMENT
-// #define INVERTED_VBUS_ENABLE_LINE
-
- #else
-
- #error Unsupported architecture for this LUFA configuration file.
-
- #endif
-#endif
diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile index ad25854e6d..9f7634d993 100644 --- a/keyboard/planck/Makefile +++ b/keyboard/planck/Makefile @@ -41,46 +41,23 @@ # Target file name (without extension). TARGET = planck_lufa + # Directory common source filess exist TOP_DIR = ../.. # Directory keyboard dependent files exist TARGET_DIR = . -# Default to PCB matrix -ifndef MATRIX - MATRIX=matrix_pcb.c -endif - -$(warning MATRIX: $(MATRIX)) - # # project specific files -ifdef COMMON - - SRC = keymap_common.c \ - $(MATRIX) \ +SRC = keymap_common.c \ + matrix.c \ led.c \ backlight.c ifdef KEYMAP - SRC := common_keymaps/keymap_$(KEYMAP).c $(SRC) + SRC := keymaps/keymap_$(KEYMAP).c $(SRC) else - SRC := common_keymaps/keymap_jack.c $(SRC) -endif - -else - -SRC = extended_keymap_common.c \ - $(MATRIX) \ - led.c \ - backlight.c - -ifdef KEYMAP - SRC := extended_keymaps/extended_keymap_$(KEYMAP).c $(SRC) -else - SRC := extended_keymaps/extended_keymap_default.c $(SRC) -endif - + SRC := keymaps/keymap_default.c $(SRC) endif CONFIG_H = config.h @@ -145,8 +122,10 @@ 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 = yes # Breathing sleep LED during USB suspend -NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA +NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality +#MIDI_ENABLE = YES # MIDI controls +BACKLIGHT_ENABLE = yes # Optimize size but this may cause error "relocation truncated to fit" #EXTRALDFLAGS = -Wl,--relax @@ -158,3 +137,4 @@ VPATH += $(TOP_DIR) include $(TOP_DIR)/protocol/lufa.mk include $(TOP_DIR)/common.mk include $(TOP_DIR)/rules.mk + diff --git a/keyboard/planck/PCB_GUIDE.md b/keyboard/planck/PCB_GUIDE.md index c3004c75a4..88a6c0140d 100644 --- a/keyboard/planck/PCB_GUIDE.md +++ b/keyboard/planck/PCB_GUIDE.md @@ -26,10 +26,7 @@ Here is a list of some of the functions available from the command line: * `make clean`: clean the environment - may be required in-between builds * `make`: compile the code -* `make COMMON=true`: compile with the common (non-extended) keymap -* `make MATRIX=<matrix_file>`: compile with the referenced matrix file. Default if unspecified is `matrix_pcb.c`. For handwired boards, use `matrix_handwired.c`. * `make KEYMAP=<keymap>`: compile with the extended keymap file `extended_keymaps/extended_keymap_<keymap>.c` -* `make COMMON=true KEYMAP=<keymap>`: compile with the common keymap file `common_keymaps/keymap_<keymap>.c` * `make dfu`: build and flash the layout to the PCB * `make dfu-force`: build and force-flash the layout to the PCB (may be require for first flash) @@ -41,11 +38,11 @@ Generally, the instructions to flash the PCB are as follows: 4. Press the reset button on the PCB/press the key with the `RESET` keycode 5. `make <arguments> dfu` - use the necessary `KEYMAP=<keymap>` and/or `COMMON=true` arguments here. -## Extended keymap +## OLKB keymap ### Keymap -Unlike the common keymap, prefixing the keycodes with `KC_` is required. A full list of the keycodes is available [here](https://github.com/jackhumbert/tmk_keyboard/blob/master/doc/keycode.txt). For the keycodes available only in the extended keymap, see this [header file](https://github.com/jackhumbert/tmk_keyboard/blob/master/keyboard/planck/extended_keymap_common.h). +Unlike the other keymaps, prefixing the keycodes with `KC_` is required. A full list of the keycodes is available [here](https://github.com/jackhumbert/tmk_keyboard/blob/master/doc/keycode.txt). For the keycodes available only in the extended keymap, see this [header file](https://github.com/jackhumbert/tmk_keyboard/blob/master/keyboard/planck/keymap_common.h). You can use modifiers with keycodes like this: @@ -88,7 +85,7 @@ The function actions are unchanged, and you can see the full list of them [here] ### Macros -Macros have been setup in the `extended_keymaps/extended_keymaps_default.c` file so that you can use `M(<num>)` to access a macro in the `action_get_macro` section on your keymap. The switch/case structure you see here is required, and is setup for `M(0)` - you'll need to copy and paste the code to look like this (e.g. to support `M(3)`): +Macros have been setup in the `keymaps/keymap_default.c` file so that you can use `M(<num>)` to access a macro in the `action_get_macro` section on your keymap. The switch/case structure you see here is required, and is setup for `M(0)` - you'll need to copy and paste the code to look like this (e.g. to support `M(3)`): switch(id) { case 0: diff --git a/keyboard/planck/README.md b/keyboard/planck/README.md index ee824d26e0..faaee09585 100644 --- a/keyboard/planck/README.md +++ b/keyboard/planck/README.md @@ -2,10 +2,10 @@ Planck keyboard firmware ====================== DIY/Assembled compact ortholinear 40% keyboard by [Ortholinear Keyboards](http://ortholinearkeyboards.com). -## Extended Keymap -If you include extended_keymap_common.h instead of keymap_common.h at the top of your file, you'll have access to a bunch of goodies: +## OLKB Keymap +You have access to a bunch of goodies: -- Use `LSFT()`, `LCTL()`, et. al. (listed in extended_keymap_common.h) as modifiers for keys (daisy-chain-able) +- Use `LSFT()`, `LCTL()`, et. al. (listed in keymap_common.h) as modifiers for keys (daisy-chain-able) - Use `FUNC(1)` instead of `FN1` (etc.) to access the function layers beyond the 32 function layer limit - Use `CM_F` instead of `KC_F` to get the ColeMak equivilent for shortcuts (maps backwards) - Use `MACRODOWN()` instead of `MACRO()` to easily make a keydown macro (`CM_*` works here too) @@ -33,21 +33,13 @@ $ make ## Keymap Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create file named `keymap_<name>.c` and see keymap document (you can find in top README.md) and existent keymap files. -####**Extended Keymaps** +####**Keymaps** To build the firmware binary hex file with an extended keymap just do `make` with `KEYMAP` option like: ``` -$ make KEYMAP=[common|jack|<name>] +$ make KEYMAP=[default|jack|<name>] ``` -_The only applicable keymaps will work with this option._ Extended keymaps follow the format **__extended\_keymap\_\<name\>.c__** - -####**Common Keymaps** - -Building with a common keymap is as simple as adding the COMMON option. Note that only -``` -$ make KEYMAP=[common|jack|<name>] COMMON=true -``` -_The only applicable keymaps will work with this option._ Common keymaps follow the format **__keymap\_\<name\>.c__** +_The only applicable keymaps will work with this option._ Keymaps follow the format **__keymap\_\<name\>.c__** and are stored in the `keymaps` folder. ## Notable TMK forks (which some of the keymap files are from) - [Shane's Fork](https://github.com/shanecelis/tmk_keyboard/tree/master/keyboard/planck) diff --git a/keyboard/planck/extended_keymap_common.c b/keyboard/planck/extended_keymap_common.c deleted file mode 100644 index ade8508444..0000000000 --- a/keyboard/planck/extended_keymap_common.c +++ /dev/null @@ -1,210 +0,0 @@ -/* -Copyright 2012,2013 Jun Wako <wakojun@gmail.com> - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include "extended_keymap_common.h" -#include "report.h" -#include "keycode.h" -#include "action_layer.h" -#include "action.h" -#include "action_macro.h" -#include "debug.h" -#include "backlight.h" - -static action_t keycode_to_action(uint16_t keycode); - - -/* converts key to action */ -action_t action_for_key(uint8_t layer, keypos_t key) -{ - // 16bit keycodes - important - uint16_t keycode = keymap_key_to_keycode(layer, key); - - if (keycode >= 0x0100 && keycode < 0x2000) { - // Has a modifier - action_t action; - // Split it up - action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); - return action; - } else if (keycode >= 0x2000 && keycode < 0x3000) { - // Is a shortcut for function layer, pull last 12bits - return keymap_func_to_action(keycode & 0xFFF); - } else if (keycode >= 0x3000 && keycode < 0x4000) { - action_t action; - action.code = ACTION_MACRO(keycode & 0xFF); - return action; - } else if (keycode >= BL_0 & keycode <= BL_15) { - action_t action; - action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F); - return action; - } else if (keycode == BL_DEC) { - action_t action; - action.code = ACTION_BACKLIGHT_DECREASE(); - return action; - } else if (keycode == BL_INC) { - action_t action; - action.code = ACTION_BACKLIGHT_INCREASE(); - return action; - } else if (keycode == BL_TOGG) { - action_t action; - action.code = ACTION_BACKLIGHT_TOGGLE(); - return action; - } else if (keycode == BL_STEP) { - action_t action; - action.code = ACTION_BACKLIGHT_STEP(); - return action; - } else if (keycode == RESET) { - bootloader_jump(); - return; - } else if (keycode > RESET) { - // MIDI - return; - } - - switch (keycode) { - case KC_FN0 ... KC_FN31: - return keymap_fn_to_action(keycode); -#ifdef BOOTMAGIC_ENABLE - case KC_CAPSLOCK: - case KC_LOCKING_CAPS: - if (keymap_config.swap_control_capslock || keymap_config.capslock_to_control) { - return keycode_to_action(KC_LCTL); - } - return keycode_to_action(keycode); - case KC_LCTL: - if (keymap_config.swap_control_capslock) { - return keycode_to_action(KC_CAPSLOCK); - } - return keycode_to_action(KC_LCTL); - case KC_LALT: - if (keymap_config.swap_lalt_lgui) { - if (keymap_config.no_gui) { - return keycode_to_action(ACTION_NO); - } - return keycode_to_action(KC_LGUI); - } - return keycode_to_action(KC_LALT); - case KC_LGUI: - if (keymap_config.swap_lalt_lgui) { - return keycode_to_action(KC_LALT); - } - if (keymap_config.no_gui) { - return keycode_to_action(ACTION_NO); - } - return keycode_to_action(KC_LGUI); - case KC_RALT: - if (keymap_config.swap_ralt_rgui) { - if (keymap_config.no_gui) { - return keycode_to_action(ACTION_NO); - } - return keycode_to_action(KC_RGUI); - } - return keycode_to_action(KC_RALT); - case KC_RGUI: - if (keymap_config.swap_ralt_rgui) { - return keycode_to_action(KC_RALT); - } - if (keymap_config.no_gui) { - return keycode_to_action(ACTION_NO); - } - return keycode_to_action(KC_RGUI); - case KC_GRAVE: - if (keymap_config.swap_grave_esc) { - return keycode_to_action(KC_ESC); - } - return keycode_to_action(KC_GRAVE); - case KC_ESC: - if (keymap_config.swap_grave_esc) { - return keycode_to_action(KC_GRAVE); - } - return keycode_to_action(KC_ESC); - case KC_BSLASH: - if (keymap_config.swap_backslash_backspace) { - return keycode_to_action(KC_BSPACE); - } - return keycode_to_action(KC_BSLASH); - case KC_BSPACE: - if (keymap_config.swap_backslash_backspace) { - return keycode_to_action(KC_BSLASH); - } - return keycode_to_action(KC_BSPACE); -#endif - default: - return keycode_to_action(keycode); - } -} - - -/* Macro */ -__attribute__ ((weak)) -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - return MACRO_NONE; -} - -/* Function */ -__attribute__ ((weak)) -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) -{ -} - -/* translates keycode to action */ -static action_t keycode_to_action(uint16_t keycode) -{ - action_t action; - switch (keycode) { - case KC_A ... KC_EXSEL: - case KC_LCTRL ... KC_RGUI: - action.code = ACTION_KEY(keycode); - break; - case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE: - action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode)); - break; - case KC_AUDIO_MUTE ... KC_WWW_FAVORITES: - action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode)); - break; - case KC_MS_UP ... KC_MS_ACCEL2: - action.code = ACTION_MOUSEKEY(keycode); - break; - case KC_TRNS: - action.code = ACTION_TRANSPARENT; - break; - default: - action.code = ACTION_NO; - break; - } - return action; -} - - -/* translates key to keycode */ -uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) -{ - // Read entire word (16bits) - return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]); -} - -/* translates Fn keycode to action */ -action_t keymap_fn_to_action(uint16_t keycode) -{ - return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; -} - -action_t keymap_func_to_action(uint16_t keycode) -{ - // For FUNC without 8bit limit - return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) }; -} diff --git a/keyboard/planck/extended_keymap_common.h b/keyboard/planck/extended_keymap_common.h deleted file mode 100644 index e6a7dac5b5..0000000000 --- a/keyboard/planck/extended_keymap_common.h +++ /dev/null @@ -1,180 +0,0 @@ -/* -Copyright 2012,2013 Jun Wako <wakojun@gmail.com> - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef KEYMAP_H -#define KEYMAP_H - -#include <stdint.h> -#include <stdbool.h> -#include "action.h" -#include <avr/pgmspace.h> -#include "keycode.h" -#include "keymap.h" -#include "action_macro.h" -#include "report.h" -#include "host.h" -// #include "print.h" -#include "debug.h" - -#ifdef BOOTMAGIC_ENABLE -/* NOTE: Not portable. Bit field order depends on implementation */ -typedef union { - uint16_t raw; - struct { - bool swap_control_capslock:1; - bool capslock_to_control:1; - bool swap_lalt_lgui:1; - bool swap_ralt_rgui:1; - bool no_gui:1; - bool swap_grave_esc:1; - bool swap_backslash_backspace:1; - bool nkro:1; - }; -} keymap_config_t; -keymap_config_t keymap_config; -#endif - - -/* translates key to keycode */ -uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key); - -/* translates Fn keycode to action */ -action_t keymap_fn_to_action(uint16_t keycode); - -/* translates Fn keycode to action */ -action_t keymap_func_to_action(uint16_t keycode); - -extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; -extern const uint16_t fn_actions[]; - -// Ability to use mods in layouts -#define LCTL(kc) kc | 0x0100 -#define LSFT(kc) kc | 0x0200 -#define LALT(kc) kc | 0x0400 -#define LGUI(kc) kc | 0x0800 -#define RCTL(kc) kc | 0x1100 -#define RSFT(kc) kc | 0x1200 -#define RALT(kc) kc | 0x1400 -#define RGUI(kc) kc | 0x1800 - -// Alias for function layers than expand past FN31 -#define FUNC(kc) kc | 0x2000 - -// Aliases -#define S(kc) LSFT(kc) -#define F(kc) FUNC(kc) - -// For software implementation of colemak -#define CM_Q KC_Q -#define CM_W KC_W -#define CM_F KC_E -#define CM_P KC_R -#define CM_G KC_T -#define CM_J KC_Y -#define CM_L KC_U -#define CM_U KC_I -#define CM_Y KC_O -#define CM_SCLN KC_P - -#define CM_A KC_A -#define CM_R KC_S -#define CM_S KC_D -#define CM_T KC_F -#define CM_D KC_G -#define CM_H KC_H -#define CM_N KC_J -#define CM_E KC_K -#define CM_I KC_L -#define CM_O KC_SCLN - -#define CM_Z KC_Z -#define CM_X KC_X -#define CM_C KC_C -#define CM_V KC_V -#define CM_B KC_B -#define CM_K KC_N -#define CM_M KC_M -#define CM_COMM KC_COMM -#define CM_DOT KC_DOT -#define CM_SLSH KC_SLSH - -// Make it easy to support these in macros -#define KC_CM_Q CM_Q -#define KC_CM_W CM_W -#define KC_CM_F CM_F -#define KC_CM_P CM_P -#define KC_CM_G CM_G -#define KC_CM_J CM_J -#define KC_CM_L CM_L -#define KC_CM_U CM_U -#define KC_CM_Y CM_Y -#define KC_CM_SCLN CM_SCLN - -#define KC_CM_A CM_A -#define KC_CM_R CM_R -#define KC_CM_S CM_S -#define KC_CM_T CM_T -#define KC_CM_D CM_D -#define KC_CM_H CM_H -#define KC_CM_N CM_N -#define KC_CM_E CM_E -#define KC_CM_I CM_I -#define KC_CM_O CM_O - -#define KC_CM_Z CM_Z -#define KC_CM_X CM_X -#define KC_CM_C CM_C -#define KC_CM_V CM_V -#define KC_CM_B CM_B -#define KC_CM_K CM_K -#define KC_CM_M CM_M -#define KC_CM_COMM CM_COMM -#define KC_CM_DOT CM_DOT -#define KC_CM_SLSH CM_SLSH - -#define M(kc) kc | 0x3000 - -#define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE) - -#define BL_ON 0x4009 -#define BL_OFF 0x4000 -#define BL_0 0x4000 -#define BL_1 0x4001 -#define BL_2 0x4002 -#define BL_3 0x4003 -#define BL_4 0x4004 -#define BL_5 0x4005 -#define BL_6 0x4006 -#define BL_7 0x4007 -#define BL_8 0x4008 -#define BL_9 0x4009 -#define BL_10 0x400A -#define BL_11 0x400B -#define BL_12 0x400C -#define BL_13 0x400D -#define BL_14 0x400E -#define BL_15 0x400F -#define BL_DEC 0x4010 -#define BL_INC 0x4011 -#define BL_TOGG 0x4012 -#define BL_STEP 0x4013 - -#define RESET 0x5000 - -#define MIDI(n) n | 0x6000 - -#endif diff --git a/keyboard/planck/extended_keymaps/extended_keymap_angerthosenear.c b/keyboard/planck/extended_keymaps/extended_keymap_angerthosenear.c deleted file mode 100644 index 34710d60df..0000000000 --- a/keyboard/planck/extended_keymaps/extended_keymap_angerthosenear.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "extended_keymap_common.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = { /* Qwerty */ - {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_SCLN, 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_QUOT}, - {KC_LCTL, KC_LGUI, KC_LALT, BL_STEP, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - // Space is repeated to accommadate for both spacebar wiring positions -}, -[1] = { /* WASD + NumPad */ - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P7, KC_P8, KC_P9, KC_PSLS, KC_PMNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P4, KC_P5, KC_P6, KC_PAST, KC_PPLS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P1, KC_P2, KC_P3, KC_PDOT, KC_PENT, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_SPC, KC_P0, FUNC(1), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, -[2] = { /* RAISE */ - {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS}, - {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -}, -[3] = { /* LOWER */ - {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_DEL}, - {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, - {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_PGDN, KC_PGUP, KC_END} -} -}; - - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE - [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER - - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; - -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: - return MACRODOWN(T(CM_T), END); - break; - } - return MACRO_NONE; -}; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_austin.c b/keyboard/planck/extended_keymaps/extended_keymap_austin.c deleted file mode 100644 index 35330be747..0000000000 --- a/keyboard/planck/extended_keymaps/extended_keymap_austin.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "extended_keymap_common.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = { /* 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}, - {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}, - {BL_STEP, KC_LGUI, KC_LALT, KC_LCTL, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - // Space is repeated to accommadate for both spacebar wiring positions -}, -[1] = { /* 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}, - {KC_FN3, KC_LGUI, KC_LALT, KC_LCTL, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} -}, -[2] = { /* 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_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -}, -[3] = { /* LOWER */ - {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, - {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, - {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -} -}; - - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE - [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER - - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; - -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: - return MACRODOWN(T(CM_T), END); - break; - } - return MACRO_NONE; -}; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_charlie.c b/keyboard/planck/extended_keymaps/extended_keymap_charlie.c deleted file mode 100644 index 18657c8e41..0000000000 --- a/keyboard/planck/extended_keymaps/extended_keymap_charlie.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "extended_keymap_common.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = { /* Native */ - {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, FUNC(2)}, - {KC_BSPC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, - {KC_TAB, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, - {KC_DEL, KC_LCTL, KC_NO, KC_LSFT, KC_LALT, KC_SPC, KC_NO, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} -}, - [1] = { /* QWERTY->PHOTOSHOP */ - {KC_DELETE, KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, FUNC(1)}, - {KC_O, KC_G, KC_S, KC_U, KC_T, FUNC(27), KC_F21, KC_F10, KC_F11, KC_F7, KC_F8, KC_F9}, - {KC_TAB, FUNC(4), FUNC(5), FUNC(6), KC_F1, FUNC(7), KC_F18, KC_F19, KC_F23, KC_F20, KC_F22, FUNC(9)}, - {KC_COMM, KC_DOT, KC_R, FUNC(11), FUNC(3), KC_SPC, FUNC(12), KC_F2, FUNC(8), KC_F3, KC_F14} - }, - [2] = { /* 2: FUNC(3 PHOTOSHOP */ - {KC_ESC, FUNC(25), FUNC(26), 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, FUNC(19), FUNC(20), FUNC(21)}, - {KC_C, KC_NO, FUNC(22), FUNC(5), KC_NO, FUNC(23), KC_NO, KC_NO, KC_NO, KC_NO, FUNC(13), KC_NO}, - {FUNC(14), FUNC(15), FUNC(16), FUNC(17), FUNC(3), KC_SPC, FUNC(18), KC_NO, KC_NO, KC_F24, KC_NO} - } -}; - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_DEFAULT_LAYER_SET(0), // set Qwerty layout - [2] = ACTION_DEFAULT_LAYER_SET(1), // set Photoshop presets - [3] = ACTION_LAYER_MOMENTARY(2), // Photoshop function layer - - [4] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F9), // photo folder AHK - [5] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_I), // select inverse - [6] = ACTION_MODS_KEY(MOD_LSFT, KC_M), // marquee select - [7] = ACTION_MODS_KEY(MOD_LALT, KC_BSPC), // fill - [8] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_X), // warp - [9] = ACTION_MODS_KEY(MOD_LCTL | MOD_LALT | MOD_LSFT, KC_F12), // merge all new layer - [10] = ACTION_MODS_KEY(MOD_LCTL, KC_MINS), // zoom out - [11] = ACTION_MODS_KEY(MOD_LCTL, KC_H), // RBG sliders - [12] = ACTION_MODS_KEY(MOD_LCTL, KC_S), // save - [13] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_F5), // layer mask from transparancy - [14] = ACTION_MODS_KEY(MOD_LCTL, KC_F2), // stroke - [15] = ACTION_MODS_KEY(MOD_LCTL | MOD_LSFT, KC_F2), // stroke layer - [16] = ACTION_MODS_KEY(MOD_LCTL, KC_0), // zoom 0 - [17] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_H), // HSV sliders - [18] = ACTION_MODS_KEY(MOD_LCTL | MOD_LSFT, KC_S), // save as - [19] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F7), // gaussian blur - [20] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL | MOD_LALT, KC_F8), // motion blur - [21] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_X), // liquify filter - [22] = ACTION_MODS_KEY(MOD_LSFT, KC_MINS), // prev layer blending - [23] = ACTION_MODS_KEY(MOD_LSFT | MOD_LCTL, KC_BSPC), // KC_NOrmal layer blending - [24] = ACTION_MODS_KEY(MOD_LSFT, KC_EQL), // next layer blending - [25] = ACTION_MODS_KEY(MOD_LCTL, KC_Z), // step back - [26] = ACTION_MODS_KEY(MOD_LCTL, KC_Y), // step forward - [27] = ACTION_MODS_KEY(MOD_LCTL, KC_R), // rasterize - -}; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_daniel.c b/keyboard/planck/extended_keymaps/extended_keymap_daniel.c deleted file mode 100644 index d3565495f5..0000000000 --- a/keyboard/planck/extended_keymaps/extended_keymap_daniel.c +++ /dev/null @@ -1,48 +0,0 @@ -#include "extended_keymap_common.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = { /* Qwerty */ - {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_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_RSFT}, - {FUNC(3), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - // Space is repeated to accommadate for both spacebar wiring positions -}, -[1] = { /* RAISE */ - {KC_GRV, S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_EQL}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_LBRC, KC_RBRC}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, S(KC_MINS), KC_BSLS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -}, -[2] = { /* LOWER */ - {S(KC_GRV), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, S(KC_EQL)}, - {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12}, - {KC_CAPS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_ENT}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -}, -[3] = { /* Qwerty */ - {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL}, - {KC_TAB, 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_RSFT}, - {KC_TRNS, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - // Space is repeated to accommadate for both spacebar wiring positions -} -}; - - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(1), // to RAISE - [2] = ACTION_LAYER_MOMENTARY(2), // to LOWER - [3] = ACTION_LAYER_MOMENTARY(3) // to LOWER -}; - -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: - return MACRODOWN(T(CM_T), END); - break; - } - return MACRO_NONE; -}; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_david.c b/keyboard/planck/extended_keymaps/extended_keymap_david.c deleted file mode 100644 index fe9f3937a5..0000000000 --- a/keyboard/planck/extended_keymaps/extended_keymap_david.c +++ /dev/null @@ -1,76 +0,0 @@ -#include "extended_keymap_common.h" -#include "beeps.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = { /* Qwerty */ - {KC_Q, KC_W, KC_E, KC_R, KC_T, KC_BSPC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, - {KC_A, KC_S, KC_D, KC_F, KC_G, KC_ENT, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, - {KC_Z, KC_X, KC_C, KC_V, KC_B, KC_ESC, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, - {M(10), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - // Space is repeated to accommadate for both spacebar wiring positions -}, -[1] = { /* 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}, - {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} -}, -[2] = { /* 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_TRNS, FUNC(3), FUNC(4), RESET, M(0), M(1), M(2), KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_TRNS, KC_F11, KC_F12, M(0), M(1), M(2), M(3), M(4), M(5), M(6), M(7), KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -}, -[3] = { /* LOWER */ - {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, - {KC_TRNS, FUNC(3), FUNC(4), RESET, M(0), M(1), M(2), S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, - {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -} -}; - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE - [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER - - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; - -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - // MACRODOWN only works in this function - if (record->event.pressed) { - switch(id) { - case 0: - true_note(12, 12, 20); - break; - case 1: - true_note(14, 14, 20); - break; - case 2: - true_note(16, 16, 20); - break; - case 3: - true_note(17, 17, 20); - break; - case 4: - true_note(19, 19, 20); - break; - case 5: - true_note(21, 21, 20); - break; - case 6: - true_note(23, 23, 20); - break; - case 7: - true_note(24, 24, 20); - break; - case 10: - - break; - } - } - return MACRO_NONE; -}; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_dzobert.c b/keyboard/planck/extended_keymaps/extended_keymap_dzobert.c deleted file mode 100644 index 6b3864b6c6..0000000000 --- a/keyboard/planck/extended_keymaps/extended_keymap_dzobert.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "extended_keymap_common.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = { /* Qwerty */ - {KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_TAB}, - {KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_BSPC}, - {KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, - {KC_FN4, KC_RSFT, KC_LGUI, KC_LSFT, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - // Space is repeated to accommadate for both spacebar wiring positions -}, -[1] = { /* Colemak */ - {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_TAB}, - {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_BSPC}, - {KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT}, - {KC_FN3, KC_RSFT, KC_LGUI, KC_LSFT, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} -}, -[2] = { /* RAISE */ - {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_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_DEL}, - {KC_TRNS, KC_GRV, KC_MINS, KC_EQL, KC_QUOT, S(KC_QUOT), S(KC_LBRC), S(KC_RBRC), KC_LBRC, KC_RBRC, KC_BSLS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_HOME, KC_PGUP, KC_PGDN, KC_END} -}, -[3] = { /* LOWER */ - {KC_POWER,KC_PSCR, KC_SLCK, KC_PAUSE, KC_NLCK, KC_EXECUTE, KC_MENU, KC_APP, KC_7, KC_8, KC_9, KC_KP_SLASH}, - {KC_TRNS, KC_VOLD, KC_VOLU, KC_MUTE, KC_CAPS, KC_CANCEL, KC_UNDO, KC_AGAIN, KC_4, KC_5, KC_6, KC_KP_ASTERISK}, - {KC_TRNS, KC_INSERT,KC_CUT, KC_COPY, KC_PASTE, KC_BSLS, KC_9, KC_0, KC_1, KC_2, KC_3, KC_KP_MINUS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_0, KC_KP_DOT, KC_KP_ENTER, KC_KP_PLUS} -} -}; - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE - [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER - - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; - -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: - return MACRODOWN(T(CM_T), END); - break; - } - return MACRO_NONE; -};
\ No newline at end of file diff --git a/keyboard/planck/extended_keymaps/extended_keymap_jack.c b/keyboard/planck/extended_keymaps/extended_keymap_jack.c deleted file mode 100644 index d39dc5b84c..0000000000 --- a/keyboard/planck/extended_keymaps/extended_keymap_jack.c +++ /dev/null @@ -1,50 +0,0 @@ -#include "extended_keymap_common.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = { /* Jack soft-coded colemak */ - {KC_TAB, CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, CM_SCLN, KC_BSPC}, - {KC_ESC, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, KC_QUOT}, - {KC_LSFT, CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, CM_COMM, CM_DOT, CM_SLSH, KC_ENT}, - {BL_STEP, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - // Space is repeated to accommadate for both spacebar wiring positions -}, -[1] = { /* Jack hard-coded 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}, - {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} -}, -[2] = { /* Jack 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_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -}, -[3] = { /* Jack LOWER */ - {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, - {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, - {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -} -}; - - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(2), // to Fn overlay - [2] = ACTION_LAYER_MOMENTARY(3), // to Fn overlay - - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; - -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: - return MACRODOWN(T(CM_T), END); - break; - } - return MACRO_NONE; -}; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_joe.c b/keyboard/planck/extended_keymaps/extended_keymap_joe.c deleted file mode 100644 index c560d8a3a4..0000000000 --- a/keyboard/planck/extended_keymaps/extended_keymap_joe.c +++ /dev/null @@ -1,88 +0,0 @@ -#include "extended_keymap_common.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = { /* Joe colemak */ - {F(3), KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS}, - {KC_BSPC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT }, - {F(15), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT}, - {KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_SPC, KC_SPC, F(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - }, - [1] = { /* Joe soft Colemak */ - {F(3), CM_Q, CM_W, CM_F, CM_P, CM_G, CM_J, CM_L, CM_U, CM_Y, CM_SCLN, KC_MINS}, - {KC_BSPC, CM_A, CM_R, CM_S, CM_T, CM_D, CM_H, CM_N, CM_E, CM_I, CM_O, KC_ENT }, - {F(15), CM_Z, CM_X, CM_C, CM_V, CM_B, CM_K, CM_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT}, - {KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_SPC, KC_SPC, F(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - }, - [2] = { /* Joe NUMPAD */ - {F(3), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, LSFT(KC_9), LSFT(KC_0), KC_P7, KC_P8, KC_P9, KC_PSLS}, - {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, LSFT(KC_5), KC_PEQL, KC_P4, KC_P5, KC_P6, KC_PAST}, - {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PCMM, KC_P1, KC_P2, KC_P3, KC_PMNS}, - {KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_TRNS, KC_TRNS, F(2), KC_P0, KC_PDOT, KC_PENT, KC_PPLS} - }, - [3] = { /* Joe 1337 haxOr5*/ - {F(3), KC_Q, KC_W, KC_F, KC_P, KC_6, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_MINS}, - {KC_BSPC, KC_4, KC_R, KC_5, KC_7, KC_D, KC_H, KC_N, KC_3, KC_1, KC_0, KC_ENT }, - {F(15), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT}, - {KC_LCTL, KC_LGUI, KC_LALT, KC_LSFT, F(1), KC_SPC, KC_SPC, F(2), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - }, - [4] = { /* Joe LOWER fn1 */ - {KC_GRV, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, M(3), M(2), M(1), M(0) }, - {KC_BSPC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_TRNS}, - {KC_BSLS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_LBRC, KC_RBRC, KC_EQL }, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(1), KC_TRNS, KC_TRNS, F(2), KC_HOME, KC_PGDN, KC_PGUP, KC_END } - }, - [5] = { /* Joe UPPER fn2 */ - {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_BTN1, KC_MS_U, KC_BTN2, KC_BTN3, KC_WH_U, KC_BTN4, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_NO }, - {KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_L, KC_WH_D, KC_WH_R, KC_NO, KC_NO, KC_NO, LCTL(KC_PGUP), LCTL(KC_PGDN) }, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, F(1), KC_NO, KC_NO, F(2), LCTL(LALT(KC_LEFT)), LCTL(LALT(KC_DOWN)), LCTL(LALT(KC_UP)), LCTL(LALT(KC_RGHT))} - }, - [6] = { /* Joe SPECIAL fn3 */ - {KC_TRNS, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, - {KC_NO, KC_MPLY, KC_MPRV, KC_MNXT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, RESET }, - {KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, - {F(6), F(7), F(8), F(9), F(1), KC_TRNS, KC_TRNS, F(2), KC_POWER, KC_WAKE, KC_SLEP, LCTL(LALT(KC_L))} - } -}; - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(4), // fn1 - [2] = ACTION_LAYER_MOMENTARY(5), // fn2 - - /* ESC on tap, fn3 on hold */ - [3] = ACTION_LAYER_TAP_KEY(6, KC_ESC), - - /* toggle layers */ - [6] = ACTION_DEFAULT_LAYER_SET(0), - [7] = ACTION_DEFAULT_LAYER_SET(1), - [8] = ACTION_DEFAULT_LAYER_SET(2), - [9] = ACTION_DEFAULT_LAYER_SET(3), - - /* tab on tap, shift on hold */ - [15] = ACTION_MODS_TAP_KEY(MOD_LSFT, KC_TAB), -}; - -const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) -{ - switch (id) { - case 0: - /* :) */ - return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_SCLN), TYPE(KC_0), UP(KC_LSFT), END ); - break; - case 1: - /* :( */ - return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_SCLN), TYPE(KC_9), UP(KC_LSFT), END ); - break; - case 2: - /* (: | :) */ - return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_9), TYPE(KC_SCLN), TYPE(KC_SPC), TYPE(KC_SPC), TYPE(KC_SCLN), TYPE(KC_0), UP(KC_LSFT), TYPE(KC_LEFT), TYPE(KC_LEFT), TYPE(KC_LEFT), END ); - break; - case 3: - /* :( | ): */ - return MACRODOWN( DOWN(KC_LSFT), TYPE(KC_SCLN), TYPE(KC_9), TYPE(KC_SPC), TYPE(KC_SPC), TYPE(KC_0), TYPE(KC_SCLN), UP(KC_LSFT), TYPE(KC_LEFT), TYPE(KC_LEFT), TYPE(KC_LEFT), END ); - break; - default: - break; - } - return MACRO_NONE; -} diff --git a/keyboard/planck/extended_keymaps/extended_keymap_kyle.c b/keyboard/planck/extended_keymaps/extended_keymap_kyle.c deleted file mode 100644 index b7b7fcb76b..0000000000 --- a/keyboard/planck/extended_keymaps/extended_keymap_kyle.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "extended_keymap_common.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = { /* Qwerty */ - {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_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_RCTL, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - // Space is repeated to accommadate for both spacebar wiring positions -}, -[1] = { /* Colemak */ - {KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, - {KC_TAB, 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_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} -}, -[2] = { /* 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_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -}, -[3] = { /* LOWER */ - {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, - {KC_TRNS, FUNC(3), FUNC(4), LSFT(RSFT(KC_PAUSE)), LSFT(RSFT(KC_D)), KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, - {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, - {BL_STEP, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -} -}; - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE - [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER - - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; - -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: - return MACRODOWN(T(CM_T), END); - break; - } - return MACRO_NONE; -}; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_leo.c b/keyboard/planck/extended_keymaps/extended_keymap_leo.c deleted file mode 100644 index 0c8b9e3156..0000000000 --- a/keyboard/planck/extended_keymaps/extended_keymap_leo.c +++ /dev/null @@ -1,46 +0,0 @@ -#include "extended_keymap_common.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = { /* BASE */ - {KC_ESC, KC_LBRC, KC_QUOT, KC_SCLN, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, - {KC_TAB, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_ENT}, - {KC_LSFT, KC_DOT, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_COMM}, - {KC_LCTL, KC_LALT, KC_LGUI, FUNC(3), FUNC(2), KC_SPC, KC_SPC, FUNC(1), FUNC(3), KC_RGUI, KC_RALT, KC_RCTL} -}, -[2] = { /* RAISE */ - {RALT(KC_RBRC), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, S(KC_RBRC)}, - {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_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, -[3] = { /* LOWER */ - {S(KC_EQL),S(KC_1),S(KC_2),S(KC_3),RALT(KC_5),S(KC_5), S(KC_6), S(KC_7),RALT(KC_7),RALT(KC_0),S(KC_0), KC_MINS}, - {KC_TRNS,RALT(KC_2),S(KC_SLSH),KC_NUBS,S(KC_NUBS),RALT(KC_MINS),RALT(KC_NUBS), KC_NUHS, S(KC_8), S(KC_9), S(KC_MINS), KC_SLSH}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, RALT(KC_8), RALT(KC_9), KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -}, -[4] = { /* META */ - {KC_TRNS, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_TRNS, KC_TRNS, KC_HOME, KC_UP, KC_END, KC_TRNS, KC_DEL}, - {KC_TRNS, KC_RGHT, KC_DOWN, KC_LEFT, KC_PGUP, KC_TRNS, KC_PGUP, KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGDN, KC_TRNS, KC_PGDN, KC_TRNS, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS} -} -}; - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE - [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER - [3] = ACTION_LAYER_MOMENTARY(4), // to META - -}; - -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: - return MACRODOWN(T(CM_T), END); - break; - } - return MACRO_NONE; -}; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_lock.c b/keyboard/planck/extended_keymaps/extended_keymap_lock.c deleted file mode 100644 index bb989cca86..0000000000 --- a/keyboard/planck/extended_keymaps/extended_keymap_lock.c +++ /dev/null @@ -1,65 +0,0 @@ -#include "extended_keymap_common.h" -#include "backlight.h" -#include "action_layer.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = { /* 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}, - {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}, - {M(0), KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - // Space is repeated to accommadate for both spacebar wiring positions -}, -[1] = { /* 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}, - {KC_FN3, KC_LCTL, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} -}, -[2] = { /* 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_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, - {KC_TRNS, KC_F11, KC_F12, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -}, -[3] = { /* LOWER */ - {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, - {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), S(KC_BSLS)}, - {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -}, -[4] = { /* TENKEY */ - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_KP_7, KC_KP_8, KC_KP_9, KC_P, KC_BSPC}, - {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_KP_4, KC_KP_5, KC_KP_6, KC_SCLN, KC_QUOT}, - {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_KP_1, KC_KP_2, KC_KP_3, KC_SLSH, KC_ENT}, - {KC_TRNS, KC_LCTL, KC_LALT, KC_LGUI, KC_TRNS, KC_SPC, KC_SPC, KC_KP_0, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} -} -}; - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE - [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER - - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; - -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); - backlight_set(BACKLIGHT_LEVELS); - layer_on(4); - } else { - // unregister_code(KC_RSFT); - backlight_set(0); - layer_clear(); - } - break; - } - return MACRO_NONE; -}; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_max.c b/keyboard/planck/extended_keymaps/extended_keymap_max.c deleted file mode 100644 index daad22dffe..0000000000 --- a/keyboard/planck/extended_keymaps/extended_keymap_max.c +++ /dev/null @@ -1,49 +0,0 @@ -#include "extended_keymap_common.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = { /* Qwerty */ - {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_SCLN, 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_QUOT}, - {KC_LCTL, BL_STEP, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} - // Space is repeated to accommadate for both spacebar wiring positions -}, -[1] = { /* Colemak */ - {KC_ESC, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, - {KC_TAB, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_ENT }, - {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_QUOT}, - {KC_LCTL, BL_STEP, KC_LALT, KC_LGUI, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} -}, -[2] = { /* 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_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_TRNS}, - {KC_TRNS, KC_F11, KC_F12, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_BSLS}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(1), KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -}, -[3] = { /* LOWER */ - {S(KC_GRV), S(KC_1), S(KC_2), S(KC_3), S(KC_4), S(KC_5), S(KC_6), S(KC_7), S(KC_8), S(KC_9), S(KC_0), KC_BSPC}, - {KC_TRNS, FUNC(3), FUNC(4), RESET, KC_TRNS, KC_TRNS, KC_TRNS, S(KC_MINS), S(KC_EQL), S(KC_LBRC), S(KC_RBRC), KC_TRNS}, - {KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, S(KC_BSLS)}, - {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, FUNC(2), KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} -} -}; - -const uint16_t PROGMEM fn_actions[] = { - [1] = ACTION_LAYER_MOMENTARY(2), // to RAISE - [2] = ACTION_LAYER_MOMENTARY(3), // to LOWER - - [3] = ACTION_DEFAULT_LAYER_SET(0), - [4] = ACTION_DEFAULT_LAYER_SET(1), - -}; - -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: - return MACRODOWN(T(CM_T), END); - break; - } - return MACRO_NONE; -}; diff --git a/keyboard/planck/extended_keymaps/extended_keymap_numpad.c b/keyboard/planck/extended_keymaps/extended_keymap_numpad.c deleted file mode 100644 index 721fd496b0..0000000000 --- a/keyboard/planck/extended_keymaps/extended_keymap_numpad.c +++ /dev/null @@ -1,26 +0,0 @@ -#include "extended_keymap_common.h" - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -[0] = { /* Qwerty */ - {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_KP_MINUS, KC_KP_PLUS, KC_KP_PLUS, KC_KP_ENTER, KC_KP_ENTER}, - {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_KP_ASTERISK, KC_KP_9, KC_KP_6, KC_KP_3, KC_KP_DOT}, - {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_KP_SLASH, KC_KP_8, KC_KP_5, KC_KP_2, KC_KP_0}, - {BL_STEP, KC_LCTL, KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, KC_NUMLOCK, KC_KP_7, KC_KP_4, KC_KP_1, KC_KP_0} - // Space is repeated to accommadate for both spacebar wiring positions -} -}; - -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: - return MACRODOWN(T(CM_T), END); - break; - } - return MACRO_NONE; -};
\ No newline at end of file diff --git a/keyboard/planck/keymap_common.c b/keyboard/planck/keymap_common.c index fdb1769e1c..1ce4500973 100644 --- a/keyboard/planck/keymap_common.c +++ b/keyboard/planck/keymap_common.c @@ -14,17 +14,197 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ + #include "keymap_common.h" +#include "report.h" +#include "keycode.h" +#include "action_layer.h" +#include "action.h" +#include "action_macro.h" +#include "debug.h" +#include "backlight.h" + +static action_t keycode_to_action(uint16_t keycode); + + +/* converts key to action */ +action_t action_for_key(uint8_t layer, keypos_t key) +{ + // 16bit keycodes - important + uint16_t keycode = keymap_key_to_keycode(layer, key); + + if (keycode >= 0x0100 && keycode < 0x2000) { + // Has a modifier + action_t action; + // Split it up + action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); + return action; + } else if (keycode >= 0x2000 && keycode < 0x3000) { + // Is a shortcut for function layer, pull last 12bits + return keymap_func_to_action(keycode & 0xFFF); + } else if (keycode >= 0x3000 && keycode < 0x4000) { + action_t action; + action.code = ACTION_MACRO(keycode & 0xFF); + return action; + } else if (keycode >= BL_0 & keycode <= BL_15) { + action_t action; + action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F); + return action; + } else if (keycode == BL_DEC) { + action_t action; + action.code = ACTION_BACKLIGHT_DECREASE(); + return action; + } else if (keycode == BL_INC) { + action_t action; + action.code = ACTION_BACKLIGHT_INCREASE(); + return action; + } else if (keycode == BL_TOGG) { + action_t action; + action.code = ACTION_BACKLIGHT_TOGGLE(); + return action; + } else if (keycode == BL_STEP) { + action_t action; + action.code = ACTION_BACKLIGHT_STEP(); + return action; + } else if (keycode == RESET) { + bootloader_jump(); + return; + } else if (keycode > RESET) { + // MIDI + return; + } + + switch (keycode) { + case KC_FN0 ... KC_FN31: + return keymap_fn_to_action(keycode); +#ifdef BOOTMAGIC_ENABLE + case KC_CAPSLOCK: + case KC_LOCKING_CAPS: + if (keymap_config.swap_control_capslock || keymap_config.capslock_to_control) { + return keycode_to_action(KC_LCTL); + } + return keycode_to_action(keycode); + case KC_LCTL: + if (keymap_config.swap_control_capslock) { + return keycode_to_action(KC_CAPSLOCK); + } + return keycode_to_action(KC_LCTL); + case KC_LALT: + if (keymap_config.swap_lalt_lgui) { + if (keymap_config.no_gui) { + return keycode_to_action(ACTION_NO); + } + return keycode_to_action(KC_LGUI); + } + return keycode_to_action(KC_LALT); + case KC_LGUI: + if (keymap_config.swap_lalt_lgui) { + return keycode_to_action(KC_LALT); + } + if (keymap_config.no_gui) { + return keycode_to_action(ACTION_NO); + } + return keycode_to_action(KC_LGUI); + case KC_RALT: + if (keymap_config.swap_ralt_rgui) { + if (keymap_config.no_gui) { + return keycode_to_action(ACTION_NO); + } + return keycode_to_action(KC_RGUI); + } + return keycode_to_action(KC_RALT); + case KC_RGUI: + if (keymap_config.swap_ralt_rgui) { + return keycode_to_action(KC_RALT); + } + if (keymap_config.no_gui) { + return keycode_to_action(ACTION_NO); + } + return keycode_to_action(KC_RGUI); + case KC_GRAVE: + if (keymap_config.swap_grave_esc) { + return keycode_to_action(KC_ESC); + } + return keycode_to_action(KC_GRAVE); + case KC_ESC: + if (keymap_config.swap_grave_esc) { + return keycode_to_action(KC_GRAVE); + } + return keycode_to_action(KC_ESC); + case KC_BSLASH: + if (keymap_config.swap_backslash_backspace) { + return keycode_to_action(KC_BSPACE); + } + return keycode_to_action(KC_BSLASH); + case KC_BSPACE: + if (keymap_config.swap_backslash_backspace) { + return keycode_to_action(KC_BSLASH); + } + return keycode_to_action(KC_BSPACE); +#endif + default: + return keycode_to_action(keycode); + } +} + + +/* Macro */ +__attribute__ ((weak)) +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + return MACRO_NONE; +} + +/* Function */ +__attribute__ ((weak)) +void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) +{ +} + +/* translates keycode to action */ +static action_t keycode_to_action(uint16_t keycode) +{ + action_t action; + switch (keycode) { + case KC_A ... KC_EXSEL: + case KC_LCTRL ... KC_RGUI: + action.code = ACTION_KEY(keycode); + break; + case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE: + action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode)); + break; + case KC_AUDIO_MUTE ... KC_WWW_FAVORITES: + action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode)); + break; + case KC_MS_UP ... KC_MS_ACCEL2: + action.code = ACTION_MOUSEKEY(keycode); + break; + case KC_TRNS: + action.code = ACTION_TRANSPARENT; + break; + default: + action.code = ACTION_NO; + break; + } + return action; +} /* translates key to keycode */ -uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) +uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key) { - return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); + // Read entire word (16bits) + return pgm_read_word(&keymaps[(layer)][(key.row)][(key.col)]); } /* translates Fn keycode to action */ -action_t keymap_fn_to_action(uint8_t keycode) +action_t keymap_fn_to_action(uint16_t keycode) { return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; } + +action_t keymap_func_to_action(uint16_t keycode) +{ + // For FUNC without 8bit limit + return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) }; +} diff --git a/keyboard/planck/keymap_common.h b/keyboard/planck/keymap_common.h index d46df92876..e6a7dac5b5 100644 --- a/keyboard/planck/keymap_common.h +++ b/keyboard/planck/keymap_common.h @@ -14,116 +14,167 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef KEYMAP_COMMON_H -#define KEYMAP_COMMON_H + +#ifndef KEYMAP_H +#define KEYMAP_H #include <stdint.h> #include <stdbool.h> +#include "action.h" #include <avr/pgmspace.h> #include "keycode.h" -#include "action.h" +#include "keymap.h" #include "action_macro.h" #include "report.h" #include "host.h" // #include "print.h" #include "debug.h" -#include "keymap.h" + +#ifdef BOOTMAGIC_ENABLE +/* NOTE: Not portable. Bit field order depends on implementation */ +typedef union { + uint16_t raw; + struct { + bool swap_control_capslock:1; + bool capslock_to_control:1; + bool swap_lalt_lgui:1; + bool swap_ralt_rgui:1; + bool no_gui:1; + bool swap_grave_esc:1; + bool swap_backslash_backspace:1; + bool nkro:1; + }; +} keymap_config_t; +keymap_config_t keymap_config; +#endif -extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; -extern const uint16_t fn_actions[]; +/* translates key to keycode */ +uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key); +/* translates Fn keycode to action */ +action_t keymap_fn_to_action(uint16_t keycode); -// MIT Layout -/* - * ,-----------------------------------------------------------------------. - * | | | | | | | | | | | | | - * |-----------------------------------------------------------------------| - * | | | | | | | | | | | | | - * |-----------------------------------------------------------------------| - * | | | | | | | | | | | | | - * |-----------------------------------------------------------------------| - * | | | | | | | | | | | | - * `-----------------------------------------------------------------------' - */ -#define KEYMAP( \ - K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ - K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ - K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ - K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \ -) { \ - { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \ - { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \ - { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \ - { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K35, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \ -} - -// Grid Layout -/* - * ,-----------------------------------------------------------------------. - * | | | | | | | | | | | | | - * |-----------------------------------------------------------------------| - * | | | | | | | | | | | | | - * |-----------------------------------------------------------------------| - * | | | | | | | | | | | | | - * |-----------------------------------------------------------------------| - * | | | | | | | | | | | | | - * `-----------------------------------------------------------------------' - */ -#define KEYMAP_GRID( \ - K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ - K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ - K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ - K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \ -) { \ - { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \ - { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \ - { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \ - { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \ -} - -#define KEYMAP_REVERSE( \ - K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ - K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ - K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ - K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \ - ) { \ - { KC_##K0B, KC_##K0A, KC_##K09, KC_##K08, KC_##K07, KC_##K06, KC_##K05, KC_##K04, KC_##K03, KC_##K02, KC_##K01, KC_##K00 }, \ - { KC_##K1B, KC_##K1A, KC_##K19, KC_##K18, KC_##K17, KC_##K16, KC_##K15, KC_##K14, KC_##K13, KC_##K12, KC_##K11, KC_##K10 }, \ - { KC_##K2B, KC_##K2A, KC_##K29, KC_##K28, KC_##K27, KC_##K26, KC_##K25, KC_##K24, KC_##K23, KC_##K22, KC_##K21, KC_##K20 }, \ - { KC_##K3B, KC_##K3A, KC_##K39, KC_##K38, KC_##K37, KC_##K35, KC_##K35, KC_##K34, KC_##K33, KC_##K32, KC_##K31, KC_##K30 }, \ - } - -#define KEYMAP_AND_REVERSE(args...) KEYMAP(args), KEYMAP_REVERSE(args) - -#define KEYMAP_SWAP( \ - K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ - K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ - K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ - K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \ - ) { \ - { KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05 }, \ - { KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15 }, \ - { KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25 }, \ - { KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K35, KC_##K35, KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34 }, \ -} - -#define KEYMAP_AND_SWAP(args...) KEYMAP(args), KEYMAP_SWAP(args) +/* translates Fn keycode to action */ +action_t keymap_func_to_action(uint16_t keycode); -/* - Keymap for the Planck 48 key variant. - */ -#define KEYMAP_48( \ - K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ - K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ - K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ - K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \ -) { \ - { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \ - { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \ - { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \ - { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }, \ -} +extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; +extern const uint16_t fn_actions[]; +// Ability to use mods in layouts +#define LCTL(kc) kc | 0x0100 +#define LSFT(kc) kc | 0x0200 +#define LALT(kc) kc | 0x0400 +#define LGUI(kc) kc | 0x0800 +#define RCTL(kc) kc | 0x1100 +#define RSFT(kc) kc | 0x1200 +#define RALT(kc) kc | 0x1400 +#define RGUI(kc) kc | 0x1800 + +// Alias for function layers than expand past FN31 +#define FUNC(kc) kc | 0x2000 + +// Aliases +#define S(kc) LSFT(kc) +#define F(kc) FUNC(kc) + +// For software implementation of colemak +#define CM_Q KC_Q +#define CM_W KC_W +#define CM_F KC_E +#define CM_P KC_R +#define CM_G KC_T +#define CM_J KC_Y +#define CM_L KC_U +#define CM_U KC_I +#define CM_Y KC_O +#define CM_SCLN KC_P + +#define CM_A KC_A +#define CM_R KC_S +#define CM_S KC_D +#define CM_T KC_F +#define CM_D KC_G +#define CM_H KC_H +#define CM_N KC_J +#define CM_E KC_K +#define CM_I KC_L +#define CM_O KC_SCLN + +#define CM_Z KC_Z +#define CM_X KC_X +#define CM_C KC_C +#define CM_V KC_V +#define CM_B KC_B +#define CM_K KC_N +#define CM_M KC_M +#define CM_COMM KC_COMM +#define CM_DOT KC_DOT +#define CM_SLSH KC_SLSH + +// Make it easy to support these in macros +#define KC_CM_Q CM_Q +#define KC_CM_W CM_W +#define KC_CM_F CM_F +#define KC_CM_P CM_P +#define KC_CM_G CM_G +#define KC_CM_J CM_J +#define KC_CM_L CM_L +#define KC_CM_U CM_U +#define KC_CM_Y CM_Y +#define KC_CM_SCLN CM_SCLN + +#define KC_CM_A CM_A +#define KC_CM_R CM_R +#define KC_CM_S CM_S +#define KC_CM_T CM_T +#define KC_CM_D CM_D +#define KC_CM_H CM_H +#define KC_CM_N CM_N +#define KC_CM_E CM_E +#define KC_CM_I CM_I +#define KC_CM_O CM_O + +#define KC_CM_Z CM_Z +#define KC_CM_X CM_X +#define KC_CM_C CM_C +#define KC_CM_V CM_V +#define KC_CM_B CM_B +#define KC_CM_K CM_K +#define KC_CM_M CM_M +#define KC_CM_COMM CM_COMM +#define KC_CM_DOT CM_DOT +#define KC_CM_SLSH CM_SLSH + +#define M(kc) kc | 0x3000 + +#define MACRODOWN(...) (record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE) + +#define BL_ON 0x4009 +#define BL_OFF 0x4000 +#define BL_0 0x4000 +#define BL_1 0x4001 +#define BL_2 0x4002 +#define BL_3 0x4003 +#define BL_4 0x4004 +#define BL_5 0x4005 +#define BL_6 0x4006 +#define BL_7 0x4007 +#define BL_8 0x4008 +#define BL_9 0x4009 +#define BL_10 0x400A +#define BL_11 0x400B +#define BL_12 0x400C +#define BL_13 0x400D +#define BL_14 0x400E +#define BL_15 0x400F +#define BL_DEC 0x4010 +#define BL_INC 0x4011 +#define BL_TOGG 0x4012 +#define BL_STEP 0x4013 + +#define RESET 0x5000 + +#define MIDI(n) n | 0x6000 #endif diff --git a/keyboard/planck/extended_keymaps/extended_keymap_default.c b/keyboard/planck/keymaps/keymap_default.c index c75144bf4a..7eb81b2027 100644 --- a/keyboard/planck/extended_keymaps/extended_keymap_default.c +++ b/keyboard/planck/keymaps/keymap_default.c @@ -1,6 +1,5 @@ -#include "extended_keymap_common.h" +#include "keymap_common.h" #include "backlight.h" -#include "lufa.h" #include "debug.h" const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -53,11 +52,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) case 0: if (record->event.pressed) { register_code(KC_RSFT); - midi_send_noteon(&midi_device, 1, 64, 127); backlight_step(); } else { unregister_code(KC_RSFT); - midi_send_noteoff(&midi_device, 1, 64, 127); } break; } diff --git a/keyboard/planck/matrix.c b/keyboard/planck/matrix.c index 58bd61f758..98ef55ed68 100644 --- a/keyboard/planck/matrix.c +++ b/keyboard/planck/matrix.c @@ -27,7 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "debug.h" #include "util.h" #include "matrix.h" -#include "backlight.h" // TODO fix this dependency #ifndef DEBOUNCE # define DEBOUNCE 10 diff --git a/keyboard/planck/matrix_center.c b/keyboard/planck/matrix_center.c deleted file mode 100644 index 2a603f334b..0000000000 --- a/keyboard/planck/matrix_center.c +++ /dev/null @@ -1,269 +0,0 @@ -/* -Copyright 2012 Jun Wako <wakojun@gmail.com> - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -/* - * scan matrix - */ -#include <stdint.h> -#include <stdbool.h> -#include <avr/io.h> -#include <util/delay.h> -#include "action_layer.h" -// #include "print.h" -#include "debug.h" -#include "util.h" -#include "matrix.h" -#include "analog.h" - - -#ifndef DEBOUNCE -# define DEBOUNCE 10 -#endif -static uint8_t debouncing = DEBOUNCE; - -/* matrix state(1:on, 0:off) */ -static matrix_row_t matrix[MATRIX_ROWS]; -static matrix_row_t matrix_debouncing[MATRIX_ROWS]; - -static matrix_row_t read_cols(void); -static void init_cols(void); -static void init_encoder(void); -static void init_pot(void); -static void unselect_rows(void); -static void select_row(uint8_t row); -int16_t analogRead(uint8_t pin); -uint8_t state; -int32_t position; -int16_t value; - -inline -uint8_t matrix_rows(void) -{ - return MATRIX_ROWS; -} - -inline -uint8_t matrix_cols(void) -{ - return MATRIX_COLS; -} - -void matrix_init(void) -{ - // initialize row and col - unselect_rows(); - init_cols(); - init_encoder(); - init_pot(); - - // initialize matrix state: all keys off - for (uint8_t i=0; i < MATRIX_ROWS; i++) { - matrix[i] = 0; - matrix_debouncing[i] = 0; - } -} - -static void init_encoder(void) -{ - DDRC &= ~(1<<6 | 1<<7); - PORTC |= (1<<6 | 1<<7); - - uint8_t s = 0; - _delay_ms(1); - if (PINC&(1<<6)) s |= 1; - if (PINC&(1<<7)) s |= 2; - state = s; - position = 0; -} - -void read_encoder(void) -{ - uint8_t s = state & 3; - if (PINC&(1<<6)) s |= 4; - if (PINC&(1<<7)) s |= 8; - state = (s >> 2); - switch (s) { - case 1: case 7: case 8: case 14: - position++; - break; - case 2: case 4: case 11: case 13: - position--; - break; - case 3: case 12: - position += 2; - break; - case 6: case 9: - position -= 2; - break; - } -} - -#define HEX(n) (((n) < 10) ? ((n) + '0') : ((n) + 'A' - 10)) - -static void init_pot(void) -{ - // DDRD &= ~(1<<4); - // PORTD |= (1<<4); - // DIDR2 = (1<<0); -} - -uint8_t matrix_scan(void) -{ - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - select_row(i); - _delay_us(30); // without this wait read unstable value. - matrix_row_t cols = read_cols(); - if (matrix_debouncing[i] != cols) { - matrix_debouncing[i] = cols; - if (debouncing) { - debug("bounce!: "); debug_hex(debouncing); debug("\n"); - } - debouncing = DEBOUNCE; - } - unselect_rows(); - } - - if (debouncing) { - if (--debouncing) { - _delay_ms(1); - } else { - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - matrix[i] = matrix_debouncing[i]; - } - } - } - - read_encoder(); - if (position >= 2) { - register_code(KC_AUDIO_VOL_UP); - unregister_code(KC_AUDIO_VOL_UP); - position = 0; - } else if (position <= -2) { - register_code(KC_AUDIO_VOL_DOWN); - unregister_code(KC_AUDIO_VOL_DOWN); - position = 0; - } - - // uint16_t val = analogRead(11); - - // debug("analogRead: "); debug_hex(val); debug("\n"); - - return 1; -} - -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<<col)); -} - -inline -matrix_row_t matrix_get_row(uint8_t row) -{ - return matrix[row]; -} - -void matrix_print(void) -{ - print("\nr/c 0123456789ABCDEF\n"); - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - phex(row); print(": "); - pbin_reverse16(matrix_get_row(row)); - print("\n"); - } -} - -uint8_t matrix_key_count(void) -{ - uint8_t count = 0; - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - count += bitpop16(matrix[i]); - } - return count; -} - -/* Column pin configuration - * col: 0 1 2 3 4 5 6 7 8 9 10 11 - * pin: F0 F1 F4 F5 F6 F7 B6 B5 B4 D7 D5 D4 - */ - -static void init_cols(void) -{ - DDRF &= ~(1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7); - PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7); - DDRD &= ~(1<<0); - PORTD |= (1<<0); - DDRB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7); - PORTB |= (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<7); -} - -static matrix_row_t read_cols(void) -{ - return (PINB&(1<<0) ? 0 : (1<< 0)) | - (PINB&(1<<1) ? 0 : (1<< 1)) | - (PINB&(1<<2) ? 0 : (1<< 2)) | - (PINB&(1<<3) ? 0 : (1<< 3)) | - (PINB&(1<<7) ? 0 : (1<< 4)) | - (PIND&(1<<0) ? 0 : (1<< 5)) | - (PINF&(1<<7) ? 0 : (1<< 6)) | - (PINF&(1<<6) ? 0 : (1<< 7)) | - (PINF&(1<<5) ? 0 : (1<< 8)) | - (PINF&(1<<4) ? 0 : (1<< 9)) | - (PINF&(1<<1) ? 0 : (1<<10)) | - (PINF&(1<<0) ? 0 : (1<<11)); -} - -/* Row pin configuration - * row: 0 1 2 3 - * pin: B0 B1 B2 B3 - */ -static void unselect_rows(void) -{ - // Hi-Z(DDR:0, PORT:0) to unselect - DDRB &= ~0b01110000; - PORTB &= ~0b01110000; - DDRD &= ~0b10000000; - PORTD &= ~0b10000000; -} - -static void select_row(uint8_t row) -{ - switch (row) { - case 0: - DDRB |= (1<<6); - PORTB &= ~(1<<6); - break; - case 1: - DDRB |= (1<<5); - PORTB &= ~(1<<5); - break; - case 2: - DDRB |= (1<<4); - PORTB &= ~(1<<4); - break; - case 3: - DDRD |= (1<<7); - PORTD &= ~(1<<7); - break; - } -} diff --git a/keyboard/planck/matrix_handwired.c b/keyboard/planck/matrix_handwired.c deleted file mode 100644 index 2ae69c3c80..0000000000 --- a/keyboard/planck/matrix_handwired.c +++ /dev/null @@ -1,193 +0,0 @@ -/* -Copyright 2012 Jun Wako -Generated by planckkeyboard.com (2014 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 <http://www.gnu.org/licenses/>. -*/ - -/* - * scan matrix - */ -#include <stdint.h> -#include <stdbool.h> -#include <avr/io.h> -#include <util/delay.h> -// #include "print.h" -#include "debug.h" -#include "util.h" -#include "matrix.h" - - -#ifndef DEBOUNCE -# define DEBOUNCE 10 -#endif -static uint8_t debouncing = DEBOUNCE; - -/* matrix state(1:on, 0:off) */ -static matrix_row_t matrix[MATRIX_ROWS]; -static matrix_row_t matrix_debouncing[MATRIX_ROWS]; - -static matrix_row_t read_cols(void); -static void init_cols(void); -static void unselect_rows(void); -static void select_row(uint8_t row); - -inline -uint8_t matrix_rows(void) -{ - return MATRIX_ROWS; -} - -inline -uint8_t matrix_cols(void) -{ - return MATRIX_COLS; -} - -void matrix_init(void) -{ - // initialize row and col - unselect_rows(); - init_cols(); - - // initialize matrix state: all keys off - for (uint8_t i=0; i < MATRIX_ROWS; i++) { - matrix[i] = 0; - matrix_debouncing[i] = 0; - } -} - -uint8_t matrix_scan(void) -{ - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - select_row(i); - _delay_us(30); // without this wait read unstable value. - matrix_row_t cols = read_cols(); - if (matrix_debouncing[i] != cols) { - matrix_debouncing[i] = cols; - if (debouncing) { - debug("bounce!: "); debug_hex(debouncing); debug("\n"); - } - debouncing = DEBOUNCE; - } - unselect_rows(); - } - - if (debouncing) { - if (--debouncing) { - _delay_ms(1); - } else { - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - matrix[i] = matrix_debouncing[i]; - } - } - } - - return 1; -} - -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<col)); -} - -inline -matrix_row_t matrix_get_row(uint8_t row) -{ - return matrix[row]; -} - -void matrix_print(void) -{ - print("\nr/c 0123456789ABCDEF\n"); - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - phex(row); print(": "); - pbin_reverse16(matrix_get_row(row)); - print("\n"); - } -} - -uint8_t matrix_key_count(void) -{ - uint8_t count = 0; - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - count += bitpop16(matrix[i]); - } - return count; -} - -static void init_cols(void) -{ - DDRB &= ~(1<<6 | 1<<5 | 1<<4); - PORTB |= (1<<6 | 1<<5 | 1<<4); - DDRD &= ~(1<<7 | 1<<6 | 1<<4); - PORTD |= (1<<7 | 1<<6 | 1<<4); - DDRF &= ~(1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7); - PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7); - -} - -static matrix_row_t read_cols(void) -{ - return (PIND&(1<<4) ? 0 : (1<<0)) | - (PIND&(1<<6) ? 0 : (1<<1)) | - (PIND&(1<<7) ? 0 : (1<<2)) | - (PINB&(1<<4) ? 0 : (1<<3)) | - (PINB&(1<<5) ? 0 : (1<<4)) | - (PINB&(1<<6) ? 0 : (1<<5)) | - (PINF&(1<<7) ? 0 : (1<<6)) | - (PINF&(1<<6) ? 0 : (1<<7)) | - (PINF&(1<<5) ? 0 : (1<<8)) | - (PINF&(1<<4) ? 0 : (1<<9)) | - (PINF&(1<<1) ? 0 : (1<<10)) | - (PINF&(1<<0) ? 0 : (1<<11)); - -} - -static void unselect_rows(void) -{ - DDRB &= ~(1<<0 | 1<<1 | 1<<2 | 1<<3); - PORTB |= (1<<0 | 1<<1 | 1<<2 | 1<<3); - -} - -static void select_row(uint8_t row) -{ - switch (row) { - case 0: - DDRB |= (1<<0); - PORTB &= ~(1<<0); - break; - case 1: - DDRB |= (1<<1); - PORTB &= ~(1<<1); - break; - case 2: - DDRB |= (1<<2); - PORTB &= ~(1<<2); - break; - case 3: - DDRB |= (1<<3); - PORTB &= ~(1<<3); - break; - - } -} diff --git a/keyboard/planck/matrix_pcb.c b/keyboard/planck/matrix_pcb.c deleted file mode 100644 index 2a9ec8fcde..0000000000 --- a/keyboard/planck/matrix_pcb.c +++ /dev/null @@ -1,222 +0,0 @@ -/* -Copyright 2012 Jun Wako -Generated by planckkeyboard.com (2014 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 <http://www.gnu.org/licenses/>. -*/ - -/* - * scan matrix - */ -#include <stdint.h> -#include <stdbool.h> -#include <avr/io.h> -#include <util/delay.h> -// #include "print.h" -#include "debug.h" -#include "util.h" -#include "matrix.h" -#include "backlight.h" // TODO fix this dependency - -#ifndef DEBOUNCE -# define DEBOUNCE 10 -#endif -static uint8_t debouncing = DEBOUNCE; - -/* matrix state(1:on, 0:off) */ -static matrix_row_t matrix[MATRIX_ROWS]; -static matrix_row_t matrix_debouncing[MATRIX_ROWS]; - -static matrix_row_t read_cols(void); -static void init_cols(void); -static void unselect_rows(void); -static void select_row(uint8_t row); - -inline -uint8_t matrix_rows(void) -{ - return MATRIX_ROWS; -} - -inline -uint8_t matrix_cols(void) -{ - return MATRIX_COLS; -} - -void matrix_init(void) -{ - // To use PORTF disable JTAG with writing JTD bit twice within four cycles. - MCUCR |= (1<<JTD); - MCUCR |= (1<<JTD); - - backlight_init_ports(); - - // Turn status LED on - DDRE |= (1<<6); - PORTE |= (1<<6); - - // initialize row and col - unselect_rows(); - init_cols(); - - // initialize matrix state: all keys off - for (uint8_t i=0; i < MATRIX_ROWS; i++) { - matrix[i] = 0; - matrix_debouncing[i] = 0; - } -} - - -uint8_t matrix_scan(void) -{ - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - select_row(i); - _delay_us(30); // without this wait read unstable value. - matrix_row_t cols = read_cols(); - if (matrix_debouncing[i] != cols) { - matrix_debouncing[i] = cols; - if (debouncing) { - debug("bounce!: "); debug_hex(debouncing); debug("\n"); - } - debouncing = DEBOUNCE; - } - unselect_rows(); - } - - if (debouncing) { - if (--debouncing) { - _delay_ms(1); - } else { - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - matrix[i] = matrix_debouncing[i]; - } - } - } - - return 1; -} - -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<col)); -} - -inline -matrix_row_t matrix_get_row(uint8_t row) -{ - return matrix[row]; -} - -void matrix_print(void) -{ - print("\nr/c 0123456789ABCDEF\n"); - for (uint8_t row = 0; row < MATRIX_ROWS; row++) { - phex(row); print(": "); - pbin_reverse16(matrix_get_row(row)); - print("\n"); - } -} - -uint8_t matrix_key_count(void) -{ - uint8_t count = 0; - for (uint8_t i = 0; i < MATRIX_ROWS; i++) { - count += bitpop16(matrix[i]); - } - return count; -} - -// -// Planck PCB Rev 1 Pin Assignments -// -// Column: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 -// Pin: F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 -// - -static void init_cols(void) -{ - DDRB &= ~(1<<4 | 1<<0); - PORTB |= (1<<4 | 1<<0); - DDRC &= ~(1<<7); - PORTC |= (1<<7); - DDRD &= ~(1<<7 | 1<<6 | 1<<4); - PORTD |= (1<<7 | 1<<6 | 1<<4); - DDRF &= ~(1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7); - PORTF |= (1<<0 | 1<<1 | 1<<4 | 1<<5 | 1<<6 | 1<<7); - -} - -static matrix_row_t read_cols(void) -{ - return (PINF&(1<<1) ? 0 : (1<<0)) | - (PINF&(1<<0) ? 0 : (1<<1)) | - (PINB&(1<<0) ? 0 : (1<<2)) | - (PINC&(1<<7) ? 0 : (1<<3)) | - (PINF&(1<<4) ? 0 : (1<<4)) | - (PINF&(1<<5) ? 0 : (1<<5)) | - (PINF&(1<<6) ? 0 : (1<<6)) | - (PINF&(1<<7) ? 0 : (1<<7)) | - (PIND&(1<<4) ? 0 : (1<<8)) | - (PIND&(1<<6) ? 0 : (1<<9)) | - (PINB&(1<<4) ? 0 : (1<<10)) | - (PIND&(1<<7) ? 0 : (1<<11)); - -} - -// -// Planck PCB Rev 1 Pin Assignments -// -// Row: 0, 1, 2, 3 -// Pin: D0, D5, B5, B6 -// - -static void unselect_rows(void) -{ - DDRB &= ~(1<<5 | 1<<6); - PORTB |= (1<<5 | 1<<6); - DDRD &= ~(1<<0 | 1<<5); - PORTD |= (1<<0 | 1<<5); - -} - -static void select_row(uint8_t row) -{ - switch (row) { - case 0: - DDRD |= (1<<0); - PORTD &= ~(1<<0); - break; - case 1: - DDRD |= (1<<5); - PORTD &= ~(1<<5); - break; - case 2: - DDRB |= (1<<5); - PORTB &= ~(1<<5); - break; - case 3: - DDRB |= (1<<6); - PORTB &= ~(1<<6); - break; - - } -}
\ No newline at end of file diff --git a/keyboard/planck/common_keymaps/keymap_brett.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_brett.c index 97d832b47a..97d832b47a 100644 --- a/keyboard/planck/common_keymaps/keymap_brett.c +++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_brett.c diff --git a/keyboard/planck/common_keymaps/keymap_dotcom.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_dotcom.c index 347f6dea91..347f6dea91 100644 --- a/keyboard/planck/common_keymaps/keymap_dotcom.c +++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_dotcom.c diff --git a/keyboard/planck/common_keymaps/keymap_jack.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_jack.c index c74812121f..c74812121f 100644 --- a/keyboard/planck/common_keymaps/keymap_jack.c +++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_jack.c diff --git a/keyboard/planck/common_keymaps/keymap_joe.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_joe.c index 598b0c455c..598b0c455c 100644 --- a/keyboard/planck/common_keymaps/keymap_joe.c +++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_joe.c diff --git a/keyboard/planck/common_keymaps/keymap_matthew.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_matthew.c index 56e7003a97..56e7003a97 100644 --- a/keyboard/planck/common_keymaps/keymap_matthew.c +++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_matthew.c diff --git a/keyboard/planck/common_keymaps/keymap_nathan.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_nathan.c index 5a0900b66d..5a0900b66d 100644 --- a/keyboard/planck/common_keymaps/keymap_nathan.c +++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_nathan.c diff --git a/keyboard/planck/common_keymaps/keymap_paul.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_paul.c index 49c90e0196..49c90e0196 100644 --- a/keyboard/planck/common_keymaps/keymap_paul.c +++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_paul.c diff --git a/keyboard/planck/common_keymaps/keymap_peasant.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_peasant.c index ddacb614e6..ddacb614e6 100644 --- a/keyboard/planck/common_keymaps/keymap_peasant.c +++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_peasant.c diff --git a/keyboard/planck/common_keymaps/keymap_reed.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_reed.c index 1aa24e10de..1aa24e10de 100644 --- a/keyboard/planck/common_keymaps/keymap_reed.c +++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_reed.c diff --git a/keyboard/planck/common_keymaps/keymap_sean.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_sean.c index cb2ef8f138..cb2ef8f138 100644 --- a/keyboard/planck/common_keymaps/keymap_sean.c +++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_sean.c diff --git a/keyboard/planck/common_keymaps/keymap_shane.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_shane.c index 8d5ad68753..8d5ad68753 100644 --- a/keyboard/planck/common_keymaps/keymap_shane.c +++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_shane.c diff --git a/keyboard/planck/common_keymaps/keymap_simon.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_simon.c index 37951364be..37951364be 100644 --- a/keyboard/planck/common_keymaps/keymap_simon.c +++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_simon.c diff --git a/keyboard/planck/common_keymaps/keymap_tim.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_tim.c index 7444f3877b..7444f3877b 100644 --- a/keyboard/planck/common_keymaps/keymap_tim.c +++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_tim.c diff --git a/keyboard/planck/common_keymaps/keymap_wilba.c b/keyboard/planck/old_keymap_files/common_keymaps/keymap_wilba.c index 9781f8fcd8..9781f8fcd8 100644 --- a/keyboard/planck/common_keymaps/keymap_wilba.c +++ b/keyboard/planck/old_keymap_files/common_keymaps/keymap_wilba.c diff --git a/keyboard/planck/old_keymap_files/keymap_common.c b/keyboard/planck/old_keymap_files/keymap_common.c new file mode 100644 index 0000000000..fdb1769e1c --- /dev/null +++ b/keyboard/planck/old_keymap_files/keymap_common.c @@ -0,0 +1,30 @@ +/* +Copyright 2012,2013 Jun Wako <wakojun@gmail.com> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#include "keymap_common.h" + + +/* translates key to keycode */ +uint8_t keymap_key_to_keycode(uint8_t layer, keypos_t key) +{ + return pgm_read_byte(&keymaps[(layer)][(key.row)][(key.col)]); +} + +/* translates Fn keycode to action */ +action_t keymap_fn_to_action(uint8_t keycode) +{ + return (action_t){ .code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]) }; +} diff --git a/keyboard/planck/old_keymap_files/keymap_common.h b/keyboard/planck/old_keymap_files/keymap_common.h new file mode 100644 index 0000000000..d46df92876 --- /dev/null +++ b/keyboard/planck/old_keymap_files/keymap_common.h @@ -0,0 +1,129 @@ +/* +Copyright 2012,2013 Jun Wako <wakojun@gmail.com> + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef KEYMAP_COMMON_H +#define KEYMAP_COMMON_H + +#include <stdint.h> +#include <stdbool.h> +#include <avr/pgmspace.h> +#include "keycode.h" +#include "action.h" +#include "action_macro.h" +#include "report.h" +#include "host.h" +// #include "print.h" +#include "debug.h" +#include "keymap.h" + + +extern const uint8_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; +extern const uint16_t fn_actions[]; + + +// MIT Layout +/* + * ,-----------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |-----------------------------------------------------------------------| + * | | | | | | | | | | | | | + * |-----------------------------------------------------------------------| + * | | | | | | | | | | | | | + * |-----------------------------------------------------------------------| + * | | | | | | | | | | | | + * `-----------------------------------------------------------------------' + */ +#define KEYMAP( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \ +) { \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K35, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \ +} + +// Grid Layout +/* + * ,-----------------------------------------------------------------------. + * | | | | | | | | | | | | | + * |-----------------------------------------------------------------------| + * | | | | | | | | | | | | | + * |-----------------------------------------------------------------------| + * | | | | | | | | | | | | | + * |-----------------------------------------------------------------------| + * | | | | | | | | | | | | | + * `-----------------------------------------------------------------------' + */ +#define KEYMAP_GRID( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \ +) { \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B } \ +} + +#define KEYMAP_REVERSE( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \ + ) { \ + { KC_##K0B, KC_##K0A, KC_##K09, KC_##K08, KC_##K07, KC_##K06, KC_##K05, KC_##K04, KC_##K03, KC_##K02, KC_##K01, KC_##K00 }, \ + { KC_##K1B, KC_##K1A, KC_##K19, KC_##K18, KC_##K17, KC_##K16, KC_##K15, KC_##K14, KC_##K13, KC_##K12, KC_##K11, KC_##K10 }, \ + { KC_##K2B, KC_##K2A, KC_##K29, KC_##K28, KC_##K27, KC_##K26, KC_##K25, KC_##K24, KC_##K23, KC_##K22, KC_##K21, KC_##K20 }, \ + { KC_##K3B, KC_##K3A, KC_##K39, KC_##K38, KC_##K37, KC_##K35, KC_##K35, KC_##K34, KC_##K33, KC_##K32, KC_##K31, KC_##K30 }, \ + } + +#define KEYMAP_AND_REVERSE(args...) KEYMAP(args), KEYMAP_REVERSE(args) + +#define KEYMAP_SWAP( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K35, K37, K38, K39, K3A, K3B \ + ) { \ + { KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B, KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05 }, \ + { KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B, KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15 }, \ + { KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B, KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25 }, \ + { KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B, KC_##K35, KC_##K35, KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34 }, \ +} + +#define KEYMAP_AND_SWAP(args...) KEYMAP(args), KEYMAP_SWAP(args) + +/* + Keymap for the Planck 48 key variant. + */ +#define KEYMAP_48( \ + K00, K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, K0B, \ + K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, \ + K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, \ + K30, K31, K32, K33, K34, K35, K36, K37, K38, K39, K3A, K3B \ +) { \ + { KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06, KC_##K07, KC_##K08, KC_##K09, KC_##K0A, KC_##K0B }, \ + { KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16, KC_##K17, KC_##K18, KC_##K19, KC_##K1A, KC_##K1B }, \ + { KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26, KC_##K27, KC_##K28, KC_##K29, KC_##K2A, KC_##K2B }, \ + { KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36, KC_##K37, KC_##K38, KC_##K39, KC_##K3A, KC_##K3B }, \ +} + + +#endif |