aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-04-15 16:19:43 -0400
committerJack Humbert <jack.humb@gmail.com>2016-04-15 16:19:43 -0400
commit91119636631f24bd1bf97f32c3d39f8828da625f (patch)
treeb301cb936ef1985a00e634fa98fa90ccdc1b98f8
parentbdb6dceaebc358dd4aae593d51d3ba0dd61858a9 (diff)
parent2557b91644d9565c43f0e5c27d45788d4a47f3eb (diff)
downloadqmk_firmware-91119636631f24bd1bf97f32c3d39f8828da625f.tar.gz
qmk_firmware-91119636631f24bd1bf97f32c3d39f8828da625f.zip
Merge pull request #256 from jackhumbert/new_defaults
New default planck layout, audio fixes, makefile overwrites, tri-layer quantum-wide
-rw-r--r--README.md14
-rw-r--r--keyboard/planck/Makefile51
-rw-r--r--keyboard/planck/config.h4
-rw-r--r--keyboard/planck/keymaps/default/keymap.c159
-rw-r--r--keyboard/planck/keymaps/default/makefile.mk1
-rw-r--r--quantum/audio.c7
-rw-r--r--quantum/keymap_common.c18
-rw-r--r--quantum/keymap_common.h4
-rw-r--r--quantum/quantum.mk8
-rw-r--r--tmk_core/common.mk27
-rw-r--r--tmk_core/protocol/lufa.mk4
11 files changed, 233 insertions, 64 deletions
diff --git a/README.md b/README.md
index ab7373023..613bdcf42 100644
--- a/README.md
+++ b/README.md
@@ -16,13 +16,21 @@ The documentation below explains QMK customizations and elaborates on some of th
16* If you're looking to customize a keyboard that currently runs QMK or TMK, find your keyboard's directory under `keyboard/` and run the make commands from there. 16* If you're looking to customize a keyboard that currently runs QMK or TMK, find your keyboard's directory under `keyboard/` and run the make commands from there.
17* If you're looking to apply this firmware to an entirely new hardware project (a new kind of keyboard), you can create your own Quantum-based project by using `./new_project.sh <project_name>`, which will create `/keyboard/<project_name>` with all the necessary components for a Quantum project. 17* If you're looking to apply this firmware to an entirely new hardware project (a new kind of keyboard), you can create your own Quantum-based project by using `./new_project.sh <project_name>`, which will create `/keyboard/<project_name>` with all the necessary components for a Quantum project.
18 18
19### Makefile Options
20
19You have access to a bunch of goodies! Check out the Makefile to enable/disable some of the features. Uncomment the `#` to enable them. Setting them to `no` does nothing and will only confuse future you. 21You have access to a bunch of goodies! Check out the Makefile to enable/disable some of the features. Uncomment the `#` to enable them. Setting them to `no` does nothing and will only confuse future you.
20 22
21 BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 23 BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
22 MIDI_ENABLE = yes # MIDI controls 24 MIDI_ENABLE = yes # MIDI controls
23 # UNICODE_ENABLE = yes # Unicode support - this is commented out, just as an example. You have to use #, not // 25 UNICODE_ENABLE = no # <-- This is how you disable an option, just set it to "no"
24 BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID 26 BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID
25 27
28### Customizing Makefile options on a per-keymap basis
29
30If your keymap directory has a file called `makefile.mk` (note the lowercase filename, and the `.mk` extension), any Makefile options you set in that file will take precedence over other Makefile options (those set for Quantum as a whole or for your particular keyboard).
31
32So let's say your keyboard's makefile has `CONSOLE_ENABLE = yes` (or maybe doesn't even list the `CONSOLE_ENABLE` option, which would cause it to revert to the global Quantum default). You want your particular keymap to not have the debug console, so you make a file called `makefile.mk` and specify `CONSOLE_ENABLE = no`.
33
26## Quick aliases to common actions 34## Quick aliases to common actions
27 35
28Your keymap can include shortcuts to common operations (called "function actions" in tmk). 36Your keymap can include shortcuts to common operations (called "function actions" in tmk).
@@ -199,6 +207,10 @@ This will clear all mods currently pressed.
199 207
200This will clear all keys besides the mods currently pressed. 208This will clear all keys besides the mods currently pressed.
201 209
210* `update_tri_layer(layer_1, layer_2, layer_3);`
211
212If the user attempts to activate layer 1 AND layer 2 at the same time (for example, by hitting their respective layer keys), layer 3 will be activated. Layers 1 and 2 will _also_ be activated, for the purposes of fallbacks (so a given key will fall back from 3 to 2, to 1 -- and only then to 0).
213
202#### Timer functionality 214#### Timer functionality
203 215
204It's possible to start timers and read values for time-specific events - here's an example: 216It's possible to start timers and read values for time-specific events - here's an example:
diff --git a/keyboard/planck/Makefile b/keyboard/planck/Makefile
index ae637fc29..8d4e7787a 100644
--- a/keyboard/planck/Makefile
+++ b/keyboard/planck/Makefile
@@ -41,7 +41,6 @@
41# Target file name (without extension). 41# Target file name (without extension).
42TARGET = planck 42TARGET = planck
43 43
44
45# Directory common source filess exist 44# Directory common source filess exist
46TOP_DIR = ../.. 45TOP_DIR = ../..
47TMK_DIR = ../../tmk_core 46TMK_DIR = ../../tmk_core
@@ -62,17 +61,28 @@ ifneq ("$(wildcard keymaps/$(KEYMAP).c)","")
62else 61else
63ifneq ("$(wildcard keymaps/$(KEYMAP)/keymap.c)","") 62ifneq ("$(wildcard keymaps/$(KEYMAP)/keymap.c)","")
64 KEYMAP_FILE = keymaps/$(KEYMAP)/keymap.c 63 KEYMAP_FILE = keymaps/$(KEYMAP)/keymap.c
64ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","")
65 include keymaps/$(KEYMAP)/makefile.mk
66endif
65else 67else
66$(error Keymap file does not exist) 68$(error Keymap file does not exist)
69endif
67endif 70endif
68endif 71
69else 72else
73
70ifneq ("$(wildcard keymaps/default.c)","") 74ifneq ("$(wildcard keymaps/default.c)","")
71 KEYMAP_FILE = keymaps/default.c 75 KEYMAP_FILE = keymaps/default.c
72else 76else
73 KEYMAP_FILE = keymaps/default/keymap.c 77 KEYMAP_FILE = keymaps/default/keymap.c
74endif 78endif
79
80ifneq ("$(wildcard keymaps/default/makefile.mk)","")
81 include keymaps/default/makefile.mk
82endif
83
75endif 84endif
85
76SRC := $(KEYMAP_FILE) $(SRC) 86SRC := $(KEYMAP_FILE) $(SRC)
77 87
78CONFIG_H = config.h 88CONFIG_H = config.h
@@ -94,7 +104,6 @@ MCU = atmega32u4
94# software delays. 104# software delays.
95F_CPU = 16000000 105F_CPU = 16000000
96 106
97
98# 107#
99# LUFA specific 108# LUFA specific
100# 109#
@@ -126,31 +135,45 @@ OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
126# USBaspLoader 2048 135# USBaspLoader 2048
127OPT_DEFS += -DBOOTLOADER_SIZE=4096 136OPT_DEFS += -DBOOTLOADER_SIZE=4096
128 137
129
130# Build Options 138# Build Options
131# comment out to disable the options. 139# change to "no" to disable the options, or define them in the makefile.mk in
140# the appropriate keymap folder that will get included automatically
132# 141#
133BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000) 142BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
134MOUSEKEY_ENABLE = yes # Mouse keys(+4700) 143MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
135EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 144EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
136CONSOLE_ENABLE = yes # Console for debug(+400) 145CONSOLE_ENABLE = yes # Console for debug(+400)
137COMMAND_ENABLE = yes # Commands for debug and configuration 146COMMAND_ENABLE = yes # Commands for debug and configuration
138# NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 147NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
139BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 148BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
140# MIDI_ENABLE = yes # MIDI controls 149MIDI_ENABLE = no # MIDI controls
141# AUDIO_ENABLE = yes # Audio output on port C6 150AUDIO_ENABLE = no # Audio output on port C6
142# UNICODE_ENABLE = yes # Unicode 151UNICODE_ENABLE = no # Unicode
143# BLUETOOTH_ENABLE = ye # Enable Bluetooth with the Adafruit EZ-Key HID 152BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
144# RGBLIGHT_ENABLE = yes # Enable WS2812 RGB underlight. Do not enable this with audio at the same time. 153RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
145 154
146# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE 155# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
147#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend 156SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
148 157
158ifdef KEYMAP
149 159
150ifdef BACKLIGHT_ENABLE 160ifeq ("$(wildcard keymaps/$(KEYMAP).c)","")
151 SRC += backlight.c 161ifneq ("$(wildcard keymaps/$(KEYMAP)/makefile.mk)","")
162 include keymaps/$(KEYMAP)/makefile.mk
163endif
152endif 164endif
153 165
166else
167
168ifneq ("$(wildcard keymaps/default/makefile.mk)","")
169 include keymaps/default/makefile.mk
170endif
171
172endif
173
174ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
175 SRC := backlight.c $(SRC)
176endif
154 177
155# Optimize size but this may cause error "relocation truncated to fit" 178# Optimize size but this may cause error "relocation truncated to fit"
156#EXTRALDFLAGS = -Wl,--relax 179#EXTRALDFLAGS = -Wl,--relax
diff --git a/keyboard/planck/config.h b/keyboard/planck/config.h
index d3719e0cb..7d64f0977 100644
--- a/keyboard/planck/config.h
+++ b/keyboard/planck/config.h
@@ -73,10 +73,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
73 */ 73 */
74 74
75/* disable debug print */ 75/* disable debug print */
76#define NO_DEBUG 76//#define NO_DEBUG
77 77
78/* disable print */ 78/* disable print */
79#define NO_PRINT 79//#define NO_PRINT
80 80
81/* disable action features */ 81/* disable action features */
82//#define NO_ACTION_LAYER 82//#define NO_ACTION_LAYER
diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c
index 30ad87760..56092d04f 100644
--- a/keyboard/planck/keymaps/default/keymap.c
+++ b/keyboard/planck/keymaps/default/keymap.c
@@ -2,8 +2,9 @@
2// this is the style you want to emulate. 2// this is the style you want to emulate.
3 3
4#include "planck.h" 4#include "planck.h"
5#ifdef BACKLIGHT_ENABLE 5#include "action_layer.h"
6 #include "backlight.h" 6#ifdef AUDIO_ENABLE
7 #include "audio.h"
7#endif 8#endif
8 9
9// Each layer gets a name for readability, which is then used in the keymap matrix below. 10// Each layer gets a name for readability, which is then used in the keymap matrix below.
@@ -15,6 +16,15 @@
15#define _DV 2 16#define _DV 2
16#define _LW 3 17#define _LW 3
17#define _RS 4 18#define _RS 4
19#define _AD 5
20
21// Macro name shortcuts
22#define M_QW 0
23#define M_CM 1
24#define M_DV 2
25#define M_LW 3
26#define M_RS 4
27#define M_BL 5
18 28
19// Fillers to make layering more clear 29// Fillers to make layering more clear
20#define _______ KC_TRNS 30#define _______ KC_TRNS
@@ -37,7 +47,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
37 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, 47 {KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
38 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT}, 48 {KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT},
39 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, 49 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
40 {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} 50 {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, M(M_LW), KC_SPC, KC_SPC, M(M_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
41}, 51},
42 52
43/* Colemak 53/* Colemak
@@ -55,7 +65,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
55 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC}, 65 {KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC},
56 {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT}, 66 {KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT},
57 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT }, 67 {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT },
58 {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} 68 {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, M(M_LW), KC_SPC, KC_SPC, M(M_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
59}, 69},
60 70
61/* Dvorak 71/* Dvorak
@@ -73,43 +83,61 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
73 {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC}, 83 {KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC},
74 {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH}, 84 {KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH},
75 {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT }, 85 {KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT },
76 {M(0), KC_LCTL, KC_LALT, KC_LGUI, MO(_LW), KC_SPC, KC_SPC, MO(_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} 86 {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, M(M_LW), KC_SPC, KC_SPC, M(M_RS), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
87},
88
89/* Lower
90 * ,-----------------------------------------------------------------------------------.
91 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
92 * |------+------+------+------+------+-------------+------+------+------+------+------|
93 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | |
94 * |------+------+------+------+------+------|------+------+------+------+------+------|
95 * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter |
96 * |------+------+------+------+------+------+------+------+------+------+------+------|
97 * | | | | | | | | Next | Vol- | Vol+ | Play |
98 * `-----------------------------------------------------------------------------------'
99 */
100[_LW] = {
101 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC},
102 {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE},
103 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______},
104 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
77}, 105},
78 106
79/* Raise 107/* Raise
80 * ,-----------------------------------------------------------------------------------. 108 * ,-----------------------------------------------------------------------------------.
81 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp | 109 * | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
82 * |------+------+------+------+------+-------------+------+------+------+------+------| 110 * |------+------+------+------+------+-------------+------+------+------+------+------|
83 * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ | 111 * | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
84 * |------+------+------+------+------+------|------+------+------+------+------+------| 112 * |------+------+------+------+------+------|------+------+------+------+------+------|
85 * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter | 113 * | | F7 | F8 | F9 | F10 | F11 | F12 | | | | |Enter |
86 * |------+------+------+------+------+------+------+------+------+------+------+------| 114 * |------+------+------+------+------+------+------+------+------+------+------+------|
87 * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Next | Vol- | Vol+ | Play | 115 * | | | | | | | | Next | Vol- | Vol+ | Play |
88 * `-----------------------------------------------------------------------------------' 116 * `-----------------------------------------------------------------------------------'
89 */ 117 */
90[_RS] = { 118[_RS] = {
91 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC}, 119 {KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC},
92 {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS}, 120 {KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS},
93 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, _______}, 121 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______},
94 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} 122 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
95}, 123},
96 124
97/* Lower 125/* Adjust (Lower + Raise)
98 * ,-----------------------------------------------------------------------------------. 126 * ,-----------------------------------------------------------------------------------.
99 * | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp | 127 * | | Reset| | | | | | | | | | Del |
100 * |------+------+------+------+------+-------------+------+------+------+------+------| 128 * |------+------+------+------+------+-------------+------+------+------+------+------|
101 * | Esc | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | { | } | | | 129 * | | | | | | | |Qwerty|Colemk|Dvorak| | |
102 * |------+------+------+------+------+------|------+------+------+------+------+------| 130 * |------+------+------+------+------+------|------+------+------+------+------+------|
103 * | Shift| F7 | F8 | F9 | F10 | F11 | F12 |Qwerty|Colemk|Dvorak| Reset|Enter | 131 * | | | | | | | | | | | | |
104 * |------+------+------+------+------+------+------+------+------+------+------+------| 132 * |------+------+------+------+------+------+------+------+------+------+------+------|
105 * | Brite| Ctrl | Alt | GUI |Lower | Space |Raise | Next | Vol- | Vol+ | Play | 133 * | | | | | | | | | | | |
106 * `-----------------------------------------------------------------------------------' 134 * `-----------------------------------------------------------------------------------'
107 */ 135 */
108[_LW] = { 136[_AD] = {
109 {KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC}, 137 {_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_DEL},
110 {_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE}, 138 {_______, _______, _______, _______, _______, _______, _______, M(M_QW), M(M_CM), M(M_DV), _______, _______},
111 {_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, DF(_QW), DF(_CM), DF(_DV), RESET, _______}, 139 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______},
112 {_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} 140 {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}
113} 141}
114}; 142};
115 143
@@ -117,11 +145,83 @@ const uint16_t PROGMEM fn_actions[] = {
117 145
118}; 146};
119 147
148#ifdef AUDIO_ENABLE
149float tone_qw[][2] = {
150 {440.0*pow(2.0,(59)/12.0), 8},
151 {440.0*pow(2.0,(60)/12.0), 8},
152 {0, 4},
153 {440.0*pow(2.0,(67)/12.0), 16}
154};
155
156float tone_cm[][2] = {
157 {440.0*pow(2.0,(59)/12.0), 8},
158 {440.0*pow(2.0,(60)/12.0), 8},
159 {0, 4},
160 {440.0*pow(2.0,(67)/12.0), 16},
161 {0, 4},
162 {440.0*pow(2.0,(71)/12.0), 16}
163};
164
165float tone_dv[][2] = {
166 {440.0*pow(2.0,(59)/12.0), 8},
167 {440.0*pow(2.0,(60)/12.0), 8},
168 {0, 4},
169 {440.0*pow(2.0,(67)/12.0), 16},
170 {0, 4},
171 {440.0*pow(2.0,(69)/12.0), 16},
172 {0, 4},
173 {440.0*pow(2.0,(67)/12.0), 16}
174};
175#endif
176
177
120const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 178const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
121{ 179{
122 // MACRODOWN only works in this function 180 // MACRODOWN only works in this function
123 switch(id) { 181 switch(id) {
124 case 0: 182 case M_QW:
183 if (record->event.pressed) {
184 #ifdef AUDIO_ENABLE
185 play_notes(&tone_qw, 4, false);
186 #endif
187 default_layer_set(1UL<<_QW);
188 }
189 break;
190 case M_CM:
191 if (record->event.pressed) {
192 #ifdef AUDIO_ENABLE
193 play_notes(&tone_cm, 6, false);
194 #endif
195 default_layer_set(1UL<<_CM);
196 }
197 break;
198 case M_DV:
199 if (record->event.pressed) {
200 #ifdef AUDIO_ENABLE
201 play_notes(&tone_dv, 8, false);
202 #endif
203 default_layer_set(1UL<<_DV);
204 }
205 break;
206 case M_LW:
207 if (record->event.pressed) {
208 layer_on(_LW);
209 update_tri_layer(_LW, _RS, _AD);
210 } else {
211 layer_off(_LW);
212 update_tri_layer(_LW, _RS, _AD);
213 }
214 break;
215 case M_RS:
216 if (record->event.pressed) {
217 layer_on(_RS);
218 update_tri_layer(_LW, _RS, _AD);
219 } else {
220 layer_off(_RS);
221 update_tri_layer(_LW, _RS, _AD);
222 }
223 break;
224 case M_BL:
125 if (record->event.pressed) { 225 if (record->event.pressed) {
126 register_code(KC_RSFT); 226 register_code(KC_RSFT);
127 #ifdef BACKLIGHT_ENABLE 227 #ifdef BACKLIGHT_ENABLE
@@ -134,3 +234,20 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
134 } 234 }
135 return MACRO_NONE; 235 return MACRO_NONE;
136}; 236};
237
238#ifdef AUDIO_ENABLE
239float start_up[][2] = {
240 {440.0*pow(2.0,(67)/12.0), 12},
241 {440.0*pow(2.0,(64)/12.0), 8},
242 {440.0*pow(2.0,(55)/12.0), 8},
243 {440.0*pow(2.0,(60)/12.0), 8},
244 {440.0*pow(2.0,(64)/12.0), 20}
245};
246#endif
247
248void matrix_init_user(void) {
249 #ifdef AUDIO_ENABLE
250 init_notes();
251 play_notes(&start_up, 5, false);
252 #endif
253}
diff --git a/keyboard/planck/keymaps/default/makefile.mk b/keyboard/planck/keymaps/default/makefile.mk
new file mode 100644
index 000000000..8cbec4a1f
--- /dev/null
+++ b/keyboard/planck/keymaps/default/makefile.mk
@@ -0,0 +1 @@
AUDIO_ENABLE = yes \ No newline at end of file
diff --git a/quantum/audio.c b/quantum/audio.c
index f29d941d7..50e5505fe 100644
--- a/quantum/audio.c
+++ b/quantum/audio.c
@@ -255,7 +255,12 @@ ISR(TIMER3_COMPA_vect) {
255 255
256 256
257 note_position++; 257 note_position++;
258 if (note_position >= note_length) { 258 bool end_of_note = false;
259 if (ICR3 > 0)
260 end_of_note = (note_position >= (note_length / ICR3 * 0xFFFF));
261 else
262 end_of_note = (note_position >= (note_length * 0x7FF));
263 if (end_of_note) {
259 current_note++; 264 current_note++;
260 if (current_note >= notes_length) { 265 if (current_note >= notes_length) {
261 if (notes_repeat) { 266 if (notes_repeat) {
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index ae6cddb34..3a00d36f0 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -33,11 +33,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
33 #include "audio.h" 33 #include "audio.h"
34 34
35 float goodbye[][2] = { 35 float goodbye[][2] = {
36 {440.0*pow(2.0,(67)/12.0), 400}, 36 {440.0*pow(2.0,(67)/12.0), 8},
37 {0, 50}, 37 {440.0*pow(2.0,(60)/12.0), 8},
38 {440.0*pow(2.0,(60)/12.0), 400}, 38 {440.0*pow(2.0,(55)/12.0), 12},
39 {0, 50},
40 {440.0*pow(2.0,(55)/12.0), 600},
41 }; 39 };
42#endif 40#endif
43 41
@@ -90,7 +88,7 @@ action_t action_for_key(uint8_t layer, keypos_t key)
90 action_t action; 88 action_t action;
91 clear_keyboard(); 89 clear_keyboard();
92 #ifdef AUDIO_ENABLE 90 #ifdef AUDIO_ENABLE
93 play_notes(&goodbye, 5, false); 91 play_notes(&goodbye, 3, false);
94 #endif 92 #endif
95 _delay_ms(250); 93 _delay_ms(250);
96 #ifdef ATREUS_ASTAR 94 #ifdef ATREUS_ASTAR
@@ -293,3 +291,11 @@ action_t keymap_func_to_action(uint16_t keycode)
293 // For FUNC without 8bit limit 291 // For FUNC without 8bit limit
294 return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) }; 292 return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) };
295} 293}
294
295void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
296 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
297 layer_on(layer3);
298 } else {
299 layer_off(layer3);
300 }
301}
diff --git a/quantum/keymap_common.h b/quantum/keymap_common.h
index 4a877d2a7..7452a1ff3 100644
--- a/quantum/keymap_common.h
+++ b/quantum/keymap_common.h
@@ -208,5 +208,9 @@ extern const uint16_t fn_actions[];
208#define UNICODE(n) (n | 0x8000) 208#define UNICODE(n) (n | 0x8000)
209#define UC(n) UNICODE(n) 209#define UC(n) UNICODE(n)
210 210
211// For tri-layer
212void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
213#define IS_LAYER_ON(layer) ((layer_state) & (1UL<<(layer)))
214#define IS_LAYER_OFF(layer) ((!layer_state) & (1UL<<(layer)))
211 215
212#endif 216#endif
diff --git a/quantum/quantum.mk b/quantum/quantum.mk
index de93af7e8..17bb50171 100644
--- a/quantum/quantum.mk
+++ b/quantum/quantum.mk
@@ -23,19 +23,19 @@ ifndef CUSTOM_MATRIX
23 SRC += $(QUANTUM_DIR)/matrix.c 23 SRC += $(QUANTUM_DIR)/matrix.c
24endif 24endif
25 25
26ifdef MIDI_ENABLE 26ifeq ($(strip $(MIDI_ENABLE)), yes)
27 SRC += $(QUANTUM_DIR)/keymap_midi.c 27 SRC += $(QUANTUM_DIR)/keymap_midi.c
28endif 28endif
29 29
30ifdef AUDIO_ENABLE 30ifeq ($(strip $(AUDIO_ENABLE)), yes)
31 SRC += $(QUANTUM_DIR)/audio.c 31 SRC += $(QUANTUM_DIR)/audio.c
32endif 32endif
33 33
34ifdef UNICODE_ENABLE 34ifeq ($(strip $(UNICODE_ENABLE)), yes)
35 SRC += $(QUANTUM_DIR)/keymap_unicode.c 35 SRC += $(QUANTUM_DIR)/keymap_unicode.c
36endif 36endif
37 37
38ifdef RGBLIGHT_ENABLE 38ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
39 SRC += $(QUANTUM_DIR)/light_ws2812.c 39 SRC += $(QUANTUM_DIR)/light_ws2812.c
40 SRC += $(QUANTUM_DIR)/rgblight.c 40 SRC += $(QUANTUM_DIR)/rgblight.c
41 OPT_DEFS += -DRGBLIGHT_ENABLE 41 OPT_DEFS += -DRGBLIGHT_ENABLE
diff --git a/tmk_core/common.mk b/tmk_core/common.mk
index 89c366f55..f8006c670 100644
--- a/tmk_core/common.mk
+++ b/tmk_core/common.mk
@@ -17,66 +17,67 @@ SRC += $(COMMON_DIR)/host.c \
17 17
18 18
19# Option modules 19# Option modules
20ifdef BOOTMAGIC_ENABLE 20ifeq ($(strip $(BOOTMAGIC_ENABLE)), yes)
21 SRC += $(COMMON_DIR)/bootmagic.c 21 SRC += $(COMMON_DIR)/bootmagic.c
22 SRC += $(COMMON_DIR)/avr/eeconfig.c 22 SRC += $(COMMON_DIR)/avr/eeconfig.c
23 OPT_DEFS += -DBOOTMAGIC_ENABLE 23 OPT_DEFS += -DBOOTMAGIC_ENABLE
24endif 24endif
25 25
26ifdef MOUSEKEY_ENABLE 26ifeq ($(strip $(MOUSEKEY_ENABLE)), yes)
27 SRC += $(COMMON_DIR)/mousekey.c 27 SRC += $(COMMON_DIR)/mousekey.c
28 OPT_DEFS += -DMOUSEKEY_ENABLE 28 OPT_DEFS += -DMOUSEKEY_ENABLE
29 OPT_DEFS += -DMOUSE_ENABLE 29 OPT_DEFS += -DMOUSE_ENABLE
30endif 30endif
31 31
32ifdef EXTRAKEY_ENABLE 32ifeq ($(strip $(EXTRAKEY_ENABLE)), yes)
33 OPT_DEFS += -DEXTRAKEY_ENABLE 33 OPT_DEFS += -DEXTRAKEY_ENABLE
34endif 34endif
35 35
36ifdef CONSOLE_ENABLE 36ifeq ($(strip $(CONSOLE_ENABLE)), yes)
37 OPT_DEFS += -DCONSOLE_ENABLE 37 OPT_DEFS += -DCONSOLE_ENABLE
38else 38else
39 OPT_DEFS += -DNO_PRINT 39 OPT_DEFS += -DNO_PRINT
40 OPT_DEFS += -DNO_DEBUG 40 OPT_DEFS += -DNO_DEBUG
41endif 41endif
42 42
43ifdef COMMAND_ENABLE 43ifeq ($(strip $(COMMAND_ENABLE)), yes)
44 SRC += $(COMMON_DIR)/command.c 44 SRC += $(COMMON_DIR)/command.c
45 OPT_DEFS += -DCOMMAND_ENABLE 45 OPT_DEFS += -DCOMMAND_ENABLE
46endif 46endif
47 47
48ifdef NKRO_ENABLE 48ifeq ($(strip $(NKRO_ENABLE)), yes)
49 OPT_DEFS += -DNKRO_ENABLE 49 OPT_DEFS += -DNKRO_ENABLE
50endif 50endif
51 51
52ifdef MIDI_ENABLE 52ifeq ($(strip $(MIDI_ENABLE)), yes)
53 OPT_DEFS += -DMIDI_ENABLE 53 OPT_DEFS += -DMIDI_ENABLE
54endif 54endif
55 55
56ifdef AUDIO_ENABLE 56ifeq ($(strip $(AUDIO_ENABLE)), yes)
57 OPT_DEFS += -DAUDIO_ENABLE 57 OPT_DEFS += -DAUDIO_ENABLE
58endif 58endif
59 59
60ifdef USB_6KRO_ENABLE 60ifeq ($(strip $(USB_6KRO_ENABLE)), yes)
61 OPT_DEFS += -DUSB_6KRO_ENABLE 61 OPT_DEFS += -DUSB_6KRO_ENABLE
62endif 62endif
63 63
64ifdef SLEEP_LED_ENABLE 64ifeq ($(strip $(SLEEP_LED_ENABLE)), yes)
65 SRC += $(COMMON_DIR)/sleep_led.c 65 SRC += $(COMMON_DIR)/sleep_led.c
66 OPT_DEFS += -DSLEEP_LED_ENABLE 66 OPT_DEFS += -DSLEEP_LED_ENABLE
67 OPT_DEFS += -DNO_SUSPEND_POWER_DOWN 67 OPT_DEFS += -DNO_SUSPEND_POWER_DOWN
68endif 68endif
69 69
70ifdef BACKLIGHT_ENABLE 70ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
71 SRC += $(COMMON_DIR)/backlight.c 71 SRC += $(COMMON_DIR)/backlight.c
72 SRC += $(COMMON_DIR)/avr/eeconfig.c
72 OPT_DEFS += -DBACKLIGHT_ENABLE 73 OPT_DEFS += -DBACKLIGHT_ENABLE
73endif 74endif
74 75
75ifdef BLUETOOTH_ENABLE 76ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
76 OPT_DEFS += -DBLUETOOTH_ENABLE 77 OPT_DEFS += -DBLUETOOTH_ENABLE
77endif 78endif
78 79
79ifdef KEYMAP_SECTION_ENABLE 80ifeq ($(strip $(KEYMAP_SECTION_ENABLE)), yes)
80 OPT_DEFS += -DKEYMAP_SECTION_ENABLE 81 OPT_DEFS += -DKEYMAP_SECTION_ENABLE
81 82
82 ifeq ($(strip $(MCU)),atmega32u2) 83 ifeq ($(strip $(MCU)),atmega32u2)
diff --git a/tmk_core/protocol/lufa.mk b/tmk_core/protocol/lufa.mk
index 4905760bb..9ac6298f1 100644
--- a/tmk_core/protocol/lufa.mk
+++ b/tmk_core/protocol/lufa.mk
@@ -17,7 +17,7 @@ LUFA_SRC = $(LUFA_DIR)/lufa.c \
17 $(LUFA_DIR)/descriptor.c \ 17 $(LUFA_DIR)/descriptor.c \
18 $(LUFA_SRC_USB) 18 $(LUFA_SRC_USB)
19 19
20ifdef MIDI_ENABLE 20ifeq ($(strip $(MIDI_ENABLE)), yes)
21 LUFA_SRC += $(LUFA_DIR)/midi/midi.c \ 21 LUFA_SRC += $(LUFA_DIR)/midi/midi.c \
22 $(LUFA_DIR)/midi/midi_device.c \ 22 $(LUFA_DIR)/midi/midi_device.c \
23 $(LUFA_DIR)/midi/bytequeue/bytequeue.c \ 23 $(LUFA_DIR)/midi/bytequeue/bytequeue.c \
@@ -25,7 +25,7 @@ ifdef MIDI_ENABLE
25 $(LUFA_SRC_USBCLASS) 25 $(LUFA_SRC_USBCLASS)
26endif 26endif
27 27
28ifdef BLUETOOTH_ENABLE 28ifeq ($(strip $(BLUETOOTH_ENABLE)), yes)
29 LUFA_SRC += $(LUFA_DIR)/bluetooth.c \ 29 LUFA_SRC += $(LUFA_DIR)/bluetooth.c \
30 $(TMK_DIR)/protocol/serial_uart.c 30 $(TMK_DIR)/protocol/serial_uart.c
31endif 31endif