1
0
Fork 0

Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Joshua T 2016-08-07 23:28:59 -05:00
commit 6df31120a1
35 changed files with 1580 additions and 600 deletions

1
.gitignore vendored
View file

@ -17,6 +17,7 @@ build/
.build/
*.bak
.vagrant/
quantum/version.h
.idea/
CMakeLists.txt
.DS_STORE

View file

@ -10,7 +10,7 @@ env:
global:
- secure: vBTSL34BDPxDilKUuTXqU4CJ26Pv5hogD2nghatkxSQkI1/jbdnLj/DQdPUrMJFDIY6TK3AltsBx72MaMsLQ1JO/Ou24IeHINHXzUC1FlS9yQa48cpxnhX5kzXNyGs3oa0qaFbvnr7RgYRWtmD52n4bIZuSuW+xpBv05x2OCizdT2ZonH33nATaHGFasxROm4qYZ241VfzcUv766V6RVHgL4x9V08warugs+RENVkfzxxwhk3NmkrISabze0gSVJLHBPHxroZC6EUcf/ocobcuDrCwFqtEt90i7pNIAFUE7gZsN2uE75LmpzAWin21G7lLPcPL2k4FJVd8an1HiP2WmscJU6U89fOfMb2viObnKcCzebozBCmKGtHEuXZo9FcReOx49AnQSpmESJGs+q2dL/FApkTjQiyT4J6O5dJpoww0/r57Wx0cmmqjETKBb5rSgXM51Etk3wO09mvcPHsEwrT7qH8r9XWdyCDoEn7FCLX3/LYnf/D4SmZ633YPl5gv3v9XEwxR5+04akjgnvWDSNIaDbWBdxHNb7l4pMc+WR1bwCyMyA7KXj0RrftEGOrm9ZRLe6BkbT4cycA+j77nbPOMcyZChliV9pPQos+4TOJoTzcK2L8yWVoY409aDNVuAjdP6Yum0R2maBGl/etLmIMpJC35C5/lZ+dUNjJAM=
script:
- make all-keyboards-quick AUTOGEN=true
- make all-keyboards AUTOGEN=true
addons:
apt:
packages:

View file

@ -5,8 +5,9 @@ endif
.DEFAULT_GOAL := all
space := $(subst ,, )
starting_makefile := $(subst $(space),_SPACE_,$(abspath $(firstword $(MAKEFILE_LIST))))
mkfile_path := $(subst $(space),_SPACE_,$(abspath $(lastword $(MAKEFILE_LIST))))
ESCAPED_ABS_PATH = $(subst $(space),_SPACE_,$(abspath $1))
starting_makefile := $(call ESCAPED_ABS_PATH,$(firstword $(MAKEFILE_LIST)))
mkfile_path := $(call ESCAPED_ABS_PATH,$(lastword $(MAKEFILE_LIST))))
abs_tmk_root := $(patsubst %/,%,$(dir $(mkfile_path)))
ifneq (,$(findstring /keyboards/,$(starting_makefile)))
@ -83,10 +84,8 @@ endif
ifneq ("$(wildcard $(KEYBOARD_PATH)/$(KEYBOARD).c)","")
KEYBOARD_FILE = keyboards/$(KEYBOARD)/$(KEYBOARD).c
ifndef ARCH
ifneq ("$(wildcard $(KEYBOARD_PATH)/Makefile)","")
include $(KEYBOARD_PATH)/Makefile
endif
ifneq ($(call ESCAPED_ABS_PATH,$(KEYBOARD_PATH)/Makefile),$(starting_makefile))
-include $(KEYBOARD_PATH)/Makefile
endif
else
$(error "$(KEYBOARD_PATH)/$(KEYBOARD).c" does not exist)
@ -101,7 +100,9 @@ ifdef SUBPROJECT
ifneq ("$(wildcard $(SUBPROJECT_PATH)/$(SUBPROJECT).c)","")
OPT_DEFS += -DSUBPROJECT_$(SUBPROJECT)
SUBPROJECT_FILE = keyboards/$(KEYBOARD)/$(SUBPROJECT)/$(SUBPROJECT).c
-include $(SUBPROJECT_PATH)/Makefile
ifneq ($(call ESCAPED_ABS_PATH,$(SUBPROJECT_PATH)/Makefile),$(starting_makefile))
-include $(SUBPROJECT_PATH)/Makefile
endif
else
$(error "$(SUBPROJECT_PATH)/$(SUBPROJECT).c" does not exist)
endif
@ -119,14 +120,18 @@ endif
KEYMAP_PATH = $(KEYBOARD_PATH)/keymaps/$(KEYMAP)
ifneq ("$(wildcard $(KEYMAP_PATH)/keymap.c)","")
KEYMAP_FILE = keyboards/$(KEYBOARD)/keymaps/$(KEYMAP)/keymap.c
-include $(KEYMAP_PATH)/Makefile
ifneq ($(call ESCAPED_ABS_PATH,$(KEYMAP_PATH)/Makefile),$(starting_makefile))
-include $(KEYMAP_PATH)/Makefile
endif
else
ifeq ("$(wildcard $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)/keymap.c)","")
$(error "$(KEYMAP_PATH)/keymap.c" does not exist)
else
KEYMAP_PATH = $(SUBPROJECT_PATH)/keymaps/$(KEYMAP)
KEYMAP_FILE = keyboards/$(KEYBOARD)/$(SUBPROJECT)/keymaps/$(KEYMAP)/keymap.c
-include $(KEYMAP_PATH)/Makefile
ifneq ($(call ESCAPED_ABS_PATH,$(KEYMAP_PATH)/Makefile),$(starting_makefile))
-include $(KEYMAP_PATH)/Makefile
endif
endif
endif
@ -135,7 +140,8 @@ ifdef SUBPROJECT
else
TARGET ?= $(KEYBOARD)_$(KEYMAP)
endif
BUILD_DIR = .build
BUILD_DIR = $(TOP_DIR)/.build
# Object files directory
# To put object files in current directory, use a dot (.), do NOT make
@ -265,4 +271,6 @@ include $(TMK_PATH)/rules.mk
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S")
OPT_DEFS += -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\"
OPT_DEFS += -DQMK_VERSION=\"$(GIT_VERSION)\" -DQMK_BUILDDATE=\"$(BUILD_DATE)\"
$(shell echo '#define QMK_VERSION "$(GIT_VERSION)"' > $(QUANTUM_PATH)/version.h)
$(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(QUANTUM_PATH)/version.h)

View file

@ -0,0 +1,96 @@
# How keys are registered, and interpreted by computers
In this file, you can will learn the concepts of how keyboards work over USB,
and you'll be able to better understand what you can expect from changing your
firmware directly.
## Schematic view
Whenever you type on 1 particular key, here is the chain of actions taking
place:
``` text
+------+ +-----+ +----------+ +----------+ +----+
| User |-------->| Key |------>| Firmware |----->| USB wire |---->| OS |
+------+ +-----+ +----------+ +----------+ |----+
```
This scheme is a very simple view of what's going on, and more details follow
in the next sections.
## 1. You Press a Key
Whenever you press a key, the firmware of your keyboard can register this event.
It can register when the key is pressed, held and released.
This usually happens with a [periodic scan of key presses with a frequency around 100 hz](https://github.com/benblazak/ergodox-firmware/blob/master/references.md#typical-keyboard-information).
This speed often is limited by the mechanical key response time, the protocol
to transfer those key presses (here USB HID), and by the software it is used in.
## 2. What the Firmware Sends
The [HID specification](http://www.usb.org/developers/hidpage/Hut1_12v2.pdf)
tells what a keyboard can actually send through USB to have a chance to be
properly recognised. This includes a pre-defined list of keycodes which are
simple numbers from `0x00` to `0xE7`. The firmware assigns a keycode to each
key of the keyboard.
The firmware does not send actually letters or characters, but only keycodes.
Thus, by modifying the firmware, you only can modify what keycode is sent over
USB for a given key.
## 3. What the Operating System Does
Once the keycode reaches the operating system, a piece of software has to have
it match an actual character thanks to a keyboard layout. For example, if your
layout is set to QWERTY, a sample of the matching table is as follow:
``` text
| keycode | character |
|---------+-----------|
| 0x04 | a/A |
| 0x05 | b/B |
| 0x06 | c/C |
| ... | ... |
| 0x1C | y/Y |
| 0x1D | z/Z |
| ... | ... |
|---------+-----------|
```
## Back to the firmware
As the layout is generally fixed (unless you create your own), the firmware can
actually call a keycode by its layout name directly to ease things for you.
This is exactly what is done here with `KC_A` actually representing `0x04` in
QWERTY. The full list can be found in `keycode.txt`.
## List of Characters You Can Send
Putting aside shortcuts, having a limited set of keycodes mapped to a limited
layout means that **the list of characters you can assign to a given key only
is the ones present in the layout**.
For example, this means that if you have a QWERTY US layout, and you want to
assign 1 key to produce `€` (euro currency symbol), you are unable to do so,
because the QWERTY US layout does not have such mapping. You could fix that by
using a QWERTY UK layout, or a QWERTY US International.
You may wonder why a keyboard layout containing all of Unicode is not devised
then? The limited number of keycode available through USB simply disallow such
a thing.
## How to (Maybe) Enter Unicode Characters
You can have the firmware send *sequences of keys* to use the [software Unicode
Input
Method](https://en.wikipedia.org/wiki/Unicode_input#Hexadecimal_code_input) of
the target operating system, thus effectively entering characters independently
of the layout defined in the OS.
Yet, it does come with multiple disadvantages:
- Tied to a specific OS a a time (need recompilation when changing OS);
- Within a given OS, does not work in all software;
- Limited to a subset of Unicode on some systems.

View file

@ -12,6 +12,7 @@
#include "keymap_plover.h"
#include "eeconfig.h"
#include "wait.h"
#include "version.h"
/* Layers */

View file

@ -1,6 +1,7 @@
#include "ergodox.h"
#include "debug.h"
#include "action_layer.h"
#include "version.h"
#define BASE 0 // default layer
#define SYMB 1 // symbols

View file

@ -14,18 +14,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | Tab | Q | W | E | R | T | - | | = | Y | U | I | O | P | \ |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* |Ctrl/Esc|A / L2| S | D | F | G |------| |------| H | J | K | L | ; | ' |
* |Ctrl/Esc| A | S | D | F | G |------| |------| H | J | K | L | ; | ' |
* |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
* | LShift |Z/Ctrl| X | C | V | B | | | | N | M | , | . |//Ctrl| RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | ~L1 | ~L2 |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
* | ~L1 | Alt |AltShf| Left | Right| | Up | Down | [ | ] | ~L1 |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | App | Home | | PgUp |Ctrl/Esc|
* ,------|------|------| |------+--------+------.
* | | | End | | PgDn | | |
* |Space | LGui |------| |------| Tab |Enter |
* | | |Shift | | Alt | | |
* | | | ~L2 | | ~L1 | | |
* `--------------------' `----------------------'
*/
// If it accepts an argument (i.e, is a function), it doesn't need KC_.
@ -34,13 +34,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// left hand
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,
CTL_T(KC_ESC), LT(MDIA, KC_A),KC_S, KC_D, KC_F, KC_G,
CTL_T(KC_ESC), 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_FN1, KC_FN2, LALT(KC_LSFT), KC_LEFT,KC_RGHT,
KC_FN1, KC_LALT, LALT(KC_LSFT), KC_LEFT,KC_RGHT,
ALT_T(KC_APP), KC_HOME,
KC_END,
KC_SPC, KC_LGUI, KC_LSHIFT,
KC_SPC, KC_LGUI, KC_FN2,
// right hand
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,
@ -50,20 +50,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_PGUP, CTL_T(KC_ESC),
KC_PGDN,
KC_LALT, KC_TAB, KC_ENT
KC_FN1, KC_TAB, KC_ENT
),
/* Keymap 1: Symbol Layer
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
* | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 |
* | | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | . | 0 | = | |
* | | | | | | | 0 | 0 | . | = | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
@ -76,20 +76,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// SYMBOLS
[SYMB] = KEYMAP(
// left hand
KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
KC_TRNS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV,
KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,
KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,
// right hand
KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_TRNS,
KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS,
KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS,
KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS,
KC_0, KC_0, KC_DOT, KC_EQL, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
@ -97,9 +98,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 2: Media and mouse keys
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | | | | | |
* | | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | | | | | | | | | Lclk | Rclk | | |
* | | | | | | | | | | | | Lclk | Rclk | | F12 |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | |------| |------|MsLeft|MsDown| MsUp |MsRght| | Play |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
@ -117,7 +118,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
*/
// MEDIA AND MOUSE
[MDIA] = KEYMAP(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
@ -126,8 +127,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
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_BTN1, KC_BTN2, KC_TRNS, KC_TRNS,
KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2, KC_TRNS, KC_F12,
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_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,

View file

@ -1,4 +1,4 @@
# J3RN's Mac-centric ErgoDox EZ keymap
# J3RN's Mac-Centric ErgoDox EZ keymap
## Motivation
@ -14,6 +14,7 @@ This layout more closely resembles that of the Mac keyboard, and has some other
- **The key to the right of "0" is Backspace instead of "-"** (misleadingly labeled "delete" on the Mac's keyboard). There was no room to fit in "-" and "=" between "0" and Backspace, unfortunately.
- **The key to the left of "Q" is Tab instead of Delete.**
- **The rightmost big key on the left thumb is CMD (LGui) instead of Backspace.**
- **The key to the left of Alt-Shift is an Alt key**. This is close to it's position on the Mac keyboard, though slightly further left.
### Other changes
@ -23,7 +24,9 @@ This layout more closely resembles that of the Mac keyboard, and has some other
- **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 Home and End buttons have been shifted up on the left thumb, and Shift inserted below them.** This makes doing Shift-5 and other such combinations less painful.
- **The Page Up and Page Down buttons have been shifted up on the right thumb, and Alt was moved from above them to below them.** I use Alt more than Page Up or Page Down (mostly in terminal applications), and thought that it deserved a more accessible location.
- **The Page Up and Page Down buttons have been shifted up on the right thumb.** I don't use either of these keys often, and wanted to free up some real estate.
- **The bottommost-inner keys on the left and right thumb are momentary L2 and momentary L1, respectively**. I have found that both modes are useful, and this seemed like a reasonably accessible place to put these.
- **Traditional numpad layout.** The base of most numpads is a double-wide "0" key to the left of a "." key. This is reflected in my layout by having two "0" keys to the left of a "." key.
- **The function keys (F1-F12) have been moved to L2.** They were in the way in L1.
**I'm always open to feedback and/or suggestions!**

View file

@ -1,6 +1,7 @@
#include "ergodox.h"
#include "debug.h"
#include "action_layer.h"
#include "version.h"
#define BASE 0 // default layer
#define SYMB 1 // symbols

View file

@ -0,0 +1,14 @@
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = no # Commands for debug and configuration
CUSTOM_MATRIX = yes # Custom matrix file for the ErgoDox EZ
SLEEP_LED_ENABLE = yes # 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
MIDI_ENABLE = no # MIDI controls
UNICODE_ENABLE = yes # Unicode
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

View file

@ -0,0 +1,102 @@
#include "ergodox.h"
#include "action_layer.h"
#define BASE 0 // default layer
#define FN1 1 // symbols
#define FN2 2 // media keys
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[BASE] = KEYMAP( // layer 0 : default
// left hand
KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC,
KC_BSLS, KC_Q, KC_W, KC_E, KC_R, KC_T, MO(FN2),
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, MO(FN1),
KC_LGUI, KC_GRV, KC_BSLS, KC_LEFT, KC_RGHT,
KC_LCTL, KC_LALT,
KC_HOME,
KC_SPC, KC_BSPC, KC_END,
// right hand
MO(FN2), KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
KC_LBRC, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_RBRC,
KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
MO(FN1), KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT,
KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_RGUI,
KC_RALT, KC_RCTL,
KC_PGUP,
KC_PGDN, KC_ENT, KC_SPC
),
// FN1
[FN1] = KEYMAP(
// left hand
KC_TRNS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F11,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 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_F12, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
),
// FN2
[FN2] = KEYMAP(
RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, 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_NLCK, KC_PSLS, KC_PAST, KC_PAST, KC_PMNS, KC_BSPC,
KC_TRNS, KC_NO, KC_P7, KC_P8, KC_P9, KC_PMNS, KC_BSPC,
KC_NO, KC_P4, KC_P5, KC_P6, KC_PPLS, KC_PENT,
KC_TRNS, KC_NO, KC_P1, KC_P2, KC_P3, KC_PPLS, KC_PENT,
KC_P0, KC_PDOT, KC_SLSH, KC_PENT, KC_PENT,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
),
};
const uint16_t PROGMEM fn_actions[] = {
};
// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {
};
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
uint8_t layer = biton32(layer_state);
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
switch (layer) {
// TODO: Make this relevant to the ErgoDox EZ.
case 1:
ergodox_right_led_1_on();
break;
case 2:
ergodox_right_led_2_on();
break;
default:
// none
break;
}
};

View file

@ -0,0 +1,3 @@
# sethbc's Ergodox EZ keymap
Largely based on the Ergodox Infinity default keymap

View file

@ -11,7 +11,7 @@
#define BBED 2 // BBEdit
#define TMNL 3 // Terminal
#define SAFA 4 // Safari
#define ALFRED_LEAD_TIME 100 // time, in milliseconds, to let Alfred come to the fore and accept keyboard input
#define ALFRED_LEAD_TIME 250 // time, in milliseconds, to let Alfred come to the fore and accept keyboard input
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
@ -31,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | `~ | '" | | ⎋ | ⌫ |
* ,------|------|------| |------+--------+------.
* | | | PgUp | | PgDn | | |
* | | |------| |------| |Enter |
* | | |------| |------| |Enter |
* | | | L | | L | | |
* `--------------------' `----------------------'
*/
@ -46,7 +46,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_LCTL, KC_LALT, KC_LGUI,KC_LEFT,KC_RGHT,
KC_GRV, KC_QUOT,
KC_PGUP,
KC_SPC,KC_BSPC,KC_LALT,
KC_SPC,KC_TAB ,KC_LALT,
// right hand
TG(SYMB), KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
MO(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
@ -66,25 +66,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | < | > | ( | ) | ' |------| |------| - | 4 | 5 | 6 | + | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | & | 1 | 2 | 3 | = | |
* | | | | | | = | | | | : | 1 | 2 | 3 | = | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | 0 | . | | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | Home | | |
* | | | | | | | |
* | | |------| |------| | |
* | | | | | End | | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
// SYMBOLS
[SYMB] = KEYMAP(
// left hand
KC_TRNS,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
KC_TRNS,KC_LBRC,KC_RBRC,KC_LCBR,KC_RCBR,KC_DQUO,KC_TRNS,
KC_TRNS,KC_LBRC,KC_RBRC,KC_LCBR,KC_RCBR,KC_DQT ,KC_TRNS,
KC_TRNS,KC_LABK,KC_RABK,KC_LPRN,KC_RPRN,KC_QUOT,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_EQL ,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,
KC_TRNS,
@ -93,11 +93,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
KC_TRNS, KC_SLSH, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
KC_MINS, KC_4, KC_5, KC_6, KC_PLUS, KC_TRNS,
KC_TRNS, KC_AMPR, KC_1, KC_2, KC_3, KC_EQL, KC_TRNS,
KC_TRNS, KC_COLN, KC_1, KC_2, KC_3, KC_EQL, KC_TRNS,
KC_0, KC_DOT, KC_LEFT, KC_RGHT, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_HOME,
KC_END , KC_TRNS, KC_TRNS
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
),
/* Keymap 2: Media keys
*
@ -131,13 +131,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_HOME,
KC_TRNS, KC_TRNS, KC_TRNS,
// right hand
LGUI(KC_Q), LGUI(KC_W), LGUI(LSFT(KC_GRV)), LGUI(KC_GRV), KC_TRNS, KC_TRNS, KC_PWR,
LGUI(KC_Q), LGUI(KC_W), LGUI(LSFT(KC_GRV)), LGUI(KC_GRV), KC_TRNS, KC_TRNS, KC_PWR ,
KC_TRNS, LGUI(KC_RBRC), LGUI(LALT(KC_UP)), KC_UP , LGUI(LALT(KC_DOWN)), KC_TRNS, KC_TRNS,
LGUI(KC_LBRC), KC_LEFT, KC_DOWN, KC_RGHT, KC_TRNS, KC_MPLY,
KC_TRNS, LSFT(KC_SPC), KC_SPC , KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_END ,
LGUI(KC_X), LGUI(KC_C), LGUI(KC_V)
),
};

View file

@ -0,0 +1,2 @@
# Dont do a tricolor wave when the computer is shut down in Windows
SLEEP_LED_ENABLE = no

View file

@ -42,4 +42,4 @@ I press C-a, C-e, and C-k all the time. Its difficult to press these key comb
## use spreadsheets
All the common spreadsheet operations (+-*/=) are now on the right side of the symbol layer.
All the common spreadsheet operations (+-*/=) are now on the right side of the symbol layer. Theres also a colon there for entering times and maybe IPv6 addresses. Not that I expect people to type IPv6 addresses into a spreadsheet, but, yknow.

View file

@ -2,12 +2,10 @@
There are two main ways you could customize the ErgoDox (EZ and Infinity)
## The Easy Way: Use an existing firmware file and just flash it
This does not work for Infinity ErgoDox yet, you need to compile the firmware according to the instructions below
## The Easy Way: Use an existing firmware file and just flash it (ErgoDox EZ only)
1. Download and install the [Teensy Loader](https://www.pjrc.com/teensy/loader.html). Some Linux distributions already provide a binary (may be called `teensy-loader-cli`), so you may prefer to use this.
2. Find a firmware file you like. You can find a few of these in the keymaps subdirectory right here. The file you need ends with .hex, and you can look at its .c counterpart (or its PNG image) to see what you'll be getting. You can also use the [Massdrop configurator](https://keyboard-configurator.massdrop.com/ext/ergodox) to create a firmware Hex file you like.
2. Find a firmware file you like. There are [dozens of community-contributed keymaps](http://qmk.fm/keyboards/ergodox/) you can browse and download. You can also use the [Massdrop configurator](https://keyboard-configurator.massdrop.com/ext/ergodox) to create a firmware Hex file you like.
3. Download the firmware file
4. Connect the keyboard, press its Reset button (gently insert a paperclip into the hole in the top-right corner) and flash it using the Teensy loader you installed on step 1 and the firmware you downloaded.
@ -18,8 +16,7 @@ If you are just compiling an existing keymap and don't want to create your own,
1. Go to https://github.com/jackhumbert/qmk_firmware and read the readme at the base of this repository, top to bottom. Then come back here :)
2. Clone the repository (download it)
3. Set up a build environment as per [the build guide](/doc/BUILD_GUIDE.md)
- Using a Mac and have homebrew? just run `brew tap osx-cross/avr && brew install avr-libc`
3. Set up a build environment as per the readme.
4. Copy `keyboards/ergodox/keymaps/default/keymap.c` into `keymaps/your_name/keymap.c` (for example, `keymaps/german/keymap.c`)
5. Edit this file, changing keycodes to your liking (see "Finding the keycodes you need" below). Try to edit the comments as well, so the "text graphics" represent your layout correctly. See below for more tips on sharing your work.
6. Compile your firmware by running `make keymap=keymap_name`. For example, `make keymap=german`. This will result in a hex file, which will be called `ergodox_ez_keymap_name.hex`, e.g. `ergodox_ez_german.hex`. For **Infinity ErgoDox** you need to add `subproject=infinity` to the make command.
@ -32,7 +29,7 @@ Good luck! :)
## Contributing your keymap
The ErgoDox firmware is open-source, so it would be wonderful to have your contribution! Within a very short time after launching we already amassed almost 20 user-contributed keymaps, with all sorts of creative improvements and tweaks. This is very valuable for people who aren't comfortable coding, but do want to customize their ErgoDox. To make it easy for these people to use your layout, I recommend submitting your PR in the following format.
The QMK firmware is open-source, so it would be wonderful to have your contribution! Within a very short time after launching we already amassed dozens of user-contributed keymaps, with all sorts of creative improvements and tweaks. This is very valuable for people who aren't comfortable coding, but do want to customize their ErgoDox. To make it easy for these people to use your layout, I recommend submitting your PR in the following format.
1. All work goes inside your keymap subdirectory (`keymaps/german` in this example).
2. `keymap.c` - this is your actual keymap file; please update the ASCII comments in the file so they correspond with what you did.

View file

@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef CONFIG_H
#define CONFIG_H
#define PREVENT_STUCK_MODIFIERS
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
@ -50,9 +51,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)
/* Keymap for Infiity prototype */
#define INFINITY_PROTOTYPE
/* Keymap for Infinity prototype */
//#define INFINITY_PROTOTYPE
/* Keymap for Infinity 1.1a (first revision with LED support) */
//#define INFINITY_LED
/*
* Feature disable options

View file

@ -29,15 +29,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
K54, K64, K74, K84, K05, K15, K25, K35, K45, K55, K65, K75, K85, \
K06, K16, K26, K36, K46, K56, K66, K76 \
) { \
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06 }, \
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16 }, \
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26 }, \
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36 }, \
{ KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46 }, \
{ KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56 }, \
{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66 }, \
{ KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76 }, \
{ KC_##K80, KC_##K81, KC_##K82, KC_##K83, KC_##K84, KC_##K85, KC_##K86 } \
{ K00, K01, K02, K03, K04, K05, K06 }, \
{ K10, K11, K12, K13, K14, K15, K16 }, \
{ K20, K21, K22, K23, K24, K25, K26 }, \
{ K30, K31, K32, K33, K34, K35, K36 }, \
{ K40, K41, K42, K43, K44, K45, K46 }, \
{ K50, K51, K52, K53, K54, K55, K56 }, \
{ K60, K61, K62, K63, K64, K65, K66 }, \
{ K70, K71, K72, K73, K74, K75, K76 }, \
{ K80, K81, K82, K83, K84, K85, K86 } \
}
#else
@ -50,15 +50,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
K64, K74, K84, K05, K15, K25, K35, K45, K55, K65, K75, K85, K06, \
K16, K26, K36, K46, K56, K66, K76, K86 \
) { \
{ KC_##K00, KC_##K01, KC_##K02, KC_##K03, KC_##K04, KC_##K05, KC_##K06 }, \
{ KC_##K10, KC_##K11, KC_##K12, KC_##K13, KC_##K14, KC_##K15, KC_##K16 }, \
{ KC_##K20, KC_##K21, KC_##K22, KC_##K23, KC_##K24, KC_##K25, KC_##K26 }, \
{ KC_##K30, KC_##K31, KC_##K32, KC_##K33, KC_##K34, KC_##K35, KC_##K36 }, \
{ KC_##K40, KC_##K41, KC_##K42, KC_##K43, KC_##K44, KC_##K45, KC_##K46 }, \
{ KC_##K50, KC_##K51, KC_##K52, KC_##K53, KC_##K54, KC_##K55, KC_##K56 }, \
{ KC_##K60, KC_##K61, KC_##K62, KC_##K63, KC_##K64, KC_##K65, KC_##K66 }, \
{ KC_##K70, KC_##K71, KC_##K72, KC_##K73, KC_##K74, KC_##K75, KC_##K76 }, \
{ KC_##K80, KC_##K81, KC_##K82, KC_##K83, KC_##K84, KC_##K85, KC_##K86 } \
{ K00, K01, K02, K03, K04, K05, K06 }, \
{ K10, K11, K12, K13, K14, K15, K16 }, \
{ K20, K21, K22, K23, K24, K25, K26 }, \
{ K30, K31, K32, K33, K34, K35, K36 }, \
{ K40, K41, K42, K43, K44, K45, K46 }, \
{ K50, K51, K52, K53, K54, K55, K56 }, \
{ K60, K61, K62, K63, K64, K65, K66 }, \
{ K70, K71, K72, K73, K74, K75, K76 }, \
{ K80, K81, K82, K83, K84, K85, K86 } \
}
#endif

View file

@ -14,12 +14,12 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | |Gui|Alt | Space |Alt |Gui| | |
* `-----------------------------------------------------------'
*/
[0] =
KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS, GRV, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT,ENT, \
LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH,RSFT,FN0, \
NO, LGUI,LALT, SPC, RALT,RGUI,NO, NO),
[0] = KEYMAP(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSLS, KC_GRV, \
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_BSPC, \
KC_LCTL,KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN,KC_QUOT,KC_ENT, \
KC_LSFT,KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH,KC_RSFT,MO(1), \
KC_NO, KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_NO, KC_NO),
/* Layer 1: HHKB mode (HHKB Fn)
* ,-----------------------------------------------------------.
@ -34,15 +34,15 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | |Gui|Alt | Space |Alt |Gui| | |
* `-----------------------------------------------------------'
*/
[1] =
KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS, BSPC, \
TRNS,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,PENT, \
TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,TRNS,TRNS, \
TRNS,TRNS,TRNS, TRNS, TRNS,TRNS,TRNS,TRNS),
[1] = KEYMAP(
KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, \
KC_CAPS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_SLCK,KC_PAUS, KC_UP, KC_TRNS, KC_BSPC, \
KC_TRNS,KC_VOLD,KC_VOLU,KC_MUTE,KC_TRNS,KC_TRNS,KC_PAST,KC_PSLS,KC_HOME,KC_PGUP,KC_LEFT,KC_RGHT,KC_PENT, \
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PPLS,KC_PMNS,KC_END, KC_PGDN,KC_DOWN,KC_TRNS,KC_TRNS, \
KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS),
};
const uint16_t fn_actions[] = {
[0] = ACTION_LAYER_MOMENTARY(1),
};

View file

@ -0,0 +1,82 @@
#include "infinity_chibios.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Layer 0: Default Layer
* ,-----------------------------------------------------------.
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =| \| `|
* |-----------------------------------------------------------|
* |Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| Bksp|
* |-----------------------------------------------------------|
* |Contro| A| S| D| F| G| H| J| K| L| ;| '|Enter |
* |-----------------------------------------------------------|
* |Shift | Z| X| C| V| B| N| M| ,| .| /|Shift |Fn2|
* |-----------------------------------------------------------'
* |Fn2 |Gui |Alt | Space |RAlt|Prv|PlPs|Next|
* `-----------------------------------------------------------'
*/
[0] = KEYMAP(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, \
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_BSPC, \
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, LT(5, KC_ENT), \
KC_LSPO, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSPC, MO(4), \
MO(4), KC_LGUI, KC_LALT, LT(3, KC_SPC), KC_RALT, KC_MPRV, KC_MPLY, KC_MNXT),
/* Layer 1: "Toggle" off SpaceFn for League of Legends
*/
[1] = KEYMAP(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, \
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_BSPC, \
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(4), \
MO(4), KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_MPRV, KC_MPLY, KC_MNXT),
/* Layer 2: "Toggle" off SpaceFn for MapleRoyals
*/
[2] = KEYMAP(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV, \
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_BSPC, \
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, KC_LSFT, \
MO(4), KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_LEFT, KC_DOWN, KC_RGHT),
/* Layer 3: FN layer 1
*/
[3] = KEYMAP(
KC_NO, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NO, KC_NO, \
KC_NO, KC_BTN1, KC_MS_U, KC_BTN2, LALT(KC_F4), KC_HOME, KC_PGUP, KC_PSCR, KC_SLCK, KC_UP, KC_NO, KC_LPRN, KC_RPRN, KC_DEL, \
MO(6), KC_MS_L, KC_MS_D, KC_MS_R, KC_NO, KC_END, KC_PGDN, KC_TILD, KC_LEFT, KC_DOWN, KC_RGHT, KC_NO, KC_NO, \
LGUI(KC_SPC), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_CALC, KC_MENU, KC_TRNS, TG(4), \
KC_TRNS, KC_TRNS, KC_TRNS, LT(3, KC_SPC), KC_TRNS, KC_VOLD, KC_MUTE, KC_VOLU),
/* Layer 4: FN layer 2
*/
[4] = KEYMAP(
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_PMNS, KC_PPLS, KC_PSLS, TG(2), \
KC_CAPS, KC_NO, KC_UP, KC_NO, KC_NO, KC_NO, KC_NO, KC_PSCR, KC_NO, KC_P7, KC_P8, KC_P9, KC_PAST, KC_BSPC, \
KC_LCTL, KC_LEFT, KC_DOWN, KC_RGHT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_P4, KC_P5, KC_P6, KC_PENT, \
KC_LSFT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_P1, KC_P2, KC_P3, KC_RSFT, MO(4), \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P0, KC_PDOT, KC_NO, TG(1)),
/* Layer 5: FN layer 3
*/
[5] = KEYMAP(
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_TAB , KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_F13, KC_F14, KC_F15, KC_F16, KC_NO, KC_TRNS, \
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_F17, KC_F18, KC_F19, KC_F20, LT(5, KC_ENT), \
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_F21, KC_F22, KC_F23, KC_F24, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_RALT, KC_NO, KC_NO, KC_NO),
/* Layer 6: FN layer 4
*/
[6] = KEYMAP(
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
LCTL(LSFT(KC_TAB)), KC_NO, LGUI(KC_UP), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
MO(6), LGUI(KC_LEFT), LGUI(KC_DOWN), LGUI(KC_RGHT), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, \
KC_TRNS, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_TRNS, KC_TRNS, \
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_NO, KC_NO, KC_NO),
};
const uint16_t PROGMEM fn_actions[] = {
};

View file

@ -14,12 +14,12 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | |Gui|Alt | Space |Alt |Gui| | |
* `-----------------------------------------------------------'
*/
[0] =
KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, MINS,EQL, BSLS,GRV, \
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC,BSPC, \
LCTL,A, S, D, F, G, H, J, K, L, FN3, QUOT,FN6, \
FN7, Z, X, C, V, B, N, M, COMM,DOT, FN2, RSFT,FN1, \
NO, LGUI,LALT, FN4, FN5, RGUI,NO, NO),
[0] = KEYMAP(
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,KC_EQL, KC_BSLS,KC_GRV, \
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_BSPC, \
KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, LT(3, KC_SCLN), KC_QUOT,MT(KC_RCTL, KC_ENT), \
OSM(MOD_LSFT), KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM,KC_DOT, LT(2, KC_SLSH), KC_RSFT,TG(1), \
KC_NO, KC_LGUI,KC_LALT, LT(4, KC_SPC), MO(4), KC_RGUI,KC_NO, KC_NO),
/* Layer 1: HHKB mode (HHKB Fn)
* ,-----------------------------------------------------------.
@ -34,12 +34,12 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* | |Gui|Alt | Space |Alt |Gui| | |
* `-----------------------------------------------------------'
*/
[1] =
KEYMAP(PWR, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
CAPS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,TRNS,PSCR,SLCK,PAUS, UP, TRNS,BSPC, \
LCTL,VOLD,VOLU,MUTE,TRNS,TRNS,PAST,PSLS,HOME,PGUP,LEFT,RGHT,ENT, \
LSFT,TRNS,TRNS,TRNS,TRNS,TRNS,PPLS,PMNS,END, PGDN,DOWN,RSFT,TRNS, \
TRNS,LGUI,LALT, TRNS, RALT,RGUI,TRNS,TRNS),
[1] = KEYMAP(
KC_PWR, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, \
KC_CAPS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PSCR,KC_SLCK,KC_PAUS, KC_UP, KC_TRNS,KC_BSPC, \
KC_LCTL,KC_VOLD,KC_VOLU,KC_MUTE,KC_TRNS,KC_TRNS,KC_PAST,KC_PSLS,KC_HOME,KC_PGUP,KC_LEFT,KC_RGHT,KC_ENT, \
KC_LSFT,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_PPLS,KC_PMNS,KC_END, KC_PGDN,KC_DOWN,KC_RSFT,KC_TRNS, \
KC_TRNS,KC_LGUI,KC_LALT, KC_TRNS, KC_RALT,KC_RGUI,KC_TRNS,KC_TRNS),
/* Layer 2: Vi mode[Slash]
* ,-----------------------------------------------------------.
@ -54,12 +54,12 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |Gui|Alt | Space |Alt |Gui|
* `-------------------------------------------'
*/
[2] = \
KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
TAB, HOME,PGDN,UP, PGUP,END, HOME,PGDN,PGUP,END, NO, NO, NO, BSPC, \
LCTL,NO, LEFT,DOWN,RGHT,NO, LEFT,DOWN,UP, RGHT,NO, NO, ENT, \
LSFT,NO, NO, NO, NO, NO, HOME,PGDN,PGUP,END, FN2, RSFT,TRNS, \
TRNS,LGUI,LALT, SPC, RALT,RGUI,TRNS,TRNS),
[2] = KEYMAP(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, \
KC_TAB, KC_HOME,KC_PGDN,KC_UP, KC_PGUP,KC_END, KC_HOME,KC_PGDN,KC_PGUP,KC_END, KC_NO, KC_NO, KC_NO, KC_BSPC, \
KC_LCTL,KC_NO, KC_LEFT,KC_DOWN,KC_RGHT,KC_NO, KC_LEFT,KC_DOWN,KC_UP, KC_RGHT,KC_NO, KC_NO, KC_ENT, \
KC_LSFT,KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_HOME,KC_PGDN,KC_PGUP,KC_END, LT(2, KC_SLSH), KC_RSFT,KC_TRNS, \
KC_TRNS,KC_LGUI,KC_LALT, KC_SPC, KC_RALT,KC_RGUI,KC_TRNS, KC_TRNS),
/* Layer 3: Mouse mode(IJKL)[Semicolon]
* ,-----------------------------------------------------------.
@ -75,12 +75,12 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `--------------------------------------------'
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
*/
[3] = \
KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
FN8, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,FN9, FN10,FN8, \
LCTL,ACL0,ACL1,ACL2,ACL2,NO, NO, MS_L,MS_D,MS_R,FN3, NO, ENT, \
LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT,TRNS, \
TRNS,LGUI,LALT, BTN1, TRNS,TRNS,TRNS,TRNS),
[3] = KEYMAP(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, \
LALT(KC_TAB), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_L,KC_WH_D,KC_MS_U, KC_WH_U, KC_WH_R, ALT_T(KC_LEFT), ALT_T(KC_RGHT),LALT(KC_TAB), \
KC_LCTL, KC_ACL0,KC_ACL1,KC_ACL2,KC_ACL2,KC_NO, KC_NO, KC_MS_L,KC_MS_D, KC_MS_R, LT(3, KC_SCLN), KC_NO, KC_ENT, \
KC_LSFT, KC_NO, KC_NO, KC_NO, KC_NO, KC_BTN3,KC_BTN2,KC_BTN1,ALT_T(KC_LEFT), ALT_T(KC_RGHT), KC_NO, KC_RSFT, KC_TRNS, \
KC_TRNS, KC_LGUI,KC_LALT, KC_BTN1, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
/* Layer 4: Mouse mode(IJKL)[Space]
* ,-----------------------------------------------------------.
@ -96,104 +96,18 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `--------------------------------------------'
* Mc: Mouse Cursor / Mb: Mouse Button / Mw: Mouse Wheel
*/
[4] = \
KEYMAP(GRV, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, INS, DEL, \
FN8, NO, NO, NO, NO, NO, WH_L,WH_D,MS_U,WH_U,WH_R,BTN4,BTN5,FN8, \
LCTL,VOLD,VOLU,MUTE,NO, NO, NO, MS_L,MS_D,MS_R,BTN1,NO, ENT, \
LSFT,NO, NO, NO, NO, BTN3,BTN2,BTN1,FN9, FN10,NO, RSFT,TRNS, \
TRNS,LGUI,LALT, TRNS, TRNS,TRNS,TRNS,TRNS),
[4] = KEYMAP(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_INS, KC_DEL, \
LALT(KC_TAB), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_WH_L,KC_WH_D,KC_MS_U, KC_WH_U, KC_WH_R,KC_BTN4,KC_BTN5,LALT(KC_TAB), \
KC_LCTL, KC_VOLD,KC_VOLU,KC_MUTE,KC_NO, KC_NO, KC_NO, KC_MS_L,KC_MS_D, KC_MS_R, KC_BTN1,KC_NO, KC_ENT, \
KC_LSFT, KC_NO, KC_NO, KC_NO, KC_NO, KC_BTN3,KC_BTN2,KC_BTN1,ALT_T(KC_LEFT),ALT_T(KC_RGHT),KC_NO, KC_RSFT,KC_TRNS, \
KC_TRNS, KC_LGUI,KC_LALT, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS),
};
/* id for user defined functions */
enum function_id {
LSHIFT_LPAREN,
};
enum macro_id {
HELLO,
VOLUP,
ALT_TAB,
};
/*
* Fn action definition
*/
const uint16_t fn_actions[] = {
[0] = ACTION_DEFAULT_LAYER_SET(0), // Default layer(not used)
[1] = ACTION_LAYER_TAP_TOGGLE(1), // HHKB layer(toggle with 5 taps)
[2] = ACTION_LAYER_TAP_KEY(2, KC_SLASH), // Cursor layer with Slash*
[3] = ACTION_LAYER_TAP_KEY(3, KC_SCLN), // Mousekey layer with Semicolon*
[4] = ACTION_LAYER_TAP_KEY(4, KC_SPC), // Mousekey layer with Space
[5] = ACTION_LAYER_MOMENTARY(4), // Mousekey layer(IJKL)
[6] = ACTION_MODS_TAP_KEY(MOD_RCTL, KC_ENT), // RControl with tap Enter
[7] = ACTION_MODS_ONESHOT(MOD_LSFT), // Oneshot Shift
[8] = ACTION_MACRO(ALT_TAB), // Application switching
[9] = ACTION_MODS_KEY(MOD_LALT, KC_LEFT),
[10] = ACTION_MODS_KEY(MOD_LALT, KC_RIGHT),
};
/*
* Macro definition
*/
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
switch (id) {
case HELLO:
return (record->event.pressed ?
MACRO( I(0), T(H), T(E), T(L), T(L), W(255), T(O), END ) :
MACRO_NONE );
case VOLUP:
return (record->event.pressed ?
MACRO( D(VOLU), U(VOLU), END ) :
MACRO_NONE );
case ALT_TAB:
return (record->event.pressed ?
MACRO( D(LALT), D(TAB), END ) :
MACRO( U(TAB), END ));
}
return MACRO_NONE;
}
/*
* user defined action function
*/
void action_function(keyrecord_t *record, uint8_t id, uint8_t opt)
{
if (record->event.pressed) dprint("P"); else dprint("R");
dprintf("%d", record->tap.count);
if (record->tap.interrupted) dprint("i");
dprint("\n");
switch (id) {
case LSHIFT_LPAREN:
// Shift parentheses example: LShft + tap '('
// http://stevelosh.com/blog/2012/10/a-modern-space-cadet/#shift-parentheses
// http://geekhack.org/index.php?topic=41989.msg1304899#msg1304899
if (record->event.pressed) {
if (record->tap.count > 0 && !record->tap.interrupted) {
if (record->tap.interrupted) {
dprint("tap interrupted\n");
register_mods(MOD_BIT(KC_LSHIFT));
}
} else {
register_mods(MOD_BIT(KC_LSHIFT));
}
} else {
if (record->tap.count > 0 && !(record->tap.interrupted)) {
add_weak_mods(MOD_BIT(KC_LSHIFT));
send_keyboard_report();
register_code(KC_9);
unregister_code(KC_9);
del_weak_mods(MOD_BIT(KC_LSHIFT));
send_keyboard_report();
record->tap.count = 0; // ad hoc: cancel tap
} else {
unregister_mods(MOD_BIT(KC_LSHIFT));
}
}
break;
}
}

View file

@ -12,9 +12,12 @@
* Infinity Pinusage:
* Column pins are input with internal pull-down. Row pins are output and strobe with high.
* Key is high or 1 when it turns on.
*
* INFINITY PRODUCTION (NO LED)
* col: { PTD1, PTD2, PTD3, PTD4, PTD5, PTD6, PTD7 }
* row: { PTB0, PTB1, PTB2, PTB3, PTB16, PTB17, PTC4, PTC5, PTD0 }
* INFINITY PRODUCTION (WITH LED)
* col: { PTD1, PTD2, PTD3, PTD4, PTD5, PTD6, PTD7 }
* row: { PTC0, PTC1, PTC2, PTC3, PTC4, PTC5, PTC6, PTC7, PTD0 }
*/
/* matrix state(1:on, 0:off) */
static matrix_row_t matrix[MATRIX_ROWS];
@ -34,6 +37,18 @@ void matrix_init(void)
palSetPadMode(GPIOD, 6, PAL_MODE_INPUT_PULLDOWN);
palSetPadMode(GPIOD, 7, PAL_MODE_INPUT_PULLDOWN);
#ifdef INFINITY_LED
/* Row(strobe) */
palSetPadMode(GPIOC, 0, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 1, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 2, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 3, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 4, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 5, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 6, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 7, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOD, 0, PAL_MODE_OUTPUT_PUSHPULL);
#else
/* Row(strobe) */
palSetPadMode(GPIOB, 0, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOB, 1, PAL_MODE_OUTPUT_PUSHPULL);
@ -44,7 +59,7 @@ void matrix_init(void)
palSetPadMode(GPIOC, 4, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOC, 5, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(GPIOD, 0, PAL_MODE_OUTPUT_PUSHPULL);
#endif
memset(matrix, 0, MATRIX_ROWS);
memset(matrix_debouncing, 0, MATRIX_ROWS);
}
@ -53,7 +68,20 @@ uint8_t matrix_scan(void)
{
for (int row = 0; row < MATRIX_ROWS; row++) {
matrix_row_t data = 0;
#ifdef INFINITY_LED
// strobe row
switch (row) {
case 0: palSetPad(GPIOC, 0); break;
case 1: palSetPad(GPIOC, 1); break;
case 2: palSetPad(GPIOC, 2); break;
case 3: palSetPad(GPIOC, 3); break;
case 4: palSetPad(GPIOC, 4); break;
case 5: palSetPad(GPIOC, 5); break;
case 6: palSetPad(GPIOC, 6); break;
case 7: palSetPad(GPIOC, 7); break;
case 8: palSetPad(GPIOD, 0); break;
}
#else
// strobe row
switch (row) {
case 0: palSetPad(GPIOB, 0); break;
@ -66,12 +94,26 @@ uint8_t matrix_scan(void)
case 7: palSetPad(GPIOC, 5); break;
case 8: palSetPad(GPIOD, 0); break;
}
#endif
wait_us(1); // need wait to settle pin state
// read col data
data = (palReadPort(GPIOD)>>1);
#ifdef INFINITY_LED
// un-strobe row
switch (row) {
case 0: palClearPad(GPIOC, 0); break;
case 1: palClearPad(GPIOC, 1); break;
case 2: palClearPad(GPIOC, 2); break;
case 3: palClearPad(GPIOC, 3); break;
case 4: palClearPad(GPIOC, 4); break;
case 5: palClearPad(GPIOC, 5); break;
case 6: palClearPad(GPIOC, 6); break;
case 7: palClearPad(GPIOC, 7); break;
case 8: palClearPad(GPIOD, 0); break;
}
#else
// un-strobe row
switch (row) {
case 0: palClearPad(GPIOB, 0); break;
@ -84,6 +126,7 @@ uint8_t matrix_scan(void)
case 7: palClearPad(GPIOC, 5); break;
case 8: palClearPad(GPIOD, 0); break;
}
#endif
if (matrix_debouncing[row] != data) {
matrix_debouncing[row] = data;

View file

@ -4,6 +4,7 @@
#endif
#include "config.h"
#include "quantum.h"
#include "version.h"
/* Each layer is given a name to aid in readability, which is then
used in the keymap matrix below. The underscores do not denote

View file

@ -8,6 +8,7 @@
#endif
#include "eeconfig.h"
#include "version.h"
extern keymap_config_t keymap_config;

View file

@ -0,0 +1,25 @@
# Build Options
# change to "no" to disable the options, or define them in the Makefile in
# the appropriate keymap folder that will get included automatically
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # 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 = 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
ifndef QUANTUM_DIR
include ../../../../Makefile
endif

View file

@ -0,0 +1,364 @@
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,
// this is the style you want to emulate.
#include "planck.h"
#include "action_layer.h"
#ifdef AUDIO_ENABLE
#include "audio.h"
#endif
#include "eeconfig.h"
extern keymap_config_t keymap_config;
// Each layer gets a name for readability, which is then used in the keymap matrix below.
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
// Layer names don't all need to be of the same length, obviously, and you can also skip them
// entirely and just use numbers.
#define _QWERTY 0
#define _COLEMAK 1
#define _DVORAK 2
#define _LOWER 3
#define _RAISE 4
#define _PLOVER 5
#define _TOUCHCURSOR 6
#define _MOUSE 7
#define _ADJUST 16
enum planck_keycodes {
QWERTY = SAFE_RANGE,
COLEMAK,
DVORAK,
PLOVER,
LOWER,
RAISE,
BACKLIT,
EXT_PLV
};
// Fillers to make layering more clear
#define _______ KC_TRNS
#define XXXXXXX KC_NO
// Custom macros
#define CTL_ESC CTL_T(KC_ESC) // Tap for Esc, hold for Ctrl
#define LT_TC LT(_TOUCHCURSOR, KC_SPC) // L-ayer T-ap T-ouch C-ursor
// ^-- Requires KC_TRNS / _______ for the trigger key in the destination layer
#define SFT_ENT SFT_T(KC_ENT) // Tap for Enter, hold for Shift
#define LT_ML LT(_MOUSE, KC_A) // L-ayer T-ap M-ouse C-ursor (on A)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Qwerty
* ,-----------------------------------------------------------------------------------------.
* | Tab | Q | W | E | R | T | Y | U | I | O | P | Bksp |
* |----------+------+------+------+------+-------------+------+------+------+------+--------|
* | Ctrl/Esc | ML/A | S | D | F | G | H | J | K | L | ; | " |
* |----------+------+------+------+------+------|------+------+------+------+------+--------|
* | Shift | Z | X | C | V | B | N | M | , | . | / |Sft/Ent |
* |----------+------+------+------+------+------+------+------+------+------+------+--------|
* | PrntScrn | RGUI | Alt | GUI |Lower | TC/Space |Raise | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------------'
*/
[_QWERTY] = {
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{CTL_ESC, LT_ML, 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, SFT_ENT},
{KC_PSCR, KC_RGUI, KC_LALT, KC_LGUI, LOWER, LT_TC, LT_TC, RAISE, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
/* Colemak
* ,-----------------------------------------------------------------------------------------.
* | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
* |----------+------+------+------+------+-------------+------+------+------+------+--------|
* | Ctrl/Esc | ML/A | R | S | T | D | H | N | E | I | O | " |
* |----------+------+------+------+------+------|------+------+------+------+------+--------|
* | Shift | Z | X | C | V | B | K | M | , | . | / |Sft/Ent |
* |----------+------+------+------+------+------+------+------+------+------+------+--------|
* | PrntScrn | RGUI | Alt | GUI |Lower | TC/Space |Raise | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------------'
*/
[_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},
{CTL_ESC, LT_ML, 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, SFT_ENT},
{KC_PSCR, KC_RGUI, KC_LALT, KC_LGUI, LOWER, LT_TC, LT_TC, RAISE, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
/* Dvorak
* ,-----------------------------------------------------------------------------------------.
* | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp |
* |----------+------+------+------+------+-------------+------+------+------+------+--------|
* | Ctrl/Esc | ML/A | O | E | U | I | D | H | T | N | S | / |
* |----------+------+------+------+------+------|------+------+------+------+------+--------|
* | Shift | ; | Q | J | K | X | B | M | W | V | Z |Sft/Ent |
* |----------+------+------+------+------+------+------+------+------+------+------+--------|
* | PrntScrn | RGUI | Alt | GUI |Lower | TC/Space |Raise | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------------'
*/
[_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},
{CTL_ESC, LT_ML, 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, SFT_ENT},
{KC_PSCR, KC_RGUI, KC_LALT, KC_LGUI, LOWER, LT_TC, LT_TC, RAISE, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
},
/* Lower
* ,-----------------------------------------------------------------------------------.
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | [ | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | ] | F7 | F8 | F9 | F10 | F11 | F12 | - | = | [ | ] | \ |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* |Brite | | | | | | | Prev | Stop | Slct | Mute |
* `-----------------------------------------------------------------------------------'
*/
[_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_LBRC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
{KC_RBRC, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
{BACKLIT, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_MSTP, KC_MSEL, KC_MUTE}
},
/* Raise
* ,-----------------------------------------------------------------------------------.
* | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | $ | 4 | 5 | 6 | . | + | * | 4 | 5 | 6 | - | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | = | 7 | 8 | 9 | 0 | - | / | 1 | 2 | 3 | . | \ |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* |Brite | | | | | | | Prev | Stop | Slct | Mute |
* `-----------------------------------------------------------------------------------'
*/
[_RAISE] = {
{KC_0, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
{KC_DLR, KC_4, KC_5, KC_6, KC_DOT, KC_PLUS, KC_ASTR, KC_4, KC_5, KC_6, KC_MINS, KC_PIPE},
{KC_EQL, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_SLSH, KC_1, KC_2, KC_3, KC_DOT, KC_BSLS},
{BACKLIT, _______, _______, _______, _______, _______, _______, _______, KC_MPRV, KC_MSTP, KC_MSEL, KC_MUTE}
},
/* TouchCursor layer (http://martin-stone.github.io/touchcursor/) plus personal customizations
* ,-----------------------------------------------------------------------------------.
* | | | |Shift | GUI | ~ |Insert| Home | Up | End | Bksp | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | Alt |Space | | Find |Again | PgUp | Left | Down |Right | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | Undo | Cut | Copy |Paste | ` | PgDn | Del | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*
* The KC_UNDO, KC_CUT, KC_COPY, KC_PASTE, KC_FIND, and KC_AGAIN keycodes don't
* seem to work on Mac. Presumably they'll work under Windows.
*/
[_TOUCHCURSOR] = {
{_______, _______, _______, KC_LSFT, KC_LGUI, KC_TILD, KC_INS, KC_HOME, KC_UP, KC_END, KC_BSPC, _______},
{_______, KC_LALT, KC_SPC, _______, KC_FIND,KC_AGAIN, KC_PGUP, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______},
{_______, KC_UNDO, KC_CUT, KC_COPY, KC_PASTE,KC_GRV, KC_PGDN, KC_DEL, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Mouse Layer
* ,-----------------------------------------------------------------------------------.
* | | |ACCL0 |ACCL1 |ACCL2 |ACCL2 | |WHL_L | Up |WHL_R | BTN2 | |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | | BTN3 | BTN1 | BTN4 |WHL_Up| Left | Down |Right | | |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | | | | BTN2 | BTN5 |WHL_Dn| BTN1 | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_MOUSE] = {
{_______, _______, KC_ACL0, KC_ACL1, KC_ACL2, KC_ACL2, _______, KC_WH_L, KC_MS_U, KC_WH_R, KC_BTN2, _______},
{_______, _______, _______, KC_BTN3, KC_BTN1, KC_BTN4, KC_WH_U, KC_MS_L, KC_MS_D, KC_MS_R, _______, _______},
{_______, _______, _______, _______, KC_BTN2, KC_BTN5, KC_WH_D, KC_BTN1, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
},
/* Plover layer (http://opensteno.org)
* ,-----------------------------------------------------------------------------------.
* | # | # | # | # | # | # | # | # | # | # | # | # |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | S | T | P | H | * | * | F | P | L | T | D |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* |TogOut| S | K | W | R | * | * | R | B | G | S | Z |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | Exit | | | A | O | | E | U | | | |
* `-----------------------------------------------------------------------------------'
*/
[_PLOVER] = {
{KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1, KC_1 },
{XXXXXXX, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC},
{XXXXXXX, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
{EXT_PLV, XXXXXXX, XXXXXXX, KC_C, KC_V, XXXXXXX, XXXXXXX, KC_N, KC_M, XXXXXXX, XXXXXXX, XXXXXXX}
},
/* Adjust (Lower + Raise)
* ,-----------------------------------------------------------------------------------.
* | | | | | | | | | | | | Del |
* |------+------+------+------+------+-------------+------+------+------+------+------|
* | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak|Plover| |
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | |Voice-|Voice+|Mus on|Musoff|MIDIon|MIDIof| | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | |Reset |
* `-----------------------------------------------------------------------------------'
*/
[_ADJUST] = {
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL},
{_______, _______, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______},
{_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, _______},
{_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, RESET}
}
};
#ifdef AUDIO_ENABLE
float tone_startup[][2] = SONG(STARTUP_SOUND);
float tone_qwerty[][2] = SONG(QWERTY_SOUND);
float tone_dvorak[][2] = SONG(DVORAK_SOUND);
float tone_colemak[][2] = SONG(COLEMAK_SOUND);
float tone_plover[][2] = SONG(PLOVER_SOUND);
float tone_plover_gb[][2] = SONG(PLOVER_GOODBYE_SOUND);
float music_scale[][2] = SONG(MUSIC_SCALE_SOUND);
float tone_goodbye[][2] = SONG(GOODBYE_SOUND);
#endif
void persistant_default_layer_set(uint16_t default_layer) {
eeconfig_update_default_layer(default_layer);
default_layer_set(default_layer);
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
#endif
default_layer_set(1UL<<_QWERTY);
}
return false;
break;
case COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_colemak, false, 0);
#endif
default_layer_set(1UL<<_COLEMAK);
}
return false;
break;
case DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
#endif
default_layer_set(1UL<<_DVORAK);
}
return false;
break;
case LOWER:
if (record->event.pressed) {
layer_on(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_LOWER);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
case RAISE:
if (record->event.pressed) {
layer_on(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
} else {
layer_off(_RAISE);
update_tri_layer(_LOWER, _RAISE, _ADJUST);
}
return false;
break;
case BACKLIT:
if (record->event.pressed) {
register_code(KC_RSFT);
#ifdef BACKLIGHT_ENABLE
backlight_step();
#endif
} else {
unregister_code(KC_RSFT);
}
return false;
break;
case PLOVER:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
stop_all_notes();
PLAY_NOTE_ARRAY(tone_plover, false, 0);
#endif
layer_off(_RAISE);
layer_off(_LOWER);
layer_off(_ADJUST);
layer_on(_PLOVER);
if (!eeconfig_is_enabled()) {
eeconfig_init();
}
keymap_config.raw = eeconfig_read_keymap();
keymap_config.nkro = 1;
eeconfig_update_keymap(keymap_config.raw);
}
return false;
break;
case EXT_PLV:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_plover_gb, false, 0);
#endif
layer_off(_PLOVER);
}
return false;
break;
}
return true;
}
void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
startup_user();
#endif
}
#ifdef AUDIO_ENABLE
void startup_user()
{
_delay_ms(20); // gets rid of tick
PLAY_NOTE_ARRAY(tone_startup, false, 0);
}
void shutdown_user()
{
PLAY_NOTE_ARRAY(tone_goodbye, false, 0);
_delay_ms(150);
stop_all_notes();
}
void music_on_user(void)
{
music_scale_user();
}
void music_scale_user(void)
{
PLAY_NOTE_ARRAY(music_scale, false, 0);
}
#endif

View file

@ -0,0 +1,107 @@
jeebak's layout
=======================
This WIP keymap attempts to minimize fingers straying away from the home row.
To aid in this endeavor, when additional modifyer keys to switch layers are
needed, they will be mapped to home row keys. The `keymap.c` file will contain
the exact changes. The diagrams in this README shows the highlights of the
changes from the default mappings.
I also decided to change all calls to `persistant_default_layer_set()` to
`update_tri_layer()` since this is my personal perference.
## Base Layers (Qwerty/Colemak/Dvorak)
These base layers are mostly the same as the default mappings. The interesting
changes are shown below. The `Ctrl/Esc`, mapped using `CTL_T(KC_ESC)` will emit
an `Escape` when tapped, and act as a `Control` key when held. A `TODO` item is
to see if it can also act as a `CapsLock` when double-tapped. The right shift
key acts as `Enter` when tapped, and as a `Shift` key when held. The arrow
keys, which have been moved to the
[TouchCursor](http://martin-stone.github.io/touchcursor/) layer, have been
replaced with the Media keys as shown. The `ML/A` key activates the Mouse layer
when held, and emits an `A` when tapped.
```
,-----------------------------------------------------------------------------------------.
| | | | | | | | | | | | |
|----------+------+------+------+------+-------------+------+------+------+------+--------|
| Ctrl/Esc | ML/A | | | | | | | | | | |
|----------+------+------+------+------+------|------+------+------+------+------+--------|
| | | | | | | | | | | |Sft/Ent |
|----------+------+------+------+------+------+------+------+------+------+------+--------|
| PrntScrn | RGUI | Alt | GUI |Lower | TC/Space |Raise | Next | Vol- | Vol+ | Play |
`-----------------------------------------------------------------------------------------'
```
## Lower Layer (Symbols and Function Keys)
The symbols and functions keys are essentially the same as the default mapping.
The most notable changes are that the symbol keys from the `RAISE` layer have
been moved here. The remaining Media keys replace those that are now on the
base layers. The `BACKLIT` key has also been moved here.
```
,-----------------------------------------------------------------------------------.
| ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
|------+------+------+------+------+-------------+------+------+------+------+------|
| [ | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
|------+------+------+------+------+------|------+------+------+------+------+------|
| ] | F7 | F8 | F9 | F10 | F11 | F12 | - | = | [ | ] | \ |
|------+------+------+------+------+------+------+------+------+------+------+------|
|Brite | | | | | | | Prev | Stop | Slct | Mute |
`-----------------------------------------------------------------------------------'
```
## Raise Layer (Numbers and Arithmetic Operators)
All of the numbers and arithmetic operators are available on this layer. Some
keys are duplicated for the convenience of their positions. The `0` and `$`
keys at the far left are for quick access to beginning and end of line in vim.
```
,-----------------------------------------------------------------------------------.
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
|------+------+------+------+------+-------------+------+------+------+------+------|
| $ | 4 | 5 | 6 | . | + | * | 4 | 5 | 6 | - | | |
|------+------+------+------+------+------|------+------+------+------+------+------|
| = | 7 | 8 | 9 | 0 | - | / | 1 | 2 | 3 | . | \ |
|------+------+------+------+------+------+------+------+------+------+------+------|
|Brite | | | | | | | Prev | Stop | Slct | Mute |
`-----------------------------------------------------------------------------------'
```
## TouchCursor layer plus personal customizations
[TouchCursor](http://martin-stone.github.io/touchcursor/) uses the `Space` key
as the modifier, with the `IJKL` home row keys representing the inverted-T of
the arrow keys. All of the default TouchCursor keymappings for the right hand
are represented below. My personalizations include all of the keys shown for
the left hand. Having the `Alt` and `Shift` keys readily accessible from the
home row allows quick word jumps and highlighting when used in conjunction with
the arrow keys. The `KC_UNDO, KC_CUT, KC_COPY, KC_PASTE, KC_FIND,` and
`KC_AGAIN` keycodes have been mapped but they don't seem to work on Mac.
Presumably they'll work under Windows.
```
,-----------------------------------------------------------------------------------.
| | | |Shift | GUI | ~ |Insert| Home | Up | End | Bksp | |
|------+------+------+------+------+-------------+------+------+------+------+------|
| | Alt |Space | | Find |Again | PgUp | Left | Down |Right | | |
|------+------+------+------+------+------|------+------+------+------+------+------|
| | Undo | Cut | Copy |Paste | ` | PgDn | Del | | | | |
|------+------+------+------+------+------+------+------+------+------+------+------|
| | | | | | | | | | | |
`-----------------------------------------------------------------------------------'
```
## Mouse Layer
The Mouse layer, closely mimics the layout/behaviour of the TouchCursor layer.
The `A` key is used to activate this layer. All 16 keycodes for the mouse from
the `doc/keycode.txt` file are represented, and logically located, IMHO. The
left and right click buttons are duplicated; on the right hand side, for a
quick click here and there, and again on the left hand side for when the
buttons need to be held for dragging things or highlighting text, thus allowing
the right hand to be free to use the up/down/left/right actions.
```
,-----------------------------------------------------------------------------------.
| | |ACCL0 |ACCL1 |ACCL2 |ACCL2 | |WHL_L | Up |WHL_R | BTN2 | |
|------+------+------+------+------+-------------+------+------+------+------+------|
| | | | BTN3 | BTN1 | BTN4 |WHL_Up| Left | Down |Right | | |
|------+------+------+------+------+------|------+------+------+------+------+------|
| | | | | BTN2 | BTN5 |WHL_Dn| BTN1 | | | | |
|------+------+------+------+------+------+------+------+------+------+------+------|
| | | | | | | | | | | |
`-----------------------------------------------------------------------------------'
```

View file

@ -28,6 +28,14 @@
Q__NOTE(_E4), Q__NOTE(_C4), \
Q__NOTE(_E4),
/* Requires: PLAY_NOTE_ARRAY(..., ..., STACCATO); */
#define IN_LIKE_FLINT \
E__NOTE(_AS4), E__NOTE(_AS4), QD_NOTE(_B4), \
E__NOTE(_AS4), E__NOTE(_B4), QD_NOTE(_CS4), \
E__NOTE(_B4), E__NOTE(_CS4), QD_NOTE(_DS4), \
E__NOTE(_CS4), E__NOTE(_B4), QD_NOTE(_AS4), \
E__NOTE(_AS4), E__NOTE(_AS4), QD_NOTE(_B4),
#define GOODBYE_SOUND \
E__NOTE(_E7), \
E__NOTE(_A6), \

View file

@ -0,0 +1,161 @@
#ifndef KEYMAP_CYRILLIC_H
#define KEYMAP_CYRILLIC_H
#include "keymap.h"
/*
* This is based off of
* https://en.wikipedia.org/wiki/Cyrillic_script
*/
// Capital Char russian/ukrainian/bulgarian
#define CY_A UC(0x0410) // А rus ukr bul
#define CY_BE UC(0x0411) // Б rus ukr bul
#define CY_VE UC(0x0412) // В rus ukr bul
#define CY_GHE UC(0x0413) // Г rus ukr bul
#define CY_GHEUP UC(0x0490) // Ґ ukr
#define CY_DE UC(0x0414) // Д rus ukr bul
#define CY_DJE UC(0x0402) // Ђ
#define CY_GJE UC(0x0403) // Ѓ
#define CY_IE UC(0x0415) // Е rus ukr bul
#define CY_IO UC(0x0401) // Ё rus
#define CY_UIE UC(0x0404) // Є ukr
#define CY_ZHE UC(0x0416) // Ж rus ukr bul
#define CY_ZE UC(0x0417) // З rus ukr bul
#define CY_DZE UC(0x0405) // Ѕ
#define CY_I UC(0x0418) // И rus ukr bul
#define CY_B_U_I UC(0x0406) // І ukr
#define CY_YI UC(0x0407) // Ї ukr
#define CY_SRT_I UC(0x0419) // Й rus ukr bul
#define CY_JE UC(0x0408) // Ј
#define CY_KA UC(0x041a) // К rus ukr bul
#define CY_EL UC(0x041b) // Л rus ukr bul
#define CY_LJE UC(0x0409) // Љ
#define CY_EM UC(0x041c) // М rus ukr bul
#define CY_EN UC(0x041d) // Н rus ukr bul
#define CY_NJE UC(0x040a) // Њ
#define CY_O UC(0x041e) // О rus ukr bul
#define CY_PE UC(0x041f) // П rus ukr bul
#define CY_ER UC(0x0420) // Р rus ukr bul
#define CY_ES UC(0x0421) // С rus ukr bul
#define CY_TE UC(0x0422) // Т rus ukr bul
#define CY_TSHE UC(0x040b) // Ћ
#define CY_KJE UC(0x040c) // Ќ
#define CY_U UC(0x0423) // У rus ukr bul
#define CY_SRT_U UC(0x040e) // Ў
#define CY_EF UC(0x0424) // Ф rus ukr bul
#define CY_HA UC(0x0425) // Х rus bul
#define CY_TSE UC(0x0426) // Ц rus ukr bul
#define CY_CHE UC(0x0427) // Ч rus ukr bul
#define CY_DZHE UC(0x040f) // Џ
#define CY_SHA UC(0x0428) // Ш rus ukr bul
#define CY_SHCHA UC(0x0429) // Щ rus ukr bul
#define CY_HSIGN UC(0x042a) // Ъ rus bul
#define CY_YERU UC(0x042b) // Ы rus
#define CY_SSIGN UC(0x042c) // Ь rus ukr bul
#define CY_E UC(0x042d) // Э rus
#define CY_YU UC(0x042e) // Ю rus ukr bul
#define CY_YA UC(0x042f) // Я rus ukr bul
// Important Cyrillic non-Slavic letters
#define CY_PALOCHKA UC(0x04c0) // Ӏ
#define CY_SCHWA UC(0x04d8) // Ә
#define CY_GHE_S UC(0x0492) // Ғ
#define CY_ZE_D UC(0x0498) // Ҙ
#define CY_ES_D UC(0x04aa) // Ҫ
#define CY_BR_KA UC(0x04a0) // Ҡ
#define CY_ZHE_D UC(0x0496) // Җ
#define CY_KA_D UC(0x049a) // Қ
#define CY_EN_D UC(0x04a2) // Ң
#define CY_ENGHE UC(0x04a4) // Ҥ
#define CY_BRD_O UC(0x04e8) // Ө
#define CY_STR_U UC(0x04ae) // Ү
#define CY_S_U_S UC(0x04b0) // Ұ
#define CY_SHHA UC(0x04ba) // Һ
#define CY_HA_D UC(0x04b2) // Ҳ
// Small
#define CY_a UC(0x0430) // a rus ukr bul
#define CY_be UC(0x0431) // б rus ukr bul
#define CY_ve UC(0x0432) // в rus ukr bul
#define CY_ghe UC(0x0433) // г rus ukr bul
#define CY_gheup UC(0x0491) // ґ ukr
#define CY_de UC(0x0434) // д rus ukr bul
#define CY_dje UC(0x0452) // ђ
#define CY_gje UC(0x0453) // ѓ
#define CY_ie UC(0x0435) // е rus ukr bul
#define CY_io UC(0x0451) // ё rus
#define CY_uie UC(0x0454) // є ukr
#define CY_zhe UC(0x0436) // ж rus ukr bul
#define CY_ze UC(0x0437) // з rus ukr bul
#define CY_dze UC(0x0455) // ѕ
#define CY_i UC(0x0438) // и rus ukr bul
#define CY_b_u_i UC(0x0456) // і ukr
#define CY_yi UC(0x0457) // ї ukr
#define CY_srt_i UC(0x0439) // й rus ukr bul
#define CY_je UC(0x0458) // ј
#define CY_ka UC(0x043a) // к rus ukr bul
#define CY_el UC(0x043b) // л rus ukr bul
#define CY_lje UC(0x0459) // љ
#define CY_em UC(0x043c) // м rus ukr bul
#define CY_en UC(0x043d) // н rus ukr bul
#define CY_nje UC(0x045a) // њ
#define CY_o UC(0x043e) // о rus ukr bul
#define CY_pe UC(0x043f) // п rus ukr bul
#define CY_er UC(0x0440) // р rus ukr bul
#define CY_es UC(0x0441) // с rus ukr bul
#define CY_te UC(0x0442) // т rus ukr bul
#define CY_tshe UC(0x045b) // ћ
#define CY_kje UC(0x045c) // ќ
#define CY_u UC(0x0443) // у rus ukr bul
#define CY_srt_u UC(0x045e) // ў
#define CY_ef UC(0x0444) // ф rus ukr bul
#define CY_ha UC(0x0445) // х rus ukr bul
#define CY_tse UC(0x0446) // ц rus ukr bul
#define CY_che UC(0x0447) // ч rus ukr bul
#define CY_dzhe UC(0x045f) // џ
#define CY_sha UC(0x0448) // ш rus ukr bul
#define CY_shcha UC(0x0449) // щ rus ukr bul
#define CY_hsign UC(0x044a) // ъ rus bul
#define CY_yeru UC(0x044b) // ы rus
#define CY_ssign UC(0x044c) // ь rus ukr bul
#define CY_e UC(0x044d) // э rus
#define CY_yu UC(0x044e) // ю rus ukr bul
#define CY_ya UC(0x044f) // я rus ukr bul
// Important Cyrillic non-Slavic letters
#define CY_palochka UC(0x04cf) // ӏ
#define CY_schwa UC(0x04d9) // ә
#define CY_ghe_s UC(0x0493) // ғ
#define CY_ze_d UC(0x0499) // ҙ
#define CY_es_d UC(0x04ab) // ҫ
#define CY_br_ka UC(0x04a1) // ҡ
#define CY_zhe_d UC(0x0497) // җ
#define CY_ka_d UC(0x049b) // қ
#define CY_en_d UC(0x04a3) // ң
#define CY_enghe UC(0x04a5) // ҥ
#define CY_brd_o UC(0x04e9) // ө
#define CY_str_u UC(0x04af) // ү
#define CY_s_u_s UC(0x04b1) // ұ
#define CY_shha UC(0x04bb) // һ
#define CY_ha_d UC(0x04b3) // ҳ
// Extra
#define CY_slr_ve UC(0x1c80) // ᲀ CYRILLIC SMALL LETTER ROUNDED VE
#define CY_ll_de UC(0x1c81) // ᲁ CYRILLIC SMALL LETTER LONG-LEGGED DE
#define CY_ZEMLYA UC(0xa640) // Ꙁ CYRILLIC CAPITAL LETTER ZEMLYA
#define CY_zemlya UC(0xa641) // ꙁ CYRILLIC SMALL LETTER ZEMLYA
#define CY_RV_DZE UC(0xa644) // CYRILLIC CAPITAL LETTER REVERSED DZE
#define CY_rv_DZE UC(0xa645) // ꙅ CYRILLIC SMALL LETTER REVERSED DZE
#define CY_slw_es UC(0x1c83) // ᲃ CYRILLIC SMALL LETTER WIDE ES
#define CY_st_te UC(0x1c84) // ᲄ CYRILLIC SMALL LETTER TALL TE
#define CY_3l_te UC(0x1c85) // ᲅ CYRILLIC SMALL LETTER THREE-LEGGED TE
#define CY_thsign UC(0x1c86) // ᲆ CYRILLIC SMALL LETTER TALL HARD SIGN
#define CY_YERUBY UC(0xa650) // Ꙑ CYRILLIC CAPITAL LETTER YERU WITH BACK YER
#define CY_yeruby UC(0xa651) // ꙑ CYRILLIC SMALL LETTER YERU WITH BACK YER
#define CY_RUBLE UC(0x20bd) // ₽
#define CY_NUMERO UC(0x2116) // №
// The letters Zje and Sje are made for other letters and accent marks
#endif

View file

@ -7,24 +7,41 @@
#include "debug.h"
const uint8_t DIM_CURVE[] PROGMEM = {
0, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6,
6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11,
11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15,
15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20,
20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 26,
27, 27, 28, 28, 29, 29, 30, 30, 31, 32, 32, 33, 33, 34, 35, 35,
36, 36, 37, 38, 38, 39, 40, 40, 41, 42, 43, 43, 44, 45, 46, 47,
48, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
63, 64, 65, 66, 68, 69, 70, 71, 73, 74, 75, 76, 78, 79, 81, 82,
83, 85, 86, 88, 90, 91, 93, 94, 96, 98, 99, 101, 103, 105, 107, 109,
110, 112, 114, 116, 118, 121, 123, 125, 127, 129, 132, 134, 136, 139, 141, 144,
146, 149, 151, 154, 157, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, 190,
193, 196, 200, 203, 207, 211, 214, 218, 222, 226, 230, 234, 238, 242, 248, 255,
0, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6,
6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11,
11, 11, 12, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15,
15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, 20,
20, 20, 21, 21, 22, 22, 22, 23, 23, 24, 24, 25, 25, 25, 26, 26,
27, 27, 28, 28, 29, 29, 30, 30, 31, 32, 32, 33, 33, 34, 35, 35,
36, 36, 37, 38, 38, 39, 40, 40, 41, 42, 43, 43, 44, 45, 46, 47,
48, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
63, 64, 65, 66, 68, 69, 70, 71, 73, 74, 75, 76, 78, 79, 81, 82,
83, 85, 86, 88, 90, 91, 93, 94, 96, 98, 99, 101, 103, 105, 107, 109,
110, 112, 114, 116, 118, 121, 123, 125, 127, 129, 132, 134, 136, 139, 141, 144,
146, 149, 151, 154, 157, 159, 162, 165, 168, 171, 174, 177, 180, 183, 186, 190,
193, 196, 200, 203, 207, 211, 214, 218, 222, 226, 230, 234, 238, 242, 248, 255
};
const uint8_t RGBLED_BREATHING_TABLE[] PROGMEM = {
0, 0, 0, 0, 1, 1, 1, 2, 2, 3, 4, 5, 5, 6, 7, 9,
10, 11, 12, 14, 15, 17, 18, 20, 21, 23, 25, 27, 29, 31, 33, 35,
37, 40, 42, 44, 47, 49, 52, 54, 57, 59, 62, 65, 67, 70, 73, 76,
79, 82, 85, 88, 90, 93, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124,
127, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 162, 165, 167, 170, 173,
176, 179, 182, 185, 188, 190, 193, 196, 198, 201, 203, 206, 208, 211, 213, 215,
218, 220, 222, 224, 226, 228, 230, 232, 234, 235, 237, 238, 240, 241, 243, 244,
245, 246, 248, 249, 250, 250, 251, 252, 253, 253, 254, 254, 254, 255, 255, 255,
255, 255, 255, 255, 254, 254, 254, 253, 253, 252, 251, 250, 250, 249, 248, 246,
245, 244, 243, 241, 240, 238, 237, 235, 234, 232, 230, 228, 226, 224, 222, 220,
218, 215, 213, 211, 208, 206, 203, 201, 198, 196, 193, 190, 188, 185, 182, 179,
176, 173, 170, 167, 165, 162, 158, 155, 152, 149, 146, 143, 140, 137, 134, 131,
128, 124, 121, 118, 115, 112, 109, 106, 103, 100, 97, 93, 90, 88, 85, 82,
79, 76, 73, 70, 67, 65, 62, 59, 57, 54, 52, 49, 47, 44, 42, 40,
37, 35, 33, 31, 29, 27, 25, 23, 21, 20, 18, 17, 15, 14, 12, 11,
10, 9, 7, 6, 5, 5, 4, 3, 2, 2, 1, 1, 1, 0, 0, 0
};
const uint8_t RGBLED_BREATHING_TABLE[] PROGMEM = {0,0,0,0,1,1,1,2,2,3,4,5,5,6,7,9,10,11,12,14,15,17,18,20,21,23,25,27,29,31,33,35,37,40,42,44,47,49,52,54,57,59,62,65,67,70,73,76,79,82,85,88,90,93,97,100,103,106,109,112,115,118,121,124,127,131,134,137,140,143,146,149,152,155,158,162,165,167,170,173,176,179,182,185,188,190,193,196,198,201,203,206,208,211,213,215,218,220,222,224,226,228,230,232,234,235,237,238,240,241,243,244,245,246,248,249,250,250,251,252,253,253,254,254,254,255,255,255,255,255,255,255,254,254,254,253,253,252,251,250,250,249,248,246,245,244,243,241,240,238,237,235,234,232,230,228,226,224,222,220,218,215,213,211,208,206,203,201,198,196,193,190,188,185,182,179,176,173,170,167,165,162,158,155,152,149,146,143,140,137,134,131,128,124,121,118,115,112,109,106,103,100,97,93,90,88,85,82,79,76,73,70,67,65,62,59,57,54,52,49,47,44,42,40,37,35,33,31,29,27,25,23,21,20,18,17,15,14,12,11,10,9,7,6,5,5,4,3,2,2,1,1,1,0,0,0};
const uint8_t RGBLED_BREATHING_INTERVALS[] PROGMEM = {30, 20, 10, 5};
const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[] PROGMEM = {120, 60, 30};
const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[] PROGMEM = {100, 50, 20};
@ -38,63 +55,56 @@ uint8_t rgblight_inited = 0;
void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) {
/* convert hue, saturation and brightness ( HSB/HSV ) to RGB
The DIM_CURVE is used only on brightness/value and on saturation (inverted).
This looks the most natural.
*/
uint8_t r = 0, g = 0, b = 0;
// Convert hue, saturation, and value (HSV/HSB) to RGB. DIM_CURVE is used only
// on value and saturation (inverted). This looks the most natural.
uint8_t r = 0, g = 0, b = 0, base, color;
val = pgm_read_byte(&DIM_CURVE[val]);
sat = 255 - pgm_read_byte(&DIM_CURVE[255 - sat]);
sat = 255 - pgm_read_byte(&DIM_CURVE[255 - sat]);
uint8_t base;
if (sat == 0) { // Acromatic color (gray). Hue doesn't mind.
r = val;
g = val;
b = val;
} else {
base = ((255 - sat) * val) >> 8;
color = (val - base) * (hue % 60) / 60;
if (sat == 0) { // Acromatic color (gray). Hue doesn't mind.
r = val;
g = val;
b = val;
} else {
base = ((255 - sat) * val) >> 8;
switch (hue / 60) {
case 0:
r = val;
g = base + color;
b = base;
break;
case 1:
r = val - color;
g = val;
b = base;
break;
case 2:
r = base;
g = val;
b = base + color;
break;
case 3:
r = base;
g = val - color;
b = val;
break;
case 4:
r = base + color;
g = base;
b = val;
break;
case 5:
r = val;
g = base;
b = val - color;
break;
}
}
switch (hue / 60) {
case 0:
r = val;
g = (((val - base)*hue) / 60) + base;
b = base;
break;
case 1:
r = (((val - base)*(60 - (hue % 60))) / 60) + base;
g = val;
b = base;
break;
case 2:
r = base;
g = val;
b = (((val - base)*(hue % 60)) / 60) + base;
break;
case 3:
r = base;
g = (((val - base)*(60 - (hue % 60))) / 60) + base;
b = val;
break;
case 4:
r = (((val - base)*(hue % 60)) / 60) + base;
g = base;
b = val;
break;
case 5:
r = val;
g = base;
b = (((val - base)*(60 - (hue % 60))) / 60) + base;
break;
}
}
setrgb(r,g,b, led1);
setrgb(r, g, b, led1);
}
void setrgb(uint8_t r, uint8_t g, uint8_t b, struct cRGB *led1) {
@ -111,44 +121,44 @@ void eeconfig_update_rgblight(uint32_t val) {
eeprom_update_dword(EECONFIG_RGBLIGHT, val);
}
void eeconfig_update_rgblight_default(void) {
dprintf("eeconfig_update_rgblight_default\n");
rgblight_config.enable = 1;
rgblight_config.mode = 1;
rgblight_config.hue = 200;
rgblight_config.sat = 204;
rgblight_config.val = 204;
eeconfig_update_rgblight(rgblight_config.raw);
dprintf("eeconfig_update_rgblight_default\n");
rgblight_config.enable = 1;
rgblight_config.mode = 1;
rgblight_config.hue = 200;
rgblight_config.sat = 204;
rgblight_config.val = 204;
eeconfig_update_rgblight(rgblight_config.raw);
}
void eeconfig_debug_rgblight(void) {
dprintf("rgblight_config eprom\n");
dprintf("rgblight_config.enable = %d\n", rgblight_config.enable);
dprintf("rghlight_config.mode = %d\n", rgblight_config.mode);
dprintf("rgblight_config.hue = %d\n", rgblight_config.hue);
dprintf("rgblight_config.sat = %d\n", rgblight_config.sat);
dprintf("rgblight_config.val = %d\n", rgblight_config.val);
dprintf("rgblight_config eprom\n");
dprintf("rgblight_config.enable = %d\n", rgblight_config.enable);
dprintf("rghlight_config.mode = %d\n", rgblight_config.mode);
dprintf("rgblight_config.hue = %d\n", rgblight_config.hue);
dprintf("rgblight_config.sat = %d\n", rgblight_config.sat);
dprintf("rgblight_config.val = %d\n", rgblight_config.val);
}
void rgblight_init(void) {
debug_enable = 1; // Debug ON!
dprintf("rgblight_init called.\n");
dprintf("rgblight_init called.\n");
rgblight_inited = 1;
dprintf("rgblight_init start!\n");
dprintf("rgblight_init start!\n");
if (!eeconfig_is_enabled()) {
dprintf("rgblight_init eeconfig is not enabled.\n");
dprintf("rgblight_init eeconfig is not enabled.\n");
eeconfig_init();
eeconfig_update_rgblight_default();
eeconfig_update_rgblight_default();
}
rgblight_config.raw = eeconfig_read_rgblight();
if (!rgblight_config.mode) {
dprintf("rgblight_init rgblight_config.mode = 0. Write default values to EEPROM.\n");
eeconfig_update_rgblight_default();
rgblight_config.raw = eeconfig_read_rgblight();
}
eeconfig_debug_rgblight(); // display current eeprom values
if (!rgblight_config.mode) {
dprintf("rgblight_init rgblight_config.mode = 0. Write default values to EEPROM.\n");
eeconfig_update_rgblight_default();
rgblight_config.raw = eeconfig_read_rgblight();
}
eeconfig_debug_rgblight(); // display current eeprom values
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
rgblight_timer_init(); // setup the timer
#endif
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
rgblight_timer_init(); // setup the timer
#endif
if (rgblight_config.enable) {
rgblight_mode(rgblight_config.mode);
@ -156,58 +166,57 @@ void rgblight_init(void) {
}
void rgblight_increase(void) {
uint8_t mode = 0;
uint8_t mode = 0;
if (rgblight_config.mode < RGBLIGHT_MODES) {
mode = rgblight_config.mode + 1;
}
rgblight_mode(mode);
rgblight_mode(mode);
}
void rgblight_decrease(void) {
uint8_t mode = 0;
if (rgblight_config.mode > 1) { //mode will never < 1, if mode is less than 1, eeprom need to be initialized.
mode = rgblight_config.mode-1;
uint8_t mode = 0;
// Mode will never be < 1. If it ever is, eeprom needs to be initialized.
if (rgblight_config.mode > 1) {
mode = rgblight_config.mode - 1;
}
rgblight_mode(mode);
rgblight_mode(mode);
}
void rgblight_step(void) {
uint8_t mode = 0;
uint8_t mode = 0;
mode = rgblight_config.mode + 1;
if (mode > RGBLIGHT_MODES) {
mode = 1;
}
rgblight_mode(mode);
rgblight_mode(mode);
}
void rgblight_mode(uint8_t mode) {
if (!rgblight_config.enable) {
return;
}
if (mode<1) {
rgblight_config.mode = 1;
} else if (mode > RGBLIGHT_MODES) {
rgblight_config.mode = RGBLIGHT_MODES;
} else {
rgblight_config.mode = mode;
}
if (!rgblight_config.enable) {
return;
}
if (mode < 1) {
rgblight_config.mode = 1;
} else if (mode > RGBLIGHT_MODES) {
rgblight_config.mode = RGBLIGHT_MODES;
} else {
rgblight_config.mode = mode;
}
eeconfig_update_rgblight(rgblight_config.raw);
xprintf("rgblight mode: %u\n", rgblight_config.mode);
if (rgblight_config.mode == 1) {
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
rgblight_timer_disable();
#endif
} else if (rgblight_config.mode >=2 && rgblight_config.mode <=23) {
// MODE 2-5, breathing
// MODE 6-8, rainbow mood
// MODE 9-14, rainbow swirl
// MODE 15-20, snake
// MODE 21-23, knight
if (rgblight_config.mode == 1) {
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
rgblight_timer_disable();
#endif
} else if (rgblight_config.mode >= 2 && rgblight_config.mode <= 23) {
// MODE 2-5, breathing
// MODE 6-8, rainbow mood
// MODE 9-14, rainbow swirl
// MODE 15-20, snake
// MODE 21-23, knight
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
rgblight_timer_enable();
#endif
}
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
rgblight_timer_enable();
#endif
}
rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
}
@ -215,306 +224,318 @@ void rgblight_toggle(void) {
rgblight_config.enable ^= 1;
eeconfig_update_rgblight(rgblight_config.raw);
xprintf("rgblight toggle: rgblight_config.enable = %u\n", rgblight_config.enable);
if (rgblight_config.enable) {
rgblight_mode(rgblight_config.mode);
} else {
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
rgblight_timer_disable();
#endif
_delay_ms(50);
rgblight_set();
}
if (rgblight_config.enable) {
rgblight_mode(rgblight_config.mode);
} else {
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
rgblight_timer_disable();
#endif
_delay_ms(50);
rgblight_set();
}
}
void rgblight_increase_hue(void){
uint16_t hue;
void rgblight_increase_hue(void) {
uint16_t hue;
hue = (rgblight_config.hue+RGBLIGHT_HUE_STEP) % 360;
rgblight_sethsv(hue, rgblight_config.sat, rgblight_config.val);
}
void rgblight_decrease_hue(void){
uint16_t hue;
if (rgblight_config.hue-RGBLIGHT_HUE_STEP <0 ) {
hue = (rgblight_config.hue+360-RGBLIGHT_HUE_STEP) % 360;
} else {
hue = (rgblight_config.hue-RGBLIGHT_HUE_STEP) % 360;
}
void rgblight_decrease_hue(void) {
uint16_t hue;
if (rgblight_config.hue-RGBLIGHT_HUE_STEP < 0) {
hue = (rgblight_config.hue + 360 - RGBLIGHT_HUE_STEP) % 360;
} else {
hue = (rgblight_config.hue - RGBLIGHT_HUE_STEP) % 360;
}
rgblight_sethsv(hue, rgblight_config.sat, rgblight_config.val);
}
void rgblight_increase_sat(void) {
uint8_t sat;
uint8_t sat;
if (rgblight_config.sat + RGBLIGHT_SAT_STEP > 255) {
sat = 255;
} else {
sat = rgblight_config.sat+RGBLIGHT_SAT_STEP;
sat = rgblight_config.sat + RGBLIGHT_SAT_STEP;
}
rgblight_sethsv(rgblight_config.hue, sat, rgblight_config.val);
}
void rgblight_decrease_sat(void){
uint8_t sat;
void rgblight_decrease_sat(void) {
uint8_t sat;
if (rgblight_config.sat - RGBLIGHT_SAT_STEP < 0) {
sat = 0;
} else {
sat = rgblight_config.sat-RGBLIGHT_SAT_STEP;
sat = rgblight_config.sat - RGBLIGHT_SAT_STEP;
}
rgblight_sethsv(rgblight_config.hue, sat, rgblight_config.val);
}
void rgblight_increase_val(void){
uint8_t val;
void rgblight_increase_val(void) {
uint8_t val;
if (rgblight_config.val + RGBLIGHT_VAL_STEP > 255) {
val = 255;
} else {
val = rgblight_config.val+RGBLIGHT_VAL_STEP;
val = rgblight_config.val + RGBLIGHT_VAL_STEP;
}
rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val);
}
void rgblight_decrease_val(void) {
uint8_t val;
uint8_t val;
if (rgblight_config.val - RGBLIGHT_VAL_STEP < 0) {
val = 0;
} else {
val = rgblight_config.val-RGBLIGHT_VAL_STEP;
val = rgblight_config.val - RGBLIGHT_VAL_STEP;
}
rgblight_sethsv(rgblight_config.hue, rgblight_config.sat, val);
}
void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val){
inmem_config.raw = rgblight_config.raw;
void rgblight_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) {
inmem_config.raw = rgblight_config.raw;
if (rgblight_config.enable) {
struct cRGB tmp_led;
sethsv(hue, sat, val, &tmp_led);
inmem_config.hue = hue;
inmem_config.sat = sat;
inmem_config.val = val;
inmem_config.hue = hue;
inmem_config.sat = sat;
inmem_config.val = val;
// dprintf("rgblight set hue [MEMORY]: %u,%u,%u\n", inmem_config.hue, inmem_config.sat, inmem_config.val);
rgblight_setrgb(tmp_led.r, tmp_led.g, tmp_led.b);
}
}
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val){
void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val) {
if (rgblight_config.enable) {
if (rgblight_config.mode == 1) {
// same static color
rgblight_sethsv_noeeprom(hue, sat, val);
} else {
// all LEDs in same color
if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) {
// breathing mode, ignore the change of val, use in memory value instead
val = rgblight_config.val;
} else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 14) {
// rainbow mood and rainbow swirl, ignore the change of hue
hue = rgblight_config.hue;
}
}
rgblight_config.hue = hue;
rgblight_config.sat = sat;
rgblight_config.val = val;
eeconfig_update_rgblight(rgblight_config.raw);
xprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
if (rgblight_config.mode == 1) {
// same static color
rgblight_sethsv_noeeprom(hue, sat, val);
} else {
// all LEDs in same color
if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) {
// breathing mode, ignore the change of val, use in memory value instead
val = rgblight_config.val;
} else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 14) {
// rainbow mood and rainbow swirl, ignore the change of hue
hue = rgblight_config.hue;
}
}
rgblight_config.hue = hue;
rgblight_config.sat = sat;
rgblight_config.val = val;
eeconfig_update_rgblight(rgblight_config.raw);
xprintf("rgblight set hsv [EEPROM]: %u,%u,%u\n", rgblight_config.hue, rgblight_config.sat, rgblight_config.val);
}
}
void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b){
void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
// dprintf("rgblight set rgb: %u,%u,%u\n", r,g,b);
for (uint8_t i=0;i<RGBLED_NUM;i++) {
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
led[i].r = r;
led[i].g = g;
led[i].b = b;
}
rgblight_set();
}
void rgblight_set(void) {
if (rgblight_config.enable) {
ws2812_setleds(led, RGBLED_NUM);
} else {
for (uint8_t i=0;i<RGBLED_NUM;i++) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
}
ws2812_setleds(led, RGBLED_NUM);
}
if (rgblight_config.enable) {
ws2812_setleds(led, RGBLED_NUM);
} else {
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
}
ws2812_setleds(led, RGBLED_NUM);
}
}
#if !defined(AUDIO_ENABLE) && defined(RGBLIGHT_TIMER)
// Animation timer -- AVR Timer3
void rgblight_timer_init(void) {
static uint8_t rgblight_timer_is_init = 0;
if (rgblight_timer_is_init) {
return;
}
rgblight_timer_is_init = 1;
/* Timer 3 setup */
TCCR3B = _BV(WGM32) //CTC mode OCR3A as TOP
| _BV(CS30); //Clock selelct: clk/1
/* Set TOP value */
uint8_t sreg = SREG;
cli();
OCR3AH = (RGBLED_TIMER_TOP>>8)&0xff;
OCR3AL = RGBLED_TIMER_TOP&0xff;
SREG = sreg;
static uint8_t rgblight_timer_is_init = 0;
if (rgblight_timer_is_init) {
return;
}
rgblight_timer_is_init = 1;
/* Timer 3 setup */
TCCR3B = _BV(WGM32) //CTC mode OCR3A as TOP
| _BV(CS30); //Clock selelct: clk/1
/* Set TOP value */
uint8_t sreg = SREG;
cli();
OCR3AH = (RGBLED_TIMER_TOP >> 8) & 0xff;
OCR3AL = RGBLED_TIMER_TOP & 0xff;
SREG = sreg;
}
void rgblight_timer_enable(void) {
TIMSK3 |= _BV(OCIE3A);
dprintf("TIMER3 enabled.\n");
TIMSK3 |= _BV(OCIE3A);
dprintf("TIMER3 enabled.\n");
}
void rgblight_timer_disable(void) {
TIMSK3 &= ~_BV(OCIE3A);
dprintf("TIMER3 disabled.\n");
TIMSK3 &= ~_BV(OCIE3A);
dprintf("TIMER3 disabled.\n");
}
void rgblight_timer_toggle(void) {
TIMSK3 ^= _BV(OCIE3A);
dprintf("TIMER3 toggled.\n");
TIMSK3 ^= _BV(OCIE3A);
dprintf("TIMER3 toggled.\n");
}
ISR(TIMER3_COMPA_vect) {
// Mode = 1, static light, do nothing here
if (rgblight_config.mode>=2 && rgblight_config.mode<=5) {
// mode = 2 to 5, breathing mode
rgblight_effect_breathing(rgblight_config.mode-2);
} else if (rgblight_config.mode>=6 && rgblight_config.mode<=8) {
rgblight_effect_rainbow_mood(rgblight_config.mode-6);
} else if (rgblight_config.mode>=9 && rgblight_config.mode<=14) {
rgblight_effect_rainbow_swirl(rgblight_config.mode-9);
} else if (rgblight_config.mode>=15 && rgblight_config.mode<=20) {
rgblight_effect_snake(rgblight_config.mode-15);
} else if (rgblight_config.mode>=21 && rgblight_config.mode<=23) {
rgblight_effect_knight(rgblight_config.mode-21);
}
// mode = 1, static light, do nothing here
if (rgblight_config.mode >= 2 && rgblight_config.mode <= 5) {
// mode = 2 to 5, breathing mode
rgblight_effect_breathing(rgblight_config.mode - 2);
} else if (rgblight_config.mode >= 6 && rgblight_config.mode <= 8) {
// mode = 6 to 8, rainbow mood mod
rgblight_effect_rainbow_mood(rgblight_config.mode - 6);
} else if (rgblight_config.mode >= 9 && rgblight_config.mode <= 14) {
// mode = 9 to 14, rainbow swirl mode
rgblight_effect_rainbow_swirl(rgblight_config.mode - 9);
} else if (rgblight_config.mode >= 15 && rgblight_config.mode <= 20) {
// mode = 15 to 20, snake mode
rgblight_effect_snake(rgblight_config.mode - 15);
} else if (rgblight_config.mode >= 21 && rgblight_config.mode <= 23) {
// mode = 21 to 23, knight mode
rgblight_effect_knight(rgblight_config.mode - 21);
}
}
// effects
// Effects
void rgblight_effect_breathing(uint8_t interval) {
static uint8_t pos = 0;
static uint16_t last_timer = 0;
static uint8_t pos = 0;
static uint16_t last_timer = 0;
if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_BREATHING_INTERVALS[interval])) return;
last_timer = timer_read();
if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_BREATHING_INTERVALS[interval])) {
return;
}
last_timer = timer_read();
rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, pgm_read_byte(&RGBLED_BREATHING_TABLE[pos]));
pos = (pos+1) % 256;
rgblight_sethsv_noeeprom(rgblight_config.hue, rgblight_config.sat, pgm_read_byte(&RGBLED_BREATHING_TABLE[pos]));
pos = (pos + 1) % 256;
}
void rgblight_effect_rainbow_mood(uint8_t interval) {
static uint16_t current_hue=0;
static uint16_t last_timer = 0;
static uint16_t current_hue = 0;
static uint16_t last_timer = 0;
if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_RAINBOW_MOOD_INTERVALS[interval])) return;
last_timer = timer_read();
rgblight_sethsv_noeeprom(current_hue, rgblight_config.sat, rgblight_config.val);
current_hue = (current_hue+1) % 360;
if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_RAINBOW_MOOD_INTERVALS[interval])) {
return;
}
last_timer = timer_read();
rgblight_sethsv_noeeprom(current_hue, rgblight_config.sat, rgblight_config.val);
current_hue = (current_hue + 1) % 360;
}
void rgblight_effect_rainbow_swirl(uint8_t interval) {
static uint16_t current_hue=0;
static uint16_t last_timer = 0;
uint16_t hue;
uint8_t i;
if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_RAINBOW_MOOD_INTERVALS[interval/2])) return;
last_timer = timer_read();
for (i=0; i<RGBLED_NUM; i++) {
hue = (360/RGBLED_NUM*i+current_hue)%360;
sethsv(hue, rgblight_config.sat, rgblight_config.val, &led[i]);
}
rgblight_set();
static uint16_t current_hue = 0;
static uint16_t last_timer = 0;
uint16_t hue;
uint8_t i;
if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_RAINBOW_MOOD_INTERVALS[interval / 2])) {
return;
}
last_timer = timer_read();
for (i = 0; i < RGBLED_NUM; i++) {
hue = (360 / RGBLED_NUM * i + current_hue) % 360;
sethsv(hue, rgblight_config.sat, rgblight_config.val, &led[i]);
}
rgblight_set();
if (interval % 2) {
current_hue = (current_hue+1) % 360;
} else {
if (current_hue -1 < 0) {
current_hue = 359;
} else {
current_hue = current_hue - 1;
}
}
if (interval % 2) {
current_hue = (current_hue + 1) % 360;
} else {
if (current_hue - 1 < 0) {
current_hue = 359;
} else {
current_hue = current_hue - 1;
}
}
}
void rgblight_effect_snake(uint8_t interval) {
static uint8_t pos=0;
static uint16_t last_timer = 0;
uint8_t i,j;
int8_t k;
int8_t increament = 1;
if (interval%2) increament = -1;
if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_SNAKE_INTERVALS[interval/2])) return;
last_timer = timer_read();
for (i=0;i<RGBLED_NUM;i++) {
led[i].r=0;
led[i].g=0;
led[i].b=0;
for (j=0;j<RGBLIGHT_EFFECT_SNAKE_LENGTH;j++) {
k = pos+j*increament;
if (k<0) k = k+RGBLED_NUM;
if (i==k) {
sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val*(RGBLIGHT_EFFECT_SNAKE_LENGTH-j)/RGBLIGHT_EFFECT_SNAKE_LENGTH), &led[i]);
}
}
}
rgblight_set();
if (increament == 1) {
if (pos - 1 < 0) {
pos = RGBLED_NUM-1;
} else {
pos -= 1;
}
} else {
pos = (pos+1)%RGBLED_NUM;
}
static uint8_t pos = 0;
static uint16_t last_timer = 0;
uint8_t i, j;
int8_t k;
int8_t increment = 1;
if (interval % 2) {
increment = -1;
}
if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_SNAKE_INTERVALS[interval / 2])) {
return;
}
last_timer = timer_read();
for (i = 0; i < RGBLED_NUM; i++) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) {
k = pos + j * increment;
if (k < 0) {
k = k + RGBLED_NUM;
}
if (i == k) {
sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val*(RGBLIGHT_EFFECT_SNAKE_LENGTH-j)/RGBLIGHT_EFFECT_SNAKE_LENGTH), &led[i]);
}
}
}
rgblight_set();
if (increment == 1) {
if (pos - 1 < 0) {
pos = RGBLED_NUM - 1;
} else {
pos -= 1;
}
} else {
pos = (pos + 1) % RGBLED_NUM;
}
}
void rgblight_effect_knight(uint8_t interval) {
static int8_t pos=0;
static uint16_t last_timer = 0;
uint8_t i,j,cur;
int8_t k;
struct cRGB preled[RGBLED_NUM];
static int8_t increament = -1;
if (timer_elapsed(last_timer)<pgm_read_byte(&RGBLED_KNIGHT_INTERVALS[interval])) return;
last_timer = timer_read();
for (i=0;i<RGBLED_NUM;i++) {
preled[i].r=0;
preled[i].g=0;
preled[i].b=0;
for (j=0;j<RGBLIGHT_EFFECT_KNIGHT_LENGTH;j++) {
k = pos+j*increament;
if (k<0) k = 0;
if (k>=RGBLED_NUM) k=RGBLED_NUM-1;
if (i==k) {
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, &preled[i]);
}
}
}
if (RGBLIGHT_EFFECT_KNIGHT_OFFSET) {
for (i=0;i<RGBLED_NUM;i++) {
cur = (i+RGBLIGHT_EFFECT_KNIGHT_OFFSET) % RGBLED_NUM;
led[i].r = preled[cur].r;
led[i].g = preled[cur].g;
led[i].b = preled[cur].b;
}
}
rgblight_set();
if (increament == 1) {
if (pos - 1 < 0 - RGBLIGHT_EFFECT_KNIGHT_LENGTH) {
pos = 0- RGBLIGHT_EFFECT_KNIGHT_LENGTH;
increament = -1;
} else {
pos -= 1;
}
} else {
if (pos+1>RGBLED_NUM+RGBLIGHT_EFFECT_KNIGHT_LENGTH) {
pos = RGBLED_NUM+RGBLIGHT_EFFECT_KNIGHT_LENGTH-1;
increament = 1;
} else {
pos += 1;
}
}
static int8_t pos = 0;
static uint16_t last_timer = 0;
uint8_t i, j, cur;
int8_t k;
struct cRGB preled[RGBLED_NUM];
static int8_t increment = -1;
if (timer_elapsed(last_timer) < pgm_read_byte(&RGBLED_KNIGHT_INTERVALS[interval])) {
return;
}
last_timer = timer_read();
for (i = 0; i < RGBLED_NUM; i++) {
preled[i].r = 0;
preled[i].g = 0;
preled[i].b = 0;
for (j = 0; j < RGBLIGHT_EFFECT_KNIGHT_LENGTH; j++) {
k = pos + j * increment;
if (k < 0) {
k = 0;
}
if (k >= RGBLED_NUM) {
k = RGBLED_NUM - 1;
}
if (i == k) {
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, &preled[i]);
}
}
}
if (RGBLIGHT_EFFECT_KNIGHT_OFFSET) {
for (i = 0; i < RGBLED_NUM; i++) {
cur = (i + RGBLIGHT_EFFECT_KNIGHT_OFFSET) % RGBLED_NUM;
led[i].r = preled[cur].r;
led[i].g = preled[cur].g;
led[i].b = preled[cur].b;
}
}
rgblight_set();
if (increment == 1) {
if (pos - 1 < 0 - RGBLIGHT_EFFECT_KNIGHT_LENGTH) {
pos = 0 - RGBLIGHT_EFFECT_KNIGHT_LENGTH;
increment = -1;
} else {
pos -= 1;
}
} else {
if (pos + 1 > RGBLED_NUM + RGBLIGHT_EFFECT_KNIGHT_LENGTH) {
pos = RGBLED_NUM + RGBLIGHT_EFFECT_KNIGHT_LENGTH - 1;
increment = 1;
} else {
pos += 1;
}
}
}
#endif

View file

@ -122,17 +122,16 @@ Below are some definitions that will be useful:
Below is a list of the useful `make` commands in QMK:
* `make` - cleans automatically and builds your keyboard and keymap depending on which folder you're in. This defaults to the "default" layout (unless in a keymap folder), and Planck keyboard in the root folder
* `make` - builds your keyboard and keymap depending on which folder you're in. This defaults to the "default" layout (unless in a keymap folder), and Planck keyboard in the root folder
* `make keyboard=<keyboard>` - specifies the keyboard (only to be used in root)
* `make keymap=<keymap>` - specifies the keymap (only to be used in root and keyboard folder - not needed when in keymap folder)
* `make quick` - skips the clean step (cannot be used immediately after modifying config.h or Makefiles)
* `make clean` - cleans the `.build` folder, ensuring that everything is re-built
* `make dfu` - (requires dfu-programmer) builds and flashes the keymap to your keyboard once placed in reset/dfu mode (button or press `KC_RESET`). This does not work for Teensy-based keyboards like the ErgoDox EZ.
* `keyboard=` and `keymap=` are compatible with this
* `make all-keyboards` - builds all keymaps for all keyboards and outputs status of each (use in root)
* `make all-keyboards-default` - builds all default keymaps for all keyboards and outputs status of each (use in root)
* `make all-keymaps [keyboard=<keyboard>]` - builds all of the keymaps for whatever keyboard folder you're in, or specified by `<keyboard>`
* `make all-keyboards-quick`, `make all-keyboards-default-quick` and `make all-keymaps-quick [keyboard=<keyboard>]` - like the normal "make-all-*" commands, but they skip the clean steps
* `make all-keyboards-*`, `make all-keyboards-default-*` and `make all-keymaps-* [keyboard=<keyboard>]` - like the normal "make-all-*" commands, but the last string aftter the `-` (for example clean) is passed to the keyboard make command.
Other, less useful functionality:
* `make COLOR=false` - turns off color output

View file

@ -15,6 +15,16 @@
# Carlos Lamas
#
# Enable vpath seraching for source files only
# Without this, output files, could be read from the wrong .build directories
VPATH_SRC := $(VPATH)
vpath %.c $(VPATH_SRC)
vpath %.h $(VPATH_SRC)
vpath %.cpp $(VPATH_SRC)
vpath %.hpp $(VPATH_SRC)
vpath %.S $(VPATH_SRC)
VPATH :=
# Output format. (can be srec, ihex, binary)
FORMAT = ihex
@ -35,11 +45,6 @@ ifeq ($(COLOR),true)
BOLD=\033[1m
endif
ifdef quick
QUICK = $(quick)
endif
QUICK ?= false
AUTOGEN ?= false
ifneq ($(shell awk --version 2>/dev/null),)
@ -71,7 +76,7 @@ BUILD_CMD = LOG=$$($(CMD) 2>&1) ; if [ $$? -gt 0 ]; then $(PRINT_ERROR); elif [
# Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
EXTRAINCDIRS += $(subst :, ,$(VPATH))
EXTRAINCDIRS += $(subst :, ,$(VPATH_SRC))
# Compiler flag to set the C Standard level.
@ -268,22 +273,21 @@ LST = $(patsubst %.c,$(OBJDIR)/%.lst,$(patsubst %.cpp,$(OBJDIR)/%.lst,$(patsubst
# Compiler flags to generate dependency files.
#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d
GENDEPFLAGS = -MMD -MP -MF $(BUILD_DIR)/.dep/$(subst /,_,$(subst $(BUILD_DIR)/,,$@)).d
GENDEPFLAGS = -MMD -MP -MF $(patsubst %.o,%.td,$@)
# Combine all necessary flags and optional flags.
# Add target processor to flags.
# You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar
ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
ALL_CPPFLAGS = $(MCUFLAGS) -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS)
ALL_CFLAGS = $(MCUFLAGS) $(CFLAGS) $(EXTRAFLAGS)
ALL_CPPFLAGS = $(MCUFLAGS) -x c++ $(CPPFLAGS) $(EXTRAFLAGS)
ALL_ASFLAGS = $(MCUFLAGS) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS)
MOVE_DEP = mv -f $(patsubst %.o,%.td,$@) $(patsubst %.o,%.d,$@)
# Default target.
all: build sizeafter
# Quick make that doesn't clean
quick: build sizeafter
# Change the build target to build a HEX file or a library.
build: elf hex
#build: elf hex eep lss sym
@ -373,35 +377,62 @@ BEGIN = gccversion check_submodule sizebefore
# Link: create ELF output file from object files.
.SECONDARY : $(BUILD_DIR)/$(TARGET).elf
.PRECIOUS : $(OBJ)
%.elf: $(OBJ) | $(BEGIN)
# Note the obj.txt depeendency is there to force linking if a source file is deleted
%.elf: $(OBJ) $(OBJDIR)/cflags.txt $(OBJDIR)/ldflags.txt $(OBJDIR)/obj.txt | $(BEGIN)
@$(SILENT) || printf "$(MSG_LINKING) $@" | $(AWK_CMD)
$(eval CMD=$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS))
$(eval CMD=$(CC) $(ALL_CFLAGS) $(filter-out %.txt,$^) --output $@ $(LDFLAGS))
@$(BUILD_CMD)
define GEN_OBJRULE
# Compile: create object files from C source files.
$1/%.o : %.c | $(BEGIN)
$1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN)
@mkdir -p $$(@D)
@$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
$$(eval CMD=$$(CC) -c $$(ALL_CFLAGS) $$< -o $$@)
$$(eval CMD=$$(CC) -c $$(ALL_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
@$$(BUILD_CMD)
# Compile: create object files from C++ source files.
$1/%.o : %.cpp | $(BEGIN)
$1/%.o : %.cpp $1/%.d $1/cppflags.txt $1/compiler.txt | $(BEGIN)
@mkdir -p $$(@D)
@$$(SILENT) || printf "$$(MSG_COMPILING_CPP) $$<" | $$(AWK_CMD)
$$(eval CMD=$$(CC) -c $$(ALL_CPPFLAGS) $$< -o $$@)
$$(eval CMD=$$(CC) -c $$(ALL_CPPFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
@$(BUILD_CMD)
# Assemble: create object files from assembler source files.
$1/%.o : %.S | $(BEGIN)
$1/%.o : %.S $1/asflags.txt $1/compiler.txt | $(BEGIN)
@mkdir -p $$(@D)
@$(SILENT) || printf "$$(MSG_ASSEMBLING) $$<" | $$(AWK_CMD)
$$(eval CMD=$$(CC) -c $$(ALL_ASFLAGS) $$< -o $$@)
@$$(BUILD_CMD)
$1/force:
$1/cflags.txt: $1/force
echo '$$(ALL_CFLAGS)' | cmp -s - $$@ || echo '$$(ALL_CFLAGS)' > $$@
$1/cppflags.txt: $1/force
echo '$$(ALL_CPPFLAGS)' | cmp -s - $$@ || echo '$$(ALL_CPPFLAGS)' > $$@
$1/asflags.txt: $1/force
echo '$$(ALL_ASFLAGS)' | cmp -s - $$@ || echo '$$(ALL_ASFLAGS)' > $$@
$1/ldflags.txt: $1/force
echo '$$(LDFLAGS)' | cmp -s - $$@ || echo '$$(LDFLAGS)' > $$@
$1/obj.txt: $1/force
echo '$$(OBJ)' | cmp -s - $$@ || echo '$$(OBJ)' > $$@
$1/compiler.txt: $1/force
$$(CC) --version | cmp -s - $$@ || $$(CC) --version > $$@
endef
# We have to use static rules for the .d files for some reason
DEPS = $(patsubst %.o,%.d,$(OBJ))
# Keep the .d files
.PRECIOUS: $(DEPS)
# Empty rule to force recompilation if the .d file is missing
$(DEPS):
# Since the object files could be in two different folders, generate
# separate rules for them, rather than having too generic rules
$(eval $(call GEN_OBJRULE,$(OBJDIR)))
@ -425,6 +456,9 @@ $(eval $(call GEN_OBJRULE,$(KBOBJDIR)))
# Target: clean project.
clean:
$(REMOVE) -r $(OBJDIR) 2>/dev/null
$(REMOVE) -r $(KBOBJDIR) 2>/dev/null
$(REMOVE) $(BUILD_DIR)/$(TARGET).*
show_path:
@echo VPATH=$(VPATH)
@ -444,7 +478,6 @@ all-keyboards-defaults: all-keyboards-defaults-all
KEYBOARDS := $(SUBDIRS:$(TOP_DIR)/keyboards/%/=/keyboards/%)
all-keyboards-all: $(addsuffix -all,$(KEYBOARDS))
all-keyboards-quick: $(addsuffix -quick,$(KEYBOARDS))
all-keyboards-clean: $(addsuffix -clean,$(KEYBOARDS))
all-keyboards: all-keyboards-all
@ -461,12 +494,10 @@ done
endef
define make_keyboard_helper
# Just remove the -quick, -all and so on from the first argument and pass it forward
# Just remove the -all and so on from the first argument and pass it forward
$(call make_keyboard,$(subst -$2,,$1),$2)
endef
/keyboards/%-quick:
$(call make_keyboard_helper,$@,quick)
/keyboards/%-all:
$(call make_keyboard_helper,$@,all)
/keyboards/%-clean:
@ -484,19 +515,6 @@ all-keymaps-%:
all-keymaps: all-keymaps-all
GOAL=$(MAKECMDGOALS)
ifeq ($(MAKECMDGOALS),)
GOAL = all
endif
CLEANING_GOALS=clean clean_list all
ifneq ($(findstring $(GOAL),$(CLEANING_GOALS)),)
$(shell $(REMOVE) -r $(BUILD_DIR) 2>/dev/null)
$(shell $(REMOVE) -r $(TOP_DIR)/$(BUILD_DIR))
$(shell $(REMOVE) -r $(KEYBOARD_PATH)/$(BUILD_DIR))
$(shell if $$SUBPROJECT; then $(REMOVE) -r $(SUBPROJECT_PATH)/$(BUILD_DIR); fi)
$(shell $(REMOVE) -r $(KEYMAP_PATH)/$(BUILD_DIR))
endif
# Create build directory
$(shell mkdir $(BUILD_DIR) 2>/dev/null)
@ -505,11 +523,11 @@ $(shell mkdir $(OBJDIR) 2>/dev/null)
$(shell mkdir $(KBOBJDIR) 2>/dev/null)
# Include the dependency files.
-include $(shell mkdir $(BUILD_DIR)/.dep 2>/dev/null) $(wildcard $(BUILD_DIR)/.dep/*)
-include $(patsubst %.o,%.d,$(OBJ))
# Listing of phony targets.
.PHONY : all quick finish sizebefore sizeafter gccversion \
.PHONY : all finish sizebefore sizeafter gccversion \
build elf hex eep lss sym coff extcoff check_submodule \
clean clean_list debug gdb-config show_path \
program teensy dfu flip dfu-ee flip-ee dfu-start \

1
util/ergodox_ez.html Normal file
View file

@ -0,0 +1 @@
<html><head><meta http-equiv="refresh" content="0; url=http://qmk.fm/keyboards/ergodox/" /></head></html>

View file

@ -15,6 +15,8 @@ git submodule update --init --recursive
rm -rf keyboard
rm -rf keyboards
cp -r ../qmk_firmware/keyboards .
mkdir keyboards/ergodox_ez/
cp ../qmk_firmware/util/ergodox_ez.html keyboards/ergodox_ez/index.html
cp ../qmk_firmware/readme.md qmk_readme.md
./generate.sh