Olivier 9 years ago
commit b03a9f7252

@ -16,13 +16,21 @@ The documentation below explains QMK customizations and elaborates on some of th
* If you're looking to customize a keyboard that currently runs QMK or TMK, find your keyboard's directory under `keyboard/` and run the make commands from there. * If you're looking to customize a keyboard that currently runs QMK or TMK, find your keyboard's directory under `keyboard/` and run the make commands from there.
* If you're looking to apply this firmware to an entirely new hardware project (a new kind of keyboard), you can create your own Quantum-based project by using `./new_project.sh <project_name>`, which will create `/keyboard/<project_name>` with all the necessary components for a Quantum project. * If you're looking to apply this firmware to an entirely new hardware project (a new kind of keyboard), you can create your own Quantum-based project by using `./new_project.sh <project_name>`, which will create `/keyboard/<project_name>` with all the necessary components for a Quantum project.
### Makefile Options
You have access to a bunch of goodies! Check out the Makefile to enable/disable some of the features. Uncomment the `#` to enable them. Setting them to `no` does nothing and will only confuse future you. You have access to a bunch of goodies! Check out the Makefile to enable/disable some of the features. Uncomment the `#` to enable them. Setting them to `no` does nothing and will only confuse future you.
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = yes # MIDI controls MIDI_ENABLE = yes # MIDI controls
# UNICODE_ENABLE = yes # Unicode support - this is commented out, just as an example. You have to use #, not // UNICODE_ENABLE = no # <-- This is how you disable an option, just set it to "no"
BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
### Customizing Makefile options on a per-keymap basis
If your keymap directory has a file called `makefile.mk` (note the lowercase filename, and the `.mk` extension), any Makefile options you set in that file will take precedence over other Makefile options (those set for Quantum as a whole or for your particular keyboard).
So let's say your keyboard's makefile has `CONSOLE_ENABLE = yes` (or maybe doesn't even list the `CONSOLE_ENABLE` option, which would cause it to revert to the global Quantum default). You want your particular keymap to not have the debug console, so you make a file called `makefile.mk` and specify `CONSOLE_ENABLE = no`.
## Quick aliases to common actions ## Quick aliases to common actions
Your keymap can include shortcuts to common operations (called "function actions" in tmk). Your keymap can include shortcuts to common operations (called "function actions" in tmk).
@ -199,6 +207,10 @@ This will clear all mods currently pressed.
This will clear all keys besides the mods currently pressed. This will clear all keys besides the mods currently pressed.
* `update_tri_layer(layer_1, layer_2, layer_3);`
If the user attempts to activate layer 1 AND layer 2 at the same time (for example, by hitting their respective layer keys), layer 3 will be activated. Layers 1 and 2 will _also_ be activated, for the purposes of fallbacks (so a given key will fall back from 3 to 2, to 1 -- and only then to 0).
#### Timer functionality #### Timer functionality
It's possible to start timers and read values for time-specific events - here's an example: It's possible to start timers and read values for time-specific events - here's an example:
@ -292,7 +304,7 @@ For this mod, you need an unused pin wiring to DI of WS2812 strip. After wiring
Please note that the underglow is not compatible with audio output. So you cannot enable both of them at the same time. Please note that the underglow is not compatible with audio output. So you cannot enable both of them at the same time.
Please add the following options into your config.h, and set them up according your hardware configuration. Please add the following options into your config.h, and set them up according your hardware configuration. These settings are for the F4 by default:
#define ws2812_PORTREG PORTF #define ws2812_PORTREG PORTF
#define ws2812_DDRREG DDRF #define ws2812_DDRREG DDRF
@ -302,6 +314,12 @@ Please add the following options into your config.h, and set them up according y
#define RGBLIGHT_SAT_STEP 17 #define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17 #define RGBLIGHT_VAL_STEP 17
You'll need to edit `PORTF`, `DDRF`, and `PF4` on the first three lines to the port/pin you have your LED(s) wired to, eg for B3 change things to:
#define ws2812_PORTREG PORTB
#define ws2812_DDRREG DDRB
#define ws2812_pin PB3
The firmware supports 5 different light effects, and the color (hue, saturation, brightness) can be customized in most effects. To control the underglow, you need to modify your keymap file to assign those functions to some keys/key combinations. For details, please check this keymap. `keyboard/planck/keymaps/yang/keymap.c` The firmware supports 5 different light effects, and the color (hue, saturation, brightness) can be customized in most effects. To control the underglow, you need to modify your keymap file to assign those functions to some keys/key combinations. For details, please check this keymap. `keyboard/planck/keymaps/yang/keymap.c`
### WS2812 Wiring ### WS2812 Wiring

@ -41,7 +41,6 @@
# Target file name (without extension). # Target file name (without extension).
TARGET = atomic TARGET = atomic
# Directory common source filess exist # Directory common source filess exist
TOP_DIR = ../.. TOP_DIR = ../..
TMK_DIR = ../../tmk_core TMK_DIR = ../../tmk_core
@ -50,14 +49,41 @@ TMK_DIR = ../../tmk_core
TARGET_DIR = . TARGET_DIR = .
# # project specific files # # project specific files
SRC = atomic.c \ SRC = atomic.c
backlight.c
ifdef keymap
KEYMAP = $(keymap)
endif
ifdef KEYMAP ifdef KEYMAP
SRC := keymaps/$(KEYMAP).c $(SRC) ifneq ("$(wildcard keymaps/$(KEYMAP).c)","")
KEYMAP_FILE = keymaps/$(KEYMAP).c
else
ifneq ("$(wildcard keymaps/$(KEYMAP)/keymap.c)","")
KEYMAP_FILE = keymaps/$(KEYMAP)/keymap.c
ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","")
include keymaps/$(KEYMAP)/makefile.mk
endif
else else
SRC := keymaps/default.c $(SRC) $(error Keymap file does not exist)
endif endif
endif
else
ifneq ("$(wildcard keymaps/default.c)","")
KEYMAP_FILE = keymaps/default.c
else
KEYMAP_FILE = keymaps/default/keymap.c
endif
ifneq ("$(wildcard keymaps/default/makefile.mk)","")
include keymaps/default/makefile.mk
endif
endif
SRC := $(KEYMAP_FILE) $(SRC)
CONFIG_H = config.h CONFIG_H = config.h
@ -78,7 +104,6 @@ MCU = atmega32u4
# software delays. # software delays.
F_CPU = 16000000 F_CPU = 16000000
# #
# LUFA specific # LUFA specific
# #
@ -110,23 +135,45 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# USBaspLoader 2048 # USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096 OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options # Build Options
# comment out to disable the options. # change to "no" to disable the options, or define them in the makefile.mk in
# # the appropriate keymap folder that will get included automatically
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) #
MOUSEKEY_ENABLE = yes # Mouse keys(+4700) BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450) MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
CONSOLE_ENABLE = yes # Console for debug(+400) EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
COMMAND_ENABLE = yes # Commands for debug and configuration CONSOLE_ENABLE = yes # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality ifdef KEYMAP
# MIDI_ENABLE = YES # MIDI controls
# UNICODE_ENABLE = YES # Unicode ifeq ("$(wildcard keymaps/$(KEYMAP).c)","")
# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","")
include keymaps/$(KEYMAP)/makefile.mk
endif
endif
else
ifneq ("$(wildcard keymaps/default/makefile.mk)","")
include keymaps/default/makefile.mk
endif
endif
ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
SRC := backlight.c $(SRC)
endif
# Optimize size but this may cause error "relocation truncated to fit" # Optimize size but this may cause error "relocation truncated to fit"
#EXTRALDFLAGS = -Wl,--relax #EXTRALDFLAGS = -Wl,--relax
@ -137,4 +184,3 @@ VPATH += $(TOP_DIR)
VPATH += $(TMK_DIR) VPATH += $(TMK_DIR)
include $(TOP_DIR)/quantum/quantum.mk include $(TOP_DIR)/quantum/quantum.mk

@ -26,5 +26,8 @@
void matrix_init_user(void); void matrix_init_user(void);
void matrix_scan_user(void); void matrix_scan_user(void);
void process_action_user(keyrecord_t *record);
void led_set_user(uint8_t usb_led);
void backlight_init_ports(void);
#endif #endif

@ -1,6 +1,8 @@
#include <avr/io.h> #include <avr/io.h>
#include "backlight.h" #include "backlight.h"
#include "atomic.h"
#define CHANNEL OCR1C #define CHANNEL OCR1C

@ -32,36 +32,109 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROWS 5 #define MATRIX_ROWS 5
#define MATRIX_COLS 15 #define MATRIX_COLS 15
// Planck PCB default pin-out /*
// Change this to how you wired your keyboard * Keyboard Matrix Assignments
// COLS: Left to right, ROWS: Top to bottom *
* Change this to how you wired your keyboard
* COLS: AVR pins used for columns, left to right
* ROWS: AVR pins used for rows, top to bottom
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
#define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7, D3, D2, D1 } #define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7, D3, D2, D1 }
#define ROWS (int []){ D0, D5, B5, B6, C6 } #define ROWS (int []){ D0, D5, B5, B6, C6 }
/* COL2ROW or ROW2COL */ /* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW #define DIODE_DIRECTION COL2ROW
/* define if matrix has ghost */ /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST //#define MATRIX_HAS_GHOST
/* number of backlight levels */ /* number of backlight levels */
/* NOTE: this is the max value of 0..BACKLIGHT_LEVELS so really 16 levels. */
#define BACKLIGHT_LEVELS 3 #define BACKLIGHT_LEVELS 3
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ /* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE #define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */ /* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE #define LOCKING_RESYNC_ENABLE
/* key combination for command */ /*
* Force NKRO
*
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
* makefile for this to work.)
*
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
* until the next keyboard reset.
*
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
* fully operational during normal computer usage.
*
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
* power-up.
*
*/
//#define FORCE_NKRO
/*
* Magic Key Options
*
* Magic keys are hotkey commands that allow control over firmware functions of
* the keyboard. They are best used in combination with the HID Listen program,
* found here: https://www.pjrc.com/teensy/hid_listen.html
*
* The options below allow the magic key functionality to be changed. This is
* useful if your keyboard/keypad is missing keys and you want magic key support.
*
*/
/* key combination for magic key command */
#define IS_COMMAND() ( \ #define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \ keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
) )
/* control how magic key switches layers */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
/* override magic key keymap */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
//#define MAGIC_KEY_HELP1 H
//#define MAGIC_KEY_HELP2 SLASH
//#define MAGIC_KEY_DEBUG D
//#define MAGIC_KEY_DEBUG_MATRIX X
//#define MAGIC_KEY_DEBUG_KBD K
//#define MAGIC_KEY_DEBUG_MOUSE M
//#define MAGIC_KEY_VERSION V
//#define MAGIC_KEY_STATUS S
//#define MAGIC_KEY_CONSOLE C
//#define MAGIC_KEY_LAYER0_ALT1 ESC
//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
//#define MAGIC_KEY_LAYER0 0
//#define MAGIC_KEY_LAYER1 1
//#define MAGIC_KEY_LAYER2 2
//#define MAGIC_KEY_LAYER3 3
//#define MAGIC_KEY_LAYER4 4
//#define MAGIC_KEY_LAYER5 5
//#define MAGIC_KEY_LAYER6 6
//#define MAGIC_KEY_LAYER7 7
//#define MAGIC_KEY_LAYER8 8
//#define MAGIC_KEY_LAYER9 9
#define MAGIC_KEY_BOOTLOADER B
//#define MAGIC_KEY_LOCK CAPS
//#define MAGIC_KEY_EEPROM E
//#define MAGIC_KEY_NKRO N
//#define MAGIC_KEY_SLEEP_LED Z
/* /*
* Feature disable options * Feature disable options

@ -1,79 +1,234 @@
#include "atomic.h" #include "atomic.h"
// Fillers to make layering more clear
#define _______ KC_TRNS
#define ___T___ KC_TRNS
#define XXXXXXX KC_NO
// Layer shorthand
#define _QW 0
#define _CM 1
#define _DV 2
#define _LW 3
#define _RS 4
#define _FN 5
/* ROW 1 OPTIONS
* .--------------------------------------------------------------------------------------------------------------------------------------.
* | | | | | | | | | | | | | | | |
* '--------------------------------------------------------------------------------------------------------------------------------------'
* .- 2u ------------.
* | KEY . XXXXXX |
* '-----------------'
*/
/* ROW 2 OPTIONS
* .--------------------------------------------------------------------------------------------------------------------------------------.
* | | | | | | | | | | | | | | | |
* '--------------------------------------------------------------------------------------------------------------------------------------'
* .- 2u ------------. .- 2u ------------.
* | KEY . XXXXXX | | KEY . XXXXXX |
* '-----------------' '-----------------'
*/
/* ROW 3 OPTIONS
* .--------------------------------------------------------------------------------------------------------------------------------------.
* | | | | | | | | | | | | | | | |
* '--------------------------------------------------------------------------------------------------------------------------------------'
* .- 2u ------------. .- 2u ------------.
* | KEY . XXXXXX | | X |
* '-----------------' '-----------------'
* .- 2u ------------.
* | X |
* '-----------------'
*/
/* ROW 4 OPTIONS
* .--------------------------------------------------------------------------------------------------------------------------------------.
* | | | | | | | | | | | | | | | |
* '--------------------------------------------------------------------------------------------------------------------------------------'
* .- 2u ------------.
* | KEY . XXXXXX |
* '-----------------'
* .- 2u ------------. .- 2u ------------.
* | KEY . XXXXXX | | KEY . XXXXXX |
* '-----------------' '-----------------'
* .- 2u ------------.
* | KEY . XXXXXX |
* '-----------------'
*/
/* ROW 5 OPTIONS
* .--------------------------------------------------------------------------------------------------------------------------------------.
* | | | | | | | | | | | | | | | |
* '--------------------------------------------------------------------------------------------------------------------------------------'
* .- 1.25u --+ 1.25u ------- 1.25u +--- 1.25u --- 2u -------------- 1.25u ---- 1.25u ------ 1.25u +---- 1.25u .
* | X | X | X | X | X | X | X | X | X |
* '-----------------------------------------------------------------------------------------------------------'
* .- 2u ------------.
* | X |
* '-----------------'
* .--------------------- 6.25u ----------------------------.
* | X |
* '--------------------------------------------------------'
* .----------------------- 6.25u ---------------------------- 1.25u ---- 1.25u ---- 1.25u ------ 1.25u +-- 1.25u --.
* | X | X | X | X | X | X |
* '----------------------------------------------------------------------------------------------------------------'
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = { /* Qwerty */
{ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL }, /* QWERTY - MIT ENHANCED / GRID COMPATIBLE
// ┌────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┐ * .---------------------------------------------------------------------------------------------------------------------- 2u ------------.
// │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | XXXXXX . BACKSP |
// └────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┘ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
// ┌─ 2u ────────────┐ * | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | DEL |
// │ X │ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------|
// └─────────────────┘ * | ESC | A | S | D | F | G | H | J | K | L | ; | ' | XXXXXX . ENTER | PG UP |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------|
* | LSHIFT | Z | X | C | V | B | N | M | , | . | / | XXXXXX . RSHIFT | UP | PG DN |
* |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------|
* | BRITE | LCTRL | LALT | LGUI | RAISE | XXXXXX . SPACE | LOWER | RGUI | RALT | RCTRL | FN | LEFT | DOWN | RIGHT |
* '--------------------------------------------------------------------------------------------------------------------------------------'
*/
[_QW] = { /* QWERTY */
{ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC },
{ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL }, { KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL },
// ┌────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┐
// │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
// └────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┘
// ┌─ 2u ────────────┐ ┌─ 2u ────────────┐
// │ X │ │ X │
// └─────────────────┘ └─────────────────┘
{ KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_ENT, KC_PGUP }, { KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_ENT, KC_PGUP },
// ┌────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┐ { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP, KC_PGDN },
// │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ { M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_RS), KC_SPC, KC_SPC, MO(_LW), KC_RGUI, KC_RALT, KC_RCTL, MO(_FN), KC_LEFT, KC_DOWN, KC_RGHT },
// └────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┘ },
// ┌─ 2u ────────────┐ ┌─ 2u ────────────┐
// │ X │ │ X │ /* COLEMAK - MIT ENHANCED / GRID COMPATIBLE
// └─────────────────┘ └─────────────────┘ * .---------------------------------------------------------------------------------------------------------------------- 2u ------------.
// ┌─ 2u ────────────┐ * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | XXXXXX . BACKSP |
// │ X │ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
// └─────────────────┘ * | TAB | Q | W | F | P | G | J | L | U | Y | ; | [ | ] | \ | DEL |
{ 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_RSFT, KC_UP, KC_PGDN }, * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------|
// ┌────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┐ * | ESC | A | R | S | T | D | H | N | E | I | O | ' | XXXXXX . ENTER | PG UP |
// │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------|
// └────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┘ * | LSHIFT | Z | X | C | V | B | K | M | , | . | / | XXXXXX . RSHIFT | UP | PG DN |
// ┌─ 2u ────────────┐ * |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------|
// │ X │ * | BRITE | LCTRL | LALT | LGUI | RAISE | XXXXXX . SPACE | LOWER | RGUI | RALT | RCTRL | FN | LEFT | DOWN | RIGHT |
// └─────────────────┘ * '--------------------------------------------------------------------------------------------------------------------------------------'
// ┌─ 2u ────────────┐ ┌─ 2u ────────────┐ */
// │ X │ │ X │
// └─────────────────┘ └─────────────────┘ [_CM] = { /* COLEMAK */
// ┌─ 2u ────────────┐ { KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC },
// │ X │ { KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL },
// └─────────────────┘ { 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_ENT, KC_ENT, KC_PGUP },
{ BL_STEP, KC_LCTL, KC_LALT, KC_LGUI, KC_LGUI, KC_SPC, KC_SPC, KC_RGUI, KC_RGUI, KC_RALT, KC_RCTL, BL_STEP, KC_LEFT, KC_DOWN, KC_RGHT }, { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_RSFT, KC_UP, KC_PGDN },
// ┌────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┬────────┐ { M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_RS), KC_SPC, KC_SPC, MO(_LW), KC_RGUI, KC_RALT, KC_RCTL, MO(_FN), KC_LEFT, KC_DOWN, KC_RGHT },
// │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ },
// └────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┴────────┘
// ┌─ 1.25u ──┬ 1.25u ───┬─── 1.25u ┬─── 1.25u ─┬─ 2u ────────────┬─ 1.25u ──┬─ 1.25u ──┬─── 1.25u ┬──── 1.25u ┐ /* DVORAK - MIT ENHANCED / GRID COMPATIBLE
// │ X │ X │ X │ X │ X │ X │ X │ X │ X │ * .---------------------------------------------------------------------------------------------------------------------- 2u ------------.
// └──────────┴──────────┴──────────┴───────────┴─────────────────┴──────────┴──────────┴──────────┴───────────┘ * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | XXXXXX . BACKSP |
// ┌─ 2u ────────────┐ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
// │ X │ * | TAB | ' | , | . | P | Y | F | G | C | R | L | [ | ] | \ | DEL |
// └─────────────────┘ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------|
// ┌───────────────────── 6.25u ────────────────────────────┐ * | ESC | A | O | E | U | I | D | H | T | N | S | / | XXXXXX . ENTER | PG UP |
// │ X │ * |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------|
// └────────────────────────────────────────────────────────┘ * | LSHIFT | ; | Q | J | K | X | B | M | W | V | Z | XXXXXX . RSHIFT | UP | PG DN |
// ┌─────────────────────── 6.25u ──────────────────────────┬─ 1.25u ──┬─ 1.25u ──┬─ 1.25u ──┬─── 1.25u ┬── 1.25u ──┐ * |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------|
// │ X │ X │ X │ X │ X │ X │ * | BRITE | LCTRL | LALT | LGUI | RAISE | XXXXXX . SPACE | LOWER | RGUI | RALT | RCTRL | FN | LEFT | DOWN | RIGHT |
// └────────────────────────────────────────────────────────┴──────────┴──────────┴──────────┴──────────┴───────────┘ * '--------------------------------------------------------------------------------------------------------------------------------------'
} */
[_DV] = { /* DVORAK */
{ KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_BSPC },
{ KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL },
{ KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, KC_ENT, KC_ENT, KC_PGUP },
{ KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, KC_RSFT, KC_UP, KC_PGDN },
{ M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_RS), KC_SPC, KC_SPC, MO(_LW), KC_RGUI, KC_RALT, KC_RCTL, MO(_FN), KC_LEFT, KC_DOWN, KC_RGHT },
},
/* LOWERED
* .---------------------------------------------------------------------------------------------------------------------- 2u ------------.
* | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | XXXXXX . |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
* | | ! | @ | # | $ | % | ^ | & | * | ( | ) | | | | INS |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------|
* | | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | XXXXXX . | |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------|
* | | F7 | F8 | F9 | F10 | F11 | F12 | | | | | XXXXXX . | | |
* |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------|
* | | | | | | XXXXXX . | | | | | | | | |
* '--------------------------------------------------------------------------------------------------------------------------------------'
*/
[_LW] = { /* LOWERED */
{ _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ },
{ _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, _______, _______, KC_INS },
{ _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, ___T___, ___T___, _______ },
{ _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, ___T___, ___T___, _______, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
},
/* RAISED
* .---------------------------------------------------------------------------------------------------------------------- 2u ------------.
* | | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | XXXXXX . |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
* | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | | | | INS |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------|
* | | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | XXXXXX . | |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------|
* | | F7 | F8 | F9 | F10 | F11 | F12 | | | | | XXXXXX . | | |
* |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------|
* | | | | | | XXXXXX . | | | | | | | | |
* '--------------------------------------------------------------------------------------------------------------------------------------'
*/
[_RS] = { /* RAISED */
{ _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ },
{ _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, _______, _______, _______, KC_INS },
{ _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, ___T___, ___T___, _______ },
{ _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, ___T___, ___T___, _______, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
},
/* FUNCTION
* .---------------------------------------------------------------------------------------------------------------------- 2u ------------.
* | NUM LK | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | XXXXXX . |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
* | SCR LK | F13 | F14 | F15 | F16 | F17 | F18 | F19 | F20 | F21 | F22 | F23 | F24 | PAUSE | PR SCR |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------|
* | CAP LK | MS BT5 | MS BT4 | MS BT3 | MS BT2 | SLOW M | FAST M | NEXT | VOL+ | VOL- | PLAY | | XXXXXX . | WHEEL+ |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------|
* | | | QWERTY | COLEMK | DVORAK | | | | | | | XXXXXX . | MOUS U | WHEEL- |
* |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------|
* | | | | | | XXXXXX . MS BT1 | | | | | | MOUS L | MOUS D | MOUS R |
* '--------------------------------------------------------------------------------------------------------------------------------------'
*/
[_FN] = { /* FUNCTION */
{ KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ },
{ KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR },
{ KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U },
{ _______, _______, DF(_QW), DF(_CM), DF(_DV), _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D },
{ _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R },
},
}; };
const uint16_t PROGMEM fn_actions[] = { 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) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{ {
// MACRODOWN only works in this function // MACRODOWN only works in this function
switch(id) { switch(id) {
case 0: case 0:
return MACRODOWN(TYPE(KC_T), END); if (record->event.pressed) {
break; register_code(KC_RSFT);
} #ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
} else {
unregister_code(KC_RSFT);
}
break;
}
return MACRO_NONE; return MACRO_NONE;
}; };

@ -0,0 +1,157 @@
/*
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/>.
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6060
#define DEVICE_VER 0x0001
#define MANUFACTURER Ortholinear Keyboards
#define PRODUCT The Atomic Keyboard
#define DESCRIPTION A compact ortholinear keyboard
/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 15
/*
* Keyboard Matrix Assignments
*
* Change this to how you wired your keyboard
* COLS: AVR pins used for columns, left to right
* ROWS: AVR pins used for rows, top to bottom
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
#define COLS (int []){ F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7, D3, D2, D1 }
#define ROWS (int []){ D0, D5, B5, B6, B3 }
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
#define BACKLIGHT_LEVELS 3
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE
/*
* Force NKRO
*
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
* makefile for this to work.)
*
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
* until the next keyboard reset.
*
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
* fully operational during normal computer usage.
*
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
* power-up.
*
*/
//#define FORCE_NKRO
/*
* Magic Key Options
*
* Magic keys are hotkey commands that allow control over firmware functions of
* the keyboard. They are best used in combination with the HID Listen program,
* found here: https://www.pjrc.com/teensy/hid_listen.html
*
* The options below allow the magic key functionality to be changed. This is
* useful if your keyboard/keypad is missing keys and you want magic key support.
*
*/
/* key combination for magic key command */
#define IS_COMMAND() ( \
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* control how magic key switches layers */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
/* override magic key keymap */
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
//#define MAGIC_KEY_HELP1 H
//#define MAGIC_KEY_HELP2 SLASH
//#define MAGIC_KEY_DEBUG D
//#define MAGIC_KEY_DEBUG_MATRIX X
//#define MAGIC_KEY_DEBUG_KBD K
//#define MAGIC_KEY_DEBUG_MOUSE M
//#define MAGIC_KEY_VERSION V
//#define MAGIC_KEY_STATUS S
//#define MAGIC_KEY_CONSOLE C
//#define MAGIC_KEY_LAYER0_ALT1 ESC
//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
//#define MAGIC_KEY_LAYER0 0
//#define MAGIC_KEY_LAYER1 1
//#define MAGIC_KEY_LAYER2 2
//#define MAGIC_KEY_LAYER3 3
//#define MAGIC_KEY_LAYER4 4
//#define MAGIC_KEY_LAYER5 5
//#define MAGIC_KEY_LAYER6 6
//#define MAGIC_KEY_LAYER7 7
//#define MAGIC_KEY_LAYER8 8
//#define MAGIC_KEY_LAYER9 9
#define MAGIC_KEY_BOOTLOADER B
//#define MAGIC_KEY_LOCK CAPS
//#define MAGIC_KEY_EEPROM E
//#define MAGIC_KEY_NKRO N
//#define MAGIC_KEY_SLEEP_LED Z
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
//#define NO_DEBUG
/* disable print */
//#define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
#endif

@ -0,0 +1,309 @@
#include "atomic.h"
#include "action_layer.h"
#ifdef AUDIO_ENABLE
#include "audio.h"
#include "musical_notes.h"
#endif
#define _QW 0
#define _LW 1
#define _RS 2
#define _AD 3
#define _FN 4
#define M_QW 0
#define M_LW 1
#define M_RS 2
#define M_FN 3
#define _______ KC_TRNS
#define ___T___ KC_TRNS
#define XXXXXXX KC_NO
/*
* .---------------------------------------------------------------------------------------------------------------------- 2u ------------.
* | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | XXXXXX . BACKSP |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
* | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | DEL |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ------------+--------|
* | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | XXXXXX . ENTER | PG UP |
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+- 2u ---------------------+--------|
* | LSHIFT | Z | X | C | V | B | N | M | , | . | / | XXXXXX . RSHIFT | UP | PG DN |
* |--------+--------+--------+--------+--------+- 2u ------------+--------+--------+--------+--------+-----------------+--------+--------|
* | LCTRL | LWIN | FN | LALT | RAISED | XXXXXX . SPACE | LOWER | RALT | HOME | END | RCTRL | LEFT | DOWN | RIGHT |
* '--------------------------------------------------------------------------------------------------------------------------------------'
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QW] = { /* QWERTY */
{ KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, XXXXXXX },
{ KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL },
{ KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, XXXXXXX, KC_PGUP },
{ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, XXXXXXX, KC_UP, KC_PGDN },
{ KC_LCTL, KC_LGUI, M(M_FN), KC_LALT, M(M_RS), KC_SPC, XXXXXXX, M(M_LW), KC_RALT, KC_HOME, KC_END, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT },
},
[_LW] = { /* LOWERED */
{ KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
},
[_RS] = { /* RAISED */
{ KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
},
[_FN] = { /* FUNCTION */
{ KC_NLCK, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, ___T___, ___T___ },
{ KC_SLCK, KC_F13, KC_F14, KC_F15, KC_F16, KC_F17, KC_F18, KC_F19, KC_F20, KC_F21, KC_F22, KC_F23, KC_F24, KC_PAUS, KC_PSCR },
{ KC_CAPS, KC_BTN5, KC_BTN4, KC_BTN3, KC_BTN2, KC_ACL0, KC_ACL2, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, ___T___, ___T___, KC_WH_U },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, KC_MS_U, KC_WH_D },
{ _______, _______, _______, _______, _______, KC_BTN1, KC_BTN1, _______, _______, _______, _______, _______, KC_MS_L, KC_MS_D, KC_MS_R },
},
[_AD] = { /* ADJUST */
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, ___T___, ___T___, _______, _______ },
{ _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ },
},
};
#ifdef AUDIO_ENABLE
float tone_lw[][2] = {
/*
Q_NOTE(_C1 ) ,
Q_NOTE(_CS1 ) ,
Q_NOTE(_D1 ) ,
Q_NOTE(_DS1 ) ,
Q_NOTE(_E1 ) ,
Q_NOTE(_F1 ) ,
Q_NOTE(_FS1 ) ,
Q_NOTE(_G1 ) ,
Q_NOTE(_GS1 ) ,
Q_NOTE(_A1 ) ,
Q_NOTE(_AS1 ) ,
Q_NOTE(_B1 ) ,
*/
Q_NOTE(_C4 ) ,
Q_NOTE(_CS4 ) ,
Q_NOTE(_D4 ) ,
Q_NOTE(_DS4 ) ,
Q_NOTE(_E4 ) ,
Q_NOTE(_F4 ) ,
Q_NOTE(_FS4 ) ,
Q_NOTE(_G4 ) ,
Q_NOTE(_GS4 ) ,
Q_NOTE(_A4 ) ,
Q_NOTE(_AS4 ) ,
Q_NOTE(_B1 ) ,
Q_NOTE(_C2 ) ,
Q_NOTE(_CS2 ) ,
Q_NOTE(_D2 ) ,
Q_NOTE(_DS2 ) ,
Q_NOTE(_E2 ) ,
Q_NOTE(_F2 ) ,
Q_NOTE(_FS2 ) ,
Q_NOTE(_G2 ) ,
Q_NOTE(_GS2 ) ,
Q_NOTE(_A2 ) ,
Q_NOTE(_AS2 ) ,
Q_NOTE(_B2 ) ,
Q_NOTE(_C3 ) ,
Q_NOTE(_CS3 ) ,
Q_NOTE(_D3 ) ,
Q_NOTE(_DS3 ) ,
Q_NOTE(_E3 ) ,
Q_NOTE(_F3 ) ,
Q_NOTE(_FS3 ) ,
Q_NOTE(_G3 ) ,
Q_NOTE(_GS3 ) ,
Q_NOTE(_A3 ) ,
Q_NOTE(_AS3 ) ,
Q_NOTE(_B3 ) ,
Q_NOTE(_C4 ) ,
Q_NOTE(_CS4 ) ,
Q_NOTE(_D4 ) ,
Q_NOTE(_DS4 ) ,
Q_NOTE(_E4 ) ,
Q_NOTE(_F4 ) ,
Q_NOTE(_FS4 ) ,
Q_NOTE(_G4 ) ,
Q_NOTE(_GS4 ) ,
Q_NOTE(_A4 ) ,
Q_NOTE(_AS4 ) ,
Q_NOTE(_B4 ) ,
Q_NOTE(_C5 ) ,
Q_NOTE(_CS5 ) ,
Q_NOTE(_D5 ) ,
Q_NOTE(_DS5 ) ,
Q_NOTE(_E5 ) ,
Q_NOTE(_F5 ) ,
Q_NOTE(_FS5 ) ,
Q_NOTE(_G5 ) ,
Q_NOTE(_GS5 ) ,
Q_NOTE(_A5 ) ,
Q_NOTE(_AS5 ) ,
Q_NOTE(_B5 ) ,
Q_NOTE(_C6 ) ,
Q_NOTE(_CS6 ) ,
Q_NOTE(_D6 ) ,
Q_NOTE(_DS6 ) ,
Q_NOTE(_E6 ) ,
Q_NOTE(_F6 ) ,
Q_NOTE(_FS6 ) ,
Q_NOTE(_G6 ) ,
Q_NOTE(_GS6 ) ,
Q_NOTE(_A6 ) ,
Q_NOTE(_AS6 ) ,
Q_NOTE(_B6 ) ,
Q_NOTE(_C7 ) ,
Q_NOTE(_CS7 ) ,
Q_NOTE(_D7 ) ,
Q_NOTE(_DS7 ) ,
Q_NOTE(_E7 ) ,
Q_NOTE(_F7 ) ,
Q_NOTE(_FS7 ) ,
Q_NOTE(_G7 ) ,
Q_NOTE(_GS7 ) ,
Q_NOTE(_A7 ) ,
Q_NOTE(_AS7 ) ,
Q_NOTE(_B7 ) ,
Q_NOTE(_C8 ) ,
Q_NOTE(_CS8 ) ,
Q_NOTE(_D8 ) ,
Q_NOTE(_DS8 ) ,
Q_NOTE(_E8 ) ,
Q_NOTE(_F8 ) ,
Q_NOTE(_FS8 ) ,
Q_NOTE(_G8 ) ,
Q_NOTE(_GS8 ) ,
Q_NOTE(_A8 ) ,
Q_NOTE(_AS8 ) ,
Q_NOTE(_B8 ) ,
};
float tone_rs[][2] = {
Q_NOTE(_A4 ) ,
Q_NOTE(_A4 ) ,
Q_NOTE(_A4 ) ,
Q_NOTE(_A4 ) ,
Q_NOTE(_AS8 ) ,
Q_NOTE(_B8 ) ,
};
#endif
void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order)
{
if (order)
{
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2))
{
layer_on(layer3);
}
else
{
layer_off(layer3);
layer_off(layer4);
}
}
else
{
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2))
{
layer_on(layer4);
}
else
{
layer_off(layer3);
layer_off(layer4);
}
}
}
const uint16_t PROGMEM fn_actions[] = {
};
//#define MUSIC_ARRAY_SIZE(x) (((int)(sizeof(x) / (sizeof(x[0][0])))) / 2)
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch(id) {
case M_LW:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
println("PlayNotes LW");
PLAY_NOTE_ARRAY(tone_lw, false, STACCATO);
#endif
layer_on(_LW);
update_tri_layer(_LW, _RS, _FN);
} else {
layer_off(_LW);
update_tri_layer(_LW, _RS, _FN);
}
break;
case M_RS:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
println("PlayNotes RS");
PLAY_NOTE_ARRAY(tone_rs, false, LEGATO);
#endif
layer_on(_RS);
update_tri_layer(_LW, _RS, _FN);
} else {
layer_off(_RS);
update_tri_layer(_LW, _RS, _FN);
}
break;
default:
break;
}
return MACRO_NONE;
};
#ifdef AUDIO_ENABLE
float start_up[][2] = {
Q_NOTE(_E4 ) ,
Q_NOTE(_E4 ) ,
Q_NOTE(_F4 ) ,
Q_NOTE(_G4 ) ,
Q_NOTE(_G4 ) ,
Q_NOTE(_F4 ) ,
Q_NOTE(_E4 ) ,
Q_NOTE(_D4 ) ,
Q_NOTE(_C4 ) ,
Q_NOTE(_C4 ) ,
Q_NOTE(_D4 ) ,
Q_NOTE(_E4 ) ,
H_NOTE(_E4 ) ,
Q_NOTE(_D4 ) ,
H_NOTE(_D4 ) ,
};
#endif
void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
init_notes();
PLAY_NOTE_ARRAY(start_up, false, STACCATO);
println("Matrix Init");
#endif
}

@ -0,0 +1,17 @@
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = yes # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = yes # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
CONFIG_H = keymaps/$(KEYMAP)/config.h

@ -14,11 +14,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | Tab | Q | W | E | R | T | - | | = | Y | U | I | O | P | \ | * | Tab | Q | W | E | R | T | - | | = | Y | U | I | O | P | \ |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* |Ctrl/Esc| A | S | D | F | G |------| |------| H | J | K | L |; / L2| ' | * |Ctrl/Esc|A / L2| S | D | F | G |------| |------| H | J | K | L | ; | ' |
* |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------| * |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
* | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift | * | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | ~L1 | '" |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 | * | ~L1 | ~L2 |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
* `----------------------------------' `----------------------------------' * `----------------------------------' `----------------------------------'
* ,-------------. ,-------------. * ,-------------. ,-------------.
* | App | Home | | PgUp |Ctrl/Esc| * | App | Home | | PgUp |Ctrl/Esc|
@ -34,9 +34,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// left hand // left hand
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LBRC, KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LBRC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_MINS, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_MINS,
CTL_T(KC_ESC), KC_A, KC_S, KC_D, KC_F, KC_G, CTL_T(KC_ESC), LT(MDIA, KC_A),KC_S, KC_D, KC_F, KC_G,
KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO), KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO),
KC_FN1, KC_QUOT, LALT(KC_LSFT), KC_LEFT,KC_RGHT, KC_FN1, KC_FN2, LALT(KC_LSFT), KC_LEFT,KC_RGHT,
ALT_T(KC_APP), KC_HOME, ALT_T(KC_APP), KC_HOME,
KC_END, KC_END,
@ -44,7 +44,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// right hand // right hand
KC_RBRC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, KC_RBRC, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
KC_EQL, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS, KC_EQL, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H, KC_J, KC_K, KC_L, LT(MDIA, KC_SCLN),KC_QUOT, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT, MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, CTL_T(KC_SLSH), KC_RSFT,
KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1, KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN1,
@ -99,13 +99,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* ,--------------------------------------------------. ,--------------------------------------------------. * ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | | | | | | * | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| * |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | MsUp | | | | | | | | | | | | * | | | | | | | | | | | | Lclk | Rclk | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play | * | | | | | | |------| |------|MsLeft|MsDown| MsUp |MsRght| | Play |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | | Prev | Next | | | * | | | | | | | | | | | | Prev | Next | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' * `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | | * | | | | | | |VolUp |VolDn | Mute | | |
* `----------------------------------' `----------------------------------' * `----------------------------------' `----------------------------------'
* ,-------------. ,-------------. * ,-------------. ,-------------.
* | | | | | | * | | | | | |
@ -116,19 +116,19 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `--------------------' `--------------------' * `--------------------' `--------------------'
*/ */
// MEDIA AND MOUSE // MEDIA AND MOUSE
KEYMAP( [MDIA] = KEYMAP(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
// right hand // right hand
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY, KC_MS_L, KC_MS_D, KC_MS_U, KC_MS_R, KC_TRNS, KC_MPLY,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS, KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
@ -138,7 +138,8 @@ KEYMAP(
}; };
const uint16_t PROGMEM fn_actions[] = { const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) [1] = ACTION_LAYER_TAP_TOGGLE(SYMB), // FN1 - Momentary Layer 1 (Symbols)
[2] = ACTION_LAYER_TAP_TOGGLE(MDIA) // FN2 - Momentary Layer 2 (Media)
}; };
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)

@ -1,10 +1,10 @@
# J3RN's Mac-centric Ergodox EZ keymap # J3RN's Mac-centric ErgoDox EZ keymap
## Motivation ## Motivation
Essentially, I wanted to switch to a layout that was less jarring than the default Ergodox EZ layout, and did not require finger gymnastics to perform common OS X shortcuts (most of which involve the CMD (LGui) key). Essentially, I wanted to switch to a layout that was less jarring than the default ErgoDox EZ layout, and did not require finger gymnastics to perform common OS X shortcuts (most of which involve the CMD (LGui) key).
## How is it different from the default Ergodox EZ layout? ## How is it different from the default ErgoDox EZ layout?
This layout more closely resembles that of the Mac keyboard, and has some other goodness baked in. Here is a rundown of what that means: This layout more closely resembles that of the Mac keyboard, and has some other goodness baked in. Here is a rundown of what that means:
@ -18,6 +18,7 @@ This layout more closely resembles that of the Mac keyboard, and has some other
### Other changes ### Other changes
- **The button to the left of "A" is Ctrl/Esc instead of Backspace.** This is actually how I have the keyboard on my Macbook set up to be, since it's loads more convenient than a CAPS LOCK key. This is the Ctrl key I find myself using most. - **The button to the left of "A" is Ctrl/Esc instead of Backspace.** This is actually how I have the keyboard on my Macbook set up to be, since it's loads more convenient than a CAPS LOCK key. This is the Ctrl key I find myself using most.
- **Mouse uses Vim-style navigation**. To activate "Media mode," hold the 'a' key. This allows you to move the mouse around with hjkl just like in Vim. Additionally, right and left click are the conveniently placed 'i' and 'o' keys.
- **The key to the right of "5" and the key to left of "6" are "[" and "]", respectively, instead of Left and Right.** There is a more convenient set of Left and Right already present. Truth be told, I don't really use these keys, as they are a stretch to reach. - **The key to the right of "5" and the key to left of "6" are "[" and "]", respectively, instead of Left and Right.** There is a more convenient set of Left and Right already present. Truth be told, I don't really use these keys, as they are a stretch to reach.
- **The Toggle L1 keys have been replaced by the otherwise displaced "-" and "=".** They are laid out, left-to-right, in the same order as on the Mac keyboard. Honestly, they are not terribly conveniently placed, and their placement might change in a later version. I found that I did not toggle L1 frequently at all, and found using the momentary keys to access L1 to fit my workflow better. - **The Toggle L1 keys have been replaced by the otherwise displaced "-" and "=".** They are laid out, left-to-right, in the same order as on the Mac keyboard. Honestly, they are not terribly conveniently placed, and their placement might change in a later version. I found that I did not toggle L1 frequently at all, and found using the momentary keys to access L1 to fit my workflow better.
- **The "~"/L1 key in the bottom-left is now just momentary L1.** The "~" key was moved to the top-left as mentioned before, and I like to keep my multi-use keys to a minimum due to the latency for them to switch from "press" to "hold." - **The "~"/L1 key in the bottom-left is now just momentary L1.** The "~" key was moved to the top-left as mentioned before, and I like to keep my multi-use keys to a minimum due to the latency for them to switch from "press" to "hold."

@ -1,149 +1,421 @@
#include "ergodox_ez.h" #include "ergodox_ez.h"
#include "led.h"
#include "debug.h" #include "debug.h"
#include "action_layer.h" #include "action_layer.h"
#define BASE 0 // default layer #define BASE 0 // default layer
#define SYMB 1 // symbols #define LOCK 1 // layer lock keys
#define MDIA 2 // media keys #define SYMB_MO 2 // symbols momentary layer
#define SYMB_TG 3 // symbols lock layer
#define SYMB_XX 4 // symbols exit layer
#define MDIA_MO 5 // media momentary layer
#define MDIA_TG 6 // media lock layer
#define MDIA_XX 7 // media exit layer
#define UNLOCK 8 // clear to base layer
/* /*
* Ordinary Ergodox EZ keyboard layout, v2 * Ordinary Ergodox EZ keyboard layout, v3
* modifications from default by Nicholas Keene ergodoxez@nicholaskeene.com * modifications from default by Nicholas Keene ergodoxez@nicholaskeene.com
* Details: http://nicholas.rinard.us/2016/03/ergodox-ez-layout.html * Details: http://nicholas.rinard.us/2016/03/ergodox-ez-layout.html
*/ */
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer /* Keymap 0: Basic layer
* *
* ,--------------------------------------------------. ,--------------------------------------------------. * ,-----------------------------------------------------. ,-----------------------------------------------------.
* | Grv | 1 | 2 | 3 | 4 | 5 | ESC | | - | 6 | 7 | 8 | 9 | 0 | = | * | LOCK Grv | 1 | 2 | 3 | 4 | 5 | ESC | | - | 6 | 7 | 8 | 9 | 0 | = LOCK |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | MDIA \ | * | Media Tab | Q | W | E | R | T | [ | | ] | Y | U | I | O | P | \ Media |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | SYMB | A | S | D | F | G |------| |------| H | J | K | L | ; | SYMB ' | * | Symbol | A | S | D | F | G |------| |------| H | J | K | L | ; | ' Symbol |
* |--------+------+------+------+------+------|Shift | | Tab |------+------+------+------+------+--------| * |-----------+------+------+------+------+------|Shift | | Tab |------+------+------+------+------+-----------|
* | LShift | Z | X | C | V | B | -Tab | | | N | M | , | . | / | RShift | * | LShift | Z | X | C | V | B | -Tab | | | N | M | , | . | / | RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* |LCtrl | Meh |Hyper | LAlt | LGui | | RGui | RAlt | Hyper| Meh |RCtrl | * |LCtrl | Meh |Hyper | LAlt | LGui | | RGui | RAlt | Hyper| Meh |RCtrl |
* `----------------------------------' `----------------------------------' * `----------------------------------' `----------------------------------'
* ,---------------. ,---------------. * ,-------------. ,-------------.
* | Home | End | | Left | Right | * | Home | End | | Left | Right|
* ,------|--------|------| |------+--------+------. * ,------|------|------| |------+------+------.
* | | | PgUp | | Up | | | * | | | PgUp | | Up | | |
* |Backsp| Del |------| |------| Enter | Space| * |Backsp| Del |------| |------| Enter| Space|
* | | | PgDn | | Down | | |; * | | | PgDn | | Down | | |
* `----------------------' `----------------------' * `--------------------' `--------------------'
*/ */
// If it accepts an argument (i.e, is a function), it doesn't need KC_. [BASE] = KEYMAP(
// Otherwise, it needs KC_* // left hand
[BASE] = KEYMAP( // layer 0 : default LT(LOCK, KC_GRV),KC_1 ,KC_2 ,KC_3 ,KC_4 ,KC_5 ,KC_ESC
// left hand ,LT(MDIA_MO, KC_TAB),KC_Q ,KC_W ,KC_E ,KC_R ,KC_T ,KC_LBRC
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, ,MO(SYMB_MO) ,KC_A ,KC_S ,KC_D ,KC_F ,KC_G
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_LBRC, ,KC_LSFT ,KC_Z ,KC_X ,KC_C ,KC_V ,KC_B ,LSFT(KC_TAB)
MO(SYMB), KC_A, KC_S, KC_D, KC_F, KC_G, ,KC_LCTL ,MEH_T(KC_NO),ALL_T(KC_NO),KC_LALT,KC_LGUI
KC_LSFT, CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B, LSFT(KC_TAB),
KC_LCTL, MEH_T(KC_NO),ALL_T(KC_NO),KC_LALT,KC_LGUI, ,KC_HOME,KC_END
KC_HOME, KC_END, ,KC_PGUP
KC_PGUP, ,KC_BSPC,KC_DEL ,KC_PGDN
KC_BSPC, KC_DEL, KC_PGDN,
// right hand // right hand
KC_MINS, KC_6, KC_7, KC_8, KC_9, KC_0, KC_EQL, ,KC_MINS ,KC_6 ,KC_7 ,KC_8 ,KC_9 ,KC_0 ,LT(LOCK, KC_EQL)
KC_RBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, LT(MDIA, KC_BSLS), ,KC_RBRC ,KC_Y ,KC_U ,KC_I ,KC_O ,KC_P ,LT(MDIA_MO, KC_BSLS)
KC_H, KC_J, KC_K, KC_L, KC_SCLN, LT(SYMB, KC_QUOT), ,KC_H ,KC_J ,KC_K ,KC_L ,KC_SCLN ,LT(SYMB_MO, KC_QUOT)
KC_TAB, KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLSH),KC_RSFT, ,KC_TAB ,KC_N ,KC_M ,KC_COMM,KC_DOT ,KC_SLSH ,KC_RSFT
KC_RGUI, KC_RALT, ALL_T(KC_NO),MEH_T(KC_NO), KC_RCTL, ,KC_RGUI,KC_RALT,ALL_T(KC_NO),MEH_T(KC_NO),KC_RCTL
KC_LEFT, KC_RGHT,
KC_UP, ,KC_LEFT ,KC_RGHT
KC_DOWN, KC_ENT, KC_SPC ,KC_UP
,KC_DOWN ,KC_ENT ,KC_SPC
), ),
/* Keymap 1: Symbol Layer
/* Keymap 1: Layer Lock Keys
* *
* ,--------------------------------------------------. ,--------------------------------------------------. * ,-----------------------------------------------------. ,-----------------------------------------------------.
* | Esc | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 | * | | Esc | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | MDIA | ! | @ | { | } | & | < | | > | | | 7 | 8 | 9 | / | F12 | * | Media LOCK| | | | | | | | | | | | | | Media LOCK|
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | # | $ | ( | ) | ` |------| |------| / | 4 | 5 | 6 | * | | * |Symbol LOCK| | | | | |------| |------| | | | | |Symbol LOCK|
* |--------+------+------+------+------+------| Tab | | Shift|------+------+------+------+------+--------| * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | % | ^ | [ | ] | ~ | | | -Tab| \ | 1 | 2 | 3 | - | CAPS | * | Caps LOCK| | | | | | | | | | | | | | Caps LOCK|
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | | | | | | | 0 | . | = | + | | * | | | | | | | | | | | |
* `----------------------------------' `----------------------------------' * `----------------------------------' `----------------------------------'
* ,-------------. ,-------------. * ,-------------. ,-------------.
* | Left | Right| | Home | End | * | | | | | |
* ,------|------|------| |------+------+------. * ,------|------|------| |------+------+------.
* | | | Up | | PgUp | | | * | | | | | | | |
* |Space |Enter |------| |------|BackSp| Del | * | | |------| |------| | |
* | | | Down | | PgDn | | | * | | | | | | | |
* `--------------------' `--------------------' * `--------------------' `--------------------'
*/ */
// SYMBOLS [LOCK] = KEYMAP(
[SYMB] = KEYMAP( // left hand
// left hand KC_TRNS ,KC_ESC ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS, ,KC_FN3 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
MO(MDIA), KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_AMPR,LSFT(KC_COMM), ,KC_FN2 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
KC_TRNS, KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV, ,KC_CAPS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
KC_TRNS, KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TAB, ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_LEFT,KC_RGHT, ,KC_TRNS ,KC_TRNS
KC_UP, ,KC_TRNS
KC_SPC,KC_ENT,KC_DOWN, ,KC_TRNS,KC_TRNS ,KC_TRNS
// right hand
KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, // right hand
LSFT(KC_DOT), KC_PIPE, KC_P7, KC_P8, KC_P9, KC_PSLS, KC_F12, ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
KC_SLSH, KC_P4, KC_P5, KC_P6, KC_PAST, KC_TRNS, ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_FN3
LSFT(KC_TAB), KC_BSLS, KC_P1, KC_P2, KC_P3, KC_PMNS, KC_CAPS, ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_FN2
KC_P0, KC_DOT, KC_PEQL, KC_PPLS, KC_PENT, ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_CAPS
KC_HOME, KC_END, ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
KC_PGUP,
KC_PGDN, KC_BSPC, KC_DEL ,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS
),
/* Keymap 2: Symbol Momentary Layer
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | Media | ! | @ | { | } | & | < | | > | | | 7 | 8 | 9 | / | Media |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | Symbol | # | $ | ( | ) | ` |------| |------| / | 4 | 5 | 6 | * | Symbol |
* |-----------+------+------+------+------+------| Tab | | Shift|------+------+------+------+------+-----------|
* | Shift | % | ^ | [ | ] | ~ | | | -Tab| \ | 1 | 2 | 3 | - | Shift |
* `-----------+------+------+------+------+-------------' `------------+------+------+------+------+------------'
* | | | | | | | 0 | . | = | + | Entr |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | Left | Right| | Home | End |
* ,------|------|------| |------+------+------.
* | | | Up | | PgUp | | |
* |Space |Enter |------| |------|BackSp| Del |
* | | | Down | | PgDn | | |
* `--------------------' `--------------------'
*/
[SYMB_MO] = KEYMAP(
// left hand
KC_FN2 ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 ,KC_TRNS
,MO(MDIA_MO) ,KC_EXLM ,KC_AT ,KC_LCBR ,KC_RCBR ,KC_AMPR ,LSFT(KC_COMM)
,MO(SYMB_MO) ,KC_HASH ,KC_DLR ,KC_LPRN ,KC_RPRN ,KC_GRV
,KC_LSFT ,KC_PERC ,KC_CIRC ,KC_LBRC ,KC_RBRC ,KC_TILD ,KC_TAB
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_LEFT ,KC_RGHT
,KC_UP
,KC_SPC ,KC_ENT ,KC_DOWN
// right hand
,KC_TRNS ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,KC_FN2
,LSFT(KC_DOT),KC_PIPE ,KC_7 ,KC_8 ,KC_9 ,KC_SLSH ,MO(MDIA_MO)
,KC_SLSH ,KC_4 ,KC_5 ,KC_6 ,KC_ASTR ,MO(SYMB_MO)
,LSFT(KC_TAB),KC_BSLS ,KC_1 ,KC_2 ,KC_3 ,KC_MINS ,KC_RSFT
,KC_0 ,KC_DOT ,KC_EQL,KC_PLUS ,KC_ENT
,KC_HOME ,KC_END
,KC_PGUP
,KC_PGDN ,KC_BSPC ,KC_DEL
), ),
/* Keymap 2: Media and mouse keys
/* Keymap 3: Symbol Lock Layer
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | Lock | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | Lock |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | Media | ! | @ | { | } | & | < | | > | | | 7 | 8 | 9 | / | Media |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | # | $ | ( | ) | ` |------| |------| / | 4 | 5 | 6 | * | |
* |-----------+------+------+------+------+------| Tab | | Shift|------+------+------+------+------+-----------|
* | Shift | % | ^ | [ | ] | ~ | | | -Tab| \ | 1 | 2 | 3 | - | Shift |
* `-----------+------+------+------+------+-------------' `------------+------+------+------+------+------------'
* | | | | | | | 0 | . | = | + | Entr |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | Left | Right| | Home | End |
* ,------|------|------| |------+------+------.
* | | | Up | | PgUp | | |
* |Space |Enter |------| |------|BackSp| Del |
* | | | Down | | PgDn | | |
* `--------------------' `--------------------'
*/
[SYMB_TG] = KEYMAP( // layer 3 : return key for symbol lock layer
// left hand
MO(SYMB_XX) ,KC_F1 ,KC_F2 ,KC_F3 ,KC_F4 ,KC_F5 ,KC_TRNS
,MO(MDIA_MO) ,KC_EXLM ,KC_AT ,KC_LCBR ,KC_RCBR ,KC_AMPR ,LSFT(KC_COMM)
,MO(UNLOCK) ,KC_HASH ,KC_DLR ,KC_LPRN ,KC_RPRN ,KC_GRV
,KC_LSFT ,KC_PERC ,KC_CIRC ,KC_LBRC ,KC_RBRC ,KC_TILD ,KC_TAB
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_LEFT ,KC_RGHT
,KC_UP
,KC_SPC ,KC_ENT ,KC_DOWN
// right hand
,KC_TRNS ,KC_F6 ,KC_F7 ,KC_F8 ,KC_F9 ,KC_F10 ,MO(SYMB_XX)
,LSFT(KC_DOT),KC_PIPE ,KC_7 ,KC_8 ,KC_9 ,KC_SLSH ,MO(MDIA_MO)
,KC_SLSH ,KC_4 ,KC_5 ,KC_6 ,KC_ASTR ,MO(UNLOCK)
,LSFT(KC_TAB),KC_BSLS ,KC_1 ,KC_2 ,KC_3 ,KC_MINS ,KC_RSFT
,KC_0 ,KC_DOT ,KC_EQL,KC_PLUS ,KC_ENT
,KC_HOME ,KC_END
,KC_PGUP
,KC_PGDN ,KC_BSPC ,KC_DEL
),
/* Keymap 4: Symbol Unlock Layer
* *
* ,--------------------------------------------------. ,--------------------------------------------------. * ,-----------------------------------------------------. ,-----------------------------------------------------.
* | Esc |ShutDn| Sleep| Mute |Vol Dn|Vol Up| | | | |PrtSc | PgUp |MyComp| Mail | | * | | Esc | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------| * |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | | | | MsUp |ScrlUp| |ScrlUp| |ScrlUp| |ScrlUp| Up | | | | * | Unlock | | | | | | | | | | | | | | Unlock |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | |MsLeft|MsDown|MsRght| |------| |------| Home | Left | Down | Right| End | | * | | | | | | |------| |------| | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------| * |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | | |MsDown|ScrlDn| |ScrlDn| |ScrlDn| |ScrlDn| Down | | | | * | Caps LOCK | | | | | | | | | | | | | | Caps LOCK |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------' * `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | | | | Lclk | Rclk | | | PgDn | | | | * | | | | | | | | | | | |
* `----------------------------------' `----------------------------------' * `----------------------------------' `----------------------------------'
* ,-------------. ,-------------. * ,-------------. ,-------------.
* | Stop |Refrsh| | Prev | Next | * | | | | | |
* ,------|------|------| |------+------+------. * ,------|------|------| |------+------+------.
* |Brwser|Brwser|Search| |VolUp | | | * | | | | | | | |
* |Back | Fwd |------| |------| Stop | Play-| * | | |------| |------| | |
* | | | Home | |VolDn | | Pause| * | | | | | | | |
* `--------------------' `--------------------' * `--------------------' `--------------------'
*/ */
// MEDIA AND MOUSE [SYMB_XX] = KEYMAP(
[MDIA] = KEYMAP( // left hand
KC_ESC, KC_PWR, KC_SLEP, KC_MUTE, KC_VOLD, KC_VOLU, KC_TRNS, KC_TRNS ,KC_ESC ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
MO(MDIA), KC_TRNS, KC_TRNS, KC_MS_U, KC_WH_U, KC_TRNS, KC_WH_U, ,TG(MDIA_TG) ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS, ,KC_FN1 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_D, KC_TRNS, KC_TRNS, KC_WH_D, ,KC_CAPS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_WH_D, ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
KC_WSTP, KC_WREF, ,KC_TRNS ,KC_TRNS
KC_WSCH, ,KC_TRNS
KC_WBAK, KC_TRNS, KC_WHOM, ,KC_TRNS,KC_TRNS ,KC_TRNS
// right hand
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,TG(MDIA_TG)
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_FN1
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_CAPS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS
),
/* Keymap 5: Media Momentary Layer
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | | F11 | F12 | F13 | F14 | F15 | | | | F16 | F17 | F18 | F19 | F20 | |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | |ShutDn| | MsUp | | |ScrlUp| |ScrlUp|PrtScr| Home | Up | PgUp | Mail | |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | Sleep|MsLeft|MsDown|MsRght| |------| |------|NumLok| Left | Down | Right|MyComp| |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | | |MsDown| | |ScrlDn| |ScrlDn| | End | Down | PgDn | | |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | Mute |Vol Dn|Vol Up| Lclk | Rclk | |Insert|Delete| | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | Stop |Refrsh| | Prev | Next |
* ,------|------|------| |------+------+------.
* |Brwser|Brwser|Search| |VolUp | | |
* |Back | Fwd |------| |------| Stop | Play-|
* | | | Home | |VolDn | | Pause|
* `--------------------' `--------------------'
*/
[MDIA_MO] = KEYMAP(
// left hand
KC_FN3 ,KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,KC_TRNS
,MO(MDIA_MO) ,KC_POWER,KC_TRNS ,KC_MS_U ,KC_TRNS ,KC_TRNS ,KC_WH_U
,MO(SYMB_MO) ,KC_SLEP ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_TRNS
,KC_LSFT ,KC_TRNS ,KC_TRNS ,KC_MS_D ,KC_TRNS ,KC_TRNS ,KC_WH_D
,KC_MUTE ,KC_VOLD ,KC_VOLU ,KC_BTN1 ,KC_BTN2
,KC_WSTP ,KC_WREF
,KC_WSCH
,KC_WBAK ,KC_TRNS ,KC_WHOM
// right hand // right hand
KC_TRNS, KC_TRNS, KC_PSCR, KC_PGUP, KC_MYCM, KC_MAIL, KC_TRNS, ,KC_TRNS ,KC_F16 ,KC_F17 ,KC_F18 ,KC_F19 ,KC_F20 ,KC_FN3
KC_WH_U, KC_TRNS, KC_WH_U, KC_UP, KC_TRNS, KC_TRNS, KC_TRNS, ,KC_WH_U ,KC_PSCR ,KC_HOME,KC_UP ,KC_PGUP ,KC_MAIL ,MO(MDIA_MO)
KC_HOME, KC_LEFT, KC_DOWN, KC_RIGHT,KC_END, KC_TRNS, ,KC_NLCK ,KC_LEFT,KC_DOWN ,KC_RIGHT,KC_MYCM ,MO(SYMB_MO)
KC_WH_D, KC_TRNS, KC_WH_D, KC_DOWN, KC_TRNS, KC_TRNS, KC_TRNS, ,KC_WH_D ,KC_TRNS ,KC_END ,KC_DOWN ,KC_PGDN ,KC_TRNS ,KC_RSFT
KC_TRNS, KC_PGDN, KC_TRNS,KC_TRNS, KC_TRNS, ,KC_INS ,KC_DEL ,KC_TRNS ,KC_TRNS ,KC_TRNS
KC_MPRV, KC_MNXT, ,KC_MPRV ,KC_MNXT
KC_VOLU, ,KC_VOLU
KC_VOLD, KC_MSTP, KC_MPLY ,KC_VOLD ,KC_MSTP ,KC_MPLY
), ),
/* Keymap 6: Media Lock Layer
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | | F11 | F12 | F13 | F14 | F15 | | | | F16 | F17 | F18 | F19 | F20 | |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | |ShutDn| | MsUp | | |ScrlUp| |ScrlUp|PrtScr| Home | Up | PgUp | Mail | |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | Sleep|MsLeft|MsDown|MsRght| |------| |------|NumLok| Left | Down | Right|MyComp| |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | | |MsDown| | |ScrlDn| |ScrlDn| | End | Down | PgDn | | |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | Mute |Vol Dn|Vol Up| Lclk | Rclk | |Insert|Delete| | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | Stop |Refrsh| | Prev | Next |
* ,------|------|------| |------+------+------.
* |Brwser|Brwser|Search| |VolUp | | |
* |Back | Fwd |------| |------| Stop | Play-|
* | | | Home | |VolDn | | Pause|
* `--------------------' `--------------------'
*/
[MDIA_TG] = KEYMAP(
// left hand
MO(MDIA_XX) ,KC_F11 ,KC_F12 ,KC_F13 ,KC_F14 ,KC_F15 ,KC_TRNS
,MO(UNLOCK) ,KC_POWER,KC_TRNS ,KC_MS_U ,KC_TRNS ,KC_TRNS ,KC_WH_U
,KC_NO ,KC_SLEP ,KC_MS_L ,KC_MS_D ,KC_MS_R ,KC_TRNS
,KC_LSFT ,KC_TRNS ,KC_TRNS ,KC_MS_D ,KC_TRNS ,KC_TRNS ,KC_WH_D
,KC_MUTE ,KC_VOLD ,KC_VOLU ,KC_BTN1 ,KC_BTN2
,KC_WSTP ,KC_WREF
,KC_WSCH
,KC_WBAK ,KC_TRNS ,KC_WHOM
// right hand
,KC_TRNS ,KC_F16 ,KC_F17 ,KC_F18 ,KC_F19 ,KC_F20 ,MO(MDIA_XX)
,KC_WH_U ,KC_PSCR ,KC_HOME,KC_UP ,KC_PGUP ,KC_MAIL ,MO(UNLOCK)
,KC_NLCK ,KC_LEFT,KC_DOWN ,KC_RIGHT,KC_MYCM ,KC_NO
,KC_WH_D ,KC_TRNS ,KC_END ,KC_DOWN ,KC_PGDN ,KC_TRNS ,KC_RSFT
,KC_INS ,KC_DEL ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_MPRV ,KC_MNXT
,KC_VOLU
,KC_VOLD ,KC_MSTP ,KC_MPLY
),
/* Keymap 7: Media Unlock Layer
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | | Esc | | | | | | | | | | | | | |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | Unlock | | | | | | | | | | | | | | Unlock |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | | | | | |------| |------| | | | | | |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | Caps LOCK | | | | | | | | | | | | | | Caps LOCK |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | | | | | | | | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
[MDIA_XX] = KEYMAP(
// left hand
KC_TRNS ,KC_ESC ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_FN1 ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_CAPS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS,KC_TRNS ,KC_TRNS
// right hand
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_FN1
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_CAPS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS
),
/* Keymap 8: Unlock Layer
*
* ,-----------------------------------------------------. ,-----------------------------------------------------.
* | Unlock | | | | | | | | | | | | | | Unlock |
* |-----------+------+------+------+------+-------------| |------+------+------+------+------+------+-----------|
* | | | | | | | | | | | | | | | |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | | | | | |------| |------| | | | | | |
* |-----------+------+------+------+------+------| | | |------+------+------+------+------+-----------|
* | | | | | | | | | | | | | | | |
* `-----------+------+------+------+------+-------------' `-------------+------+------+------+------+-----------'
* | | | | | | | | | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
[UNLOCK] = KEYMAP(
// left hand
KC_FN1 ,KC_ESC ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS
,KC_TRNS
,KC_TRNS,KC_TRNS ,KC_TRNS
// right hand
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_FN1
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS
,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,KC_TRNS ,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[] = { const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols) [1] = ACTION_LAYER_CLEAR(ON_PRESS) // FN1 - clear to base layer
,[2] = ACTION_LAYER_INVERT(SYMB_TG, ON_PRESS) // FN2 - toggle to Symbols on press
,[3] = ACTION_LAYER_INVERT(MDIA_TG, ON_PRESS) // FN3 - toggle to Media on press
}; };
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
@ -168,25 +440,31 @@ void matrix_init_user(void) {
// Runs constantly in the background, in a loop. // Runs constantly in the background, in a loop.
void matrix_scan_user(void) { void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state);
uint8_t layer = biton32(layer_state); // do not change lights for locking and unlocking
if(layer == UNLOCK || layer == LOCK || layer == SYMB_XX || layer == MDIA_XX) {
return;
}
ergodox_board_led_off(); ergodox_board_led_off();
ergodox_right_led_1_off(); ergodox_right_led_1_off();
ergodox_right_led_2_off(); ergodox_right_led_2_off();
ergodox_right_led_3_off(); ergodox_right_led_3_off();
switch (layer) {
// TODO: Make this relevant to the ErgoDox EZ. // caps lock turns on red light
case 1: if(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) {
ergodox_right_led_1_on(); ergodox_right_led_1_on();
break;
case 2:
ergodox_right_led_2_on();
break;
default:
// none
break;
} }
// symbol lock turns on green light
if(layer == SYMB_MO || layer == SYMB_TG) {
ergodox_right_led_2_on();
}
// media lock turns on blue light
if(layer == MDIA_MO || layer == MDIA_TG) {
ergodox_right_led_3_on();
}
}; };

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 97 KiB

@ -1,24 +1,24 @@
[{x:3.5},"#\n3",{x:10.5},"*\n8"], [{x:3.5},"#\n3",{x:10.5},"*\n8"],
[{y:-0.875,x:2.5},"@\n2",{x:1},"$\n4",{x:8.5},"&\n7",{x:1},"(\n9"], [{y:-0.875,x:2.5},"@\n2",{x:1},"$\n4",{x:8.5},"&\n7",{x:1},"(\n9"],
[{y:-0.875,x:5.5},"%\n5",{c:"#ff4444"},"Esc",{x:4.5,c:"#cccccc"},"_\n\n\n\n\n\n-","^\n6"], [{y:-0.875,x:5.5},"%\n5",{c:"#ff4444"},"Esc",{x:4.5,c:"#cccccc"},"_\n\n\n\n\n\n-","^\n6"],
[{y:-0.875,c:"#73ab6a",w:1.5},"~\n\n\n\n\n\n`",{c:"#cccccc"},"!\n1",{x:14.5},")\n0",{w:1.5},"+\n\n\n\n\n\n="], [{y:-0.875,c:"#2277ff",w:1.5},"Shift\n\n~\n\n\n\nLock\n`",{c:"#cccccc"},"!\n1",{x:14.5},")\n0",{c:"#2277ff",w:1.5},"+\n\nShift\n\n\n\n=\nLock"],
[{y:-0.375,x:3.5},"E",{x:10.5},"I"], [{y:-0.375,x:3.5,c:"#cccccc"},"E",{x:10.5},"I"],
[{y:-0.875,x:2.5},"W",{x:1},"R",{x:8.5},"U",{x:1},"O"], [{y:-0.875,x:2.5},"W",{x:1},"R",{x:8.5},"U",{x:1},"O"],
[{y:-0.875,x:5.5},"T",{h:1.5},"{\n\n\n\n\n\n[",{x:4.5,h:1.5},"}\n\n\n\n\n\n]","Y"], [{y:-0.875,x:5.5},"T",{h:1.5},"{\n\n\n\n\n\n[",{x:4.5,h:1.5},"}\n\n\n\n\n\n]","Y"],
[{y:-0.875,c:"#73ab6a",w:1.5},"Tab",{c:"#cccccc"},"Q",{x:14.5},"P",{c:"#2277ff",fa:[0,0,0,1],w:1.5},"|\n\\\nMedia\nL2"], [{y:-0.875,c:"#2277ff",w:1.5},"Media\n\nTab\n\n\n\nShift",{c:"#cccccc"},"Q",{x:14.5},"P",{c:"#2277ff",w:1.5},"|\n\\\nMedia\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#cccccc"},"D",{x:10.5},"K"], [{y:-0.375,x:3.5,c:"#cccccc"},"D",{x:10.5},"K"],
[{y:-0.875,x:2.5},"S",{x:1},"F",{x:8.5},"J",{x:1},"L"], [{y:-0.875,x:2.5},"S",{x:1},"F",{x:8.5},"J",{x:1},"L"],
[{y:-0.875,x:5.5},"G",{x:6.5},"H"], [{y:-0.875,x:5.5},"G",{x:6.5},"H"],
[{y:-0.875,c:"#2277ff",w:1.5},"Symbols\n\n\nL1",{c:"#cccccc"},"A",{x:14.5},":\n;",{c:"#2277ff",w:1.5},"\"\n'\nSymbols\nL1"], [{y:-0.875,c:"#2277ff",w:1.5},"Symbols\n\n\n\n\n\nShift",{c:"#cccccc"},"A",{x:14.5},":\n;",{c:"#2277ff",w:1.5},"\"\n'\nSymbols\n\n\n\n\nShift"],
[{y:-0.625,x:6.5,c:"#bfbf67",h:1.5},"< Tab\n\n\nShift Tab",{x:4.5,h:1.5},"Tab >\n\n\nTab"], [{y:-0.625,x:6.5,c:"#54d6de",fa:[0,0,0,1],h:1.5},"< Tab\n\n\nShift Tab",{x:4.5,h:1.5},"Tab >\n\n\nTab"],
[{y:-0.75,x:3.5,c:"#cccccc"},"C",{x:10.5},"<\n,"], [{y:-0.75,x:3.5,c:"#cccccc"},"C",{x:10.5},"<\n,"],
[{y:-0.875,x:2.5},"X",{x:1},"V",{x:8.5},"M",{x:1},">\n."], [{y:-0.875,x:2.5},"X",{x:1},"V",{x:8.5},"M",{x:1},">\n."],
[{y:-0.875,x:5.5},"B",{x:6.5},"N"], [{y:-0.875,x:5.5},"B",{x:6.5},"N"],
[{y:-0.875,c:"#2277ff",w:1.5},"Capitals\n\n\nShift",{c:"#cccccc"},"Z",{x:14.5},"?\n/",{c:"#2277ff",w:1.5},"\n\nCapitals\nShift"], [{y:-0.875,c:"#2277ff",fa:[0,1,0,1,0,0,0],w:1.5},"Capitals\nShift\n\n\n\n\nShift",{c:"#cccccc"},"Z",{x:14.5,f:3},"?\n/",{c:"#2277ff",w:1.5},"\n\nCapitals\nShift\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#77aaff"},"Option\n\n\nLAlt",{x:10.5},"Option\n\n\nRAlt"], [{y:-0.375,x:3.5,c:"#77aaff"},"Option\n\n\nLAlt",{x:10.5},"Option\n\n\nRAlt"],
[{y:-0.875,x:2.5},"Hyper",{x:1},"Cmd\n\n\nSuper",{x:8.5},"Cmd\n\n\nSuper",{x:1},"Hyper"], [{y:-0.875,x:2.5},"Hyper",{x:1},"Cmd\n\n\nSuper",{x:8.5},"Cmd\n\n\nSuper",{x:1},"Hyper"],
[{y:-0.75,x:0.5},"Ctrl\n\n\nLCtrl","Meh",{x:14.5},"Meh","Ctrl\n\n\nRCtrl"], [{y:-0.75,x:0.5},"Ctrl\n\n\nLCtrl","Meh",{x:14.5},"Meh","Ctrl\n\n\nRCtrl"],
[{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#bfbf67"},"Home","End"], [{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#54d6de"},"Home","End"],
[{h:2},"< Del\n\n\nBackspace",{h:2},"Del >\n\n\nDelete","Page\n\n\n\n\n\nUp"], [{h:2},"< Del\n\n\nBackspace",{h:2},"Del >\n\n\nDelete","Page\n\n\n\n\n\nUp"],
[{x:2},"Page\n\n\n\n\n\nDown"], [{x:2},"Page\n\n\n\n\n\nDown"],
[{r:-30,rx:13,y:-1,x:-3},"Left","Right"], [{r:-30,rx:13,y:-1,x:-3},"Left","Right"],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 116 KiB

@ -1,27 +1,27 @@
[{x:3.5,c:"#9988bb"},"Vol\n\n\n\n\n\nMute",{x:10.5,c:"#ccffff"},"Page\n\n\n\n\n\nUp"], [{x:3.5,c:"#99de2a"},"F13",{x:10.5},"F18"],
[{y:-0.875,x:2.5,c:"#9988bb"},"Sleep",{x:1},"Vol\n\n\n\n\n\nDown",{x:8.5},"Print\n\n\n\n\n\nScreen",{x:1},"Home\n\n\n\n\n\nDir"], [{y:-0.875,x:2.5},"F12",{x:1},"F14",{x:8.5},"F17",{x:1},"F19"],
[{y:-0.875,x:5.5},"Vol\n\n\n\n\n\nUp",{c:"#ff4444"},"Esc",{x:4.5,c:"#cccccc",a:7},"",""], [{y:-0.875,x:5.5},"F15",{c:"#ff4444"},"Esc",{x:4.5,c:"#cccccc",a:7},"",{c:"#99de2a",a:4},"F16"],
[{y:-0.875,c:"#ff4444",a:4,w:1.5},"Esc",{c:"#9988bb"},"Shut\n\n\n\n\n\nDown",{x:14.5},"Email",{c:"#cccccc",a:7,w:1.5},""], [{y:-0.875,c:"#2277ff",w:1.5},"Shift\n\n\n\n\n\nLock",{c:"#99de2a"},"F11",{x:14.5},"F20",{c:"#2277ff",w:1.5},"\n\nShift\n\n\n\n\nLock"],
[{y:-0.375,x:3.5,c:"#ccffff",a:4},"Mouse\n\n\n\n\n\nUp",{x:10.5},"Cursor\n\n\n\n\n\nUp"], [{y:-0.375,x:3.5,c:"#ff8500"},"Mouse\n\n\n\n\n\nUp",{x:10.5},"Cursor\n\n\n\n\n\nUp"],
[{y:-0.875,x:2.5,c:"#cccccc",a:7},"",{x:1,c:"#99ffff",a:4},"Scroll\n\n\n\n\n\nUp",{x:8.5},"Scroll\n\n\n\n\n\nUp",{x:1,c:"#cccccc",a:7},""], [{y:-0.875,x:2.5,c:"#cccccc",a:7},"",{x:1,c:"#ffb063",a:4},"Scroll\n\n\n\n\n\nUp",{x:8.5},"Home",{x:1},"Page\n\n\n\n\n\nUp"],
[{y:-0.875,x:5.5},"",{c:"#99ffff",a:4,h:1.5},"Scroll\n\n\n\n\n\nUp",{x:4.5,h:1.5},"Scroll\n\n\n\n\n\nUp",{c:"#cccccc",a:7},""], [{y:-0.875,x:5.5,c:"#cccccc",a:7},"",{c:"#ffb063",a:4,h:1.5},"Scroll\n\n\n\n\n\nUp",{x:4.5,h:1.5},"Scroll\n\n\n\n\n\nUp",{c:"#e6e067"},"Print\n\n\n\n\n\nScreen"],
[{y:-0.875,c:"#000000",t:"#ff0000",a:4,fa:[0,0,0,1],w:1.5},"Media\n\n\nL2",{c:"#cccccc",t:"#000000",a:7},"",{x:14.5},"",{c:"#000000",t:"#ff0000",a:4,w:1.5},"\n\nMedia\nL2"], [{y:-0.875,c:"#000000",t:"#ff0000",w:1.5},"Media\n\n\n\n\n\nShift",{c:"#e6e067",t:"#000000"},"Shut\n\n\n\n\n\nDown",{x:14.5},"Mail",{c:"#000000",t:"#ff0000",w:1.5},"\n\nMedia\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#ccffff",t:"#000000"},"Mouse\n\n\n\n\n\nDown",{x:10.5},"Cursor\n\n\n\n\n\nDown"], [{y:-0.375,x:3.5,c:"#ff8500",t:"#000000"},"Mouse\n\n\n\n\n\nDown",{x:10.5},"Cursor\n\n\n\n\n\nDown"],
[{y:-0.875,x:2.5},"Mouse\n\n\n\n\n\nLeft",{x:1},"Mouse\n\n\n\n\n\nRight",{x:8.5},"Cursor\n\n\n\n\n\nLeft",{x:1},"Cursor\n\n\n\n\n\nRight"], [{y:-0.875,x:2.5},"Mouse\n\n\n\n\n\nLeft",{x:1},"Mouse\n\n\n\n\n\nRight",{x:8.5},"Cursor\n\n\n\n\n\nLeft",{x:1},"Cursor\n\n\n\n\n\nRight"],
[{y:-0.875,x:5.5,c:"#cccccc",a:7},"",{x:6.5,c:"#ccffff",a:4},"Home"], [{y:-0.875,x:5.5,c:"#cccccc",a:7},"",{x:6.5,c:"#e6e067",a:4},"Num\n\n\n\n\n\nLock"],
[{y:-0.875,c:"#000000",t:"#ff0000",w:1.5},"Symbols\n\n\nL1",{c:"#cccccc",t:"#000000",a:7},"",{x:14.5,c:"#ccffff",a:4},"End",{c:"#cccccc",a:7,w:1.5},""], [{y:-0.875,c:"#cccccc",a:7,w:1.5},"",{c:"#e6e067",a:4},"Sleep",{x:14.5},"My\n\n\n\n\n\nComp",{c:"#cccccc",a:7,w:1.5},""],
[{y:-0.625,x:6.5,c:"#99ffff",a:4,h:1.5},"Scroll\n\n\n\n\n\nDown",{x:4.5,h:1.5},"Scroll\n\n\n\n\n\nDown"], [{y:-0.625,x:6.5,c:"#ffb063",a:4,h:1.5},"Scroll\n\n\n\n\n\nDown",{x:4.5,h:1.5},"Scroll\n\n\n\n\n\nDown"],
[{y:-0.75,x:3.5,c:"#ccffff"},"Mouse\n\n\n\n\n\nDown",{x:10.5},"Cursor\n\n\n\n\n\nDown"], [{y:-0.75,x:3.5,c:"#ff8500"},"Mouse\n\n\n\n\n\nDown",{x:10.5},"Cursor\n\n\n\n\n\nDown"],
[{y:-0.875,x:2.5,c:"#cccccc",a:7},"",{x:1,c:"#99ffff",a:4},"Scroll\n\n\n\n\n\nDown",{x:8.5},"Scroll\n\n\n\n\n\nDown",{x:1,c:"#cccccc",a:7},""], [{y:-0.875,x:2.5,c:"#cccccc",a:7},"",{x:1,c:"#ffb063",a:4},"Scroll\n\n\n\n\n\nDown",{x:8.5},"End",{x:1},"Page\n\n\n\n\n\nDown"],
[{y:-0.875,x:5.5},"",{x:6.5},""], [{y:-0.875,x:5.5,c:"#cccccc",a:7},"",{x:6.5},""],
[{y:-0.875,w:1.5},"","",{x:14.5},"",{w:1.5},""], [{y:-0.875,c:"#2277ff",a:4,fa:[0,1,0,0,0,0,0],w:1.5},"Capitals\nShift\n\n\n\n\nShift",{c:"#cccccc",a:7},"",{x:14.5},"",{c:"#2277ff",a:4,fa:[0,1,0,1],w:1.5},"\n\nCapitals\nShift\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#ccffff",a:4},"Left\n\n\n\n\n\nClick",{x:10.5},"Page\n\n\n\n\n\nDown"], [{y:-0.375,x:3.5,c:"#ff8500"},"Left\n\n\n\n\n\nClick",{x:10.5,c:"#ffb063"},"Delete"],
[{y:-0.875,x:2.5,c:"#cccccc",a:7},"",{x:1,c:"#ccffff",a:4},"Right\n\n\n\n\n\nClick",{x:8.5,c:"#cccccc",a:7},"",{x:1},""], [{y:-0.875,x:2.5,c:"#e6e067"},"Vol\n\n\n\n\n\nUp",{x:1,c:"#ff8500"},"Right\n\n\n\n\n\nClick",{x:8.5,c:"#ffb063"},"Insert",{x:1,c:"#cccccc",a:7},""],
[{y:-0.75,x:0.5},"","",{x:14.5},"",""], [{y:-0.75,x:0.5,c:"#e6e067",a:4},"Mute","Vol\n\n\n\n\n\nDown",{x:14.5,c:"#cccccc",a:7},"",""],
[{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#bbaacc",a:4},"Stop\n\n\nBrowser","Reload\n\n\nBrowser"], [{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#cfc82b",a:4},"Stop\n\n\nBrowser","Reload\n\n\nBrowser"],
[{h:2},"< Web\n\n\nBrowser",{h:2},"Web >\n\n\nBrowser","Search\n\n\nBrowser"], [{h:2},"< Web\n\n\nBrowser",{h:2},"Web >\n\n\nBrowser","Search\n\n\nBrowser"],
[{x:2},"Home\n\n\nBrowser"], [{x:2},"Home\n\n\nBrowser"],
[{r:-30,rx:13,y:-1,x:-3},"Prev\n\n\nAudio\n\n\nTrack","Next\n\n\nAudio\n\n\nTrack"], [{r:-30,rx:13,y:-1,x:-3},"Prev\n\n\nAudio\n\n\nTrack","Next\n\n\nAudio\n\n\nTrack"],
[{x:-3,c:"#9988bb"},"Vol\n\n\n\n\n\nUp",{c:"#bbaacc",h:2},"Stop\n\n\nAudio",{h:2},"Play\n\n\nAudio\n\n\nPause"], [{x:-3,c:"#e6e067"},"Vol\n\n\n\n\n\nUp",{c:"#cfc82b",h:2},"Stop\n\n\nAudio",{h:2},"Play\n\n\nAudio\n\n\nPause"],
[{x:-3,c:"#9988bb"},"Vol\n\n\n\n\n\nDown"] [{x:-3,c:"#e6e067"},"Vol\n\n\n\n\n\nDown"]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 96 KiB

@ -1,24 +1,24 @@
[{x:3.5,c:"#a3a3a3"},"F3",{x:10.5},"F8"], [{x:3.5,c:"#99de2a"},"F3",{x:10.5},"F8"],
[{y:-0.875,x:2.5},"F2",{x:1},"F4",{x:8.5},"F7",{x:1},"F9"], [{y:-0.875,x:2.5},"F2",{x:1},"F4",{x:8.5},"F7",{x:1},"F9"],
[{y:-0.875,x:5.5},"F5",{c:"#ff4444"},"Esc",{x:4.5,c:"#cccccc",a:7},"",{c:"#a3a3a3",a:4},"F6"], [{y:-0.875,x:5.5},"F5",{c:"#ff4444"},"Esc",{x:4.5,c:"#cccccc",a:7},"",{c:"#99de2a",a:4},"F6"],
[{y:-0.875,c:"#ff4444",w:1.5},"Esc",{c:"#a3a3a3"},"F1",{x:14.5},"F10",{w:1.5},"F11"], [{y:-0.875,c:"#2277ff",w:1.5},"Shift\n\n\n\n\n\nLock",{c:"#99de2a"},"F1",{x:14.5},"F10",{c:"#2277ff",w:1.5},"\n\nShift\n\n\n\n\nLock"],
[{y:-0.375,x:3.5,c:"#bbc6ed"},"{",{x:10.5,c:"#bed4ba"},"8"], [{y:-0.375,x:3.5,c:"#c4e0bf"},"{",{x:10.5,c:"#89b087"},"8"],
[{y:-0.875,x:2.5,c:"#bbc6ed"},"@",{x:1},"}",{x:8.5,c:"#bed4ba"},"7",{x:1},"9"], [{y:-0.875,x:2.5,c:"#c4e0bf"},"@",{x:1},"}",{x:8.5,c:"#89b087"},"7",{x:1},"9"],
[{y:-0.875,x:5.5,c:"#bbc6ed"},"&",{h:1.5},"<",{x:4.5,h:1.5},">","|"], [{y:-0.875,x:5.5,c:"#c4e0bf"},"&",{h:1.5},"<",{x:4.5,h:1.5},">","|"],
[{y:-0.875,c:"#2277ff",fa:[0,0,0,1],w:1.5},"Media\n\n\nL2",{c:"#bbc6ed"},"!",{x:14.5,c:"#bed4ba"},"/",{c:"#a3a3a3",w:1.5},"F12"], [{y:-0.875,c:"#2277ff",w:1.5},"Media\n\n\n\n\n\nShift",{c:"#c4e0bf"},"!",{x:14.5,c:"#89b087"},"/",{c:"#2277ff",w:1.5},"\n\nMedia\n\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#bbc6ed"},"(",{x:10.5,c:"#bed4ba"},"5"], [{y:-0.375,x:3.5,c:"#c4e0bf"},"(",{x:10.5,c:"#89b087"},"5"],
[{y:-0.875,x:2.5,c:"#bbc6ed"},"$",{x:1},")",{x:8.5,c:"#bed4ba"},"4",{x:1},"6"], [{y:-0.875,x:2.5,c:"#c4e0bf"},"$",{x:1},")",{x:8.5,c:"#89b087"},"4",{x:1},"6"],
[{y:-0.875,x:5.5,c:"#bbc6ed"},"`",{x:6.5},"/"], [{y:-0.875,x:5.5,c:"#c4e0bf"},"`",{x:6.5},"/"],
[{y:-0.875,c:"#000000",t:"#ff0000",w:1.5},"Symbols\n\n\nL1",{c:"#bbc6ed",t:"#000000"},"#",{x:14.5,c:"#bed4ba"},"*",{c:"#000000",t:"#ff0000",w:1.5},"\n\nSymbols\nL1"], [{y:-0.875,c:"#000000",t:"#ff0000",w:1.5},"Symbols\n\n\n\n\n\nShift",{c:"#c4e0bf",t:"#000000"},"#",{x:14.5,c:"#89b087"},"*",{c:"#000000",t:"#ff0000",w:1.5},"\n\nSymbols\n\n\n\n\nShift"],
[{y:-0.625,x:6.5,c:"#bfbf67",t:"#000000",h:1.5},"Tab >\n\n\nTab",{x:4.5,h:1.5},"< Tab\n\n\nShift Tab"], [{y:-0.625,x:6.5,c:"#54d6de",t:"#000000",fa:[0,0,0,1],h:1.5},"Tab >\n\n\nTab",{x:4.5,h:1.5},"< Tab\n\n\nShift Tab"],
[{y:-0.75,x:3.5,c:"#bbc6ed"},"[",{x:10.5,c:"#bed4ba"},"2"], [{y:-0.75,x:3.5,c:"#c4e0bf"},"[",{x:10.5,c:"#89b087"},"2"],
[{y:-0.875,x:2.5,c:"#bbc6ed"},"^",{x:1},"]",{x:8.5,c:"#bed4ba"},"1",{x:1},"3"], [{y:-0.875,x:2.5,c:"#c4e0bf"},"^",{x:1},"]",{x:8.5,c:"#89b087"},"1",{x:1},"3"],
[{y:-0.875,x:5.5,c:"#bbc6ed"},"~",{x:6.5},"\\"], [{y:-0.875,x:5.5,c:"#c4e0bf"},"~",{x:6.5},"\\"],
[{y:-0.875,c:"#cccccc",a:7,w:1.5},"",{c:"#bbc6ed",a:4},"%",{x:14.5,c:"#bed4ba"},"-",{c:"#2277ff",w:1.5},"\n\nCaps Lock"], [{y:-0.875,c:"#2277ff",f2:1,w:1.5},"Capitals\nShift\n\n\n\n\nShift",{c:"#c4e0bf"},"%",{x:14.5,c:"#89b087"},"-",{c:"#2277ff",fa:[0,1,0,1],w:1.5},"\n\nCapitals\nShift\n\n\n\nShift"],
[{y:-0.375,x:3.5,c:"#cccccc",a:7},"",{x:10.5,c:"#bed4ba",a:4},"."], [{y:-0.375,x:3.5,c:"#cccccc",a:7},"",{x:10.5,c:"#89b087",a:4},"."],
[{y:-0.875,x:2.5,c:"#cccccc",a:7},"",{x:1},"",{x:8.5,c:"#bed4ba",a:4},"0",{x:1},"="], [{y:-0.875,x:2.5,c:"#cccccc",a:7},"",{x:1},"",{x:8.5,c:"#89b087",a:4},"0",{x:1},"="],
[{y:-0.75,x:0.5,c:"#cccccc",a:7},"","",{x:14.5,c:"#bed4ba",a:4},"+","Enter"], [{y:-0.75,x:0.5,c:"#cccccc",a:7},"","",{x:14.5,c:"#89b087",a:4},"+","Enter"],
[{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#bfbf67"},"Left","Right"], [{r:30,rx:6.5,ry:4.25,y:-1,x:1,c:"#54d6de"},"Left","Right"],
[{h:2},"Space",{h:2},"Enter","Up"], [{h:2},"Space",{h:2},"Enter","Up"],
[{x:2},"Down"], [{x:2},"Down"],
[{r:-30,rx:13,y:-1,x:-3},"Home","End"], [{r:-30,rx:13,y:-1,x:-3},"Home","End"],

File diff suppressed because it is too large Load Diff

@ -10,54 +10,66 @@ no rights reserved, use for any purposes, credit me if you are a nice person
## The Base Layout ## ## The Base Layout ##
* The yellow keys are text navigation and manipulation * The light blue keys are modifiers: traditional Control, Option, and Command keys, plus Hyper and Meh
* The dark blue keys are shift keys: case shift (traditional shift), symbol shift, and media shift * The dark blue keys are Shift keys: Capitals Shift (traditional shift), Symbol Shift, and Media Shift; plus a Shift Lock key
* The light blue keys are modifiers: traditional Control, Option, and C ommand keys, plus Hyper and Meh * Several dark blue keys double for entry of characters which would typically be in those locations
* The two green keys, tab and tilde, are in the typical places to ease use of the Application Switcher * The turquoise keys are text navigation and manipulation
* The red keys is Escape, one of the few buttons which is in an atypical position * The red keys is Escape and it is always found in that location no matter what
![Ordinary base layout](ordinary-base.png) ![Ordinary base layout](ordinary-base.png)
This layout puts the modifier keys along the bottom of the keyboard where they are on most layouts. They are in the regular order, with the addition of Hyper and Meh keys. The shift key (case shift) is in the prevalent location. The primo slots usually wasted on Caps Lock and Enter are instead used for the Symbol Shift key which promotes use of the Symbols layer. On the right side of the layout, the Symbol and Media shift keys also double as character keys -- quote and backslash, respectively -- so that touch typists can continue to find those punctuation marks in the right place. This layout puts the modifier keys along the bottom of the keyboard where they are on most keyboards. They are in the regular order, with the addition of Hyper and Meh keys. On the outside edges are the Shift keys. The traditional shift key is called Capitals Shift and it is in the normal location. Above that are Symbols Shift and Media Shift. Each Shift key momentarily switches the layout to that layer, and if you use the Shift Lock button you can lock the layout to that layer.
Other than the yellow keys, the only buttons which move to new locations are the Brackets and Dash and Escape. Most touch typists dont touch-type brackets or dash anyway, so only Escape really requires retraining of muscle memory. Touch typists will also find tilde, tab, equals/plus, slash/pipe, and quote/double-quote sharing space on those Shift keys where they would probably be on a common keyboard. Other than the turquoise keys the only buttons which move to new locations are the Brackets and Dash and Escape. Most touch typists dont touch-type brackets or dash anyway so only Escape really requires retraining of muscle memory, and see below for the Special Escape Sequence.
The four big yellow keys are arranged differently than in the default Ergodox EZ layout. The Ordinary Layout here copies the design of the old Fingerworks TouchStream keyboard, but also reflects the natural presumptions of the author -- me!; I type the space character with my right hand, and to me it makes sense for the two delete keys to be next to one another. The four big turquoise keys are arranged differently than in the default Ergodox EZ layout. The Ordinary Layout here copies the design of the old Fingerworks TouchStream keyboard, but also reflects the natural presumptions of the author -- me! I type the space character with my right hand, and to me it makes sense for the two delete keys to be next to one another.
The Forward Tab and Backward Tab keys are there mostly because I ended up with two extra buttons and needed something to do with them. My muscle memory from using the Truly Ergonomic Keyboard makes me look for the Tab key with my right index finger, so it is handy to have this redundant Tab, and the idea with the Backward Tab key is that it becomes easy to navigate text fields in forms, or to indent/unindent code. The Forward Tab and Backward Tab keys are in their locations mostly because I ended up with two extra buttons and needed something to do with them. My muscle memory from using the Truly Ergonomic Keyboard makes me look for the Tab key with my right index finger, so it is handy to have this redundant Tab, and the idea with the Backward Tab key is that it becomes easy to navigate text fields in forms, or to indent/unindent code.
## The Symbols Layout ## ## The Symbols Layer ##
* The periwinkle keys are the eponymous symbols * The light green keys are the eponymous symbols
* The gray keys are F-Keys * The bright green keys are F-Keys
* The green keys are a proper number pad * The dark green keys constitute a number pad
* The red Escape key is found in the "right" location on this layer * The turquoise keys are the *reverse* of the turquoise keys on the base layer
* The yellow keys are the *reverse* of the yellow keys on the base layer
* The dark blue Media key means that the Media layer is accessible with the left hand
![Ordinary symbol layout](ordinary-symbol.png) ![Ordinary symbol layout](ordinary-symbol.png)
The Ergodox EZ ships with the "Coder Layer" which I like to call the Symbols layer. There are some significant improvements in The Ordinary Layout over the default layout. The Ergodox EZ ships with the "Coder Layer" which I like to call the Symbols layer. There are some significant improvements in The Ordinary Layout over the default layout.
The symbol keys are mostly the same as on the default layout, which did a good job in this regard, but with a few enhancements: The symbol keys are mostly the same as on the default layout, which did a good job in this regard, but with a few enhancements:
* Angle brackets on this layer mean that curly, square, and angle brackets are all available on different layers of the same two buttons. Also, they mean that all kinds of brackets, including parentheses, are available on both the Base and Symbols layers. * Angle brackets on this layer mean that curly, square, and angle brackets are all available on different layers of the same two buttons. Also, they mean that all kinds of brackets, including parentheses, are available on both the Base and Symbols layers.
* The slash, backslash, and pipe characters are grouped together as a memory aid. * The slash, backslash, and pipe characters are grouped together as a memory aid.
* The & and | symbols are juxtaposed as a memory aid * The & and | symbols are juxtaposed as a memory aid
The number pad area here, in green, includes all four arithmetic operations in the same order found on most number pads. This layout also has an Enter key, and importantly the key codes emitted by this number pad are *number pad specific key codes*, not regular keyboard key codes. Some software distinguishes keypad codes so users now have access to a fully realized number pad when using The Ordinary Layout. The number pad area here, in green, includes all four arithmetic operations in the same order found on most number pads and features an Enter key. The keycodes emitted here are normal numeric keycodes, not the number-pad specific keycodes emitted by most number pads, because this layout does not use a Num Lock key to switch the buttons between numeric keycodes and navigational keycodes. See the explanation in The Media Layout section about navigation using these same buttons.
The Escape key's true home is in the top left corner of the keyboard, so on this layer it can be found there. And on the Symbols layer, the Tab key switches to become a Media key, so press Symbols then Media to access the Media layer using the left hand.
Finally, consider the yellow text-nav keys. In the Symbols layer, these are *reversed* from the base layer, with most keys mirrored, but the Delete keys shifted to maintain the directional significance of their arrangement. This is powerful! Often I find myself using the mouse with my right hand, and the left hand needs to press Enter. Instead of reaching the left hand over to the right side of the keyboard, now I simply tap Symbols to reverse the yellow keys, and Enter is right where it should be. Finally, consider the turquoise text-nav keys. Here in the Symbols layer, these are *reversed* from the base layer, with most keys mirrored, but the Delete keys shifted to maintain the directional significance of their arrangement. This is powerful! Often I find myself using the mouse with my right hand, and the left hand needs to press Enter. Instead of reaching the left hand over to the right side of the keyboard, now I simply tap Symbols to reverse the yellow keys, and Enter is right where it should be.
## The Media Layout ## ## The Media Layer ##
* The light turquoise keys move the mouse or the text cursor * The dark orange keys on the left move the mouse cursor
* The dark turquoise keys scroll * The dark orange keys on the right move the text cursor
* The light purple keys signal Web and Audio applications * The light orange keys are for scrolling and paging
* The dark purple keys signal the operating system * The bright green keys are more F-keys
* The red Escape key is, again, found in the "right" location * The dark yellow keys signal Web and Audio applications
* The light yellow keys signal the operating system
![Ordinary media layout](ordinary-media.png) ![Ordinary media layout](ordinary-media.png)
This layer was inspired by the Media layer on the Ergodox EZ but takes it farther. The Fingerworks TouchStream had a very useful feature for controlling the text cursor easily and this layer does something similar. The left hand can move the mouse, the right hand moves the text cursor, in all four directions, in small or large increments. This greatly enhances navigation in text documents. This layer was inspired by the Media layer on the Ergodox EZ but takes it farther. The Fingerworks TouchStream keyboard had a very useful feature for controlling the text cursor easily and this layer does something similar. The left hand can move the mouse, the right hand moves the text cursor, in all four directions, in small or large increments. This greatly enhances navigation in text documents.
Moreover, the orange keys on the right overlay the numberpad from the Symbols Layer, such that in the Media Layer the same keys can be used as if they were a number pad in navigational mode (Num Lock off). For instance, in traditional number pads the '3' key became 'Page Down', and so it is here. This means a user can do text navigation without moving either hand.
## Switching Between Layers ##
The three Shift keys correspond to three logical layers on top of the ever-present base layer, and are represented in the three LEDs on the keyboard: Capitals (red), Symbols (green), Media (blue). The color of a layer illuminates when the layer is active. Shift keys work in the expected way: press them and the keys shift to that layer; release them and the keys shift back to the base layer. The Ordinary Layout also features a Shift Lock key to keep a layer active indefinitely. Hold down the Shift Lock key then press any Shift key to lock to that layer. Or, hold down the Shift key and press the Shift Lock key; either way works. To revert to the base layer, use the Shift Lock key again in combination with the Shift key.
This layout attempts to treat the Capitals Shift layer the same as the other two Shift layers, but internally they are different which causes some inconsistencies. For instance, it is possible to switch from any layer to any other layer, and to lock to any layer, *except* it is not possible to go from Media to Symbols. You must exit the Media layer before engaging the Symbols layer. Also, the Caps Lock feature must be triggered by first pressing the Shift Lock key then a Capitals Shift key; it doesn't work if you press the Shift key first (instead you get the secondary symbol associated with the Shift Lock button).
## Special Escape Sequence ##
In the Ordinary Layout, the most unsatisfying key location is the Escape key which rightly belongs segregated on its own way up on the top left of the keyboard. The Ergodox does not have a physical button in such a location and the nearest one, in the top left corner, was assigned to the tilde button which is traditionally found in that location. The Escape key is important so it features prominently on the other top corner on the left side of the keyboard, and is always there in all layers. Nevertheless, alas, it isn't Ordinary to put the escape in that different corner!
That tilde key has a second function as the Shift Lock key and that makes possible a special feature. To make this layout as Ordinary as possible, the Escape key can *also* be accessed by pressing Shift Lock then the 1 button right next to it. This easy gesture is a way to partially maintain the ease of flicking your wrist to the left and tapping Escape. This gesture works in all layers.

@ -41,7 +41,6 @@
# Target file name (without extension). # Target file name (without extension).
TARGET = planck TARGET = planck
# Directory common source filess exist # Directory common source filess exist
TOP_DIR = ../.. TOP_DIR = ../..
TMK_DIR = ../../tmk_core TMK_DIR = ../../tmk_core
@ -62,17 +61,28 @@ ifneq ("$(wildcard keymaps/$(KEYMAP).c)","")
else else
ifneq ("$(wildcard keymaps/$(KEYMAP)/keymap.c)","") ifneq ("$(wildcard keymaps/$(KEYMAP)/keymap.c)","")
KEYMAP_FILE = keymaps/$(KEYMAP)/keymap.c KEYMAP_FILE = keymaps/$(KEYMAP)/keymap.c
ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","")
include keymaps/$(KEYMAP)/makefile.mk
endif
else else
$(error Keymap file does not exist) $(error Keymap file does not exist)
endif endif
endif endif
else else
ifneq ("$(wildcard keymaps/default.c)","") ifneq ("$(wildcard keymaps/default.c)","")
KEYMAP_FILE = keymaps/default.c KEYMAP_FILE = keymaps/default.c
else else
KEYMAP_FILE = keymaps/default/keymap.c KEYMAP_FILE = keymaps/default/keymap.c
endif endif
ifneq ("$(wildcard keymaps/default/makefile.mk)","")
include keymaps/default/makefile.mk
endif
endif endif
SRC := $(KEYMAP_FILE) $(SRC) SRC := $(KEYMAP_FILE) $(SRC)
CONFIG_H = config.h CONFIG_H = config.h
@ -94,7 +104,6 @@ MCU = atmega32u4
# software delays. # software delays.
F_CPU = 16000000 F_CPU = 16000000
# #
# LUFA specific # LUFA specific
# #
@ -126,29 +135,45 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# USBaspLoader 2048 # USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096 OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options # Build Options
# comment out to disable the options. # change to "no" to disable the options, or define them in the makefile.mk in
# # the appropriate keymap folder that will get included automatically
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) #
MOUSEKEY_ENABLE = yes # Mouse keys(+4700) BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450) MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
CONSOLE_ENABLE = yes # Console for debug(+400) EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
COMMAND_ENABLE = yes # Commands for debug and configuration CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality ifdef KEYMAP
# MIDI_ENABLE = YES # MIDI controls
# AUDIO_ENABLE = YES # Audio output on port C6 ifeq ("$(wildcard keymaps/$(KEYMAP).c)","")
# UNICODE_ENABLE = YES # Unicode ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","")
# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID include keymaps/$(KEYMAP)/makefile.mk
# RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
ifdef BACKLIGHT_ENABLE
SRC += backlight.c
endif endif
endif
else
ifneq ("$(wildcard keymaps/default/makefile.mk)","")
include keymaps/default/makefile.mk
endif
endif
ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
SRC := backlight.c $(SRC)
endif
# Optimize size but this may cause error "relocation truncated to fit" # Optimize size but this may cause error "relocation truncated to fit"
#EXTRALDFLAGS = -Wl,--relax #EXTRALDFLAGS = -Wl,--relax

@ -73,10 +73,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* disable debug print */ /* disable debug print */
#define NO_DEBUG //#define NO_DEBUG
/* disable print */ /* disable print */
#define NO_PRINT //#define NO_PRINT
/* disable action features */ /* disable action features */
//#define NO_ACTION_LAYER //#define NO_ACTION_LAYER

@ -0,0 +1,112 @@

#include "planck.h"
#ifdef BACKLIGHT_ENABLE
#include "backlight.h"
#endif
#include "..\..\quantum\keymap_extras\keymap_german.h"
/* This Layout tries to emulate the Bone2 Variant of Neo2, and is intended to be used with a German QWERTZ Softwarelayout.
It has Umlauts and "ß" as it is optimized for a mix of German & English.
My favourite features are the placement of the special characters often used for programming right on the home row
and the number & navigation block combo, so you never have to move your hands from their home position.
Bone2 wiki page: http://wiki.neo-layout.org/wiki/Bone
*/
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Bone2
* ,-----------------------------------------------------------------------------------.
* | Q | J | D | U | A | X | P | H | L | M | W | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | M1 | C | T | I | E | O | B | N | R | S | G | M1 |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| F | V | Ü | Ä | Ö | Y | Z | , | . | K |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | GUI | Alt | M3 | M2 | Space | M2 | M3 | Esc | Tab |Enter |
* `-----------------------------------------------------------------------------------'
*/
[0] = {
{ DE_Q, DE_J, DE_D, DE_U, DE_A, DE_X, DE_P, DE_H, DE_L, DE_M, DE_W, DE_SS },
{ MO(1), DE_C, DE_T, DE_I, DE_E, DE_O, DE_B, DE_N, DE_R, DE_S, DE_G, MO(1) },
{ DE_S, DE_F, DE_V, DE_UE, DE_AE, DE_OE, DE_Y, DE_Z, DE_COMM, DE_DOT, DE_K, DE_S },
{ KC_LCTL, KC_LGUI, KC_LALT, MO(3), MO(2), KC_SPC, KC_SPC, MO(2), MO(3), KC_ESC, KC_TAB, KC_ENT }
},
/* M1 Special Characters
* ,-----------------------------------------------------------------------------------.
* | ° | @ | _ | [ | ] | ^ | ! | < | > | = | & | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | M1 | \ | / | { | } | * | ? | ( | ) | - | : | M1 |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | # | $ | | | ~ | | + | % | " | ' | ; | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | GUI | Alt | M3 | M2 | Space | M2 | M3 | Esc | Tab |Enter |
* `-----------------------------------------------------------------------------------'
*/
[1] = {
{ DE_RING, DE_AT, DE_UNDS, DE_LBRC, DE_RBRC, DE_CIRC, DE_EXLM, DE_LESS, DE_MORE, DE_EQL, DE_AMPR, KC_NO },
{ KC_TRNS, DE_BSLS, DE_SLSH, DE_LCBR, DE_RCBR, DE_ASTR, DE_QST, DE_LPRN, DE_RPRN, DE_MINS, DE_COLN, KC_TRNS },
{ KC_NO , DE_HASH, DE_DLR, DE_PIPE, DE_TILD, DE_EURO, DE_PLUS, DE_PERC, DE_DQOT, DE_QUOT, DE_SCLN, KC_NO },
{ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS }
},
/* Navigation & Number Blocks
* ,-----------------------------------------------------------------------------------.
* | | PgUp | Bksp | Up | DEL | PgDn | | 7 | 8 | 9 | | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | Home | Lft | Down | Right| End | . | 4 | 5 | 6 | , | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| | Tab | Ins | Enter| | 0 | 1 | 2 | 3 | ; |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | GUI | Alt | M3 | M2 | Space | M2 | M3 | Esc | Tab |Enter |
* `-----------------------------------------------------------------------------------'
*/
[2] = {
{ KC_NO, KC_PGUP, KC_BSPC, KC_UP, KC_DEL, KC_PGDN, KC_NO, DE_7, DE_8, DE_9, KC_NO, KC_NO },
{ KC_NO, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, DE_DOT, DE_4, DE_5, DE_6, DE_COMM, KC_NO },
{ DE_S, KC_NO, KC_TAB, KC_INS, KC_ENT, KC_NO, KC_0, DE_1, DE_2, DE_3, DE_SCLN, DE_S },
{ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS }
},
/* Function & Media Keys
* ,-----------------------------------------------------------------------------------.
* | | | Print|Scroll|Pause | | | F7 | F8 | F9 | F12 | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | Mute | Vol- | Vol+ | | ³ | F4 | F5 | F6 | F11 | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| | Prev | Play | Next | | ² | F1 | F2 | F3 | F10 |Shift |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | GUI | Alt | M3 | | Space | | M3 | Esc | Tab |Enter |
* `-----------------------------------------------------------------------------------'
*/
[3] = {
{ KC_NO, KC_NO, KC_PSCR, KC_SLCK, KC_PAUS, KC_NO, KC_NO, KC_F7, KC_F8, KC_F9, KC_F12, KC_NO },
{ KC_NO, KC_NO, KC_MUTE, KC_VOLD, KC_VOLU, KC_NO, DE_SQ3, KC_F4, KC_F5, KC_F6, KC_F11, KC_NO },
{ KC_TRNS, KC_NO, KC_MPRV, KC_MPLY, KC_MNXT, KC_NO, DE_SQ2, KC_F1, KC_F2, KC_F3, KC_F10, KC_TRNS},
{ KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_NO, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS}
}
};
const uint16_t PROGMEM fn_actions[] = {
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch (id) {
case 0:
if (record->event.pressed) {
register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
}
else {
unregister_code(KC_RSFT);
}
break;
}
return MACRO_NONE;
};

@ -1,34 +1,2 @@
# The Default Planck Layout # The Default Planck Layout
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QW] = { /* 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, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[_CM] = { /* 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 },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[_DV] = { /* Dvorak */
{KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
{KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
{KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[_RS] = { /* 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, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
{KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
[_LW] = { /* LOWER */
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
{KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
{KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
}
};

@ -2,19 +2,40 @@
// this is the style you want to emulate. // this is the style you want to emulate.
#include "planck.h" #include "planck.h"
#ifdef BACKLIGHT_ENABLE #include "action_layer.h"
#include "backlight.h" #ifdef AUDIO_ENABLE
#include "audio.h"
#endif #endif
// Each layer gets a name for readability, which is then used in the keymap matrix below. // Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them // Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers. // entirely and just use numbers.
#define _QW 0 #define _QWERTY 0
#define _CM 1 #define _COLEMAK 1
#define _DV 2 #define _DVORAK 2
#define _LW 3 #define _LOWER 3
#define _RS 4 #define _RAISE 4
#define _ADJUST 5
#define _MUSIC 6
// Macro name shortcuts
#define QWERTY M(_QWERTY)
#define COLEMAK M(_COLEMAK)
#define DVORAK M(_DVORAK)
#define LOWER M(_LOWER)
#define RAISE M(_RAISE)
#define M_BL 5
#ifdef AUDIO_ENABLE
#define AUD_OFF M(6)
#define AUD_ON M(7)
#endif
#define MUS_OFF M(8)
#define MUS_ON M(9)
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@ -29,11 +50,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_QW] = { [_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_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_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 }, {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, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
}, },
/* Colemak /* Colemak
@ -47,11 +68,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_CM] = { [_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_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_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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
}, },
/* Dvorak /* Dvorak
@ -65,47 +86,75 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right | * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_DV] = { [_DVORAK] = {
{KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
{KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
{KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
/* Lower
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_LOWER] = {
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
{KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
}, },
/* Raise /* Raise
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter | * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Next | Vol- | Vol+ | Play | * | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_RS] = { [_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_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, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
{KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS}, {_______, 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_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
}, },
/* Lower /* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------. * ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | * | | Reset| | | | | | | | | | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------| * |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
* |------+------+------+------+------+------|------+------+------+------+------+------| * |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter | * | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------| * |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Next | Vol- | Vol+ | Play | * | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------' * `-----------------------------------------------------------------------------------'
*/ */
[_LW] = { [_ADJUST] = {
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL},
{KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, {_______, _______, _______, AUD_ON, AUD_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______},
{KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS}, {_______, _______, _______, MUS_ON, MUS_OFF, _______, _______, _______, _______, _______, _______, _______},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Music (reserved for process_action_user)
*
*/
[_MUSIC] = {
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
} }
}; };
@ -113,11 +162,106 @@ const uint16_t PROGMEM fn_actions[] = {
}; };
#ifdef AUDIO_ENABLE
float tone_startup[][2] = {
{440.0*pow(2.0,(31)/12.0), 12},
{440.0*pow(2.0,(28)/12.0), 8},
{440.0*pow(2.0,(19)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8},
{440.0*pow(2.0,(28)/12.0), 20}
};
float tone_qwerty[][2] = {
{440.0*pow(2.0,(23)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(31)/12.0), 16}
};
float tone_colemak[][2] = {
{440.0*pow(2.0,(23)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(31)/12.0), 12},
{0, 4},
{440.0*pow(2.0,(35)/12.0), 12}
};
float tone_dvorak[][2] = {
{440.0*pow(2.0,(23)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(31)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(33)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(31)/12.0), 8}
};
float tone_music[][2] = {
{440.0*pow(2.0,(12)/12.0), 8},
{440.0*pow(2.0,(14)/12.0), 8},
{440.0*pow(2.0,(16)/12.0), 8},
{440.0*pow(2.0,(17)/12.0), 8},
{440.0*pow(2.0,(19)/12.0), 8},
{440.0*pow(2.0,(21)/12.0), 8},
{440.0*pow(2.0,(23)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8}
};
#endif
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_write_default_layer(default_layer);
default_layer_set(default_layer);
}
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{ {
// MACRODOWN only works in this function
switch(id) { switch(id) {
case 0: case _QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
break;
case _COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
#endif
persistant_default_layer_set(1UL<<_COLEMAK);
}
break;
case _DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
#endif
persistant_default_layer_set(1UL<<_DVORAK);
}
break;
case _LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
break;
case _RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
break;
case M_BL:
if (record->event.pressed) { if (record->event.pressed) {
register_code(KC_RSFT); register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE #ifdef BACKLIGHT_ENABLE
@ -127,6 +271,59 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
unregister_code(KC_RSFT); unregister_code(KC_RSFT);
} }
break; break;
case 6:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
audio_off();
#endif
}
break;
case 7:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
audio_on();
PLAY_NOTE_ARRAY(tone_startup, false, 0);
#endif
}
break;
case 8:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
layer_off(_MUSIC);
stop_all_notes();
#endif
}
break;
case 9:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_music, false, 0);
layer_on(_MUSIC);
#endif
}
break;
} }
return MACRO_NONE; return MACRO_NONE;
}; };
uint8_t starting_note = 0x0C;
int offset = 7;
void process_action_user(keyrecord_t *record) {
if (IS_LAYER_ON(_MUSIC)) {
if (record->event.pressed) {
play_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF);
} else {
stop_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)));
}
}
}
void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
init_notes();
PLAY_NOTE_ARRAY(tone_startup, false, 0);
#endif
}

@ -0,0 +1,193 @@
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
// this is the style you want to emulate.
#include "planck.h"
#include "print.h"
#include "action_layer.h"
#ifdef BACKLIGHT_ENABLE
#include "backlight.h"
#endif
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _QW 0
#define _CM 1
#define _DV 2
#define _LW 3
#define _RS 4
#define _FN 5
#define XXXXXXX KC_NO
#define _______ KC_TRNS
#define ASFT(kc) LSFT(RSFT(kc))
#define MG_B ASFT(KC_B)
#define MG_H ASFT(KC_H)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | S | D | F | G | H | J | K | L | ; | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | Up |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Ctrl | GUI | Alt | Del |Raise | Space |Lower | / | Left | Down |Right |
* `-----------------------------------------------------------------------------------'
*/
[_QW] = {
{RESET, 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_UP, KC_ENT },
{KC_LCTL, KC_LGUI, KC_LALT, KC_DEL, M(_LW), KC_SPC, KC_SPC, M(_RS), KC_SLSH, KC_LEFT, KC_DOWN, KC_RGHT}
},
/* Colemak
* ,-----------------------------------------------------------------------------------.
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | R | S | T | D | H | N | E | I | O | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_CM] = {
{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 },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
/* Dvorak
* ,-----------------------------------------------------------------------------------.
* | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | O | E | U | I | D | H | T | N | S | / |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_DV] = {
{KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
{KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
{KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
/* Raise
* ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_RS] = {
{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_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, RESET, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
/* Lower
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_LW] = {
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
{_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, MG_B, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
/* Function
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Raise | Space |Lower | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_FN] = {
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, MG_H, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX},
{XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX}
}
};
const uint16_t PROGMEM fn_actions[] = {
};
int tri_layer = 0;
void update_tri_layer(int layer) {
if (tri_layer > 1) {
layer_on(layer);
} else {
layer_off(layer);
}
}
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch(id)
{
case _RS:
if (record->event.pressed) {
print("RS_DN");
layer_on(_RS);
tri_layer++;
update_tri_layer(_FN);
} else {
print("RS_UP");
layer_off(_RS);
tri_layer--;
update_tri_layer(_FN);
phex(layer_state);
}
break;
case _LW:
if (record->event.pressed) {
print("LW_DN");
layer_on(_LW);
tri_layer++;
update_tri_layer(_FN);
} else {
print("LW_UP");
layer_off(_LW);
tri_layer--;
update_tri_layer(_FN);
}
break;
default:
break;
}
return MACRO_NONE;
};

@ -126,27 +126,44 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
# USBaspLoader 2048 # USBaspLoader 2048
OPT_DEFS += -DBOOTLOADER_SIZE=4096 OPT_DEFS += -DBOOTLOADER_SIZE=4096
# Build Options # Build Options
# comment out to disable the options. # change to "no" to disable the options, or define them in the makefile.mk in
# # the appropriate keymap folder that will get included automatically
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) #
MOUSEKEY_ENABLE = yes # Mouse keys(+4700) BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450) MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
CONSOLE_ENABLE = yes # Console for debug(+400) EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
COMMAND_ENABLE = yes # Commands for debug and configuration CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls
AUDIO_ENABLE = no # Audio output on port C6
UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
# SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality ifdef KEYMAP
MIDI_ENABLE = YES # MIDI controls
AUDIO_ENABLE = YES # Audio output on port C6 ifeq ("$(wildcard keymaps/$(KEYMAP).c)","")
# UNICODE_ENABLE = YES # Unicode ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","")
# BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID include keymaps/$(KEYMAP)/makefile.mk
# RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with MIDI at the same time. endif
endif
ifdef BACKLIGHT_ENABLE
SRC += backlight.c else
ifneq ("$(wildcard keymaps/default/makefile.mk)","")
include keymaps/default/makefile.mk
endif
endif
ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
SRC := backlight.c $(SRC)
endif endif

@ -73,10 +73,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* disable debug print */ /* disable debug print */
#define NO_DEBUG // #define NO_DEBUG
/* disable print */ /* disable print */
#define NO_PRINT // #define NO_PRINT
/* disable action features */ /* disable action features */
//#define NO_ACTION_LAYER //#define NO_ACTION_LAYER

@ -1,34 +1 @@
# The Default Planck Layout # The default Preonic layout - largely based on the Planck's
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QW] = { /* 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, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[_CM] = { /* 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 },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[_DV] = { /* Dvorak */
{KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
{KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
{KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
[_RS] = { /* 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, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
{KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
[_LW] = { /* LOWER */
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
{KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
{KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS},
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
}
};

@ -1,56 +1,177 @@
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
// this is the style you want to emulate.
#include "preonic.h" #include "preonic.h"
#ifdef BACKLIGHT_ENABLE #include "action_layer.h"
#include "backlight.h" #include "eeconfig.h"
#ifdef AUDIO_ENABLE
#include "audio.h"
#endif #endif
// Each layer gets a name for readability, which is then used in the keymap matrix below. // Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name. // The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them // Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers. // entirely and just use numbers.
#define _QW 0 #define _QWERTY 0
#define _CM 1 #define _COLEMAK 1
#define _DV 2 #define _DVORAK 2
#define _LW 3 #define _LOWER 3
#define _RS 4 #define _RAISE 4
#define _ADJUST 5
#define _MUSIC 6
// Macro name shortcuts
#define QWERTY M(_QWERTY)
#define COLEMAK M(_COLEMAK)
#define DVORAK M(_DVORAK)
#define LOWER M(_LOWER)
#define RAISE M(_RAISE)
#define M_BL 5
#ifdef AUDIO_ENABLE
#define AUD_OFF M(6)
#define AUD_ON M(7)
#endif
#define MUS_OFF M(8)
#define MUS_ON M(9)
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QW] = { /* Qwerty */
/* Qwerty
* ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | S | D | F | G | H | J | K | L | ; | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = {
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{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_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_DEL},
{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_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 }, {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, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
}, },
[_CM] = { /* Colemak */
/* Colemak
* ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | R | S | T | D | H | N | E | I | O | " |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_COLEMAK] = {
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{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_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_DEL},
{KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, {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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
}, },
[_DV] = { /* Dvorak */
/* Dvorak
* ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Tab | " | , | . | P | Y | F | G | C | R | L | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Esc | A | O | E | U | I | D | H | T | N | S | / |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_DVORAK] = {
{KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_DEL},
{KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
{KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
{M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
}, },
[_RS] = { /* 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}, /* Lower
{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, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
{KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS}, * |------+------+------+------+------+-------------+------+------+------+------+------|
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_LOWER] = {
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL},
{KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
{_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
}, },
[_LW] = { /* LOWER */
/* Raise
* ,-----------------------------------------------------------------------------------.
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_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_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL},
{KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
{KC_TRNS, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, KC_TRNS}, {_______, 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_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
/* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------.
* | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | Reset| | | | | | | | | | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | |Audoff|Aud on|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | | |Musoff|Mus on| | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_ADJUST] = {
{KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12},
{_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL},
{_______, _______, _______, AUD_ON, AUD_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______},
{_______, _______, _______, MUS_ON, MUS_OFF, _______, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Music (reserved for process_action_user)
*
*/
[_MUSIC] = {
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
} }
}; };
@ -58,19 +179,104 @@ const uint16_t PROGMEM fn_actions[] = {
}; };
#ifdef AUDIO_ENABLE
float start_up[][2] = { float start_up[][2] = {
{440.0*pow(2.0,(67)/12.0), 600}, {440.0*pow(2.0,(14)/12.0), 20},
{440.0*pow(2.0,(64)/12.0), 400}, {440.0*pow(2.0,(26)/12.0), 8},
{440.0*pow(2.0,(55)/12.0), 400}, {440.0*pow(2.0,(18)/12.0), 20},
{440.0*pow(2.0,(60)/12.0), 400}, {440.0*pow(2.0,(26)/12.0), 8}
{440.0*pow(2.0,(64)/12.0), 1000},
}; };
float tone_qwerty[][2] = {
{440.0*pow(2.0,(23)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(31)/12.0), 16}
};
float tone_colemak[][2] = {
{440.0*pow(2.0,(23)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(31)/12.0), 12},
{0, 4},
{440.0*pow(2.0,(35)/12.0), 12}
};
float tone_dvorak[][2] = {
{440.0*pow(2.0,(23)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(31)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(33)/12.0), 8},
{0, 4},
{440.0*pow(2.0,(31)/12.0), 8}
};
float tone_music[][2] = {
{440.0*pow(2.0,(12)/12.0), 8},
{440.0*pow(2.0,(14)/12.0), 8},
{440.0*pow(2.0,(16)/12.0), 8},
{440.0*pow(2.0,(17)/12.0), 8},
{440.0*pow(2.0,(19)/12.0), 8},
{440.0*pow(2.0,(21)/12.0), 8},
{440.0*pow(2.0,(23)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8}
};
#endif
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_write_default_layer(default_layer);
default_layer_set(default_layer);
}
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{ {
// MACRODOWN only works in this function
switch(id) { switch(id) {
case 0: case _QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
#endif
persistant_default_layer_set(1UL<<_QWERTY);
}
break;
case _COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
#endif
persistant_default_layer_set(1UL<<_COLEMAK);
}
break;
case _DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
#endif
persistant_default_layer_set(1UL<<_DVORAK);
}
break;
case _LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
break;
case _RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
break;
case M_BL:
if (record->event.pressed) { if (record->event.pressed) {
register_code(KC_RSFT); register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE #ifdef BACKLIGHT_ENABLE
@ -80,13 +286,59 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
unregister_code(KC_RSFT); unregister_code(KC_RSFT);
} }
break; break;
case 6:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
audio_off();
#endif
}
break;
case 7:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
audio_on();
PLAY_NOTE_ARRAY(start_up, false, 0);
#endif
}
break;
case 8:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
layer_off(_MUSIC);
stop_all_notes();
#endif
}
break;
case 9:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_music, false, 0);
layer_on(_MUSIC);
#endif
}
break;
} }
return MACRO_NONE; return MACRO_NONE;
}; };
uint8_t starting_note = 0x0C;
int offset = 7;
void process_action_user(keyrecord_t *record) {
if (IS_LAYER_ON(_MUSIC)) {
if (record->event.pressed) {
play_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)), 0xF);
} else {
stop_note(((double)220.0)*pow(2.0, -4.0)*pow(2.0,(starting_note + SCALE[record->event.key.col + offset])/12.0+(MATRIX_ROWS - record->event.key.row)));
}
}
}
void matrix_init_user(void) { void matrix_init_user(void) {
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
init_notes(); init_notes();
play_notes(&start_up, 5, false); play_notes(&start_up, false, 0);
#endif #endif
} }

@ -8,8 +8,12 @@
#include "audio.h" #include "audio.h"
#include "keymap_common.h" #include "keymap_common.h"
#include "eeconfig.h"
#define PI 3.14159265 #define PI 3.14159265
#define CPU_PRESCALER 8
// #define PWM_AUDIO // #define PWM_AUDIO
#ifdef PWM_AUDIO #ifdef PWM_AUDIO
@ -30,6 +34,8 @@ int voice_place = 0;
double frequency = 0; double frequency = 0;
int volume = 0; int volume = 0;
long position = 0; long position = 0;
int duty_place = 1;
int duty_counter = 0;
double frequencies[8] = {0, 0, 0, 0, 0, 0, 0, 0}; double frequencies[8] = {0, 0, 0, 0, 0, 0, 0, 0};
int volumes[8] = {0, 0, 0, 0, 0, 0, 0, 0}; int volumes[8] = {0, 0, 0, 0, 0, 0, 0, 0};
@ -55,7 +61,30 @@ uint16_t note_position = 0;
float (* notes_pointer)[][2]; float (* notes_pointer)[][2];
uint8_t notes_length; uint8_t notes_length;
bool notes_repeat; bool notes_repeat;
float notes_rest;
bool note_resting = false;
uint8_t current_note = 0; uint8_t current_note = 0;
uint8_t rest_counter = 0;
audio_config_t audio_config;
void audio_toggle(void) {
audio_config.enable ^= 1;
eeconfig_write_audio(audio_config.raw);
}
void audio_on(void) {
audio_config.enable = 1;
eeconfig_write_audio(audio_config.raw);
}
void audio_off(void) {
audio_config.enable = 0;
eeconfig_write_audio(audio_config.raw);
}
void stop_all_notes() { void stop_all_notes() {
voices = 0; voices = 0;
@ -77,58 +106,66 @@ void stop_all_notes() {
} }
void stop_note(double freq) { void stop_note(double freq) {
#ifdef PWM_AUDIO if (note) {
freq = freq / SAMPLE_RATE;
#endif
for (int i = 7; i >= 0; i--) {
if (frequencies[i] == freq) {
frequencies[i] = 0;
volumes[i] = 0;
for (int j = i; (j < 7); j++) {
frequencies[j] = frequencies[j+1];
frequencies[j+1] = 0;
volumes[j] = volumes[j+1];
volumes[j+1] = 0;
}
}
}
voices--;
if (voices < 0)
voices = 0;
if (voices == 0) {
#ifdef PWM_AUDIO #ifdef PWM_AUDIO
TIMSK3 &= ~_BV(OCIE3A); freq = freq / SAMPLE_RATE;
#else
TIMSK3 &= ~_BV(OCIE3A);
TCCR3A &= ~_BV(COM3A1);
#endif #endif
frequency = 0; for (int i = 7; i >= 0; i--) {
volume = 0; if (frequencies[i] == freq) {
note = false; frequencies[i] = 0;
} else { volumes[i] = 0;
double freq = frequencies[voices - 1]; for (int j = i; (j < 7); j++) {
int vol = volumes[voices - 1]; frequencies[j] = frequencies[j+1];
double starting_f = frequency; frequencies[j+1] = 0;
if (frequency < freq) { volumes[j] = volumes[j+1];
sliding = true; volumes[j+1] = 0;
for (double f = starting_f; f <= freq; f += ((freq - starting_f) / 2000.0)) { }
frequency = f;
} }
sliding = false; }
} else if (frequency > freq) { voices--;
sliding = true; if (voices < 0)
for (double f = starting_f; f >= freq; f -= ((starting_f - freq) / 2000.0)) { voices = 0;
frequency = f; if (voices == 0) {
#ifdef PWM_AUDIO
TIMSK3 &= ~_BV(OCIE3A);
#else
TIMSK3 &= ~_BV(OCIE3A);
TCCR3A &= ~_BV(COM3A1);
#endif
frequency = 0;
volume = 0;
note = false;
} else {
double freq = frequencies[voices - 1];
int vol = volumes[voices - 1];
double starting_f = frequency;
if (frequency < freq) {
sliding = true;
for (double f = starting_f; f <= freq; f += ((freq - starting_f) / 2000.0)) {
frequency = f;
}
sliding = false;
} else if (frequency > freq) {
sliding = true;
for (double f = starting_f; f >= freq; f -= ((starting_f - freq) / 2000.0)) {
frequency = f;
}
sliding = false;
} }
sliding = false; frequency = freq;
volume = vol;
} }
frequency = freq;
volume = vol;
} }
} }
void init_notes() { void init_notes() {
/* check signature */
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
audio_config.raw = eeconfig_read_audio();
#ifdef PWM_AUDIO #ifdef PWM_AUDIO
PLLFRQ = _BV(PDIV2); PLLFRQ = _BV(PDIV2);
PLLCSR = _BV(PLLE); PLLCSR = _BV(PLLE);
@ -160,7 +197,6 @@ void init_notes() {
ISR(TIMER3_COMPA_vect) { ISR(TIMER3_COMPA_vect) {
if (note) { if (note) {
#ifdef PWM_AUDIO #ifdef PWM_AUDIO
if (voices == 1) { if (voices == 1) {
@ -213,13 +249,19 @@ ISR(TIMER3_COMPA_vect) {
if (frequency > 0) { if (frequency > 0) {
// ICR3 = (int)(((double)F_CPU) / frequency); // Set max to the period // ICR3 = (int)(((double)F_CPU) / frequency); // Set max to the period
// OCR3A = (int)(((double)F_CPU) / frequency) >> 1; // Set compare to half the period // OCR3A = (int)(((double)F_CPU) / frequency) >> 1; // Set compare to half the period
if (place > 10) { voice_place %= voices;
if (place > (frequencies[voice_place] / 50)) {
voice_place = (voice_place + 1) % voices; voice_place = (voice_place + 1) % voices;
place = 0.0; place = 0.0;
} }
ICR3 = (int)(((double)F_CPU) / frequencies[voice_place]); // Set max to the period ICR3 = (int)(((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)); // Set max to the period
OCR3A = (int)(((double)F_CPU) / frequencies[voice_place]) >> 1; // Set compare to half the period OCR3A = (int)(((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)) >> 1 * duty_place; // Set compare to half the period
place++; place++;
// if (duty_counter > (frequencies[voice_place] / 500)) {
// duty_place = (duty_place % 3) + 1;
// duty_counter = 0;
// }
// duty_counter++;
} }
#endif #endif
} }
@ -245,8 +287,8 @@ ISR(TIMER3_COMPA_vect) {
place -= SINE_LENGTH; place -= SINE_LENGTH;
#else #else
if (note_frequency > 0) { if (note_frequency > 0) {
ICR3 = (int)(((double)F_CPU) / note_frequency); // Set max to the period ICR3 = (int)(((double)F_CPU) / (note_frequency * CPU_PRESCALER)); // Set max to the period
OCR3A = (int)(((double)F_CPU) / note_frequency) >> 1; // Set compare to half the period OCR3A = (int)(((double)F_CPU) / (note_frequency * CPU_PRESCALER)) >> 1; // Set compare to half the period
} else { } else {
ICR3 = 0; ICR3 = 0;
OCR3A = 0; OCR3A = 0;
@ -255,7 +297,12 @@ ISR(TIMER3_COMPA_vect) {
note_position++; note_position++;
if (note_position >= note_length) { bool end_of_note = false;
if (ICR3 > 0)
end_of_note = (note_position >= (note_length / ICR3 * 0xFFFF));
else
end_of_note = (note_position >= (note_length * 0x7FF));
if (end_of_note) {
current_note++; current_note++;
if (current_note >= notes_length) { if (current_note >= notes_length) {
if (notes_repeat) { if (notes_repeat) {
@ -271,28 +318,43 @@ ISR(TIMER3_COMPA_vect) {
return; return;
} }
} }
#ifdef PWM_AUDIO if (!note_resting && (notes_rest > 0)) {
note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE; note_resting = true;
note_length = (*notes_pointer)[current_note][1]; note_frequency = 0;
#else note_length = notes_rest;
note_frequency = (*notes_pointer)[current_note][0]; current_note--;
note_length = (*notes_pointer)[current_note][1] / 4; } else {
#endif note_resting = false;
#ifdef PWM_AUDIO
note_frequency = (*notes_pointer)[current_note][0] / SAMPLE_RATE;
note_length = (*notes_pointer)[current_note][1];
#else
note_frequency = (*notes_pointer)[current_note][0];
note_length = (*notes_pointer)[current_note][1] / 4;
#endif
}
note_position = 0; note_position = 0;
} }
} }
if (!audio_config.enable) {
notes = false;
note = false;
}
} }
void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat) { void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat, float n_rest) {
if (audio_config.enable) {
if (note) if (note)
stop_all_notes(); stop_all_notes();
notes = true;
notes_pointer = np; notes_pointer = np;
notes_length = n_length; notes_length = n_length;
notes_repeat = n_repeat; notes_repeat = n_repeat;
notes_rest = n_rest;
place = 0; place = 0;
current_note = 0; current_note = 0;
@ -312,9 +374,16 @@ void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat) {
TIMSK3 |= _BV(OCIE3A); TIMSK3 |= _BV(OCIE3A);
TCCR3A |= _BV(COM3A1); TCCR3A |= _BV(COM3A1);
#endif #endif
notes = true;
}
} }
void play_sample(uint8_t * s, uint16_t l, bool r) { void play_sample(uint8_t * s, uint16_t l, bool r) {
if (audio_config.enable) {
stop_all_notes(); stop_all_notes();
place_int = 0; place_int = 0;
sample = s; sample = s;
@ -325,12 +394,17 @@ void play_sample(uint8_t * s, uint16_t l, bool r) {
TIMSK3 |= _BV(OCIE3A); TIMSK3 |= _BV(OCIE3A);
#else #else
#endif #endif
}
} }
void play_note(double freq, int vol) { void play_note(double freq, int vol) {
if (audio_config.enable && voices < 8) {
if (notes) if (notes)
stop_all_notes(); stop_all_notes();
note = true;
#ifdef PWM_AUDIO #ifdef PWM_AUDIO
freq = freq / SAMPLE_RATE; freq = freq / SAMPLE_RATE;
#endif #endif
@ -362,4 +436,7 @@ void play_note(double freq, int vol) {
TCCR3A |= _BV(COM3A1); TCCR3A |= _BV(COM3A1);
#endif #endif
note = true;
}
} }

@ -2,10 +2,42 @@
#include <stdbool.h> #include <stdbool.h>
#include <avr/io.h> #include <avr/io.h>
#include <util/delay.h> #include <util/delay.h>
#include "musical_notes.h"
#ifndef AUDIO_H
#define AUDIO_H
typedef union {
uint8_t raw;
struct {
bool enable :1;
uint8_t level :7;
};
} audio_config_t;
void audio_toggle(void);
void audio_on(void);
void audio_off(void);
void play_sample(uint8_t * s, uint16_t l, bool r); void play_sample(uint8_t * s, uint16_t l, bool r);
void play_note(double freq, int vol); void play_note(double freq, int vol);
void stop_note(double freq); void stop_note(double freq);
void stop_all_notes(); void stop_all_notes(void);
void init_notes(); void init_notes(void);
void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat); void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat, float n_rest);
#define SCALE (int []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \
0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \
0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \
0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \
0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), }
// These macros are used to allow play_notes to play an array of indeterminate
// length. This works around the limitation of C's sizeof operation on pointers.
// The global float array for the song must be used here.
#define NOTE_ARRAY_SIZE(x) ((int)(sizeof(x) / (sizeof(x[0]))))
#define PLAY_NOTE_ARRAY(note_array, note_repeat, note_rest_style) play_notes(&note_array, NOTE_ARRAY_SIZE((note_array)), (note_repeat), (note_rest_style));
#endif

@ -27,18 +27,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "keymap_midi.h" #include "keymap_midi.h"
#include "bootloader.h" #include "bootloader.h"
extern keymap_config_t keymap_config;
#include <stdio.h> #include <stdio.h>
#include <inttypes.h> #include <inttypes.h>
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
#include "audio.h" #include "audio.h"
#ifndef TONE_GOODBYE
float goodbye[][2] = { #define TONE_GOODBYE { \
{440.0*pow(2.0,(67)/12.0), 400}, {440.0*pow(2.0,(31)/12.0), 8}, \
{0, 50}, {440.0*pow(2.0,(24)/12.0), 8}, \
{440.0*pow(2.0,(60)/12.0), 400}, {440.0*pow(2.0,(19)/12.0), 12}, \
{0, 50}, }
{440.0*pow(2.0,(55)/12.0), 600}, #endif
}; float tone_goodbye[][2] = TONE_GOODBYE;
#endif #endif
static action_t keycode_to_action(uint16_t keycode); static action_t keycode_to_action(uint16_t keycode);
@ -49,118 +51,9 @@ action_t action_for_key(uint8_t layer, keypos_t key)
// 16bit keycodes - important // 16bit keycodes - important
uint16_t keycode = keymap_key_to_keycode(layer, key); 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); // adds modifier to key
return action;
} else if (keycode >= 0x2000 && keycode < 0x3000) {
// Is a shortcut for function layer, pull last 12bits
// This means we have 4,096 FN macros at our disposal
return keymap_func_to_action(keycode & 0xFFF);
} else if (keycode >= 0x3000 && keycode < 0x4000) {
// When the code starts with 3, it's an action macro.
action_t action;
action.code = ACTION_MACRO(keycode & 0xFF);
return action;
#ifdef BACKLIGHT_ENABLE
} 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;
#endif
} else if (keycode == RESET) { // RESET is 0x5000, which is why this is here
clear_keyboard();
#ifdef AUDIO_ENABLE
play_notes(&goodbye, 5, false);
#endif
_delay_ms(250);
#ifdef ATREUS_ASTAR
*(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
#endif
bootloader_jump();
return;
} else if (keycode == DEBUG) { // DEBUG is 0x5001
// TODO: Does this actually work?
print("\nDEBUG: enabled.\n");
debug_enable = true;
return;
} else if (keycode >= 0x5000 && keycode < 0x6000) {
// Layer movement shortcuts
// See .h to see constraints/usage
int type = (keycode >> 0x8) & 0xF;
if (type == 0x1) {
// Layer set "GOTO"
int when = (keycode >> 0x4) & 0x3;
int layer = keycode & 0xF;
action_t action;
action.code = ACTION_LAYER_SET(layer, when);
return action;
} else if (type == 0x2) {
// Momentary layer
int layer = keycode & 0xFF;
action_t action;
action.code = ACTION_LAYER_MOMENTARY(layer);
return action;
} else if (type == 0x3) {
// Set default layer
int layer = keycode & 0xFF;
action_t action;
action.code = ACTION_DEFAULT_LAYER_SET(layer);
return action;
} else if (type == 0x4) {
// Set default layer
int layer = keycode & 0xFF;
action_t action;
action.code = ACTION_LAYER_TOGGLE(layer);
return action;
}
#ifdef MIDI_ENABLE
} else if (keycode >= 0x6000 && keycode < 0x7000) {
action_t action;
action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8);
return action;
#endif
} else if (keycode >= 0x7000 && keycode < 0x8000) {
action_t action;
action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
return action;
} else if (keycode >= 0x8000 && keycode < 0x9000) {
action_t action;
action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
return action;
#ifdef UNICODE_ENABLE
} else if (keycode >= 0x8000000) {
action_t action;
uint16_t unicode = keycode & ~(0x8000);
action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8);
return action;
#endif
} else {
}
switch (keycode) { switch (keycode) {
case KC_FN0 ... KC_FN31: case KC_FN0 ... KC_FN31:
return keymap_fn_to_action(keycode); return keymap_fn_to_action(keycode);
#ifdef BOOTMAGIC_ENABLE
case KC_CAPSLOCK: case KC_CAPSLOCK:
case KC_LOCKING_CAPS: case KC_LOCKING_CAPS:
if (keymap_config.swap_control_capslock || keymap_config.capslock_to_control) { if (keymap_config.swap_control_capslock || keymap_config.capslock_to_control) {
@ -224,7 +117,6 @@ action_t action_for_key(uint8_t layer, keypos_t key)
return keycode_to_action(KC_BSLASH); return keycode_to_action(KC_BSLASH);
} }
return keycode_to_action(KC_BSPACE); return keycode_to_action(KC_BSPACE);
#endif
default: default:
return keycode_to_action(keycode); return keycode_to_action(keycode);
} }
@ -265,6 +157,142 @@ static action_t keycode_to_action(uint16_t keycode)
case KC_TRNS: case KC_TRNS:
action.code = ACTION_TRANSPARENT; action.code = ACTION_TRANSPARENT;
break; break;
case 0x0100 ... 0x1FFF: ;
// Has a modifier
// Split it up
action.code = ACTION_MODS_KEY(keycode >> 8, keycode & 0xFF); // adds modifier to key
break;
case 0x2000 ... 0x2FFF:
// Is a shortcut for function layer, pull last 12bits
// This means we have 4,096 FN macros at our disposal
return keymap_func_to_action(keycode & 0xFFF);
break;
case 0x3000 ... 0x3FFF: ;
// When the code starts with 3, it's an action macro.
action.code = ACTION_MACRO(keycode & 0xFF);
break;
#ifdef BACKLIGHT_ENABLE
case BL_0 ... BL_15:
action.code = ACTION_BACKLIGHT_LEVEL(keycode & 0x000F);
break;
case BL_DEC:
action.code = ACTION_BACKLIGHT_DECREASE();
break;
case BL_INC:
action.code = ACTION_BACKLIGHT_INCREASE();
break;
case BL_TOGG:
action.code = ACTION_BACKLIGHT_TOGGLE();
break;
case BL_STEP:
action.code = ACTION_BACKLIGHT_STEP();
break;
#endif
case RESET: ; // RESET is 0x5000, which is why this is here
clear_keyboard();
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
#endif
_delay_ms(250);
#ifdef ATREUS_ASTAR
*(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
#endif
bootloader_jump();
break;
case DEBUG: ; // DEBUG is 0x5001
print("\nDEBUG: enabled.\n");
debug_enable = true;
break;
case 0x5002 ... 0x50FF:
// MAGIC actions (BOOTMAGIC without the boot)
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
/* keymap config */
keymap_config.raw = eeconfig_read_keymap();
if (keycode == MAGIC_SWAP_CONTROL_CAPSLOCK) {
keymap_config.swap_control_capslock = 1;
} else if (keycode == MAGIC_CAPSLOCK_TO_CONTROL) {
keymap_config.capslock_to_control = 1;
} else if (keycode == MAGIC_SWAP_LALT_LGUI) {
keymap_config.swap_lalt_lgui = 1;
} else if (keycode == MAGIC_SWAP_RALT_RGUI) {
keymap_config.swap_ralt_rgui = 1;
} else if (keycode == MAGIC_NO_GUI) {
keymap_config.no_gui = 1;
} else if (keycode == MAGIC_SWAP_GRAVE_ESC) {
keymap_config.swap_grave_esc = 1;
} else if (keycode == MAGIC_SWAP_BACKSLASH_BACKSPACE) {
keymap_config.swap_backslash_backspace = 1;
} else if (keycode == MAGIC_HOST_NKRO) {
keymap_config.nkro = 1;
} else if (keycode == MAGIC_SWAP_ALT_GUI) {
keymap_config.swap_lalt_lgui = 1;
keymap_config.swap_ralt_rgui = 1;
}
/* UNs */
else if (keycode == MAGIC_UNSWAP_CONTROL_CAPSLOCK) {
keymap_config.swap_control_capslock = 0;
} else if (keycode == MAGIC_UNCAPSLOCK_TO_CONTROL) {
keymap_config.capslock_to_control = 0;
} else if (keycode == MAGIC_UNSWAP_LALT_LGUI) {
keymap_config.swap_lalt_lgui = 0;
} else if (keycode == MAGIC_UNSWAP_RALT_RGUI) {
keymap_config.swap_ralt_rgui = 0;
} else if (keycode == MAGIC_UNNO_GUI) {
keymap_config.no_gui = 0;
} else if (keycode == MAGIC_UNSWAP_GRAVE_ESC) {
keymap_config.swap_grave_esc = 0;
} else if (keycode == MAGIC_UNSWAP_BACKSLASH_BACKSPACE) {
keymap_config.swap_backslash_backspace = 0;
} else if (keycode == MAGIC_UNHOST_NKRO) {
keymap_config.nkro = 0;
} else if (keycode == MAGIC_UNSWAP_ALT_GUI) {
keymap_config.swap_lalt_lgui = 0;
keymap_config.swap_ralt_rgui = 0;
}
eeconfig_write_keymap(keymap_config.raw);
break;
case 0x5100 ... 0x5FFF: ;
// Layer movement shortcuts
// See .h to see constraints/usage
int type = (keycode >> 0x8) & 0xF;
if (type == 0x1) {
// Layer set "GOTO"
int when = (keycode >> 0x4) & 0x3;
int layer = keycode & 0xF;
action.code = ACTION_LAYER_SET(layer, when);
} else if (type == 0x2) {
// Momentary layer
int layer = keycode & 0xFF;
action.code = ACTION_LAYER_MOMENTARY(layer);
} else if (type == 0x3) {
// Set default layer
int layer = keycode & 0xFF;
action.code = ACTION_DEFAULT_LAYER_SET(layer);
} else if (type == 0x4) {
// Set default layer
int layer = keycode & 0xFF;
action.code = ACTION_LAYER_TOGGLE(layer);
}
break;
#ifdef MIDI_ENABLE
case 0x6000 ... 0x6FFF:
action.code = ACTION_FUNCTION_OPT(keycode & 0xFF, (keycode & 0x0F00) >> 8);
break;
#endif
case 0x7000 ... 0x7FFF:
action.code = ACTION_MODS_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
break;
case 0x8000 ... 0x8FFF:
action.code = ACTION_LAYER_TAP_KEY((keycode >> 0x8) & 0xF, keycode & 0xFF);
break;
#ifdef UNICODE_ENABLE
case 0x8000000 ... 0x8FFFFFF:
uint16_t unicode = keycode & ~(0x8000);
action.code = ACTION_FUNCTION_OPT(unicode & 0xFF, (unicode & 0xFF00) >> 8);
break;
#endif
default: default:
action.code = ACTION_NO; action.code = ACTION_NO;
break; break;
@ -291,3 +319,11 @@ action_t keymap_func_to_action(uint16_t keycode)
// For FUNC without 8bit limit // For FUNC without 8bit limit
return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) }; return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) };
} }
void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
layer_on(layer3);
} else {
layer_off(layer3);
}
}

@ -30,7 +30,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #include "print.h" // #include "print.h"
#include "debug.h" #include "debug.h"
#ifdef BOOTMAGIC_ENABLE
/* NOTE: Not portable. Bit field order depends on implementation */ /* NOTE: Not portable. Bit field order depends on implementation */
typedef union { typedef union {
uint16_t raw; uint16_t raw;
@ -45,8 +44,6 @@ typedef union {
bool nkro:1; bool nkro:1;
}; };
} keymap_config_t; } keymap_config_t;
keymap_config_t keymap_config;
#endif
/* translates key to keycode */ /* translates key to keycode */
@ -168,6 +165,30 @@ extern const uint16_t fn_actions[];
#define RESET 0x5000 #define RESET 0x5000
#define DEBUG 0x5001 #define DEBUG 0x5001
// MAGIC keycodes
#define MAGIC_SWAP_CONTROL_CAPSLOCK 0x5002
#define MAGIC_UNSWAP_CONTROL_CAPSLOCK 0x5003
#define MAGIC_CAPSLOCK_TO_CONTROL 0x5004
#define MAGIC_UNCAPSLOCK_TO_CONTROL 0x5005
#define MAGIC_SWAP_LALT_LGUI 0x5006
#define MAGIC_UNSWAP_LALT_LGUI 0x5007
#define MAGIC_SWAP_RALT_RGUI 0x5008
#define MAGIC_UNSWAP_RALT_RGUI 0x5009
#define MAGIC_NO_GUI 0x500a
#define MAGIC_UNNO_GUI 0x500b
#define MAGIC_SWAP_GRAVE_ESC 0x500c
#define MAGIC_UNSWAP_GRAVE_ESC 0x500d
#define MAGIC_SWAP_BACKSLASH_BACKSPACE 0x500e
#define MAGIC_UNSWAP_BACKSLASH_BACKSPACE 0x500f
#define MAGIC_HOST_NKRO 0x5010
#define MAGIC_UNHOST_NKRO 0x5011
#define MAGIC_SWAP_ALT_GUI 0x5012
#define MAGIC_UNSWAP_ALT_GUI 0x5013
#define AG_SWAP MAGIC_SWAP_ALT_GUI
#define AG_NORM MAGIC_UNSWAP_ALT_GUI
// GOTO layer - 16 layers max // GOTO layer - 16 layers max
// when: // when:
// ON_PRESS = 1 // ON_PRESS = 1
@ -184,8 +205,6 @@ extern const uint16_t fn_actions[];
// Toggle to layer - 256 layer max // Toggle to layer - 256 layer max
#define TG(layer) (layer | 0x5400) #define TG(layer) (layer | 0x5400)
#define MIDI(n) (n | 0x6000)
// M-od, T-ap - 256 keycode max // M-od, T-ap - 256 keycode max
#define MT(mod, kc) (kc | 0x7000 | ((mod & 0xF) << 8)) #define MT(mod, kc) (kc | 0x7000 | ((mod & 0xF) << 8))
#define CTL_T(kc) MT(0x1, kc) #define CTL_T(kc) MT(0x1, kc)
@ -210,5 +229,10 @@ extern const uint16_t fn_actions[];
#define UNICODE(n) (n | 0x8000) #define UNICODE(n) (n | 0x8000)
#define UC(n) UNICODE(n) #define UC(n) UNICODE(n)
// For tri-layer
void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
#define IS_LAYER_ON(layer) ((layer_state) & (1UL<<(layer)))
#define IS_LAYER_OFF(layer) ((!layer_state) & (1UL<<(layer)))
#endif #endif

@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <lufa.h> #include <lufa.h>
#define MIDI 0x6000 #define MIDI(n) ((n) | 0x6000)
#define MIDI12 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000 #define MIDI12 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000
#define CHNL(note, channel) (note + (channel << 8)) #define CHNL(note, channel) (note + (channel << 8))

@ -0,0 +1,187 @@
#ifndef MUSICAL_NOTES_H
#define MUSICAL_NOTES_H
// Tempo Placeholder
#define TEMPO 120
// Note Types
#define WHOLE_NOTE(note) {(NOTE##note), 64}
#define HALF_NOTE(note) {(NOTE##note), 32}
#define QUARTER_NOTE(note) {(NOTE##note), 16}
#define EIGHTH_NOTE(note) {(NOTE##note), 8}
#define SIXTEENTH_NOTE(note) {(NOTE##note), 4}
// Note Types Short
#define W_NOTE(n) WHOLE_NOTE(n)
#define H_NOTE(n) HALF_NOTE(n)
#define Q_NOTE(n) QUARTER_NOTE(n)
#define E_NOTE(n) EIGTH_NOTE(n)
#define S_NOTE(n) SIXTEENTH_NOTE(n)
// Note Styles
// Staccato makes sure there is a rest between each note. Think: TA TA TA
// Legato makes notes flow together. Think: TAAA
#define STACCATO 0.01
#define LEGATO 0
// Notes - # = Octave
#define NOTE_REST 0.00
#define NOTE_C0 16.35
#define NOTE_CS0 17.32
#define NOTE_D0 18.35
#define NOTE_DS0 19.45
#define NOTE_E0 20.60
#define NOTE_F0 21.83
#define NOTE_FS0 23.12
#define NOTE_G0 24.50
#define NOTE_GS0 25.96
#define NOTE_A0 27.50
#define NOTE_AS0 29.14
#define NOTE_B0 30.87
#define NOTE_C1 32.70
#define NOTE_CS1 34.65
#define NOTE_D1 36.71
#define NOTE_DS1 38.89
#define NOTE_E1 41.20
#define NOTE_F1 43.65
#define NOTE_FS1 46.25
#define NOTE_G1 49.00
#define NOTE_GS1 51.91
#define NOTE_A1 55.00
#define NOTE_AS1 58.27
#define NOTE_B1 61.74
#define NOTE_C2 65.41
#define NOTE_CS2 69.30
#define NOTE_D2 73.42
#define NOTE_DS2 77.78
#define NOTE_E2 82.41
#define NOTE_F2 87.31
#define NOTE_FS2 92.50
#define NOTE_G2 98.00
#define NOTE_GS2 103.83
#define NOTE_A2 110.00
#define NOTE_AS2 116.54
#define NOTE_B2 123.47
#define NOTE_C3 130.81
#define NOTE_CS3 138.59
#define NOTE_D3 146.83
#define NOTE_DS3 155.56
#define NOTE_E3 164.81
#define NOTE_F3 174.61
#define NOTE_FS3 185.00
#define NOTE_G3 196.00
#define NOTE_GS3 207.65
#define NOTE_A3 220.00
#define NOTE_AS3 233.08
#define NOTE_B3 246.94
#define NOTE_C4 261.63
#define NOTE_CS4 277.18
#define NOTE_D4 293.66
#define NOTE_DS4 311.13
#define NOTE_E4 329.63
#define NOTE_F4 349.23
#define NOTE_FS4 369.99
#define NOTE_G4 392.00
#define NOTE_GS4 415.30
#define NOTE_A4 440.00
#define NOTE_AS4 466.16
#define NOTE_B4 493.88
#define NOTE_C5 523.25
#define NOTE_CS5 554.37
#define NOTE_D5 587.33
#define NOTE_DS5 622.25
#define NOTE_E5 659.26
#define NOTE_F5 698.46
#define NOTE_FS5 739.99
#define NOTE_G5 783.99
#define NOTE_GS5 830.61
#define NOTE_A5 880.00
#define NOTE_AS5 932.33
#define NOTE_B5 987.77
#define NOTE_C6 1046.50
#define NOTE_CS6 1108.73
#define NOTE_D6 1174.66
#define NOTE_DS6 1244.51
#define NOTE_E6 1318.51
#define NOTE_F6 1396.91
#define NOTE_FS6 1479.98
#define NOTE_G6 1567.98
#define NOTE_GS6 1661.22
#define NOTE_A6 1760.00
#define NOTE_AS6 1864.66
#define NOTE_B6 1975.53
#define NOTE_C7 2093.00
#define NOTE_CS7 2217.46
#define NOTE_D7 2349.32
#define NOTE_DS7 2489.02
#define NOTE_E7 2637.02
#define NOTE_F7 2793.83
#define NOTE_FS7 2959.96
#define NOTE_G7 3135.96
#define NOTE_GS7 3322.44
#define NOTE_A7 3520.00
#define NOTE_AS7 3729.31
#define NOTE_B7 3951.07
#define NOTE_C8 4186.01
#define NOTE_CS8 4434.92
#define NOTE_D8 4698.64
#define NOTE_DS8 4978.03
#define NOTE_E8 5274.04
#define NOTE_F8 5587.65
#define NOTE_FS8 5919.91
#define NOTE_G8 6271.93
#define NOTE_GS8 6644.88
#define NOTE_A8 7040.00
#define NOTE_AS8 7458.62
#define NOTE_B8 7902.13
// Flat Aliases
#define NOTE_DF0 NOTE_CS0
#define NOTE_EF0 NOTE_DS0
#define NOTE_GF0 NOTE_FS0
#define NOTE_AF0 NOTE_GS0
#define NOTE_BF0 NOTE_AS0
#define NOTE_DF1 NOTE_CS1
#define NOTE_EF1 NOTE_DS1
#define NOTE_GF1 NOTE_FS1
#define NOTE_AF1 NOTE_GS1
#define NOTE_BF1 NOTE_AS1
#define NOTE_DF2 NOTE_CS2
#define NOTE_EF2 NOTE_DS2
#define NOTE_GF2 NOTE_FS2
#define NOTE_AF2 NOTE_GS2
#define NOTE_BF2 NOTE_AS2
#define NOTE_DF3 NOTE_CS3
#define NOTE_EF3 NOTE_DS3
#define NOTE_GF3 NOTE_FS3
#define NOTE_AF3 NOTE_GS3
#define NOTE_BF3 NOTE_AS3
#define NOTE_DF4 NOTE_CS4
#define NOTE_EF4 NOTE_DS4
#define NOTE_GF4 NOTE_FS4
#define NOTE_AF4 NOTE_GS4
#define NOTE_BF4 NOTE_AS4
#define NOTE_DF5 NOTE_CS5
#define NOTE_EF5 NOTE_DS5
#define NOTE_GF5 NOTE_FS5
#define NOTE_AF5 NOTE_GS5
#define NOTE_BF5 NOTE_AS5
#define NOTE_DF6 NOTE_CS6
#define NOTE_EF6 NOTE_DS6
#define NOTE_GF6 NOTE_FS6
#define NOTE_AF6 NOTE_GS6
#define NOTE_BF6 NOTE_AS6
#define NOTE_DF7 NOTE_CS7
#define NOTE_EF7 NOTE_DS7
#define NOTE_GF7 NOTE_FS7
#define NOTE_AF7 NOTE_GS7
#define NOTE_BF7 NOTE_AS7
#define NOTE_DF8 NOTE_CS8
#define NOTE_EF8 NOTE_DS8
#define NOTE_GF8 NOTE_FS8
#define NOTE_AF8 NOTE_GS8
#define NOTE_BF8 NOTE_AS8
#endif

@ -23,19 +23,19 @@ ifndef CUSTOM_MATRIX
SRC += $(QUANTUM_DIR)/matrix.c SRC += $(QUANTUM_DIR)/matrix.c
endif endif
ifdef MIDI_ENABLE ifeq ($(strip $(MIDI_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/keymap_midi.c SRC += $(QUANTUM_DIR)/keymap_midi.c
endif endif
ifdef AUDIO_ENABLE ifeq ($(strip $(AUDIO_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/audio.c SRC += $(QUANTUM_DIR)/audio.c
endif endif
ifdef UNICODE_ENABLE ifeq ($(strip $(UNICODE_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/keymap_unicode.c SRC += $(QUANTUM_DIR)/keymap_unicode.c
endif endif
ifdef RGBLIGHT_ENABLE ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/light_ws2812.c SRC += $(QUANTUM_DIR)/light_ws2812.c
SRC += $(QUANTUM_DIR)/rgblight.c SRC += $(QUANTUM_DIR)/rgblight.c
OPT_DEFS += -DRGBLIGHT_ENABLE OPT_DEFS += -DRGBLIGHT_ENABLE
@ -46,6 +46,7 @@ endif
# Search Path # Search Path
VPATH += $(TOP_DIR)/$(QUANTUM_DIR) VPATH += $(TOP_DIR)/$(QUANTUM_DIR)
VPATH += $(TOP_DIR)/$(QUANTUM_DIR)/keymap_extras
include $(TMK_DIR)/protocol/lufa.mk include $(TMK_DIR)/protocol/lufa.mk

@ -0,0 +1,6 @@
`eeprom_reset.hex` is to reset the eeprom on the Atmega32u4, like this:
dfu-programmer atmega32u4 erase
dfu-programmer atmega32u4 flash --eeprom eeprom-reset.bin
You'll need to reflash afterwards, because DFU requires the flash to be erased before messing with the eeprom.

@ -0,0 +1,9 @@
:10000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00
:10001000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0
:10002000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0
:10003000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0
:10004000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC0
:10005000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0
:10006000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA0
:10007000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF90
:00000001FF

@ -17,66 +17,70 @@ SRC += $(COMMON_DIR)/host.c \
# Option modules # Option modules
ifdef BOOTMAGIC_ENABLE ifeq ($(strip $(BOOTMAGIC_ENABLE)), yes)
SRC += $(COMMON_DIR)/bootmagic.c SRC += $(COMMON_DIR)/bootmagic.c
SRC += $(COMMON_DIR)/avr/eeconfig.c SRC += $(COMMON_DIR)/avr/eeconfig.c
OPT_DEFS += -DBOOTMAGIC_ENABLE OPT_DEFS += -DBOOTMAGIC_ENABLE
else
SRC += $(COMMON_DIR)/magic.c
SRC += $(COMMON_DIR)/avr/eeconfig.c
endif endif
ifdef MOUSEKEY_ENABLE ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)
SRC += $(COMMON_DIR)/mousekey.c SRC += $(COMMON_DIR)/mousekey.c
OPT_DEFS += -DMOUSEKEY_ENABLE OPT_DEFS += -DMOUSEKEY_ENABLE
OPT_DEFS += -DMOUSE_ENABLE OPT_DEFS += -DMOUSE_ENABLE
endif endif
ifdef EXTRAKEY_ENABLE ifeq ($(strip $(EXTRAKEY_ENABLE)), yes)
OPT_DEFS += -DEXTRAKEY_ENABLE OPT_DEFS += -DEXTRAKEY_ENABLE
endif endif
ifdef CONSOLE_ENABLE ifeq ($(strip $(CONSOLE_ENABLE)), yes)
OPT_DEFS += -DCONSOLE_ENABLE OPT_DEFS += -DCONSOLE_ENABLE
else else
OPT_DEFS += -DNO_PRINT OPT_DEFS += -DNO_PRINT
OPT_DEFS += -DNO_DEBUG OPT_DEFS += -DNO_DEBUG
endif endif
ifdef COMMAND_ENABLE ifeq ($(strip $(COMMAND_ENABLE)), yes)
SRC += $(COMMON_DIR)/command.c SRC += $(COMMON_DIR)/command.c
OPT_DEFS += -DCOMMAND_ENABLE OPT_DEFS += -DCOMMAND_ENABLE
endif endif
ifdef NKRO_ENABLE ifeq ($(strip $(NKRO_ENABLE)), yes)
OPT_DEFS += -DNKRO_ENABLE OPT_DEFS += -DNKRO_ENABLE
endif endif
ifdef MIDI_ENABLE ifeq ($(strip $(MIDI_ENABLE)), yes)
OPT_DEFS += -DMIDI_ENABLE OPT_DEFS += -DMIDI_ENABLE
endif endif
ifdef AUDIO_ENABLE ifeq ($(strip $(AUDIO_ENABLE)), yes)
OPT_DEFS += -DAUDIO_ENABLE OPT_DEFS += -DAUDIO_ENABLE
endif endif
ifdef USB_6KRO_ENABLE ifeq ($(strip $(USB_6KRO_ENABLE)), yes)
OPT_DEFS += -DUSB_6KRO_ENABLE OPT_DEFS += -DUSB_6KRO_ENABLE
endif endif
ifdef SLEEP_LED_ENABLE ifeq ($(strip $(SLEEP_LED_ENABLE)), yes)
SRC += $(COMMON_DIR)/sleep_led.c SRC += $(COMMON_DIR)/sleep_led.c
OPT_DEFS += -DSLEEP_LED_ENABLE OPT_DEFS += -DSLEEP_LED_ENABLE
OPT_DEFS += -DNO_SUSPEND_POWER_DOWN OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
endif endif
ifdef BACKLIGHT_ENABLE ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
SRC += $(COMMON_DIR)/backlight.c SRC += $(COMMON_DIR)/backlight.c
SRC += $(COMMON_DIR)/avr/eeconfig.c
OPT_DEFS += -DBACKLIGHT_ENABLE OPT_DEFS += -DBACKLIGHT_ENABLE
endif endif
ifdef BLUETOOTH_ENABLE ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
OPT_DEFS += -DBLUETOOTH_ENABLE OPT_DEFS += -DBLUETOOTH_ENABLE
endif endif
ifdef KEYMAP_SECTION_ENABLE ifeq ($(strip $(KEYMAP_SECTION_ENABLE)), yes)
OPT_DEFS += -DKEYMAP_SECTION_ENABLE OPT_DEFS += -DKEYMAP_SECTION_ENABLE
ifeq ($(strip $(MCU)),atmega32u2) ifeq ($(strip $(MCU)),atmega32u2)

@ -301,7 +301,7 @@ enum backlight_opt {
#define ACTION_BACKLIGHT_DECREASE() ACTION(ACT_BACKLIGHT, BACKLIGHT_DECREASE << 8) #define ACTION_BACKLIGHT_DECREASE() ACTION(ACT_BACKLIGHT, BACKLIGHT_DECREASE << 8)
#define ACTION_BACKLIGHT_TOGGLE() ACTION(ACT_BACKLIGHT, BACKLIGHT_TOGGLE << 8) #define ACTION_BACKLIGHT_TOGGLE() ACTION(ACT_BACKLIGHT, BACKLIGHT_TOGGLE << 8)
#define ACTION_BACKLIGHT_STEP() ACTION(ACT_BACKLIGHT, BACKLIGHT_STEP << 8) #define ACTION_BACKLIGHT_STEP() ACTION(ACT_BACKLIGHT, BACKLIGHT_STEP << 8)
#define ACTION_BACKLIGHT_LEVEL(level) ACTION(ACT_BACKLIGHT, BACKLIGHT_LEVEL << 8 | level) #define ACTION_BACKLIGHT_LEVEL(level) ACTION(ACT_BACKLIGHT, BACKLIGHT_LEVEL << 8 | (level))
/* Command */ /* Command */
#define ACTION_COMMAND(id, opt) ACTION(ACT_COMMAND, (opt)<<8 | (addr)) #define ACTION_COMMAND(id, opt) ACTION(ACT_COMMAND, (opt)<<8 | (addr))
/* Function */ /* Function */

@ -111,7 +111,7 @@ void layer_debug(void)
#endif #endif
#if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS) #if !defined(NO_ACTION_LAYER) && defined(PREVENT_STUCK_MODIFIERS)
uint8_t source_layers_cache[MAX_LAYER_BITS][(MATRIX_ROWS * MATRIX_COLS + 7) / 8] = {0}; uint8_t source_layers_cache[(MATRIX_ROWS * MATRIX_COLS + 7) / 8][MAX_LAYER_BITS] = {0};
void update_source_layers_cache(keypos_t key, uint8_t layer) void update_source_layers_cache(keypos_t key, uint8_t layer)
{ {
@ -120,9 +120,9 @@ void update_source_layers_cache(keypos_t key, uint8_t layer)
const uint8_t storage_bit = key_number % 8; const uint8_t storage_bit = key_number % 8;
for (uint8_t bit_number = 0; bit_number < MAX_LAYER_BITS; bit_number++) { for (uint8_t bit_number = 0; bit_number < MAX_LAYER_BITS; bit_number++) {
source_layers_cache[bit_number][storage_row] ^= source_layers_cache[storage_row][bit_number] ^=
(-((layer & (1U << bit_number)) != 0) (-((layer & (1U << bit_number)) != 0)
^ source_layers_cache[bit_number][storage_row]) ^ source_layers_cache[storage_row][bit_number])
& (1U << storage_bit); & (1U << storage_bit);
} }
} }
@ -136,7 +136,7 @@ uint8_t read_source_layers_cache(keypos_t key)
for (uint8_t bit_number = 0; bit_number < MAX_LAYER_BITS; bit_number++) { for (uint8_t bit_number = 0; bit_number < MAX_LAYER_BITS; bit_number++) {
layer |= layer |=
((source_layers_cache[bit_number][storage_row] ((source_layers_cache[storage_row][bit_number]
& (1U << storage_bit)) != 0) & (1U << storage_bit)) != 0)
<< bit_number; << bit_number;
} }

@ -68,6 +68,7 @@ void layer_xor(uint32_t state);
#define layer_and(state) #define layer_and(state)
#define layer_xor(state) #define layer_xor(state)
#define layer_debug() #define layer_debug()
#endif #endif
/* pressed actions cache */ /* pressed actions cache */

@ -13,6 +13,9 @@ void eeconfig_init(void)
#ifdef BACKLIGHT_ENABLE #ifdef BACKLIGHT_ENABLE
eeprom_write_byte(EECONFIG_BACKLIGHT, 0); eeprom_write_byte(EECONFIG_BACKLIGHT, 0);
#endif #endif
#ifdef AUDIO_ENABLE
eeprom_write_byte(EECONFIG_AUDIO, 0xFF); // On by default
#endif
} }
void eeconfig_enable(void) void eeconfig_enable(void)
@ -43,3 +46,8 @@ void eeconfig_write_keymap(uint8_t val) { eeprom_write_byte(EECONFIG_KEYMAP, val
uint8_t eeconfig_read_backlight(void) { return eeprom_read_byte(EECONFIG_BACKLIGHT); } uint8_t eeconfig_read_backlight(void) { return eeprom_read_byte(EECONFIG_BACKLIGHT); }
void eeconfig_write_backlight(uint8_t val) { eeprom_write_byte(EECONFIG_BACKLIGHT, val); } void eeconfig_write_backlight(uint8_t val) { eeprom_write_byte(EECONFIG_BACKLIGHT, val); }
#endif #endif
#ifdef AUDIO_ENABLE
uint8_t eeconfig_read_audio(void) { return eeprom_read_byte(EECONFIG_AUDIO); }
void eeconfig_write_audio(uint8_t val) { eeprom_write_byte(EECONFIG_AUDIO, val); }
#endif

@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define EECONFIG_KEYMAP (uint8_t *)4 #define EECONFIG_KEYMAP (uint8_t *)4
#define EECONFIG_MOUSEKEY_ACCEL (uint8_t *)5 #define EECONFIG_MOUSEKEY_ACCEL (uint8_t *)5
#define EECONFIG_BACKLIGHT (uint8_t *)6 #define EECONFIG_BACKLIGHT (uint8_t *)6
#define EECONFIG_AUDIO (uint8_t *)7
/* debug bit */ /* debug bit */
@ -72,4 +73,9 @@ uint8_t eeconfig_read_backlight(void);
void eeconfig_write_backlight(uint8_t val); void eeconfig_write_backlight(uint8_t val);
#endif #endif
#ifdef AUDIO_ENABLE
uint8_t eeconfig_read_audio(void);
void eeconfig_write_audio(uint8_t val);
#endif
#endif #endif

@ -27,7 +27,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "command.h" #include "command.h"
#include "util.h" #include "util.h"
#include "sendchar.h" #include "sendchar.h"
#include "bootmagic.h" #ifdef BOOTMAGIC_ENABLE
#include "bootmagic.h"
#else
#include "magic.h"
#endif
#include "eeconfig.h" #include "eeconfig.h"
#include "backlight.h" #include "backlight.h"
#ifdef MOUSEKEY_ENABLE #ifdef MOUSEKEY_ENABLE
@ -86,6 +90,8 @@ void keyboard_init(void)
#ifdef BOOTMAGIC_ENABLE #ifdef BOOTMAGIC_ENABLE
bootmagic(); bootmagic();
#else
magic();
#endif #endif
#ifdef BACKLIGHT_ENABLE #ifdef BACKLIGHT_ENABLE

@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "action_macro.h" #include "action_macro.h"
#include "wait.h" #include "wait.h"
#include "debug.h" #include "debug.h"
#include "bootloader.h"
static action_t keycode_to_action(uint8_t keycode); static action_t keycode_to_action(uint8_t keycode);
@ -143,6 +143,7 @@ static action_t keycode_to_action(uint8_t keycode)
action.code = ACTION_TRANSPARENT; action.code = ACTION_TRANSPARENT;
break; break;
case KC_BOOTLOADER: case KC_BOOTLOADER:
action.code = ACTION_NO;
clear_keyboard(); clear_keyboard();
wait_ms(50); wait_ms(50);
bootloader_jump(); // not return bootloader_jump(); // not return

@ -22,8 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdbool.h> #include <stdbool.h>
#include "action.h" #include "action.h"
#ifdef BOOTMAGIC_ENABLE
/* NOTE: Not portable. Bit field order depends on implementation */ /* NOTE: Not portable. Bit field order depends on implementation */
typedef union { typedef union {
uint8_t raw; uint8_t raw;
@ -39,7 +37,6 @@ typedef union {
}; };
} keymap_config_t; } keymap_config_t;
keymap_config_t keymap_config; keymap_config_t keymap_config;
#endif
/* translates key to keycode */ /* translates key to keycode */

@ -0,0 +1,36 @@
#include <stdint.h>
#include <stdbool.h>
#include <util/delay.h>
#include "matrix.h"
#include "bootloader.h"
#include "debug.h"
#include "keymap.h"
#include "host.h"
#include "action_layer.h"
#include "eeconfig.h"
#include "magic.h"
keymap_config_t keymap_config;
void magic(void)
{
/* check signature */
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
/* debug enable */
debug_config.raw = eeconfig_read_debug();
/* keymap config */
keymap_config.raw = eeconfig_read_keymap();
#ifdef NKRO_ENABLE
keyboard_nkro = keymap_config.nkro;
#endif
uint8_t default_layer = 0;
default_layer = eeconfig_read_default_layer();
default_layer_set((uint32_t)default_layer);
}

@ -0,0 +1,6 @@
#ifndef MAGIC_H
#define MAGIC_H
void magic(void);
#endif

@ -17,7 +17,7 @@ LUFA_SRC = $(LUFA_DIR)/lufa.c \
$(LUFA_DIR)/descriptor.c \ $(LUFA_DIR)/descriptor.c \
$(LUFA_SRC_USB) $(LUFA_SRC_USB)
ifdef MIDI_ENABLE ifeq ($(strip $(MIDI_ENABLE)), yes)
LUFA_SRC += $(LUFA_DIR)/midi/midi.c \ LUFA_SRC += $(LUFA_DIR)/midi/midi.c \
$(LUFA_DIR)/midi/midi_device.c \ $(LUFA_DIR)/midi/midi_device.c \
$(LUFA_DIR)/midi/bytequeue/bytequeue.c \ $(LUFA_DIR)/midi/bytequeue/bytequeue.c \
@ -25,7 +25,7 @@ ifdef MIDI_ENABLE
$(LUFA_SRC_USBCLASS) $(LUFA_SRC_USBCLASS)
endif endif
ifdef BLUETOOTH_ENABLE ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
$(TMK_DIR)/protocol/serial_uart.c $(TMK_DIR)/protocol/serial_uart.c
endif endif

Loading…
Cancel
Save