aboutsummaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2017-04-03 21:06:40 -0400
committerGitHub <noreply@github.com>2017-04-03 21:06:40 -0400
commit27aa185222b709dc53a1478e46d6e04271dc199c (patch)
treefd6311aa6fb2b10fc01d2562e819817d798668b2 /quantum
parent4e51c1e3ca75c9abe45673866d026cc0f810a410 (diff)
parent3ac9259742bfd428f71c31dbf2bfedace2a7f91b (diff)
downloadqmk_firmware-27aa185222b709dc53a1478e46d6e04271dc199c.tar.gz
qmk_firmware-27aa185222b709dc53a1478e46d6e04271dc199c.zip
Merge branch 'master' into master
Diffstat (limited to 'quantum')
-rw-r--r--quantum/analog.c16
-rw-r--r--quantum/analog.h16
-rw-r--r--quantum/api.c18
-rw-r--r--quantum/api.h18
-rw-r--r--quantum/api/api_sysex.c15
-rw-r--r--quantum/api/api_sysex.h18
-rw-r--r--quantum/audio/audio.c337
-rw-r--r--quantum/audio/audio.h17
-rw-r--r--quantum/audio/audio_pwm.c15
-rw-r--r--quantum/audio/luts.c16
-rw-r--r--quantum/audio/luts.h18
-rw-r--r--quantum/audio/musical_notes.h18
-rw-r--r--quantum/audio/song_list.h54
-rw-r--r--quantum/audio/voices.c15
-rw-r--r--quantum/audio/voices.h17
-rw-r--r--quantum/audio/wave.h18
-rw-r--r--quantum/config_common.h16
-rw-r--r--quantum/dynamic_macro.h16
-rw-r--r--quantum/keycode_config.c18
-rw-r--r--quantum/keycode_config.h16
-rw-r--r--quantum/keymap.h2
-rw-r--r--quantum/keymap_common.c2
-rw-r--r--quantum/keymap_extras/keymap_bepo.h15
-rw-r--r--quantum/keymap_extras/keymap_canadian_multilingual.h15
-rw-r--r--quantum/keymap_extras/keymap_colemak.h15
-rw-r--r--quantum/keymap_extras/keymap_dvorak.h15
-rw-r--r--quantum/keymap_extras/keymap_dvp.h16
-rw-r--r--quantum/keymap_extras/keymap_fr_ch.h15
-rw-r--r--quantum/keymap_extras/keymap_french.h15
-rw-r--r--quantum/keymap_extras/keymap_french_osx.h17
-rw-r--r--quantum/keymap_extras/keymap_german.h16
-rw-r--r--quantum/keymap_extras/keymap_german_ch.h15
-rw-r--r--quantum/keymap_extras/keymap_german_osx.h15
-rw-r--r--quantum/keymap_extras/keymap_jp.h17
-rw-r--r--quantum/keymap_extras/keymap_neo2.h15
-rw-r--r--quantum/keymap_extras/keymap_nordic.h15
-rw-r--r--quantum/keymap_extras/keymap_norwegian.h15
-rw-r--r--quantum/keymap_extras/keymap_plover.h15
-rw-r--r--quantum/keymap_extras/keymap_russian.h77
-rw-r--r--quantum/keymap_extras/keymap_spanish.h15
-rw-r--r--quantum/keymap_extras/keymap_uk.h15
-rw-r--r--quantum/keymap_extras/keymap_unicode_cyrillic.h163
-rwxr-xr-xquantum/light_ws2812.c13
-rwxr-xr-xquantum/light_ws2812.h14
-rw-r--r--quantum/matrix.c3
-rw-r--r--quantum/pincontrol.h15
-rw-r--r--quantum/process_keycode/process_audio.c62
-rw-r--r--quantum/process_keycode/process_audio.h11
-rw-r--r--quantum/process_keycode/process_chording.c18
-rw-r--r--quantum/process_keycode/process_chording.h18
-rw-r--r--quantum/process_keycode/process_combo.c16
-rw-r--r--quantum/process_keycode/process_combo.h16
-rw-r--r--quantum/process_keycode/process_leader.c18
-rw-r--r--quantum/process_keycode/process_leader.h18
-rw-r--r--quantum/process_keycode/process_midi.c307
-rw-r--r--quantum/process_keycode/process_midi.h243
-rw-r--r--quantum/process_keycode/process_music.c133
-rw-r--r--quantum/process_keycode/process_music.h24
-rw-r--r--quantum/process_keycode/process_printer.c18
-rw-r--r--quantum/process_keycode/process_printer.h18
-rw-r--r--quantum/process_keycode/process_printer_bb.c18
-rw-r--r--quantum/process_keycode/process_tap_dance.c17
-rw-r--r--quantum/process_keycode/process_tap_dance.h15
-rw-r--r--quantum/process_keycode/process_ucis.c18
-rw-r--r--quantum/process_keycode/process_ucis.h16
-rw-r--r--quantum/process_keycode/process_unicode.c21
-rw-r--r--quantum/process_keycode/process_unicode.h15
-rw-r--r--quantum/process_keycode/process_unicode_common.c32
-rw-r--r--quantum/process_keycode/process_unicode_common.h18
-rw-r--r--quantum/process_keycode/process_unicodemap.c18
-rw-r--r--quantum/process_keycode/process_unicodemap.h18
-rw-r--r--quantum/quantum.c43
-rw-r--r--quantum/quantum.h22
-rw-r--r--quantum/quantum_keycodes.h259
-rw-r--r--quantum/rgblight.c15
-rw-r--r--quantum/rgblight.h15
-rw-r--r--quantum/serial_link/LICENSE2
-rw-r--r--quantum/template/Makefile17
-rw-r--r--quantum/template/config.h25
-rw-r--r--quantum/template/keymaps/default/Makefile22
-rw-r--r--quantum/template/keymaps/default/config.h18
-rw-r--r--quantum/template/keymaps/default/keymap.c17
-rw-r--r--quantum/template/rules.mk2
-rw-r--r--quantum/template/template.c15
-rw-r--r--quantum/template/template.h17
-rw-r--r--quantum/variable_trace.c16
-rw-r--r--quantum/variable_trace.h16
87 files changed, 2121 insertions, 783 deletions
diff --git a/quantum/analog.c b/quantum/analog.c
index 49b84ee0e..1ec38df75 100644
--- a/quantum/analog.c
+++ b/quantum/analog.c
@@ -1,3 +1,19 @@
1/* Copyright 2015 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1// Simple analog to digitial conversion 17// Simple analog to digitial conversion
2 18
3#include <avr/io.h> 19#include <avr/io.h>
diff --git a/quantum/analog.h b/quantum/analog.h
index 9b95a93be..8d93de7dc 100644
--- a/quantum/analog.h
+++ b/quantum/analog.h
@@ -1,3 +1,19 @@
1/* Copyright 2015 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef _analog_h_included__ 17#ifndef _analog_h_included__
2#define _analog_h_included__ 18#define _analog_h_included__
3 19
diff --git a/quantum/api.c b/quantum/api.c
index 6a7c0a433..52dfe23e1 100644
--- a/quantum/api.c
+++ b/quantum/api.c
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "api.h" 17#include "api.h"
2#include "quantum.h" 18#include "quantum.h"
3 19
@@ -176,4 +192,4 @@ void process_api(uint16_t length, uint8_t * data) {
176 // #endif 192 // #endif
177 } 193 }
178 194
179} \ No newline at end of file 195}
diff --git a/quantum/api.h b/quantum/api.h
index 00dcdb895..efc0ddca1 100644
--- a/quantum/api.h
+++ b/quantum/api.h
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef _API_H_ 17#ifndef _API_H_
2#define _API_H_ 18#define _API_H_
3 19
@@ -56,4 +72,4 @@ bool process_api_keyboard(uint8_t length, uint8_t * data);
56__attribute__ ((weak)) 72__attribute__ ((weak))
57bool process_api_user(uint8_t length, uint8_t * data); 73bool process_api_user(uint8_t length, uint8_t * data);
58 74
59#endif \ No newline at end of file 75#endif
diff --git a/quantum/api/api_sysex.c b/quantum/api/api_sysex.c
index 868f854b9..6a2ee9012 100644
--- a/quantum/api/api_sysex.c
+++ b/quantum/api/api_sysex.c
@@ -1,3 +1,18 @@
1/* Copyright 2016 Jack Humbert, Fred Sundvik
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include "api_sysex.h" 16#include "api_sysex.h"
2#include "sysex_tools.h" 17#include "sysex_tools.h"
3#include "print.h" 18#include "print.h"
diff --git a/quantum/api/api_sysex.h b/quantum/api/api_sysex.h
index b947b60e5..a23f00f57 100644
--- a/quantum/api/api_sysex.h
+++ b/quantum/api/api_sysex.h
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef _API_SYSEX_H_ 17#ifndef _API_SYSEX_H_
2#define _API_SYSEX_H_ 18#define _API_SYSEX_H_
3 19
@@ -7,4 +23,4 @@ void send_bytes_sysex(uint8_t message_type, uint8_t data_type, uint8_t * bytes,
7 23
8#define SEND_BYTES(mt, dt, b, l) send_bytes_sysex(mt, dt, b, l) 24#define SEND_BYTES(mt, dt, b, l) send_bytes_sysex(mt, dt, b, l)
9 25
10#endif \ No newline at end of file 26#endif
diff --git a/quantum/audio/audio.c b/quantum/audio/audio.c
index 2a315fd16..597073611 100644
--- a/quantum/audio/audio.c
+++ b/quantum/audio/audio.c
@@ -1,3 +1,18 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include <stdio.h> 16#include <stdio.h>
2#include <string.h> 17#include <string.h>
3//#include <math.h> 18//#include <math.h>
@@ -89,15 +104,15 @@ void audio_init()
89 } 104 }
90 audio_config.raw = eeconfig_read_audio(); 105 audio_config.raw = eeconfig_read_audio();
91 106
92 // Set port PC6 (OC3A and /OC4A) as output 107 // Set port PC6 (OC3A and /OC4A) as output
93 DDRC |= _BV(PORTC6); 108 DDRC |= _BV(PORTC6);
94 109
95 DISABLE_AUDIO_COUNTER_3_ISR; 110 DISABLE_AUDIO_COUNTER_3_ISR;
96 111
97 // TCCR3A / TCCR3B: Timer/Counter #3 Control Registers 112 // TCCR3A / TCCR3B: Timer/Counter #3 Control Registers
98 // Compare Output Mode (COM3An) = 0b00 = Normal port operation, OC3A disconnected from PC6 113 // Compare Output Mode (COM3An) = 0b00 = Normal port operation, OC3A disconnected from PC6
99 // Waveform Generation Mode (WGM3n) = 0b1110 = Fast PWM Mode 14 (Period = ICR3, Duty Cycle = OCR3A) 114 // Waveform Generation Mode (WGM3n) = 0b1110 = Fast PWM Mode 14 (Period = ICR3, Duty Cycle = OCR3A)
100 // Clock Select (CS3n) = 0b010 = Clock / 8 115 // Clock Select (CS3n) = 0b010 = Clock / 8
101 TCCR3A = (0 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30); 116 TCCR3A = (0 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30);
102 TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30); 117 TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30);
103 118
@@ -106,6 +121,8 @@ void audio_init()
106 121
107void stop_all_notes() 122void stop_all_notes()
108{ 123{
124 dprintf("audio stop all notes");
125
109 if (!audio_initialized) { 126 if (!audio_initialized) {
110 audio_init(); 127 audio_init();
111 } 128 }
@@ -128,6 +145,8 @@ void stop_all_notes()
128 145
129void stop_note(float freq) 146void stop_note(float freq)
130{ 147{
148 dprintf("audio stop note freq=%d", (int)freq);
149
131 if (playing_note) { 150 if (playing_note) {
132 if (!audio_initialized) { 151 if (!audio_initialized) {
133 audio_init(); 152 audio_init();
@@ -183,159 +202,161 @@ float vibrato(float average_freq) {
183 202
184ISR(TIMER3_COMPA_vect) 203ISR(TIMER3_COMPA_vect)
185{ 204{
186 float freq; 205 float freq;
187 206
188 if (playing_note) { 207 if (playing_note) {
189 if (voices > 0) { 208 if (voices > 0) {
190 if (polyphony_rate > 0) { 209 if (polyphony_rate > 0) {
191 if (voices > 1) { 210 if (voices > 1) {
192 voice_place %= voices; 211 voice_place %= voices;
193 if (place++ > (frequencies[voice_place] / polyphony_rate / CPU_PRESCALER)) { 212 if (place++ > (frequencies[voice_place] / polyphony_rate / CPU_PRESCALER)) {
194 voice_place = (voice_place + 1) % voices; 213 voice_place = (voice_place + 1) % voices;
195 place = 0.0; 214 place = 0.0;
196 } 215 }
197 } 216 }
198 217
199 #ifdef VIBRATO_ENABLE 218 #ifdef VIBRATO_ENABLE
200 if (vibrato_strength > 0) { 219 if (vibrato_strength > 0) {
201 freq = vibrato(frequencies[voice_place]); 220 freq = vibrato(frequencies[voice_place]);
202 } else { 221 } else {
203 freq = frequencies[voice_place]; 222 freq = frequencies[voice_place];
204 } 223 }
205 #else 224 #else
206 freq = frequencies[voice_place]; 225 freq = frequencies[voice_place];
207 #endif 226 #endif
208 } else { 227 } else {
209 if (glissando) { 228 if (glissando) {
210 if (frequency != 0 && frequency < frequencies[voices - 1] && frequency < frequencies[voices - 1] * pow(2, -440/frequencies[voices - 1]/12/2)) { 229 if (frequency != 0 && frequency < frequencies[voices - 1] && frequency < frequencies[voices - 1] * pow(2, -440/frequencies[voices - 1]/12/2)) {
211 frequency = frequency * pow(2, 440/frequency/12/2); 230 frequency = frequency * pow(2, 440/frequency/12/2);
212 } else if (frequency != 0 && frequency > frequencies[voices - 1] && frequency > frequencies[voices - 1] * pow(2, 440/frequencies[voices - 1]/12/2)) { 231 } else if (frequency != 0 && frequency > frequencies[voices - 1] && frequency > frequencies[voices - 1] * pow(2, 440/frequencies[voices - 1]/12/2)) {
213 frequency = frequency * pow(2, -440/frequency/12/2); 232 frequency = frequency * pow(2, -440/frequency/12/2);
214 } else { 233 } else {
215 frequency = frequencies[voices - 1]; 234 frequency = frequencies[voices - 1];
216 } 235 }
217 } else { 236 } else {
218 frequency = frequencies[voices - 1]; 237 frequency = frequencies[voices - 1];
219 } 238 }
220 239
221 #ifdef VIBRATO_ENABLE 240 #ifdef VIBRATO_ENABLE
222 if (vibrato_strength > 0) { 241 if (vibrato_strength > 0) {
223 freq = vibrato(frequency); 242 freq = vibrato(frequency);
224 } else { 243 } else {
225 freq = frequency; 244 freq = frequency;
226 } 245 }
227 #else 246 #else
228 freq = frequency; 247 freq = frequency;
229 #endif 248 #endif
230 } 249 }
231 250
232 if (envelope_index < 65535) { 251 if (envelope_index < 65535) {
233 envelope_index++; 252 envelope_index++;
234 } 253 }
235 254
236 freq = voice_envelope(freq); 255 freq = voice_envelope(freq);
237 256
238 if (freq < 30.517578125) { 257 if (freq < 30.517578125) {
239 freq = 30.52; 258 freq = 30.52;
240 } 259 }
241 260
242 TIMER_3_PERIOD = (uint16_t)(((float)F_CPU) / (freq * CPU_PRESCALER)); 261 TIMER_3_PERIOD = (uint16_t)(((float)F_CPU) / (freq * CPU_PRESCALER));
243 TIMER_3_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre); 262 TIMER_3_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre);
244 } 263 }
245 } 264 }
246 265
247 if (playing_notes) { 266 if (playing_notes) {
248 if (note_frequency > 0) { 267 if (note_frequency > 0) {
249 #ifdef VIBRATO_ENABLE 268 #ifdef VIBRATO_ENABLE
250 if (vibrato_strength > 0) { 269 if (vibrato_strength > 0) {
251 freq = vibrato(note_frequency); 270 freq = vibrato(note_frequency);
252 } else { 271 } else {
253 freq = note_frequency; 272 freq = note_frequency;
254 } 273 }
255 #else 274 #else
256 freq = note_frequency; 275 freq = note_frequency;
257 #endif 276 #endif
258 277
259 if (envelope_index < 65535) { 278 if (envelope_index < 65535) {
260 envelope_index++; 279 envelope_index++;
261 } 280 }
262 freq = voice_envelope(freq); 281 freq = voice_envelope(freq);
263 282
264 TIMER_3_PERIOD = (uint16_t)(((float)F_CPU) / (freq * CPU_PRESCALER)); 283 TIMER_3_PERIOD = (uint16_t)(((float)F_CPU) / (freq * CPU_PRESCALER));
265 TIMER_3_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre); 284 TIMER_3_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (freq * CPU_PRESCALER)) * note_timbre);
266 } else { 285 } else {
267 TIMER_3_PERIOD = 0; 286 TIMER_3_PERIOD = 0;
268 TIMER_3_DUTY_CYCLE = 0; 287 TIMER_3_DUTY_CYCLE = 0;
269 } 288 }
270 289
271 note_position++; 290 note_position++;
272 bool end_of_note = false; 291 bool end_of_note = false;
273 if (TIMER_3_PERIOD > 0) { 292 if (TIMER_3_PERIOD > 0) {
274 end_of_note = (note_position >= (note_length / TIMER_3_PERIOD * 0xFFFF)); 293 end_of_note = (note_position >= (note_length / TIMER_3_PERIOD * 0xFFFF));
275 } else { 294 } else {
276 end_of_note = (note_position >= (note_length * 0x7FF)); 295 end_of_note = (note_position >= (note_length * 0x7FF));
277 } 296 }
278 297
279 if (end_of_note) { 298 if (end_of_note) {
280 current_note++; 299 current_note++;
281 if (current_note >= notes_count) { 300 if (current_note >= notes_count) {
282 if (notes_repeat) { 301 if (notes_repeat) {
283 current_note = 0; 302 current_note = 0;
284 } else { 303 } else {
285 DISABLE_AUDIO_COUNTER_3_ISR; 304 DISABLE_AUDIO_COUNTER_3_ISR;
286 DISABLE_AUDIO_COUNTER_3_OUTPUT; 305 DISABLE_AUDIO_COUNTER_3_OUTPUT;
287 playing_notes = false; 306 playing_notes = false;
288 return; 307 return;
289 } 308 }
290 } 309 }
291 if (!note_resting && (notes_rest > 0)) { 310 if (!note_resting && (notes_rest > 0)) {
292 note_resting = true; 311 note_resting = true;
293 note_frequency = 0; 312 note_frequency = 0;
294 note_length = notes_rest; 313 note_length = notes_rest;
295 current_note--; 314 current_note--;
296 } else { 315 } else {
297 note_resting = false; 316 note_resting = false;
298 envelope_index = 0; 317 envelope_index = 0;
299 note_frequency = (*notes_pointer)[current_note][0]; 318 note_frequency = (*notes_pointer)[current_note][0];
300 note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100); 319 note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
301 } 320 }
302 321
303 note_position = 0; 322 note_position = 0;
304 } 323 }
305 } 324 }
306 325
307 if (!audio_config.enable) { 326 if (!audio_config.enable) {
308 playing_notes = false; 327 playing_notes = false;
309 playing_note = false; 328 playing_note = false;
310 } 329 }
311} 330}
312 331
313void play_note(float freq, int vol) { 332void play_note(float freq, int vol) {
314 333
334 dprintf("audio play note freq=%d vol=%d", (int)freq, vol);
335
315 if (!audio_initialized) { 336 if (!audio_initialized) {
316 audio_init(); 337 audio_init();
317 } 338 }
318 339
319 if (audio_config.enable && voices < 8) { 340 if (audio_config.enable && voices < 8) {
320 DISABLE_AUDIO_COUNTER_3_ISR; 341 DISABLE_AUDIO_COUNTER_3_ISR;
321 342
322 // Cancel notes if notes are playing 343 // Cancel notes if notes are playing
323 if (playing_notes) 344 if (playing_notes)
324 stop_all_notes(); 345 stop_all_notes();
325 346
326 playing_note = true; 347 playing_note = true;
327 348
328 envelope_index = 0; 349 envelope_index = 0;
329 350
330 if (freq > 0) { 351 if (freq > 0) {
331 frequencies[voices] = freq; 352 frequencies[voices] = freq;
332 volumes[voices] = vol; 353 volumes[voices] = vol;
333 voices++; 354 voices++;
334 } 355 }
335 356
336 ENABLE_AUDIO_COUNTER_3_ISR; 357 ENABLE_AUDIO_COUNTER_3_ISR;
337 ENABLE_AUDIO_COUNTER_3_OUTPUT; 358 ENABLE_AUDIO_COUNTER_3_OUTPUT;
338 } 359 }
339 360
340} 361}
341 362
@@ -346,37 +367,37 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest)
346 audio_init(); 367 audio_init();
347 } 368 }
348 369
349 if (audio_config.enable) { 370 if (audio_config.enable) {
350 371
351 DISABLE_AUDIO_COUNTER_3_ISR; 372 DISABLE_AUDIO_COUNTER_3_ISR;
352 373
353 // Cancel note if a note is playing 374 // Cancel note if a note is playing
354 if (playing_note) 375 if (playing_note)
355 stop_all_notes(); 376 stop_all_notes();
356 377
357 playing_notes = true; 378 playing_notes = true;
358 379
359 notes_pointer = np; 380 notes_pointer = np;
360 notes_count = n_count; 381 notes_count = n_count;
361 notes_repeat = n_repeat; 382 notes_repeat = n_repeat;
362 notes_rest = n_rest; 383 notes_rest = n_rest;
363 384
364 place = 0; 385 place = 0;
365 current_note = 0; 386 current_note = 0;
366 387
367 note_frequency = (*notes_pointer)[current_note][0]; 388 note_frequency = (*notes_pointer)[current_note][0];
368 note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100); 389 note_length = ((*notes_pointer)[current_note][1] / 4) * (((float)note_tempo) / 100);
369 note_position = 0; 390 note_position = 0;
370 391
371 392
372 ENABLE_AUDIO_COUNTER_3_ISR; 393 ENABLE_AUDIO_COUNTER_3_ISR;
373 ENABLE_AUDIO_COUNTER_3_OUTPUT; 394 ENABLE_AUDIO_COUNTER_3_OUTPUT;
374 } 395 }
375 396
376} 397}
377 398
378bool is_playing_notes(void) { 399bool is_playing_notes(void) {
379 return playing_notes; 400 return playing_notes;
380} 401}
381 402
382bool is_audio_on(void) { 403bool is_audio_on(void) {
diff --git a/quantum/audio/audio.h b/quantum/audio/audio.h
index 47f326ea0..27fdc2ab6 100644
--- a/quantum/audio/audio.h
+++ b/quantum/audio/audio.h
@@ -1,3 +1,18 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef AUDIO_H 16#ifndef AUDIO_H
2#define AUDIO_H 17#define AUDIO_H
3 18
@@ -88,4 +103,4 @@ void play_notes(float (*np)[][2], uint16_t n_count, bool n_repeat, float n_rest)
88 103
89bool is_playing_notes(void); 104bool is_playing_notes(void);
90 105
91#endif \ No newline at end of file 106#endif
diff --git a/quantum/audio/audio_pwm.c b/quantum/audio/audio_pwm.c
index f820eec1b..ded86edee 100644
--- a/quantum/audio/audio_pwm.c
+++ b/quantum/audio/audio_pwm.c
@@ -1,3 +1,18 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include <stdio.h> 16#include <stdio.h>
2#include <string.h> 17#include <string.h>
3//#include <math.h> 18//#include <math.h>
diff --git a/quantum/audio/luts.c b/quantum/audio/luts.c
index 9f3de9a05..57f2d5924 100644
--- a/quantum/audio/luts.c
+++ b/quantum/audio/luts.c
@@ -1,3 +1,19 @@
1/* Copyright 2016 IBNobody
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include <avr/io.h> 17#include <avr/io.h>
2#include <avr/interrupt.h> 18#include <avr/interrupt.h>
3#include <avr/pgmspace.h> 19#include <avr/pgmspace.h>
diff --git a/quantum/audio/luts.h b/quantum/audio/luts.h
index 7df3078a7..155e34e88 100644
--- a/quantum/audio/luts.h
+++ b/quantum/audio/luts.h
@@ -1,3 +1,19 @@
1/* Copyright 2016 IBNobody
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include <avr/io.h> 17#include <avr/io.h>
2#include <avr/interrupt.h> 18#include <avr/interrupt.h>
3#include <avr/pgmspace.h> 19#include <avr/pgmspace.h>
@@ -12,4 +28,4 @@
12extern const float vibrato_lut[VIBRATO_LUT_LENGTH]; 28extern const float vibrato_lut[VIBRATO_LUT_LENGTH];
13extern const uint16_t frequency_lut[FREQUENCY_LUT_LENGTH]; 29extern const uint16_t frequency_lut[FREQUENCY_LUT_LENGTH];
14 30
15#endif /* LUTS_H */ \ No newline at end of file 31#endif /* LUTS_H */
diff --git a/quantum/audio/musical_notes.h b/quantum/audio/musical_notes.h
index b08d16a6f..a3aaa2f19 100644
--- a/quantum/audio/musical_notes.h
+++ b/quantum/audio/musical_notes.h
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef MUSICAL_NOTES_H 17#ifndef MUSICAL_NOTES_H
2#define MUSICAL_NOTES_H 18#define MUSICAL_NOTES_H
3 19
@@ -214,4 +230,4 @@
214#define NOTE_BF8 NOTE_AS8 230#define NOTE_BF8 NOTE_AS8
215 231
216 232
217#endif \ No newline at end of file 233#endif
diff --git a/quantum/audio/song_list.h b/quantum/audio/song_list.h
index 8022ca672..db2d1a94c 100644
--- a/quantum/audio/song_list.h
+++ b/quantum/audio/song_list.h
@@ -1,8 +1,27 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include "musical_notes.h" 16#include "musical_notes.h"
2 17
3#ifndef SONG_LIST_H 18#ifndef SONG_LIST_H
4#define SONG_LIST_H 19#define SONG_LIST_H
5 20
21#define COIN_SOUND \
22 E__NOTE(_A5 ),\
23 HD_NOTE(_E6 ),
24
6#define ODE_TO_JOY \ 25#define ODE_TO_JOY \
7 Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \ 26 Q__NOTE(_E4), Q__NOTE(_E4), Q__NOTE(_F4), Q__NOTE(_G4), \
8 Q__NOTE(_G4), Q__NOTE(_F4), Q__NOTE(_E4), Q__NOTE(_D4), \ 27 Q__NOTE(_G4), Q__NOTE(_F4), Q__NOTE(_E4), Q__NOTE(_D4), \
@@ -122,4 +141,39 @@
122 E__NOTE(_E5), \ 141 E__NOTE(_E5), \
123 E__NOTE(_D5), 142 E__NOTE(_D5),
124 143
144#define UNICODE_WINDOWS \
145 E__NOTE(_B5), \
146 S__NOTE(_E6),
147
148#define UNICODE_LINUX \
149 E__NOTE(_E6), \
150 S__NOTE(_B5),
151
152#define COIN_SOUND \
153 E__NOTE(_A5 ), \
154 HD_NOTE(_E6 ),
155
156#define ONE_UP_SOUND \
157 Q__NOTE(_E6 ), \
158 Q__NOTE(_G6 ), \
159 Q__NOTE(_E7 ), \
160 Q__NOTE(_C7 ), \
161 Q__NOTE(_D7 ), \
162 Q__NOTE(_G7 ),
163
164#define SONIC_RING \
165 E__NOTE(_E6), \
166 E__NOTE(_G6), \
167 HD_NOTE(_C7),
168
169#define ZELDA_PUZZLE \
170 Q__NOTE(_G5), \
171 Q__NOTE(_FS5), \
172 Q__NOTE(_DS5), \
173 Q__NOTE(_A4), \
174 Q__NOTE(_GS4), \
175 Q__NOTE(_E5), \
176 Q__NOTE(_GS5), \
177 HD_NOTE(_C6),
178
125#endif 179#endif
diff --git a/quantum/audio/voices.c b/quantum/audio/voices.c
index c2edb75f0..54ebd423b 100644
--- a/quantum/audio/voices.c
+++ b/quantum/audio/voices.c
@@ -1,3 +1,18 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include "voices.h" 16#include "voices.h"
2#include "audio.h" 17#include "audio.h"
3#include "stdlib.h" 18#include "stdlib.h"
diff --git a/quantum/audio/voices.h b/quantum/audio/voices.h
index 52f7e006d..9403a6b5e 100644
--- a/quantum/audio/voices.h
+++ b/quantum/audio/voices.h
@@ -1,3 +1,18 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include <stdint.h> 16#include <stdint.h>
2#include <stdbool.h> 17#include <stdbool.h>
3#include <avr/io.h> 18#include <avr/io.h>
@@ -32,4 +47,4 @@ void set_voice(voice_type v);
32void voice_iterate(void); 47void voice_iterate(void);
33void voice_deiterate(void); 48void voice_deiterate(void);
34 49
35#endif \ No newline at end of file 50#endif
diff --git a/quantum/audio/wave.h b/quantum/audio/wave.h
index 6ebc34851..f15615dd1 100644
--- a/quantum/audio/wave.h
+++ b/quantum/audio/wave.h
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include <avr/io.h> 17#include <avr/io.h>
2#include <avr/interrupt.h> 18#include <avr/interrupt.h>
3#include <avr/pgmspace.h> 19#include <avr/pgmspace.h>
@@ -262,4 +278,4 @@ const uint8_t sinewave[] PROGMEM= //2048 values
2620x76,0x77,0x77,0x77,0x78,0x78,0x78,0x79, 2780x76,0x77,0x77,0x77,0x78,0x78,0x78,0x79,
2630x79,0x7a,0x7a,0x7a,0x7b,0x7b,0x7c,0x7c, 2790x79,0x7a,0x7a,0x7a,0x7b,0x7b,0x7c,0x7c,
2640x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f 2800x7c,0x7d,0x7d,0x7e,0x7e,0x7e,0x7f,0x7f
265}; \ No newline at end of file 281};
diff --git a/quantum/config_common.h b/quantum/config_common.h
index 28f68b9c7..c88e02d91 100644
--- a/quantum/config_common.h
+++ b/quantum/config_common.h
@@ -1,3 +1,19 @@
1/* Copyright 2015-2017 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef CONFIG_DEFINITIONS_H 17#ifndef CONFIG_DEFINITIONS_H
2#define CONFIG_DEFINITIONS_H 18#define CONFIG_DEFINITIONS_H
3 19
diff --git a/quantum/dynamic_macro.h b/quantum/dynamic_macro.h
index e6dbc5b9c..64093f293 100644
--- a/quantum/dynamic_macro.h
+++ b/quantum/dynamic_macro.h
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1/* Author: Wojciech Siewierski < wojciech dot siewierski at onet dot pl > */ 17/* Author: Wojciech Siewierski < wojciech dot siewierski at onet dot pl > */
2#ifndef DYNAMIC_MACROS_H 18#ifndef DYNAMIC_MACROS_H
3#define DYNAMIC_MACROS_H 19#define DYNAMIC_MACROS_H
diff --git a/quantum/keycode_config.c b/quantum/keycode_config.c
index 6d90781a1..4f7bc525e 100644
--- a/quantum/keycode_config.c
+++ b/quantum/keycode_config.c
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "keycode_config.h" 17#include "keycode_config.h"
2 18
3extern keymap_config_t keymap_config; 19extern keymap_config_t keymap_config;
@@ -71,4 +87,4 @@ uint16_t keycode_config(uint16_t keycode) {
71 default: 87 default:
72 return keycode; 88 return keycode;
73 } 89 }
74} \ No newline at end of file 90}
diff --git a/quantum/keycode_config.h b/quantum/keycode_config.h
index c15b0d32f..293fefecf 100644
--- a/quantum/keycode_config.h
+++ b/quantum/keycode_config.h
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "eeconfig.h" 17#include "eeconfig.h"
2#include "keycode.h" 18#include "keycode.h"
3 19
diff --git a/quantum/keymap.h b/quantum/keymap.h
index c000d2da8..5d64be19c 100644
--- a/quantum/keymap.h
+++ b/quantum/keymap.h
@@ -1,5 +1,5 @@
1/* 1/*
2Copyright 2012,2013 Jun Wako <wakojun@gmail.com> 2Copyright 2012-2016 Jun Wako <wakojun@gmail.com>
3 3
4This program is free software: you can redistribute it and/or modify 4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by 5it under the terms of the GNU General Public License as published by
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index 002eabd85..6cf4f031f 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -1,5 +1,5 @@
1/* 1/*
2Copyright 2012,2013 Jun Wako <wakojun@gmail.com> 2Copyright 2012-2017 Jun Wako <wakojun@gmail.com>
3 3
4This program is free software: you can redistribute it and/or modify 4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by 5it under the terms of the GNU General Public License as published by
diff --git a/quantum/keymap_extras/keymap_bepo.h b/quantum/keymap_extras/keymap_bepo.h
index e5ef39552..013559e96 100644
--- a/quantum/keymap_extras/keymap_bepo.h
+++ b/quantum/keymap_extras/keymap_bepo.h
@@ -1,3 +1,18 @@
1/* Copyright 2016 Didier Loiseau
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1/* Keymap macros for the French BÉPO layout - http://bepo.fr */ 16/* Keymap macros for the French BÉPO layout - http://bepo.fr */
2#ifndef KEYMAP_BEPO_H 17#ifndef KEYMAP_BEPO_H
3#define KEYMAP_BEPO_H 18#define KEYMAP_BEPO_H
diff --git a/quantum/keymap_extras/keymap_canadian_multilingual.h b/quantum/keymap_extras/keymap_canadian_multilingual.h
index 0bc20c7b9..1d45bee32 100644
--- a/quantum/keymap_extras/keymap_canadian_multilingual.h
+++ b/quantum/keymap_extras/keymap_canadian_multilingual.h
@@ -1,3 +1,18 @@
1/* Copyright 2016 Didier Loiseau
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef KEYMAP_CANADIAN_MULTILINGUAG_H 16#ifndef KEYMAP_CANADIAN_MULTILINGUAG_H
2#define KEYMAP_CANADIAN_MULTILINGUAG_H 17#define KEYMAP_CANADIAN_MULTILINGUAG_H
3 18
diff --git a/quantum/keymap_extras/keymap_colemak.h b/quantum/keymap_extras/keymap_colemak.h
index b8d615748..2d3f9c06a 100644
--- a/quantum/keymap_extras/keymap_colemak.h
+++ b/quantum/keymap_extras/keymap_colemak.h
@@ -1,3 +1,18 @@
1/* Copyright 2015-2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef KEYMAP_COLEMAK_H 16#ifndef KEYMAP_COLEMAK_H
2#define KEYMAP_COLEMAK_H 17#define KEYMAP_COLEMAK_H
3 18
diff --git a/quantum/keymap_extras/keymap_dvorak.h b/quantum/keymap_extras/keymap_dvorak.h
index a0feed850..b1d5604ba 100644
--- a/quantum/keymap_extras/keymap_dvorak.h
+++ b/quantum/keymap_extras/keymap_dvorak.h
@@ -1,3 +1,18 @@
1/* Copyright 2015-2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef KEYMAP_DVORAK_H 16#ifndef KEYMAP_DVORAK_H
2#define KEYMAP_DVORAK_H 17#define KEYMAP_DVORAK_H
3 18
diff --git a/quantum/keymap_extras/keymap_dvp.h b/quantum/keymap_extras/keymap_dvp.h
index 83f49a52b..50e2d1f46 100644
--- a/quantum/keymap_extras/keymap_dvp.h
+++ b/quantum/keymap_extras/keymap_dvp.h
@@ -1,3 +1,19 @@
1/* Copyright 2016 Artyom Mironov
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef KEYMAP_DVP_H 17#ifndef KEYMAP_DVP_H
2#define KEYMAP_DVP_H 18#define KEYMAP_DVP_H
3 19
diff --git a/quantum/keymap_extras/keymap_fr_ch.h b/quantum/keymap_extras/keymap_fr_ch.h
index 87d4bb24c..c0ca832a6 100644
--- a/quantum/keymap_extras/keymap_fr_ch.h
+++ b/quantum/keymap_extras/keymap_fr_ch.h
@@ -1,3 +1,18 @@
1/* Copyright 2016 Vincent Pochet
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef KEYMAP_FR_CH 16#ifndef KEYMAP_FR_CH
2#define KEYMAP_FR_CH 17#define KEYMAP_FR_CH
3 18
diff --git a/quantum/keymap_extras/keymap_french.h b/quantum/keymap_extras/keymap_french.h
index 401bbdf64..3308dc5f7 100644
--- a/quantum/keymap_extras/keymap_french.h
+++ b/quantum/keymap_extras/keymap_french.h
@@ -1,3 +1,18 @@
1/* Copyright 2015-2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef KEYMAP_FRENCH_H 16#ifndef KEYMAP_FRENCH_H
2#define KEYMAP_FRENCH_H 17#define KEYMAP_FRENCH_H
3 18
diff --git a/quantum/keymap_extras/keymap_french_osx.h b/quantum/keymap_extras/keymap_french_osx.h
index 004d73ee2..ecade3fe9 100644
--- a/quantum/keymap_extras/keymap_french_osx.h
+++ b/quantum/keymap_extras/keymap_french_osx.h
@@ -1,3 +1,18 @@
1/* Copyright 2016 Sébastien Pérochon
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef KEYMAP_FRENCH_OSX_H 16#ifndef KEYMAP_FRENCH_OSX_H
2#define KEYMAP_FRENCH_OSX_H 17#define KEYMAP_FRENCH_OSX_H
3 18
@@ -74,4 +89,4 @@
74#define FR_PIPE LSFT(LALT(KC_L)) 89#define FR_PIPE LSFT(LALT(KC_L))
75#define FR_BSLS LSFT(LALT(FR_COLN)) 90#define FR_BSLS LSFT(LALT(FR_COLN))
76 91
77#endif \ No newline at end of file 92#endif
diff --git a/quantum/keymap_extras/keymap_german.h b/quantum/keymap_extras/keymap_german.h
index 7e2e0ed44..e007c26ef 100644
--- a/quantum/keymap_extras/keymap_german.h
+++ b/quantum/keymap_extras/keymap_german.h
@@ -1,3 +1,19 @@
1/* Copyright 2015-2016 Matthias Schmidtt
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef KEYMAP_GERMAN 17#ifndef KEYMAP_GERMAN
2#define KEYMAP_GERMAN 18#define KEYMAP_GERMAN
3 19
diff --git a/quantum/keymap_extras/keymap_german_ch.h b/quantum/keymap_extras/keymap_german_ch.h
index b66d582a4..8332e00af 100644
--- a/quantum/keymap_extras/keymap_german_ch.h
+++ b/quantum/keymap_extras/keymap_german_ch.h
@@ -1,3 +1,18 @@
1/* Copyright 2016 heartsekai
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef KEYMAP_SWISS_GERMAN 16#ifndef KEYMAP_SWISS_GERMAN
2#define KEYMAP_SWISS_GERMAN 17#define KEYMAP_SWISS_GERMAN
3 18
diff --git a/quantum/keymap_extras/keymap_german_osx.h b/quantum/keymap_extras/keymap_german_osx.h
index f63f06618..798bb7579 100644
--- a/quantum/keymap_extras/keymap_german_osx.h
+++ b/quantum/keymap_extras/keymap_german_osx.h
@@ -1,3 +1,18 @@
1/* Copyright 2016 Stephen Bösebeck
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef KEYMAP_GERMAN_OSX 16#ifndef KEYMAP_GERMAN_OSX
2#define KEYMAP_GERMAN_OSX 17#define KEYMAP_GERMAN_OSX
3 18
diff --git a/quantum/keymap_extras/keymap_jp.h b/quantum/keymap_extras/keymap_jp.h
index e81b5952e..fb74bce8d 100644
--- a/quantum/keymap_extras/keymap_jp.h
+++ b/quantum/keymap_extras/keymap_jp.h
@@ -1,4 +1,19 @@
1/* JP106-layout (Japanese Standard) 1/* Copyright 2016 h-youhei
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * JP106-layout (Japanese Standard)
2 * 17 *
3 * For more information, see 18 * For more information, see
4 * http://www2d.biglobe.ne.jp/~msyk/keyboard/layout/usbkeycode.html 19 * http://www2d.biglobe.ne.jp/~msyk/keyboard/layout/usbkeycode.html
diff --git a/quantum/keymap_extras/keymap_neo2.h b/quantum/keymap_extras/keymap_neo2.h
index 80439af34..174f4a6ee 100644
--- a/quantum/keymap_extras/keymap_neo2.h
+++ b/quantum/keymap_extras/keymap_neo2.h
@@ -1,3 +1,18 @@
1/* Copyright 2016 Matthias Schmitt
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef KEYMAP_NEO2 16#ifndef KEYMAP_NEO2
2#define KEYMAP_NEO2 17#define KEYMAP_NEO2
3 18
diff --git a/quantum/keymap_extras/keymap_nordic.h b/quantum/keymap_extras/keymap_nordic.h
index 9b0ef35ca..6b34db558 100644
--- a/quantum/keymap_extras/keymap_nordic.h
+++ b/quantum/keymap_extras/keymap_nordic.h
@@ -1,3 +1,18 @@
1/* Copyright 2015-2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef KEYMAP_NORDIC_H 16#ifndef KEYMAP_NORDIC_H
2#define KEYMAP_NORDIC_H 17#define KEYMAP_NORDIC_H
3 18
diff --git a/quantum/keymap_extras/keymap_norwegian.h b/quantum/keymap_extras/keymap_norwegian.h
index 5c4e8c495..b7128973a 100644
--- a/quantum/keymap_extras/keymap_norwegian.h
+++ b/quantum/keymap_extras/keymap_norwegian.h
@@ -1,3 +1,18 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef KEYMAP_NORWEGIAN_H 16#ifndef KEYMAP_NORWEGIAN_H
2#define KEYMAP_NORWEGIAN_H 17#define KEYMAP_NORWEGIAN_H
3 18
diff --git a/quantum/keymap_extras/keymap_plover.h b/quantum/keymap_extras/keymap_plover.h
index 9b88f7d84..de6d8c53f 100644
--- a/quantum/keymap_extras/keymap_plover.h
+++ b/quantum/keymap_extras/keymap_plover.h
@@ -1,3 +1,18 @@
1/* Copyright 2016 James Kay
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef KEYMAP_PLOVER_H 16#ifndef KEYMAP_PLOVER_H
2#define KEYMAP_PLOVER_H 17#define KEYMAP_PLOVER_H
3 18
diff --git a/quantum/keymap_extras/keymap_russian.h b/quantum/keymap_extras/keymap_russian.h
deleted file mode 100644
index 237e9abde..000000000
--- a/quantum/keymap_extras/keymap_russian.h
+++ /dev/null
@@ -1,77 +0,0 @@
1#ifndef KEYMAP_RUSSIAN_H
2#define KEYMAP_RUSSIAN_H
3
4#include "keymap.h"
5
6// Normal Chracters // reg SHIFT
7#define RU_A KC_F // а and А
8#define RU_BE KC_COMM // б and Б
9#define RU_VE KC_D // в and В
10#define RU_GHE KC_U // г and Г
11#define RU_DE KC_L // д and Д
12#define RU_IE KC_T // е and Е
13#define RU_IO KC_GRV // ё and Ё
14#define RU_ZHE KC_SCLN // ж and Ж
15#define RU_ZE KC_P // з and З
16#define RU_I KC_B // и and И
17#define RU_SRT_I KC_Q // й and Й
18#define RU_KA KC_R // к and К
19#define RU_EL KC_K // л and Л
20#define RU_EM KC_V // м and М
21#define RU_EN KC_Y // н and Н
22#define RU_O KC_J // о and О
23#define RU_PE KC_G // п and П
24#define RU_ER KC_H // р and Р
25#define RU_ES KC_C // с and С
26#define RU_TE KC_N // т and Т
27#define RU_U KC_E // у and У
28#define RU_EF KC_A // ф and Ф
29#define RU_HA KC_LBRC // х and Х
30#define RU_TSE KC_W // ц and Ц
31#define RU_CHE KC_X // ч and Ч
32#define RU_SHA KC_I // ш and Ш
33#define RU_SHCHA KC_O // щ and Щ
34#define RU_HSIGN KC_RBRC // ъ and Ъ
35#define RU_YERU KC_S // ы and Ы
36#define RU_SSIGN KC_M // ь and Ь
37#define RU_E KC_QUOT // э and Э
38#define RU_YU KC_DOT // ю and Ю
39#define RU_YA KC_Z // я and Я
40
41#define RU_1 KC_1 // 1 and !
42#define RU_2 KC_2 // 2 and "
43#define RU_3 KC_3 // 3 and №
44#define RU_4 KC_4 // 4 and ;
45#define RU_5 KC_5 // 5 and %
46#define RU_6 KC_6 // 6 and :
47#define RU_7 KC_7 // 7 and ?
48#define RU_8 KC_8 // 8 and *
49#define RU_9 KC_9 // 9 and (
50#define RU_0 KC_0 // 0 and )
51
52#define RU_MINS KC_MINS // - and _
53#define RU_EQL KC_EQL // = and +
54#define RU_BSLS KC_BSLS // \ and /
55#define RU_DOT KC_SLSH // . and ,
56
57// Shifted Chracters
58#define RU_EXLM LSFT(RU_1) // !
59#define RU_DQUT LSFT(RU_2) // "
60#define RU_NMRO LSFT(RU_3) // №
61#define RU_SCLN LSFT(RU_4) // ;
62#define RU_PERC LSFT(RU_5) // %
63#define RU_COLN LSFT(RU_6) // :
64#define RU_QUES LSFT(RU_7) // ?
65#define RU_ASTR LSFT(RU_8) // *
66#define RU_LPRN LSFT(RU_9) // (
67#define RU_RPRN LSFT(RU_0) // )
68
69#define RU_UNDR LSFT(RU_MINS) // _
70#define RU_PLUS LSFT(RU_EQL) // +
71#define RU_SLSH LSFT(RU_BSLS) // /
72#define RU_COMM LSFT(RU_DOT) // ,
73
74// Alt Gr-ed characters
75#define RU_RUBL RALT(RU_8) // ₽
76
77#endif
diff --git a/quantum/keymap_extras/keymap_spanish.h b/quantum/keymap_extras/keymap_spanish.h
index 4ba568af2..3a5787e9c 100644
--- a/quantum/keymap_extras/keymap_spanish.h
+++ b/quantum/keymap_extras/keymap_spanish.h
@@ -1,3 +1,18 @@
1/* Copyright 2015-2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef KEYMAP_SPANISH_H 16#ifndef KEYMAP_SPANISH_H
2#define KEYMAP_SPANISH_H 17#define KEYMAP_SPANISH_H
3 18
diff --git a/quantum/keymap_extras/keymap_uk.h b/quantum/keymap_extras/keymap_uk.h
index 00c87afc3..9d02efe04 100644
--- a/quantum/keymap_extras/keymap_uk.h
+++ b/quantum/keymap_extras/keymap_uk.h
@@ -1,3 +1,18 @@
1/* Copyright 2015-2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef KEYMAP_UK_H 16#ifndef KEYMAP_UK_H
2#define KEYMAP_UK_H 17#define KEYMAP_UK_H
3 18
diff --git a/quantum/keymap_extras/keymap_unicode_cyrillic.h b/quantum/keymap_extras/keymap_unicode_cyrillic.h
deleted file mode 100644
index a40626d91..000000000
--- a/quantum/keymap_extras/keymap_unicode_cyrillic.h
+++ /dev/null
@@ -1,163 +0,0 @@
1#ifndef KEYMAP_CYRILLIC_H
2#define KEYMAP_CYRILLIC_H
3
4#include "keymap.h"
5
6/*
7 * This is based off of
8 * https://en.wikipedia.org/wiki/Cyrillic_script
9 *
10 * Unicode is iffy, a software implementation is preferred
11 */
12
13// Capital Char russian/ukrainian/bulgarian
14#define CY_A UC(0x0410) // А rus ukr bul
15#define CY_BE UC(0x0411) // Б rus ukr bul
16#define CY_VE UC(0x0412) // В rus ukr bul
17#define CY_GHE UC(0x0413) // Г rus ukr bul
18#define CY_GHEUP UC(0x0490) // Ґ ukr
19#define CY_DE UC(0x0414) // Д rus ukr bul
20#define CY_DJE UC(0x0402) // Ђ
21#define CY_GJE UC(0x0403) // Ѓ
22#define CY_IE UC(0x0415) // Е rus ukr bul
23#define CY_IO UC(0x0401) // Ё rus
24#define CY_UIE UC(0x0404) // Є ukr
25#define CY_ZHE UC(0x0416) // Ж rus ukr bul
26#define CY_ZE UC(0x0417) // З rus ukr bul
27#define CY_DZE UC(0x0405) // Ѕ
28#define CY_I UC(0x0418) // И rus ukr bul
29#define CY_B_U_I UC(0x0406) // І ukr
30#define CY_YI UC(0x0407) // Ї ukr
31#define CY_SRT_I UC(0x0419) // Й rus ukr bul
32#define CY_JE UC(0x0408) // Ј
33#define CY_KA UC(0x041a) // К rus ukr bul
34#define CY_EL UC(0x041b) // Л rus ukr bul
35#define CY_LJE UC(0x0409) // Љ
36#define CY_EM UC(0x041c) // М rus ukr bul
37#define CY_EN UC(0x041d) // Н rus ukr bul
38#define CY_NJE UC(0x040a) // Њ
39#define CY_O UC(0x041e) // О rus ukr bul
40#define CY_PE UC(0x041f) // П rus ukr bul
41#define CY_ER UC(0x0420) // Р rus ukr bul
42#define CY_ES UC(0x0421) // С rus ukr bul
43#define CY_TE UC(0x0422) // Т rus ukr bul
44#define CY_TSHE UC(0x040b) // Ћ
45#define CY_KJE UC(0x040c) // Ќ
46#define CY_U UC(0x0423) // У rus ukr bul
47#define CY_SRT_U UC(0x040e) // Ў
48#define CY_EF UC(0x0424) // Ф rus ukr bul
49#define CY_HA UC(0x0425) // Х rus bul
50#define CY_TSE UC(0x0426) // Ц rus ukr bul
51#define CY_CHE UC(0x0427) // Ч rus ukr bul
52#define CY_DZHE UC(0x040f) // Џ
53#define CY_SHA UC(0x0428) // Ш rus ukr bul
54#define CY_SHCHA UC(0x0429) // Щ rus ukr bul
55#define CY_HSIGN UC(0x042a) // Ъ rus bul
56#define CY_YERU UC(0x042b) // Ы rus
57#define CY_SSIGN UC(0x042c) // Ь rus ukr bul
58#define CY_E UC(0x042d) // Э rus
59#define CY_YU UC(0x042e) // Ю rus ukr bul
60#define CY_YA UC(0x042f) // Я rus ukr bul
61// Important Cyrillic non-Slavic letters
62#define CY_PALOCHKA UC(0x04c0) // Ӏ
63#define CY_SCHWA UC(0x04d8) // Ә
64#define CY_GHE_S UC(0x0492) // Ғ
65#define CY_ZE_D UC(0x0498) // Ҙ
66#define CY_ES_D UC(0x04aa) // Ҫ
67#define CY_BR_KA UC(0x04a0) // Ҡ
68#define CY_ZHE_D UC(0x0496) // Җ
69#define CY_KA_D UC(0x049a) // Қ
70#define CY_EN_D UC(0x04a2) // Ң
71#define CY_ENGHE UC(0x04a4) // Ҥ
72#define CY_BRD_O UC(0x04e8) // Ө
73#define CY_STR_U UC(0x04ae) // Ү
74#define CY_S_U_S UC(0x04b0) // Ұ
75#define CY_SHHA UC(0x04ba) // Һ
76#define CY_HA_D UC(0x04b2) // Ҳ
77
78
79// Small
80#define CY_a UC(0x0430) // a rus ukr bul
81#define CY_be UC(0x0431) // б rus ukr bul
82#define CY_ve UC(0x0432) // в rus ukr bul
83#define CY_ghe UC(0x0433) // г rus ukr bul
84#define CY_gheup UC(0x0491) // ґ ukr
85#define CY_de UC(0x0434) // д rus ukr bul
86#define CY_dje UC(0x0452) // ђ
87#define CY_gje UC(0x0453) // ѓ
88#define CY_ie UC(0x0435) // е rus ukr bul
89#define CY_io UC(0x0451) // ё rus
90#define CY_uie UC(0x0454) // є ukr
91#define CY_zhe UC(0x0436) // ж rus ukr bul
92#define CY_ze UC(0x0437) // з rus ukr bul
93#define CY_dze UC(0x0455) // ѕ
94#define CY_i UC(0x0438) // и rus ukr bul
95#define CY_b_u_i UC(0x0456) // і ukr
96#define CY_yi UC(0x0457) // ї ukr
97#define CY_srt_i UC(0x0439) // й rus ukr bul
98#define CY_je UC(0x0458) // ј
99#define CY_ka UC(0x043a) // к rus ukr bul
100#define CY_el UC(0x043b) // л rus ukr bul
101#define CY_lje UC(0x0459) // љ
102#define CY_em UC(0x043c) // м rus ukr bul
103#define CY_en UC(0x043d) // н rus ukr bul
104#define CY_nje UC(0x045a) // њ
105#define CY_o UC(0x043e) // о rus ukr bul
106#define CY_pe UC(0x043f) // п rus ukr bul
107#define CY_er UC(0x0440) // р rus ukr bul
108#define CY_es UC(0x0441) // с rus ukr bul
109#define CY_te UC(0x0442) // т rus ukr bul
110#define CY_tshe UC(0x045b) // ћ
111#define CY_kje UC(0x045c) // ќ
112#define CY_u UC(0x0443) // у rus ukr bul
113#define CY_srt_u UC(0x045e) // ў
114#define CY_ef UC(0x0444) // ф rus ukr bul
115#define CY_ha UC(0x0445) // х rus ukr bul
116#define CY_tse UC(0x0446) // ц rus ukr bul
117#define CY_che UC(0x0447) // ч rus ukr bul
118#define CY_dzhe UC(0x045f) // џ
119#define CY_sha UC(0x0448) // ш rus ukr bul
120#define CY_shcha UC(0x0449) // щ rus ukr bul
121#define CY_hsign UC(0x044a) // ъ rus bul
122#define CY_yeru UC(0x044b) // ы rus
123#define CY_ssign UC(0x044c) // ь rus ukr bul
124#define CY_e UC(0x044d) // э rus
125#define CY_yu UC(0x044e) // ю rus ukr bul
126#define CY_ya UC(0x044f) // я rus ukr bul
127// Important Cyrillic non-Slavic letters
128#define CY_palochka UC(0x04cf) // ӏ
129#define CY_schwa UC(0x04d9) // ә
130#define CY_ghe_s UC(0x0493) // ғ
131#define CY_ze_d UC(0x0499) // ҙ
132#define CY_es_d UC(0x04ab) // ҫ
133#define CY_br_ka UC(0x04a1) // ҡ
134#define CY_zhe_d UC(0x0497) // җ
135#define CY_ka_d UC(0x049b) // қ
136#define CY_en_d UC(0x04a3) // ң
137#define CY_enghe UC(0x04a5) // ҥ
138#define CY_brd_o UC(0x04e9) // ө
139#define CY_str_u UC(0x04af) // ү
140#define CY_s_u_s UC(0x04b1) // ұ
141#define CY_shha UC(0x04bb) // һ
142#define CY_ha_d UC(0x04b3) // ҳ
143
144
145// Extra
146#define CY_slr_ve UC(0x1c80) // ᲀ CYRILLIC SMALL LETTER ROUNDED VE
147#define CY_ll_de UC(0x1c81) // ᲁ CYRILLIC SMALL LETTER LONG-LEGGED DE
148#define CY_ZEMLYA UC(0xa640) // Ꙁ CYRILLIC CAPITAL LETTER ZEMLYA
149#define CY_zemlya UC(0xa641) // ꙁ CYRILLIC SMALL LETTER ZEMLYA
150#define CY_RV_DZE UC(0xa644) // Ꙅ CYRILLIC CAPITAL LETTER REVERSED DZE
151#define CY_rv_DZE UC(0xa645) // ꙅ CYRILLIC SMALL LETTER REVERSED DZE
152#define CY_slw_es UC(0x1c83) // ᲃ CYRILLIC SMALL LETTER WIDE ES
153#define CY_st_te UC(0x1c84) // ᲄ CYRILLIC SMALL LETTER TALL TE
154#define CY_3l_te UC(0x1c85) // ᲅ CYRILLIC SMALL LETTER THREE-LEGGED TE
155#define CY_thsign UC(0x1c86) // ᲆ CYRILLIC SMALL LETTER TALL HARD SIGN
156#define CY_YERUBY UC(0xa650) // Ꙑ CYRILLIC CAPITAL LETTER YERU WITH BACK YER
157#define CY_yeruby UC(0xa651) // ꙑ CYRILLIC SMALL LETTER YERU WITH BACK YER
158#define CY_RUBL UC(0x20bd) // ₽
159#define CY_NMRO UC(0x2116) // №
160
161// The letters Zje and Sje are made for other letters and accent marks
162
163#endif
diff --git a/quantum/light_ws2812.c b/quantum/light_ws2812.c
index 55bdd9cd8..2506e3d8e 100755
--- a/quantum/light_ws2812.c
+++ b/quantum/light_ws2812.c
@@ -7,7 +7,18 @@
7* Jan 18th, 2014 v2.0b Initial Version 7* Jan 18th, 2014 v2.0b Initial Version
8* Nov 29th, 2015 v2.3 Added SK6812RGBW support 8* Nov 29th, 2015 v2.3 Added SK6812RGBW support
9* 9*
10* License: GNU GPL v2 (see License.txt) 10* This program is free software: you can redistribute it and/or modify
11* it under the terms of the GNU General Public License as published by
12* the Free Software Foundation, either version 2 of the License, or
13* (at your option) any later version.
14*
15* This program is distributed in the hope that it will be useful,
16* but WITHOUT ANY WARRANTY; without even the implied warranty of
17* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18* GNU General Public License for more details.
19*
20* You should have received a copy of the GNU General Public License
21* along with this program. If not, see <http://www.gnu.org/licenses/>.
11*/ 22*/
12 23
13#include "light_ws2812.h" 24#include "light_ws2812.h"
diff --git a/quantum/light_ws2812.h b/quantum/light_ws2812.h
index 2f78c20fc..60924a0fb 100755
--- a/quantum/light_ws2812.h
+++ b/quantum/light_ws2812.h
@@ -6,8 +6,18 @@
6 * 6 *
7 * Please do not change this file! All configuration is handled in "ws2812_config.h" 7 * Please do not change this file! All configuration is handled in "ws2812_config.h"
8 * 8 *
9 * License: GNU GPL v2 (see License.txt) 9 * This program is free software: you can redistribute it and/or modify
10 + 10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
11 */ 21 */
12 22
13#ifndef LIGHT_WS2812_H_ 23#ifndef LIGHT_WS2812_H_
diff --git a/quantum/matrix.c b/quantum/matrix.c
index ac523482a..5337e2626 100644
--- a/quantum/matrix.c
+++ b/quantum/matrix.c
@@ -1,6 +1,5 @@
1/* 1/*
2Copyright 2012 Jun Wako 2Copyright 2012-2017 Jun Wako, Jack Humbert
3Copyright 2014 Jack Humbert
4 3
5This program is free software: you can redistribute it and/or modify 4This program is free software: you can redistribute it and/or modify
6it under the terms of the GNU General Public License as published by 5it under the terms of the GNU General Public License as published by
diff --git a/quantum/pincontrol.h b/quantum/pincontrol.h
index 36ce29ef2..d77977ebe 100644
--- a/quantum/pincontrol.h
+++ b/quantum/pincontrol.h
@@ -1,3 +1,18 @@
1/* Copyright 2016 Wez Furlong
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#pragma once 16#pragma once
2// Some helpers for controlling gpio pins 17// Some helpers for controlling gpio pins
3#include <avr/io.h> 18#include <avr/io.h>
diff --git a/quantum/process_keycode/process_audio.c b/quantum/process_keycode/process_audio.c
new file mode 100644
index 000000000..0b6380ed3
--- /dev/null
+++ b/quantum/process_keycode/process_audio.c
@@ -0,0 +1,62 @@
1#include "audio.h"
2#include "process_audio.h"
3
4static float compute_freq_for_midi_note(uint8_t note)
5{
6 // https://en.wikipedia.org/wiki/MIDI_tuning_standard
7 return pow(2.0, (note - 69) / 12.0) * 440.0f;
8}
9
10bool process_audio(uint16_t keycode, keyrecord_t *record) {
11
12 if (keycode == AU_ON && record->event.pressed) {
13 audio_on();
14 return false;
15 }
16
17 if (keycode == AU_OFF && record->event.pressed) {
18 audio_off();
19 return false;
20 }
21
22 if (keycode == AU_TOG && record->event.pressed) {
23 if (is_audio_on())
24 {
25 audio_off();
26 }
27 else
28 {
29 audio_on();
30 }
31 return false;
32 }
33
34 if (keycode == MUV_IN && record->event.pressed) {
35 voice_iterate();
36 music_scale_user();
37 return false;
38 }
39
40 if (keycode == MUV_DE && record->event.pressed) {
41 voice_deiterate();
42 music_scale_user();
43 return false;
44 }
45
46 return true;
47}
48
49void process_audio_noteon(uint8_t note) {
50 play_note(compute_freq_for_midi_note(note), 0xF);
51}
52
53void process_audio_noteoff(uint8_t note) {
54 stop_note(compute_freq_for_midi_note(note));
55}
56
57void process_audio_all_notes_off(void) {
58 stop_all_notes();
59}
60
61__attribute__ ((weak))
62void audio_on_user() {} \ No newline at end of file
diff --git a/quantum/process_keycode/process_audio.h b/quantum/process_keycode/process_audio.h
new file mode 100644
index 000000000..7ac15b733
--- /dev/null
+++ b/quantum/process_keycode/process_audio.h
@@ -0,0 +1,11 @@
1#ifndef PROCESS_AUDIO_H
2#define PROCESS_AUDIO_H
3
4bool process_audio(uint16_t keycode, keyrecord_t *record);
5void process_audio_noteon(uint8_t note);
6void process_audio_noteoff(uint8_t note);
7void process_audio_all_notes_off(void);
8
9void audio_on_user(void);
10
11#endif \ No newline at end of file
diff --git a/quantum/process_keycode/process_chording.c b/quantum/process_keycode/process_chording.c
index d7814629f..6c6ebe300 100644
--- a/quantum/process_keycode/process_chording.c
+++ b/quantum/process_keycode/process_chording.c
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "process_chording.h" 17#include "process_chording.h"
2 18
3bool keys_chord(uint8_t keys[]) { 19bool keys_chord(uint8_t keys[]) {
@@ -57,4 +73,4 @@ bool process_chording(uint16_t keycode, keyrecord_t *record) {
57 } 73 }
58 } 74 }
59 return true; 75 return true;
60} \ No newline at end of file 76}
diff --git a/quantum/process_keycode/process_chording.h b/quantum/process_keycode/process_chording.h
index 49c97db3b..8c0f4862a 100644
--- a/quantum/process_keycode/process_chording.h
+++ b/quantum/process_keycode/process_chording.h
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef PROCESS_CHORDING_H 17#ifndef PROCESS_CHORDING_H
2#define PROCESS_CHORDING_H 18#define PROCESS_CHORDING_H
3 19
@@ -13,4 +29,4 @@ uint8_t chord_key_down = 0;
13 29
14bool process_chording(uint16_t keycode, keyrecord_t *record); 30bool process_chording(uint16_t keycode, keyrecord_t *record);
15 31
16#endif \ No newline at end of file 32#endif
diff --git a/quantum/process_keycode/process_combo.c b/quantum/process_keycode/process_combo.c
index e2189ad98..58d45add2 100644
--- a/quantum/process_keycode/process_combo.c
+++ b/quantum/process_keycode/process_combo.c
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "process_combo.h" 17#include "process_combo.h"
2#include "print.h" 18#include "print.h"
3 19
diff --git a/quantum/process_keycode/process_combo.h b/quantum/process_keycode/process_combo.h
index 847f2b737..a5dbd788a 100644
--- a/quantum/process_keycode/process_combo.h
+++ b/quantum/process_keycode/process_combo.h
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef PROCESS_COMBO_H 17#ifndef PROCESS_COMBO_H
2#define PROCESS_COMBO_H 18#define PROCESS_COMBO_H
3 19
diff --git a/quantum/process_keycode/process_leader.c b/quantum/process_keycode/process_leader.c
index e53d221e7..473906d65 100644
--- a/quantum/process_keycode/process_leader.c
+++ b/quantum/process_keycode/process_leader.c
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "process_leader.h" 17#include "process_leader.h"
2 18
3__attribute__ ((weak)) 19__attribute__ ((weak))
@@ -35,4 +51,4 @@ bool process_leader(uint16_t keycode, keyrecord_t *record) {
35 } 51 }
36 } 52 }
37 return true; 53 return true;
38} \ No newline at end of file 54}
diff --git a/quantum/process_keycode/process_leader.h b/quantum/process_keycode/process_leader.h
index c83db8abb..da7a3d2ef 100644
--- a/quantum/process_keycode/process_leader.h
+++ b/quantum/process_keycode/process_leader.h
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef PROCESS_LEADER_H 17#ifndef PROCESS_LEADER_H
2#define PROCESS_LEADER_H 18#define PROCESS_LEADER_H
3 19
@@ -20,4 +36,4 @@ void leader_end(void);
20#define LEADER_EXTERNS() extern bool leading; extern uint16_t leader_time; extern uint16_t leader_sequence[5]; extern uint8_t leader_sequence_size 36#define LEADER_EXTERNS() extern bool leading; extern uint16_t leader_time; extern uint16_t leader_sequence[5]; extern uint8_t leader_sequence_size
21#define LEADER_DICTIONARY() if (leading && timer_elapsed(leader_time) > LEADER_TIMEOUT) 37#define LEADER_DICTIONARY() if (leading && timer_elapsed(leader_time) > LEADER_TIMEOUT)
22 38
23#endif \ No newline at end of file 39#endif
diff --git a/quantum/process_keycode/process_midi.c b/quantum/process_keycode/process_midi.c
index 577dad43a..9184feaae 100644
--- a/quantum/process_keycode/process_midi.c
+++ b/quantum/process_keycode/process_midi.c
@@ -1,68 +1,253 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include "process_midi.h" 16#include "process_midi.h"
2 17
3bool midi_activated = false; 18#ifdef MIDI_ENABLE
4uint8_t midi_starting_note = 0x0C; 19#include "midi.h"
5int midi_offset = 7; 20
6 21#ifdef MIDI_BASIC
7bool process_midi(uint16_t keycode, keyrecord_t *record) { 22
8 if (keycode == MI_ON && record->event.pressed) { 23void process_midi_basic_noteon(uint8_t note)
9 midi_activated = true; 24{
10#ifdef AUDIO_ENABLE 25 midi_send_noteon(&midi_device, 0, note, 128);
11 music_scale_user(); 26}
12#endif 27
13 return false; 28void process_midi_basic_noteoff(uint8_t note)
14 } 29{
30 midi_send_noteoff(&midi_device, 0, note, 0);
31}
32
33void process_midi_all_notes_off(void)
34{
35 midi_send_cc(&midi_device, 0, 0x7B, 0);
36}
37
38#endif // MIDI_BASIC
39
40#ifdef MIDI_ADVANCED
41
42#include "timer.h"
43
44static uint8_t tone_status[MIDI_TONE_COUNT];
45
46static uint8_t midi_modulation;
47static int8_t midi_modulation_step;
48static uint16_t midi_modulation_timer;
49
50inline uint8_t compute_velocity(uint8_t setting)
51{
52 return (setting + 1) * (128 / (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN + 1));
53}
15 54
16 if (keycode == MI_OFF && record->event.pressed) { 55void midi_init(void)
17 midi_activated = false; 56{
18 midi_send_cc(&midi_device, 0, 0x7B, 0); 57 midi_config.octave = MI_OCT_2 - MIDI_OCTAVE_MIN;
19 return false; 58 midi_config.transpose = 0;
59 midi_config.velocity = (MIDI_VELOCITY_MAX - MIDI_VELOCITY_MIN);
60 midi_config.channel = 0;
61 midi_config.modulation_interval = 8;
62
63 for (uint8_t i = 0; i < MIDI_TONE_COUNT; i++)
64 {
65 tone_status[i] = MIDI_INVALID_NOTE;
20 } 66 }
21 67
22 if (midi_activated) { 68 midi_modulation = 0;
23 if (record->event.key.col == (MATRIX_COLS - 1) && record->event.key.row == (MATRIX_ROWS - 1)) { 69 midi_modulation_step = 0;
24 if (record->event.pressed) { 70 midi_modulation_timer = 0;
25 midi_starting_note++; // Change key 71}
26 midi_send_cc(&midi_device, 0, 0x7B, 0); 72
27 } 73void midi_task(void)
28 return false; 74{
29 } 75 if (timer_elapsed(midi_modulation_timer) < midi_config.modulation_interval)
30 if (record->event.key.col == (MATRIX_COLS - 2) && record->event.key.row == (MATRIX_ROWS - 1)) { 76 return;
31 if (record->event.pressed) { 77 midi_modulation_timer = timer_read();
32 midi_starting_note--; // Change key 78
33 midi_send_cc(&midi_device, 0, 0x7B, 0); 79 if (midi_modulation_step != 0)
34 } 80 {
35 return false; 81 dprintf("midi modulation %d\n", midi_modulation);
36 } 82 midi_send_cc(&midi_device, midi_config.channel, 0x1, midi_modulation);
37 if (record->event.key.col == (MATRIX_COLS - 3) && record->event.key.row == (MATRIX_ROWS - 1) && record->event.pressed) { 83
38 midi_offset++; // Change scale 84 if (midi_modulation_step < 0 && midi_modulation < -midi_modulation_step) {
39 midi_send_cc(&midi_device, 0, 0x7B, 0); 85 midi_modulation = 0;
40 return false; 86 midi_modulation_step = 0;
41 } 87 return;
42 if (record->event.key.col == (MATRIX_COLS - 4) && record->event.key.row == (MATRIX_ROWS - 1) && record->event.pressed) { 88 }
43 midi_offset--; // Change scale 89
44 midi_send_cc(&midi_device, 0, 0x7B, 0); 90 midi_modulation += midi_modulation_step;
45 return false; 91
46 } 92 if (midi_modulation > 127)
47 // basic 93 midi_modulation = 127;
48 // uint8_t note = (midi_starting_note + SCALE[record->event.key.col + midi_offset])+12*(MATRIX_ROWS - record->event.key.row);
49 // advanced
50 // uint8_t note = (midi_starting_note + record->event.key.col + midi_offset)+12*(MATRIX_ROWS - record->event.key.row);
51 // guitar
52 uint8_t note = (midi_starting_note + record->event.key.col + midi_offset)+5*(MATRIX_ROWS - record->event.key.row);
53 // violin
54 // uint8_t note = (midi_starting_note + record->event.key.col + midi_offset)+7*(MATRIX_ROWS - record->event.key.row);
55
56 if (record->event.pressed) {
57 // midi_send_noteon(&midi_device, record->event.key.row, midi_starting_note + SCALE[record->event.key.col], 127);
58 midi_send_noteon(&midi_device, 0, note, 127);
59 } else {
60 // midi_send_noteoff(&midi_device, record->event.key.row, midi_starting_note + SCALE[record->event.key.col], 127);
61 midi_send_noteoff(&midi_device, 0, note, 127);
62 }
63
64 if (keycode < 0xFF) // ignores all normal keycodes, but lets RAISE, LOWER, etc through
65 return false;
66 } 94 }
67 return true;
68} 95}
96
97uint8_t midi_compute_note(uint16_t keycode)
98{
99 return 12 * midi_config.octave + (keycode - MIDI_TONE_MIN) + midi_config.transpose;
100}
101
102bool process_midi(uint16_t keycode, keyrecord_t *record)
103{
104 switch (keycode) {
105 case MIDI_TONE_MIN ... MIDI_TONE_MAX:
106 {
107 uint8_t channel = midi_config.channel;
108 uint8_t tone = keycode - MIDI_TONE_MIN;
109 uint8_t velocity = compute_velocity(midi_config.velocity);
110 if (record->event.pressed) {
111 uint8_t note = midi_compute_note(keycode);
112 midi_send_noteon(&midi_device, channel, note, velocity);
113 dprintf("midi noteon channel:%d note:%d velocity:%d\n", channel, note, velocity);
114 tone_status[tone] = note;
115 }
116 else {
117 uint8_t note = tone_status[tone];
118 if (note != MIDI_INVALID_NOTE)
119 {
120 midi_send_noteoff(&midi_device, channel, note, velocity);
121 dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
122 }
123 tone_status[tone] = MIDI_INVALID_NOTE;
124 }
125 return false;
126 }
127 case MIDI_OCTAVE_MIN ... MIDI_OCTAVE_MAX:
128 if (record->event.pressed) {
129 midi_config.octave = keycode - MIDI_OCTAVE_MIN;
130 dprintf("midi octave %d\n", midi_config.octave);
131 }
132 return false;
133 case MI_OCTD:
134 if (record->event.pressed && midi_config.octave > 0) {
135 midi_config.octave--;
136 dprintf("midi octave %d\n", midi_config.octave);
137 }
138 return false;
139 case MI_OCTU:
140 if (record->event.pressed && midi_config.octave < (MIDI_OCTAVE_MAX - MIDI_OCTAVE_MIN)) {
141 midi_config.octave++;
142 dprintf("midi octave %d\n", midi_config.octave);
143 }
144 return false;
145 case MIDI_TRANSPOSE_MIN ... MIDI_TRANSPOSE_MAX:
146 if (record->event.pressed) {
147 midi_config.transpose = keycode - MI_TRNS_0;
148 dprintf("midi transpose %d\n", midi_config.transpose);
149 }
150 return false;
151 case MI_TRNSD:
152 if (record->event.pressed && midi_config.transpose > (MIDI_TRANSPOSE_MIN - MI_TRNS_0)) {
153 midi_config.transpose--;
154 dprintf("midi transpose %d\n", midi_config.transpose);
155 }
156 return false;
157 case MI_TRNSU:
158 if (record->event.pressed && midi_config.transpose < (MIDI_TRANSPOSE_MAX - MI_TRNS_0)) {
159 const bool positive = midi_config.transpose > 0;
160 midi_config.transpose++;
161 if (positive && midi_config.transpose < 0)
162 midi_config.transpose--;
163 dprintf("midi transpose %d\n", midi_config.transpose);
164 }
165 return false;
166 case MIDI_VELOCITY_MIN ... MIDI_VELOCITY_MAX:
167 if (record->event.pressed) {
168 midi_config.velocity = keycode - MIDI_VELOCITY_MIN;
169 dprintf("midi velocity %d\n", midi_config.velocity);
170 }
171 return false;
172 case MI_VELD:
173 if (record->event.pressed && midi_config.velocity > 0) {
174 midi_config.velocity--;
175 dprintf("midi velocity %d\n", midi_config.velocity);
176 }
177 return false;
178 case MI_VELU:
179 if (record->event.pressed) {
180 midi_config.velocity++;
181 dprintf("midi velocity %d\n", midi_config.velocity);
182 }
183 return false;
184 case MIDI_CHANNEL_MIN ... MIDI_CHANNEL_MAX:
185 if (record->event.pressed) {
186 midi_config.channel = keycode - MIDI_CHANNEL_MIN;
187 dprintf("midi channel %d\n", midi_config.channel);
188 }
189 return false;
190 case MI_CHD:
191 if (record->event.pressed) {
192 midi_config.channel--;
193 dprintf("midi channel %d\n", midi_config.channel);
194 }
195 return false;
196 case MI_CHU:
197 if (record->event.pressed) {
198 midi_config.channel++;
199 dprintf("midi channel %d\n", midi_config.channel);
200 }
201 return false;
202 case MI_ALLOFF:
203 if (record->event.pressed) {
204 midi_send_cc(&midi_device, midi_config.channel, 0x7B, 0);
205 dprintf("midi all notes off\n");
206 }
207 return false;
208 case MI_SUS:
209 midi_send_cc(&midi_device, midi_config.channel, 0x40, record->event.pressed ? 127 : 0);
210 dprintf("midi sustain %d\n", record->event.pressed);
211 return false;
212 case MI_PORT:
213 midi_send_cc(&midi_device, midi_config.channel, 0x41, record->event.pressed ? 127 : 0);
214 dprintf("midi portamento %d\n", record->event.pressed);
215 return false;
216 case MI_SOST:
217 midi_send_cc(&midi_device, midi_config.channel, 0x42, record->event.pressed ? 127 : 0);
218 dprintf("midi sostenuto %d\n", record->event.pressed);
219 return false;
220 case MI_SOFT:
221 midi_send_cc(&midi_device, midi_config.channel, 0x43, record->event.pressed ? 127 : 0);
222 dprintf("midi soft %d\n", record->event.pressed);
223 return false;
224 case MI_LEG:
225 midi_send_cc(&midi_device, midi_config.channel, 0x43, record->event.pressed ? 127 : 0);
226 dprintf("midi legato %d\n", record->event.pressed);
227 return false;
228 case MI_MOD:
229 midi_modulation_step = record->event.pressed ? 1 : -1;
230 return false;
231 case MI_MODSD:
232 if (record->event.pressed) {
233 midi_config.modulation_interval++;
234 // prevent overflow
235 if (midi_config.modulation_interval == 0)
236 midi_config.modulation_interval--;
237 dprintf("midi modulation interval %d\n", midi_config.modulation_interval);
238 }
239 return false;
240 case MI_MODSU:
241 if (record->event.pressed && midi_config.modulation_interval > 0) {
242 midi_config.modulation_interval--;
243 dprintf("midi modulation interval %d\n", midi_config.modulation_interval);
244 }
245 return false;
246 };
247
248 return true;
249}
250
251#endif // MIDI_ADVANCED
252
253#endif // MIDI_ENABLE
diff --git a/quantum/process_keycode/process_midi.h b/quantum/process_keycode/process_midi.h
index acd4fc1b1..ccac8981a 100644
--- a/quantum/process_keycode/process_midi.h
+++ b/quantum/process_keycode/process_midi.h
@@ -1,207 +1,56 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef PROCESS_MIDI_H 17#ifndef PROCESS_MIDI_H
2#define PROCESS_MIDI_H 18#define PROCESS_MIDI_H
3 19
4#include "quantum.h" 20#include "quantum.h"
5 21
6bool process_midi(uint16_t keycode, keyrecord_t *record); 22#ifdef MIDI_ENABLE
23
24#ifdef MIDI_BASIC
25void process_midi_basic_noteon(uint8_t note);
26void process_midi_basic_noteoff(uint8_t note);
27void process_midi_all_notes_off(void);
28#endif
7 29
8#define MIDI(n) ((n) | 0x6000) 30#ifdef MIDI_ADVANCED
9#define MIDI12 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000, 0x6000 31typedef union {
32 uint32_t raw;
33 struct {
34 uint8_t octave :4;
35 int8_t transpose :4;
36 uint8_t velocity :4;
37 uint8_t channel :4;
38 uint8_t modulation_interval :4;
39 };
40} midi_config_t;
41
42midi_config_t midi_config;
43
44void midi_init(void);
45void midi_task(void);
46bool process_midi(uint16_t keycode, keyrecord_t *record);
10 47
11#define CHNL(note, channel) (note + (channel << 8)) 48#define MIDI_INVALID_NOTE 0xFF
49#define MIDI_TONE_COUNT (MIDI_TONE_MAX - MIDI_TONE_MIN + 1)
12 50
13#define SCALE (int8_t []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \ 51uint8_t midi_compute_note(uint16_t keycode);
14 0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \ 52#endif // MIDI_ADVANCED
15 0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \
16 0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \
17 0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), }
18 53
19#define N_CN1 (0x600C + (12 * -1) + 0 ) 54#endif // MIDI_ENABLE
20#define N_CN1S (0x600C + (12 * -1) + 1 )
21#define N_DN1F (0x600C + (12 * -1) + 1 )
22#define N_DN1 (0x600C + (12 * -1) + 2 )
23#define N_DN1S (0x600C + (12 * -1) + 3 )
24#define N_EN1F (0x600C + (12 * -1) + 3 )
25#define N_EN1 (0x600C + (12 * -1) + 4 )
26#define N_FN1 (0x600C + (12 * -1) + 5 )
27#define N_FN1S (0x600C + (12 * -1) + 6 )
28#define N_GN1F (0x600C + (12 * -1) + 6 )
29#define N_GN1 (0x600C + (12 * -1) + 7 )
30#define N_GN1S (0x600C + (12 * -1) + 8 )
31#define N_AN1F (0x600C + (12 * -1) + 8 )
32#define N_AN1 (0x600C + (12 * -1) + 9 )
33#define N_AN1S (0x600C + (12 * -1) + 10)
34#define N_BN1F (0x600C + (12 * -1) + 10)
35#define N_BN1 (0x600C + (12 * -1) + 11)
36#define N_C0 (0x600C + (12 * 0) + 0 )
37#define N_C0S (0x600C + (12 * 0) + 1 )
38#define N_D0F (0x600C + (12 * 0) + 1 )
39#define N_D0 (0x600C + (12 * 0) + 2 )
40#define N_D0S (0x600C + (12 * 0) + 3 )
41#define N_E0F (0x600C + (12 * 0) + 3 )
42#define N_E0 (0x600C + (12 * 0) + 4 )
43#define N_F0 (0x600C + (12 * 0) + 5 )
44#define N_F0S (0x600C + (12 * 0) + 6 )
45#define N_G0F (0x600C + (12 * 0) + 6 )
46#define N_G0 (0x600C + (12 * 0) + 7 )
47#define N_G0S (0x600C + (12 * 0) + 8 )
48#define N_A0F (0x600C + (12 * 0) + 8 )
49#define N_A0 (0x600C + (12 * 0) + 9 )
50#define N_A0S (0x600C + (12 * 0) + 10)
51#define N_B0F (0x600C + (12 * 0) + 10)
52#define N_B0 (0x600C + (12 * 0) + 11)
53#define N_C1 (0x600C + (12 * 1) + 0 )
54#define N_C1S (0x600C + (12 * 1) + 1 )
55#define N_D1F (0x600C + (12 * 1) + 1 )
56#define N_D1 (0x600C + (12 * 1) + 2 )
57#define N_D1S (0x600C + (12 * 1) + 3 )
58#define N_E1F (0x600C + (12 * 1) + 3 )
59#define N_E1 (0x600C + (12 * 1) + 4 )
60#define N_F1 (0x600C + (12 * 1) + 5 )
61#define N_F1S (0x600C + (12 * 1) + 6 )
62#define N_G1F (0x600C + (12 * 1) + 6 )
63#define N_G1 (0x600C + (12 * 1) + 7 )
64#define N_G1S (0x600C + (12 * 1) + 8 )
65#define N_A1F (0x600C + (12 * 1) + 8 )
66#define N_A1 (0x600C + (12 * 1) + 9 )
67#define N_A1S (0x600C + (12 * 1) + 10)
68#define N_B1F (0x600C + (12 * 1) + 10)
69#define N_B1 (0x600C + (12 * 1) + 11)
70#define N_C2 (0x600C + (12 * 2) + 0 )
71#define N_C2S (0x600C + (12 * 2) + 1 )
72#define N_D2F (0x600C + (12 * 2) + 1 )
73#define N_D2 (0x600C + (12 * 2) + 2 )
74#define N_D2S (0x600C + (12 * 2) + 3 )
75#define N_E2F (0x600C + (12 * 2) + 3 )
76#define N_E2 (0x600C + (12 * 2) + 4 )
77#define N_F2 (0x600C + (12 * 2) + 5 )
78#define N_F2S (0x600C + (12 * 2) + 6 )
79#define N_G2F (0x600C + (12 * 2) + 6 )
80#define N_G2 (0x600C + (12 * 2) + 7 )
81#define N_G2S (0x600C + (12 * 2) + 8 )
82#define N_A2F (0x600C + (12 * 2) + 8 )
83#define N_A2 (0x600C + (12 * 2) + 9 )
84#define N_A2S (0x600C + (12 * 2) + 10)
85#define N_B2F (0x600C + (12 * 2) + 10)
86#define N_B2 (0x600C + (12 * 2) + 11)
87#define N_C3 (0x600C + (12 * 3) + 0 )
88#define N_C3S (0x600C + (12 * 3) + 1 )
89#define N_D3F (0x600C + (12 * 3) + 1 )
90#define N_D3 (0x600C + (12 * 3) + 2 )
91#define N_D3S (0x600C + (12 * 3) + 3 )
92#define N_E3F (0x600C + (12 * 3) + 3 )
93#define N_E3 (0x600C + (12 * 3) + 4 )
94#define N_F3 (0x600C + (12 * 3) + 5 )
95#define N_F3S (0x600C + (12 * 3) + 6 )
96#define N_G3F (0x600C + (12 * 3) + 6 )
97#define N_G3 (0x600C + (12 * 3) + 7 )
98#define N_G3S (0x600C + (12 * 3) + 8 )
99#define N_A3F (0x600C + (12 * 3) + 8 )
100#define N_A3 (0x600C + (12 * 3) + 9 )
101#define N_A3S (0x600C + (12 * 3) + 10)
102#define N_B3F (0x600C + (12 * 3) + 10)
103#define N_B3 (0x600C + (12 * 3) + 11)
104#define N_C4 (0x600C + (12 * 4) + 0 )
105#define N_C4S (0x600C + (12 * 4) + 1 )
106#define N_D4F (0x600C + (12 * 4) + 1 )
107#define N_D4 (0x600C + (12 * 4) + 2 )
108#define N_D4S (0x600C + (12 * 4) + 3 )
109#define N_E4F (0x600C + (12 * 4) + 3 )
110#define N_E4 (0x600C + (12 * 4) + 4 )
111#define N_F4 (0x600C + (12 * 4) + 5 )
112#define N_F4S (0x600C + (12 * 4) + 6 )
113#define N_G4F (0x600C + (12 * 4) + 6 )
114#define N_G4 (0x600C + (12 * 4) + 7 )
115#define N_G4S (0x600C + (12 * 4) + 8 )
116#define N_A4F (0x600C + (12 * 4) + 8 )
117#define N_A4 (0x600C + (12 * 4) + 9 )
118#define N_A4S (0x600C + (12 * 4) + 10)
119#define N_B4F (0x600C + (12 * 4) + 10)
120#define N_B4 (0x600C + (12 * 4) + 11)
121#define N_C5 (0x600C + (12 * 5) + 0 )
122#define N_C5S (0x600C + (12 * 5) + 1 )
123#define N_D5F (0x600C + (12 * 5) + 1 )
124#define N_D5 (0x600C + (12 * 5) + 2 )
125#define N_D5S (0x600C + (12 * 5) + 3 )
126#define N_E5F (0x600C + (12 * 5) + 3 )
127#define N_E5 (0x600C + (12 * 5) + 4 )
128#define N_F5 (0x600C + (12 * 5) + 5 )
129#define N_F5S (0x600C + (12 * 5) + 6 )
130#define N_G5F (0x600C + (12 * 5) + 6 )
131#define N_G5 (0x600C + (12 * 5) + 7 )
132#define N_G5S (0x600C + (12 * 5) + 8 )
133#define N_A5F (0x600C + (12 * 5) + 8 )
134#define N_A5 (0x600C + (12 * 5) + 9 )
135#define N_A5S (0x600C + (12 * 5) + 10)
136#define N_B5F (0x600C + (12 * 5) + 10)
137#define N_B5 (0x600C + (12 * 5) + 11)
138#define N_C6 (0x600C + (12 * 6) + 0 )
139#define N_C6S (0x600C + (12 * 6) + 1 )
140#define N_D6F (0x600C + (12 * 6) + 1 )
141#define N_D6 (0x600C + (12 * 6) + 2 )
142#define N_D6S (0x600C + (12 * 6) + 3 )
143#define N_E6F (0x600C + (12 * 6) + 3 )
144#define N_E6 (0x600C + (12 * 6) + 4 )
145#define N_F6 (0x600C + (12 * 6) + 5 )
146#define N_F6S (0x600C + (12 * 6) + 6 )
147#define N_G6F (0x600C + (12 * 6) + 6 )
148#define N_G6 (0x600C + (12 * 6) + 7 )
149#define N_G6S (0x600C + (12 * 6) + 8 )
150#define N_A6F (0x600C + (12 * 6) + 8 )
151#define N_A6 (0x600C + (12 * 6) + 9 )
152#define N_A6S (0x600C + (12 * 6) + 10)
153#define N_B6F (0x600C + (12 * 6) + 10)
154#define N_B6 (0x600C + (12 * 6) + 11)
155#define N_C7 (0x600C + (12 * 7) + 0 )
156#define N_C7S (0x600C + (12 * 7) + 1 )
157#define N_D7F (0x600C + (12 * 7) + 1 )
158#define N_D7 (0x600C + (12 * 7) + 2 )
159#define N_D7S (0x600C + (12 * 7) + 3 )
160#define N_E7F (0x600C + (12 * 7) + 3 )
161#define N_E7 (0x600C + (12 * 7) + 4 )
162#define N_F7 (0x600C + (12 * 7) + 5 )
163#define N_F7S (0x600C + (12 * 7) + 6 )
164#define N_G7F (0x600C + (12 * 7) + 6 )
165#define N_G7 (0x600C + (12 * 7) + 7 )
166#define N_G7S (0x600C + (12 * 7) + 8 )
167#define N_A7F (0x600C + (12 * 7) + 8 )
168#define N_A7 (0x600C + (12 * 7) + 9 )
169#define N_A7S (0x600C + (12 * 7) + 10)
170#define N_B7F (0x600C + (12 * 7) + 10)
171#define N_B7 (0x600C + (12 * 7) + 11)
172#define N_C8 (0x600C + (12 * 8) + 0 )
173#define N_C8S (0x600C + (12 * 8) + 1 )
174#define N_D8F (0x600C + (12 * 8) + 1 )
175#define N_D8 (0x600C + (12 * 8) + 2 )
176#define N_D8S (0x600C + (12 * 8) + 3 )
177#define N_E8F (0x600C + (12 * 8) + 3 )
178#define N_E8 (0x600C + (12 * 8) + 4 )
179#define N_F8 (0x600C + (12 * 8) + 5 )
180#define N_F8S (0x600C + (12 * 8) + 6 )
181#define N_G8F (0x600C + (12 * 8) + 6 )
182#define N_G8 (0x600C + (12 * 8) + 7 )
183#define N_G8S (0x600C + (12 * 8) + 8 )
184#define N_A8F (0x600C + (12 * 8) + 8 )
185#define N_A8 (0x600C + (12 * 8) + 9 )
186#define N_A8S (0x600C + (12 * 8) + 10)
187#define N_B8F (0x600C + (12 * 8) + 10)
188#define N_B8 (0x600C + (12 * 8) + 11)
189#define N_C8 (0x600C + (12 * 8) + 0 )
190#define N_C8S (0x600C + (12 * 8) + 1 )
191#define N_D8F (0x600C + (12 * 8) + 1 )
192#define N_D8 (0x600C + (12 * 8) + 2 )
193#define N_D8S (0x600C + (12 * 8) + 3 )
194#define N_E8F (0x600C + (12 * 8) + 3 )
195#define N_E8 (0x600C + (12 * 8) + 4 )
196#define N_F8 (0x600C + (12 * 8) + 5 )
197#define N_F8S (0x600C + (12 * 8) + 6 )
198#define N_G8F (0x600C + (12 * 8) + 6 )
199#define N_G8 (0x600C + (12 * 8) + 7 )
200#define N_G8S (0x600C + (12 * 8) + 8 )
201#define N_A8F (0x600C + (12 * 8) + 8 )
202#define N_A8 (0x600C + (12 * 8) + 9 )
203#define N_A8S (0x600C + (12 * 8) + 10)
204#define N_B8F (0x600C + (12 * 8) + 10)
205#define N_B8 (0x600C + (12 * 8) + 11)
206 55
207#endif \ No newline at end of file 56#endif
diff --git a/quantum/process_keycode/process_music.c b/quantum/process_keycode/process_music.c
index 1e2648bff..217dca280 100644
--- a/quantum/process_keycode/process_music.c
+++ b/quantum/process_keycode/process_music.c
@@ -1,5 +1,29 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include "process_music.h" 16#include "process_music.h"
2 17
18#ifdef AUDIO_ENABLE
19#include "process_audio.h"
20#endif
21#if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
22#include "process_midi.h"
23#endif
24
25#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
26
3bool music_activated = false; 27bool music_activated = false;
4uint8_t music_starting_note = 0x0C; 28uint8_t music_starting_note = 0x0C;
5int music_offset = 7; 29int music_offset = 7;
@@ -8,36 +32,41 @@ int music_offset = 7;
8static bool music_sequence_recording = false; 32static bool music_sequence_recording = false;
9static bool music_sequence_recorded = false; 33static bool music_sequence_recorded = false;
10static bool music_sequence_playing = false; 34static bool music_sequence_playing = false;
11static float music_sequence[16] = {0}; 35static uint8_t music_sequence[16] = {0};
12static uint8_t music_sequence_count = 0; 36static uint8_t music_sequence_count = 0;
13static uint8_t music_sequence_position = 0; 37static uint8_t music_sequence_position = 0;
14 38
15static uint16_t music_sequence_timer = 0; 39static uint16_t music_sequence_timer = 0;
16static uint16_t music_sequence_interval = 100; 40static uint16_t music_sequence_interval = 100;
17 41
18bool process_music(uint16_t keycode, keyrecord_t *record) { 42static void music_noteon(uint8_t note) {
43 #ifdef AUDIO_ENABLE
44 process_audio_noteon(note);
45 #endif
46 #if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
47 process_midi_basic_noteon(note);
48 #endif
49}
19 50
20 if (keycode == AU_ON && record->event.pressed) { 51static void music_noteoff(uint8_t note) {
21 audio_on(); 52 #ifdef AUDIO_ENABLE
22 return false; 53 process_audio_noteoff(note);
23 } 54 #endif
55 #if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
56 process_midi_basic_noteoff(note);
57 #endif
58}
24 59
25 if (keycode == AU_OFF && record->event.pressed) { 60void music_all_notes_off(void) {
26 audio_off(); 61 #ifdef AUDIO_ENABLE
27 return false; 62 process_audio_all_notes_off();
28 } 63 #endif
64 #if defined(MIDI_ENABLE) && defined(MIDI_BASIC)
65 process_midi_all_notes_off();
66 #endif
67}
29 68
30 if (keycode == AU_TOG && record->event.pressed) { 69bool process_music(uint16_t keycode, keyrecord_t *record) {
31 if (is_audio_on())
32 {
33 audio_off();
34 }
35 else
36 {
37 audio_on();
38 }
39 return false;
40 }
41 70
42 if (keycode == MU_ON && record->event.pressed) { 71 if (keycode == MU_ON && record->event.pressed) {
43 music_on(); 72 music_on();
@@ -61,22 +90,10 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
61 return false; 90 return false;
62 } 91 }
63 92
64 if (keycode == MUV_IN && record->event.pressed) {
65 voice_iterate();
66 music_scale_user();
67 return false;
68 }
69
70 if (keycode == MUV_DE && record->event.pressed) {
71 voice_deiterate();
72 music_scale_user();
73 return false;
74 }
75
76 if (music_activated) { 93 if (music_activated) {
77 94
78 if (keycode == KC_LCTL && record->event.pressed) { // Start recording 95 if (keycode == KC_LCTL && record->event.pressed) { // Start recording
79 stop_all_notes(); 96 music_all_notes_off();
80 music_sequence_recording = true; 97 music_sequence_recording = true;
81 music_sequence_recorded = false; 98 music_sequence_recorded = false;
82 music_sequence_playing = false; 99 music_sequence_playing = false;
@@ -85,7 +102,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
85 } 102 }
86 103
87 if (keycode == KC_LALT && record->event.pressed) { // Stop recording/playing 104 if (keycode == KC_LALT && record->event.pressed) { // Stop recording/playing
88 stop_all_notes(); 105 music_all_notes_off();
89 if (music_sequence_recording) { // was recording 106 if (music_sequence_recording) { // was recording
90 music_sequence_recorded = true; 107 music_sequence_recorded = true;
91 } 108 }
@@ -95,7 +112,7 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
95 } 112 }
96 113
97 if (keycode == KC_LGUI && record->event.pressed && music_sequence_recorded) { // Start playing 114 if (keycode == KC_LGUI && record->event.pressed && music_sequence_recorded) { // Start playing
98 stop_all_notes(); 115 music_all_notes_off();
99 music_sequence_recording = false; 116 music_sequence_recording = false;
100 music_sequence_playing = true; 117 music_sequence_playing = true;
101 music_sequence_position = 0; 118 music_sequence_position = 0;
@@ -114,32 +131,34 @@ bool process_music(uint16_t keycode, keyrecord_t *record) {
114 music_sequence_interval+=10; 131 music_sequence_interval+=10;
115 return false; 132 return false;
116 } 133 }
134
117 #define MUSIC_MODE_GUITAR 135 #define MUSIC_MODE_GUITAR
118 136
119 #ifdef MUSIC_MODE_CHROMATIC 137 #ifdef MUSIC_MODE_CHROMATIC
120 float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + record->event.key.col + music_offset)/12.0+(MATRIX_ROWS - record->event.key.row)); 138 uint8_t note = (music_starting_note + record->event.key.col + music_offset - 3)+12*(MATRIX_ROWS - record->event.key.row);
121 #elif defined(MUSIC_MODE_GUITAR) 139 #elif defined(MUSIC_MODE_GUITAR)
122 float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + record->event.key.col + music_offset)/12.0+(float)(MATRIX_ROWS - record->event.key.row + 7)*5.0/12); 140 uint8_t note = (music_starting_note + record->event.key.col + music_offset + 32)+5*(MATRIX_ROWS - record->event.key.row);
123 #elif defined(MUSIC_MODE_VIOLIN) 141 #elif defined(MUSIC_MODE_VIOLIN)
124 float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + record->event.key.col + music_offset)/12.0+(float)(MATRIX_ROWS - record->event.key.row + 5)*7.0/12); 142 uint8_t note = (music_starting_note + record->event.key.col + music_offset + 32)+7*(MATRIX_ROWS - record->event.key.row);
125 #else 143 #else
126 float freq = ((float)220.0)*pow(2.0, -5.0)*pow(2.0,(music_starting_note + SCALE[record->event.key.col + music_offset])/12.0+(MATRIX_ROWS - record->event.key.row)); 144 uint8_t note = (music_starting_note + SCALE[record->event.key.col + music_offset] - 3)+12*(MATRIX_ROWS - record->event.key.row);
127 #endif 145 #endif
128 146
129 if (record->event.pressed) { 147 if (record->event.pressed) {
130 play_note(freq, 0xF); 148 music_noteon(note);
131 if (music_sequence_recording) { 149 if (music_sequence_recording) {
132 music_sequence[music_sequence_count] = freq; 150 music_sequence[music_sequence_count] = note;
133 music_sequence_count++; 151 music_sequence_count++;
134 } 152 }
135 } else { 153 } else {
136 stop_note(freq); 154 music_noteoff(note);
137 } 155 }
138 156
139 if (keycode < 0xFF) // ignores all normal keycodes, but lets RAISE, LOWER, etc through 157 if (keycode < 0xFF) // ignores all normal keycodes, but lets RAISE, LOWER, etc through
140 return false; 158 return false;
141 } 159 }
142 return true; 160
161 return true;
143} 162}
144 163
145bool is_music_on(void) { 164bool is_music_on(void) {
@@ -161,26 +180,26 @@ void music_on(void) {
161 180
162void music_off(void) { 181void music_off(void) {
163 music_activated = 0; 182 music_activated = 0;
164 stop_all_notes(); 183 music_all_notes_off();
165} 184}
166 185
167
168__attribute__ ((weak))
169void music_on_user() {}
170
171__attribute__ ((weak))
172void audio_on_user() {}
173
174__attribute__ ((weak))
175void music_scale_user() {}
176
177void matrix_scan_music(void) { 186void matrix_scan_music(void) {
178 if (music_sequence_playing) { 187 if (music_sequence_playing) {
179 if ((music_sequence_timer == 0) || (timer_elapsed(music_sequence_timer) > music_sequence_interval)) { 188 if ((music_sequence_timer == 0) || (timer_elapsed(music_sequence_timer) > music_sequence_interval)) {
180 music_sequence_timer = timer_read(); 189 music_sequence_timer = timer_read();
181 stop_note(music_sequence[(music_sequence_position - 1 < 0)?(music_sequence_position - 1 + music_sequence_count):(music_sequence_position - 1)]); 190 uint8_t prev_note = music_sequence[(music_sequence_position - 1 < 0)?(music_sequence_position - 1 + music_sequence_count):(music_sequence_position - 1)];
182 play_note(music_sequence[music_sequence_position], 0xF); 191 uint8_t next_note = music_sequence[music_sequence_position];
192 music_noteoff(prev_note);
193 music_noteon(next_note);
183 music_sequence_position = (music_sequence_position + 1) % music_sequence_count; 194 music_sequence_position = (music_sequence_position + 1) % music_sequence_count;
184 } 195 }
185 } 196 }
186} 197}
198
199__attribute__ ((weak))
200void music_on_user() {}
201
202__attribute__ ((weak))
203void music_scale_user() {}
204
205#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC)) \ No newline at end of file
diff --git a/quantum/process_keycode/process_music.h b/quantum/process_keycode/process_music.h
index 318b3e387..8dfbf041f 100644
--- a/quantum/process_keycode/process_music.h
+++ b/quantum/process_keycode/process_music.h
@@ -1,8 +1,26 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef PROCESS_MUSIC_H 17#ifndef PROCESS_MUSIC_H
2#define PROCESS_MUSIC_H 18#define PROCESS_MUSIC_H
3 19
4#include "quantum.h" 20#include "quantum.h"
5 21
22#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
23
6bool process_music(uint16_t keycode, keyrecord_t *record); 24bool process_music(uint16_t keycode, keyrecord_t *record);
7 25
8bool is_music_on(void); 26bool is_music_on(void);
@@ -10,9 +28,9 @@ void music_toggle(void);
10void music_on(void); 28void music_on(void);
11void music_off(void); 29void music_off(void);
12 30
13void audio_on_user(void);
14void music_on_user(void); 31void music_on_user(void);
15void music_scale_user(void); 32void music_scale_user(void);
33void music_all_notes_off(void);
16 34
17void matrix_scan_music(void); 35void matrix_scan_music(void);
18 36
@@ -24,4 +42,6 @@ void matrix_scan_music(void);
24 0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), } 42 0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), }
25#endif 43#endif
26 44
27#endif \ No newline at end of file 45#endif // defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
46
47#endif
diff --git a/quantum/process_keycode/process_printer.c b/quantum/process_keycode/process_printer.c
index 2e11dd366..807f7a0b9 100644
--- a/quantum/process_keycode/process_printer.c
+++ b/quantum/process_keycode/process_printer.c
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "process_printer.h" 17#include "process_printer.h"
2#include "action_util.h" 18#include "action_util.h"
3 19
@@ -251,4 +267,4 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) {
251 } 267 }
252 return true; 268 return true;
253 269
254} \ No newline at end of file 270}
diff --git a/quantum/process_keycode/process_printer.h b/quantum/process_keycode/process_printer.h
index fdd36d75a..aa494ac8a 100644
--- a/quantum/process_keycode/process_printer.h
+++ b/quantum/process_keycode/process_printer.h
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef PROCESS_PRINTER_H 17#ifndef PROCESS_PRINTER_H
2#define PROCESS_PRINTER_H 18#define PROCESS_PRINTER_H
3 19
@@ -5,4 +21,4 @@
5 21
6#include "protocol/serial.h" 22#include "protocol/serial.h"
7 23
8#endif \ No newline at end of file 24#endif
diff --git a/quantum/process_keycode/process_printer_bb.c b/quantum/process_keycode/process_printer_bb.c
index 1924d0377..55d3b552b 100644
--- a/quantum/process_keycode/process_printer_bb.c
+++ b/quantum/process_keycode/process_printer_bb.c
@@ -1,3 +1,19 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "process_printer.h" 17#include "process_printer.h"
2#include "action_util.h" 18#include "action_util.h"
3 19
@@ -257,4 +273,4 @@ bool process_printer(uint16_t keycode, keyrecord_t *record) {
257 } 273 }
258 return true; 274 return true;
259 275
260} \ No newline at end of file 276}
diff --git a/quantum/process_keycode/process_tap_dance.c b/quantum/process_keycode/process_tap_dance.c
index 403dca538..b807ec3c3 100644
--- a/quantum/process_keycode/process_tap_dance.c
+++ b/quantum/process_keycode/process_tap_dance.c
@@ -1,6 +1,23 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include "quantum.h" 16#include "quantum.h"
2#include "action_tapping.h" 17#include "action_tapping.h"
3 18
19uint8_t get_oneshot_mods(void);
20
4static uint16_t last_td; 21static uint16_t last_td;
5static int8_t highest_td = -1; 22static int8_t highest_td = -1;
6 23
diff --git a/quantum/process_keycode/process_tap_dance.h b/quantum/process_keycode/process_tap_dance.h
index 726752ecc..330809f83 100644
--- a/quantum/process_keycode/process_tap_dance.h
+++ b/quantum/process_keycode/process_tap_dance.h
@@ -1,3 +1,18 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef PROCESS_TAP_DANCE_H 16#ifndef PROCESS_TAP_DANCE_H
2#define PROCESS_TAP_DANCE_H 17#define PROCESS_TAP_DANCE_H
3 18
diff --git a/quantum/process_keycode/process_ucis.c b/quantum/process_keycode/process_ucis.c
index 4ad2533b0..86c0937f5 100644
--- a/quantum/process_keycode/process_ucis.c
+++ b/quantum/process_keycode/process_ucis.c
@@ -1,3 +1,19 @@
1/* Copyright 2017 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "process_ucis.h" 17#include "process_ucis.h"
2 18
3qk_ucis_state_t qk_ucis_state; 19qk_ucis_state_t qk_ucis_state;
@@ -130,4 +146,4 @@ bool process_ucis (uint16_t keycode, keyrecord_t *record) {
130 return false; 146 return false;
131 } 147 }
132 return true; 148 return true;
133} \ No newline at end of file 149}
diff --git a/quantum/process_keycode/process_ucis.h b/quantum/process_keycode/process_ucis.h
index 4332f57b3..3f736a709 100644
--- a/quantum/process_keycode/process_ucis.h
+++ b/quantum/process_keycode/process_ucis.h
@@ -1,3 +1,19 @@
1/* Copyright 2017 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef PROCESS_UCIS_H 17#ifndef PROCESS_UCIS_H
2#define PROCESS_UCIS_H 18#define PROCESS_UCIS_H
3 19
diff --git a/quantum/process_keycode/process_unicode.c b/quantum/process_keycode/process_unicode.c
index ccae6fdca..678a15234 100644
--- a/quantum/process_keycode/process_unicode.c
+++ b/quantum/process_keycode/process_unicode.c
@@ -1,8 +1,29 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include "process_unicode.h" 16#include "process_unicode.h"
2#include "action_util.h" 17#include "action_util.h"
3 18
19static uint8_t first_flag = 0;
20
4bool process_unicode(uint16_t keycode, keyrecord_t *record) { 21bool process_unicode(uint16_t keycode, keyrecord_t *record) {
5 if (keycode > QK_UNICODE && record->event.pressed) { 22 if (keycode > QK_UNICODE && record->event.pressed) {
23 if (first_flag == 0) {
24 set_unicode_input_mode(eeprom_read_byte(EECONFIG_UNICODEMODE));
25 first_flag = 1;
26 }
6 uint16_t unicode = keycode & 0x7FFF; 27 uint16_t unicode = keycode & 0x7FFF;
7 unicode_input_start(); 28 unicode_input_start();
8 register_hex(unicode); 29 register_hex(unicode);
diff --git a/quantum/process_keycode/process_unicode.h b/quantum/process_keycode/process_unicode.h
index 4c21f11eb..c525b74f0 100644
--- a/quantum/process_keycode/process_unicode.h
+++ b/quantum/process_keycode/process_unicode.h
@@ -1,3 +1,18 @@
1/* Copyright 2016 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef PROCESS_UNICODE_H 16#ifndef PROCESS_UNICODE_H
2#define PROCESS_UNICODE_H 17#define PROCESS_UNICODE_H
3 18
diff --git a/quantum/process_keycode/process_unicode_common.c b/quantum/process_keycode/process_unicode_common.c
index 31bc3b7ab..1dbdec3e7 100644
--- a/quantum/process_keycode/process_unicode_common.c
+++ b/quantum/process_keycode/process_unicode_common.c
@@ -1,10 +1,28 @@
1/* Copyright 2017 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "process_unicode_common.h" 17#include "process_unicode_common.h"
2 18
19static uint8_t input_mode;
3uint8_t mods; 20uint8_t mods;
4 21
5void set_unicode_input_mode(uint8_t os_target) 22void set_unicode_input_mode(uint8_t os_target)
6{ 23{
7 input_mode = os_target; 24 input_mode = os_target;
25 eeprom_update_byte(EECONFIG_UNICODEMODE, os_target);
8} 26}
9 27
10uint8_t get_unicode_input_mode(void) { 28uint8_t get_unicode_input_mode(void) {
@@ -76,10 +94,22 @@ void unicode_input_finish (void) {
76 if (mods & MOD_BIT(KC_RGUI)) register_code(KC_RGUI); 94 if (mods & MOD_BIT(KC_RGUI)) register_code(KC_RGUI);
77} 95}
78 96
97__attribute__((weak))
98uint16_t hex_to_keycode(uint8_t hex)
99{
100 if (hex == 0x0) {
101 return KC_0;
102 } else if (hex < 0xA) {
103 return KC_1 + (hex - 0x1);
104 } else {
105 return KC_A + (hex - 0xA);
106 }
107}
108
79void register_hex(uint16_t hex) { 109void register_hex(uint16_t hex) {
80 for(int i = 3; i >= 0; i--) { 110 for(int i = 3; i >= 0; i--) {
81 uint8_t digit = ((hex >> (i*4)) & 0xF); 111 uint8_t digit = ((hex >> (i*4)) & 0xF);
82 register_code(hex_to_keycode(digit)); 112 register_code(hex_to_keycode(digit));
83 unregister_code(hex_to_keycode(digit)); 113 unregister_code(hex_to_keycode(digit));
84 } 114 }
85} \ No newline at end of file 115}
diff --git a/quantum/process_keycode/process_unicode_common.h b/quantum/process_keycode/process_unicode_common.h
index 864693cdd..f5be1da5c 100644
--- a/quantum/process_keycode/process_unicode_common.h
+++ b/quantum/process_keycode/process_unicode_common.h
@@ -1,3 +1,19 @@
1/* Copyright 2017 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef PROCESS_UNICODE_COMMON_H 17#ifndef PROCESS_UNICODE_COMMON_H
2#define PROCESS_UNICODE_COMMON_H 18#define PROCESS_UNICODE_COMMON_H
3 19
@@ -129,4 +145,4 @@ void register_hex(uint16_t hex);
129#define UC_TILD UC(0x007E) 145#define UC_TILD UC(0x007E)
130#define UC_DEL UC(0x007F) 146#define UC_DEL UC(0x007F)
131 147
132#endif \ No newline at end of file 148#endif
diff --git a/quantum/process_keycode/process_unicodemap.c b/quantum/process_keycode/process_unicodemap.c
index 68a593a18..0227fbdd7 100644
--- a/quantum/process_keycode/process_unicodemap.c
+++ b/quantum/process_keycode/process_unicodemap.c
@@ -1,3 +1,19 @@
1/* Copyright 2017 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "process_unicodemap.h" 17#include "process_unicodemap.h"
2#include "process_unicode_common.h" 18#include "process_unicode_common.h"
3 19
@@ -53,4 +69,4 @@ bool process_unicode_map(uint16_t keycode, keyrecord_t *record) {
53 } 69 }
54 } 70 }
55 return true; 71 return true;
56} \ No newline at end of file 72}
diff --git a/quantum/process_keycode/process_unicodemap.h b/quantum/process_keycode/process_unicodemap.h
index 64a7a0109..929c88c0b 100644
--- a/quantum/process_keycode/process_unicodemap.h
+++ b/quantum/process_keycode/process_unicodemap.h
@@ -1,3 +1,19 @@
1/* Copyright 2017 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef PROCESS_UNICODEMAP_H 17#ifndef PROCESS_UNICODEMAP_H
2#define PROCESS_UNICODEMAP_H 18#define PROCESS_UNICODEMAP_H
3 19
@@ -6,4 +22,4 @@
6 22
7void unicode_map_input_error(void); 23void unicode_map_input_error(void);
8bool process_unicode_map(uint16_t keycode, keyrecord_t *record); 24bool process_unicode_map(uint16_t keycode, keyrecord_t *record);
9#endif \ No newline at end of file 25#endif
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 582f8920b..4f4cee4e9 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -1,3 +1,19 @@
1/* Copyright 2016-2017 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "quantum.h" 17#include "quantum.h"
2#ifdef PROTOCOL_LUFA 18#ifdef PROTOCOL_LUFA
3#include "outputselect.h" 19#include "outputselect.h"
@@ -98,8 +114,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
98 114
99void reset_keyboard(void) { 115void reset_keyboard(void) {
100 clear_keyboard(); 116 clear_keyboard();
101#ifdef AUDIO_ENABLE 117#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_ENABLE_BASIC))
102 stop_all_notes(); 118 music_all_notes_off();
103 shutdown_user(); 119 shutdown_user();
104#endif 120#endif
105 wait_ms(250); 121 wait_ms(250);
@@ -119,7 +135,7 @@ void reset_keyboard(void) {
119#endif 135#endif
120 136
121static bool shift_interrupted[2] = {0, 0}; 137static bool shift_interrupted[2] = {0, 0};
122static uint16_t scs_timer = 0; 138static uint16_t scs_timer[2] = {0, 0};
123 139
124bool process_record_quantum(keyrecord_t *record) { 140bool process_record_quantum(keyrecord_t *record) {
125 141
@@ -153,10 +169,13 @@ bool process_record_quantum(keyrecord_t *record) {
153 169
154 if (!( 170 if (!(
155 process_record_kb(keycode, record) && 171 process_record_kb(keycode, record) &&
156 #ifdef MIDI_ENABLE 172 #if defined(MIDI_ENABLE) && defined(MIDI_ADVANCED)
157 process_midi(keycode, record) && 173 process_midi(keycode, record) &&
158 #endif 174 #endif
159 #ifdef AUDIO_ENABLE 175 #ifdef AUDIO_ENABLE
176 process_audio(keycode, record) &&
177 #endif
178 #if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
160 process_music(keycode, record) && 179 process_music(keycode, record) &&
161 #endif 180 #endif
162 #ifdef TAP_DANCE_ENABLE 181 #ifdef TAP_DANCE_ENABLE
@@ -294,14 +313,6 @@ bool process_record_quantum(keyrecord_t *record) {
294 return false; 313 return false;
295 break; 314 break;
296 #endif 315 #endif
297 #ifdef ADAFRUIT_BLE_ENABLE
298 case OUT_BLE:
299 if (record->event.pressed) {
300 set_output(OUTPUT_ADAFRUIT_BLE);
301 }
302 return false;
303 break;
304 #endif
305 #endif 316 #endif
306 case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO: 317 case MAGIC_SWAP_CONTROL_CAPSLOCK ... MAGIC_TOGGLE_NKRO:
307 if (record->event.pressed) { 318 if (record->event.pressed) {
@@ -384,7 +395,7 @@ bool process_record_quantum(keyrecord_t *record) {
384 case KC_LSPO: { 395 case KC_LSPO: {
385 if (record->event.pressed) { 396 if (record->event.pressed) {
386 shift_interrupted[0] = false; 397 shift_interrupted[0] = false;
387 scs_timer = timer_read (); 398 scs_timer[0] = timer_read ();
388 register_mods(MOD_BIT(KC_LSFT)); 399 register_mods(MOD_BIT(KC_LSFT));
389 } 400 }
390 else { 401 else {
@@ -394,7 +405,7 @@ bool process_record_quantum(keyrecord_t *record) {
394 shift_interrupted[1] = true; 405 shift_interrupted[1] = true;
395 } 406 }
396 #endif 407 #endif
397 if (!shift_interrupted[0] && timer_elapsed(scs_timer) < TAPPING_TERM) { 408 if (!shift_interrupted[0] && timer_elapsed(scs_timer[0]) < TAPPING_TERM) {
398 register_code(LSPO_KEY); 409 register_code(LSPO_KEY);
399 unregister_code(LSPO_KEY); 410 unregister_code(LSPO_KEY);
400 } 411 }
@@ -407,7 +418,7 @@ bool process_record_quantum(keyrecord_t *record) {
407 case KC_RSPC: { 418 case KC_RSPC: {
408 if (record->event.pressed) { 419 if (record->event.pressed) {
409 shift_interrupted[1] = false; 420 shift_interrupted[1] = false;
410 scs_timer = timer_read (); 421 scs_timer[1] = timer_read ();
411 register_mods(MOD_BIT(KC_RSFT)); 422 register_mods(MOD_BIT(KC_RSFT));
412 } 423 }
413 else { 424 else {
@@ -417,7 +428,7 @@ bool process_record_quantum(keyrecord_t *record) {
417 shift_interrupted[1] = true; 428 shift_interrupted[1] = true;
418 } 429 }
419 #endif 430 #endif
420 if (!shift_interrupted[1] && timer_elapsed(scs_timer) < TAPPING_TERM) { 431 if (!shift_interrupted[1] && timer_elapsed(scs_timer[1]) < TAPPING_TERM) {
421 register_code(RSPC_KEY); 432 register_code(RSPC_KEY);
422 unregister_code(RSPC_KEY); 433 unregister_code(RSPC_KEY);
423 } 434 }
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 259bac369..2bf18d095 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -1,3 +1,18 @@
1/* Copyright 2016-2017 Erez Zukerman, Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef QUANTUM_H 16#ifndef QUANTUM_H
2#define QUANTUM_H 17#define QUANTUM_H
3 18
@@ -35,11 +50,16 @@ extern uint32_t default_layer_state;
35 50
36#ifdef MIDI_ENABLE 51#ifdef MIDI_ENABLE
37 #include <lufa.h> 52 #include <lufa.h>
53#ifdef MIDI_ADVANCED
38 #include "process_midi.h" 54 #include "process_midi.h"
39#endif 55#endif
56#endif // MIDI_ENABLE
40 57
41#ifdef AUDIO_ENABLE 58#ifdef AUDIO_ENABLE
42 #include "audio.h" 59 #include "process_audio.h"
60#endif
61
62#if defined(AUDIO_ENABLE) || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
43 #include "process_music.h" 63 #include "process_music.h"
44#endif 64#endif
45 65
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index 903d57f1e..7354ae0da 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -1,7 +1,31 @@
1 1/* Copyright 2016-2017 Jack Humbert
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
2#ifndef QUANTUM_KEYCODES_H 16#ifndef QUANTUM_KEYCODES_H
3#define QUANTUM_KEYCODES_H 17#define QUANTUM_KEYCODES_H
4 18
19#ifndef MIDI_ENABLE_STRICT
20#define MIDI_ENABLE_STRICT 0
21#endif
22
23#if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_ADVANCED))
24#ifndef MIDI_TONE_KEYCODE_OCTAVES
25#define MIDI_TONE_KEYCODE_OCTAVES 3
26#endif
27#endif
28
5enum quantum_keycodes { 29enum quantum_keycodes {
6 // Ranges used in shortucuts - not to be used directly 30 // Ranges used in shortucuts - not to be used directly
7 QK_TMK = 0x0000, 31 QK_TMK = 0x0000,
@@ -107,9 +131,230 @@ enum quantum_keycodes {
107 MUV_IN, 131 MUV_IN,
108 MUV_DE, 132 MUV_DE,
109 133
110 // Midi mode on/off 134 // Midi
111 MIDI_ON, 135#if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
112 MIDI_OFF, 136 MI_ON, // send midi notes when music mode is enabled
137 MI_OFF, // don't send midi notes when music mode is enabled
138#endif
139
140#if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_ADVANCED))
141 MIDI_TONE_MIN,
142
143#if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 0
144 MI_C = MIDI_TONE_MIN,
145 MI_Cs,
146 MI_Db = MI_Cs,
147 MI_D,
148 MI_Ds,
149 MI_Eb = MI_Ds,
150 MI_E,
151 MI_F,
152 MI_Fs,
153 MI_Gb = MI_Fs,
154 MI_G,
155 MI_Gs,
156 MI_Ab = MI_Gs,
157 MI_A,
158 MI_As,
159 MI_Bb = MI_As,
160 MI_B,
161#endif
162
163#if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 1
164 MI_C_1,
165 MI_Cs_1,
166 MI_Db_1 = MI_Cs_1,
167 MI_D_1,
168 MI_Ds_1,
169 MI_Eb_1 = MI_Ds_1,
170 MI_E_1,
171 MI_F_1,
172 MI_Fs_1,
173 MI_Gb_1 = MI_Fs_1,
174 MI_G_1,
175 MI_Gs_1,
176 MI_Ab_1 = MI_Gs_1,
177 MI_A_1,
178 MI_As_1,
179 MI_Bb_1 = MI_As_1,
180 MI_B_1,
181#endif
182
183#if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 2
184 MI_C_2,
185 MI_Cs_2,
186 MI_Db_2 = MI_Cs_2,
187 MI_D_2,
188 MI_Ds_2,
189 MI_Eb_2 = MI_Ds_2,
190 MI_E_2,
191 MI_F_2,
192 MI_Fs_2,
193 MI_Gb_2 = MI_Fs_2,
194 MI_G_2,
195 MI_Gs_2,
196 MI_Ab_2 = MI_Gs_2,
197 MI_A_2,
198 MI_As_2,
199 MI_Bb_2 = MI_As_2,
200 MI_B_2,
201#endif
202
203#if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 3
204 MI_C_3,
205 MI_Cs_3,
206 MI_Db_3 = MI_Cs_3,
207 MI_D_3,
208 MI_Ds_3,
209 MI_Eb_3 = MI_Ds_3,
210 MI_E_3,
211 MI_F_3,
212 MI_Fs_3,
213 MI_Gb_3 = MI_Fs_3,
214 MI_G_3,
215 MI_Gs_3,
216 MI_Ab_3 = MI_Gs_3,
217 MI_A_3,
218 MI_As_3,
219 MI_Bb_3 = MI_As_3,
220 MI_B_3,
221#endif
222
223#if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 4
224 MI_C_4,
225 MI_Cs_4,
226 MI_Db_4 = MI_Cs_4,
227 MI_D_4,
228 MI_Ds_4,
229 MI_Eb_4 = MI_Ds_4,
230 MI_E_4,
231 MI_F_4,
232 MI_Fs_4,
233 MI_Gb_4 = MI_Fs_4,
234 MI_G_4,
235 MI_Gs_4,
236 MI_Ab_4 = MI_Gs_4,
237 MI_A_4,
238 MI_As_4,
239 MI_Bb_4 = MI_As_4,
240 MI_B_4,
241#endif
242
243#if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 5
244 MI_C_5,
245 MI_Cs_5,
246 MI_Db_5 = MI_Cs_5,
247 MI_D_5,
248 MI_Ds_5,
249 MI_Eb_5 = MI_Ds_5,
250 MI_E_5,
251 MI_F_5,
252 MI_Fs_5,
253 MI_Gb_5 = MI_Fs_5,
254 MI_G_5,
255 MI_Gs_5,
256 MI_Ab_5 = MI_Gs_5,
257 MI_A_5,
258 MI_As_5,
259 MI_Bb_5 = MI_As_5,
260 MI_B_5,
261#endif
262
263#if !MIDI_ENABLE_STRICT || MIDI_TONE_KEYCODE_OCTAVES > 5
264 MIDI_TONE_MAX = MI_B_5,
265#elif MIDI_TONE_KEYCODE_OCTAVES > 4
266 MIDI_TONE_MAX = MI_B_4,
267#elif MIDI_TONE_KEYCODE_OCTAVES > 3
268 MIDI_TONE_MAX = MI_B_3,
269#elif MIDI_TONE_KEYCODE_OCTAVES > 2
270 MIDI_TONE_MAX = MI_B_2,
271#elif MIDI_TONE_KEYCODE_OCTAVES > 1
272 MIDI_TONE_MAX = MI_B_1,
273#elif MIDI_TONE_KEYCODE_OCTAVES > 0
274 MIDI_TONE_MAX = MI_B,
275#endif
276
277 MIDI_OCTAVE_MIN,
278 MI_OCT_N2 = MIDI_OCTAVE_MIN,
279 MI_OCT_N1,
280 MI_OCT_0,
281 MI_OCT_1,
282 MI_OCT_2,
283 MI_OCT_3,
284 MI_OCT_4,
285 MI_OCT_5,
286 MI_OCT_6,
287 MI_OCT_7,
288 MIDI_OCTAVE_MAX = MI_OCT_7,
289 MI_OCTD, // octave down
290 MI_OCTU, // octave up
291
292 MIDI_TRANSPOSE_MIN,
293 MI_TRNS_N6 = MIDI_TRANSPOSE_MIN,
294 MI_TRNS_N5,
295 MI_TRNS_N4,
296 MI_TRNS_N3,
297 MI_TRNS_N2,
298 MI_TRNS_N1,
299 MI_TRNS_0,
300 MI_TRNS_1,
301 MI_TRNS_2,
302 MI_TRNS_3,
303 MI_TRNS_4,
304 MI_TRNS_5,
305 MI_TRNS_6,
306 MIDI_TRANSPOSE_MAX = MI_TRNS_6,
307 MI_TRNSD, // transpose down
308 MI_TRNSU, // transpose up
309
310 MIDI_VELOCITY_MIN,
311 MI_VEL_1 = MIDI_VELOCITY_MIN,
312 MI_VEL_2,
313 MI_VEL_3,
314 MI_VEL_4,
315 MI_VEL_5,
316 MI_VEL_6,
317 MI_VEL_7,
318 MI_VEL_8,
319 MI_VEL_9,
320 MI_VEL_10,
321 MIDI_VELOCITY_MAX = MI_VEL_10,
322 MI_VELD, // velocity down
323 MI_VELU, // velocity up
324
325 MIDI_CHANNEL_MIN,
326 MI_CH1 = MIDI_CHANNEL_MIN,
327 MI_CH2,
328 MI_CH3,
329 MI_CH4,
330 MI_CH5,
331 MI_CH6,
332 MI_CH7,
333 MI_CH8,
334 MI_CH9,
335 MI_CH10,
336 MI_CH11,
337 MI_CH12,
338 MI_CH13,
339 MI_CH14,
340 MI_CH15,
341 MI_CH16,
342 MIDI_CHANNEL_MAX = MI_CH16,
343 MI_CHD, // previous channel
344 MI_CHU, // next channel
345
346 MI_ALLOFF, // all notes off
347
348 MI_SUS, // sustain
349 MI_PORT, // portamento
350 MI_SOST, // sostenuto
351 MI_SOFT, // soft pedal
352 MI_LEG, // legato
353
354 MI_MOD, // modulation
355 MI_MODSD, // decrease modulation speed
356 MI_MODSU, // increase modulation speed
357#endif // MIDI_ADVANCED
113 358
114 // Backlight functionality 359 // Backlight functionality
115 BL_0, 360 BL_0,
@@ -159,9 +404,6 @@ enum quantum_keycodes {
159#ifdef BLUETOOTH_ENABLE 404#ifdef BLUETOOTH_ENABLE
160 OUT_BT, 405 OUT_BT,
161#endif 406#endif
162#ifdef ADAFRUIT_BLE_ENABLE
163 OUT_BLE,
164#endif
165 407
166 // always leave at the end 408 // always leave at the end
167 SAFE_RANGE 409 SAFE_RANGE
@@ -282,9 +524,6 @@ enum quantum_keycodes {
282#define BL_ON BL_9 524#define BL_ON BL_9
283#define BL_OFF BL_0 525#define BL_OFF BL_0
284 526
285#define MI_ON MIDI_ON
286#define MI_OFF MIDI_OFF
287
288// GOTO layer - 16 layers max 527// GOTO layer - 16 layers max
289// when: 528// when:
290// ON_PRESS = 1 529// ON_PRESS = 1
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index dd1b91c63..eff70aae1 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -1,3 +1,18 @@
1/* Copyright 2016-2017 Yang Liu
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include <avr/eeprom.h> 16#include <avr/eeprom.h>
2#include <avr/interrupt.h> 17#include <avr/interrupt.h>
3#include <util/delay.h> 18#include <util/delay.h>
diff --git a/quantum/rgblight.h b/quantum/rgblight.h
index 2b3e791bf..92130192c 100644
--- a/quantum/rgblight.h
+++ b/quantum/rgblight.h
@@ -1,3 +1,18 @@
1/* Copyright 2017 Yang Liu
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef RGBLIGHT_H 16#ifndef RGBLIGHT_H
2#define RGBLIGHT_H 17#define RGBLIGHT_H
3 18
diff --git a/quantum/serial_link/LICENSE b/quantum/serial_link/LICENSE
index d7cc3198c..d13cc4b26 100644
--- a/quantum/serial_link/LICENSE
+++ b/quantum/serial_link/LICENSE
@@ -1,7 +1,5 @@
1The MIT License (MIT) 1The MIT License (MIT)
2 2
3Copyright (c) 2016 Fred Sundvik
4
5Permission is hereby granted, free of charge, to any person obtaining a copy 3Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the "Software"), to deal 4of this software and associated documentation files (the "Software"), to deal
7in the Software without restriction, including without limitation the rights 5in the Software without restriction, including without limitation the rights
diff --git a/quantum/template/Makefile b/quantum/template/Makefile
index 4e2a6f00f..840dc9a28 100644
--- a/quantum/template/Makefile
+++ b/quantum/template/Makefile
@@ -1,3 +1,18 @@
1# Copyright 2013 Jun Wako <wakojun@gmail.com>
2#
3# This program is free software: you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation, either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
1ifndef MAKEFILE_INCLUDED 16ifndef MAKEFILE_INCLUDED
2 include ../../Makefile 17 include ../../Makefile
3endif \ No newline at end of file 18endif
diff --git a/quantum/template/config.h b/quantum/template/config.h
index c61c4a618..dbca45765 100644
--- a/quantum/template/config.h
+++ b/quantum/template/config.h
@@ -1,5 +1,5 @@
1/* 1/*
2Copyright 2012 Jun Wako <wakojun@gmail.com> 2Copyright 2017 REPLACE_WITH_YOUR_NAME
3 3
4This program is free software: you can redistribute it and/or modify 4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by 5it under the terms of the GNU General Public License as published by
@@ -159,4 +159,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
159//#define NO_ACTION_MACRO 159//#define NO_ACTION_MACRO
160//#define NO_ACTION_FUNCTION 160//#define NO_ACTION_FUNCTION
161 161
162/*
163 * MIDI options
164 */
165
166/* Prevent use of disabled MIDI features in the keymap */
167//#define MIDI_ENABLE_STRICT 1
168
169/* enable basic MIDI features:
170 - MIDI notes can be sent when in Music mode is on
171*/
172//#define MIDI_BASIC
173
174/* enable advanced MIDI features:
175 - MIDI notes can be added to the keymap
176 - Octave shift and transpose
177 - Virtual sustain, portamento, and modulation wheel
178 - etc.
179*/
180//#define MIDI_ADVANCED
181
182/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
183//#define MIDI_TONE_KEYCODE_OCTAVES 1
184
162#endif 185#endif
diff --git a/quantum/template/keymaps/default/Makefile b/quantum/template/keymaps/default/Makefile
index f4671a9d1..b8879076b 100644
--- a/quantum/template/keymaps/default/Makefile
+++ b/quantum/template/keymaps/default/Makefile
@@ -1,4 +1,20 @@
1# Build Options 1# Copyright 2013 Jun Wako <wakojun@gmail.com>
2#
3# This program is free software: you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation, either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16
17# QMK Build Options
2# change to "no" to disable the options, or define them in the Makefile in 18# change to "no" to disable the options, or define them in the Makefile in
3# the appropriate keymap folder that will get included automatically 19# the appropriate keymap folder that will get included automatically
4# 20#
@@ -9,7 +25,7 @@ CONSOLE_ENABLE = no # Console for debug(+400)
9COMMAND_ENABLE = yes # Commands for debug and configuration 25COMMAND_ENABLE = yes # Commands for debug and configuration
10NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 26NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
11BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality 27BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
12MIDI_ENABLE = no # MIDI controls 28MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
13AUDIO_ENABLE = no # Audio output on port C6 29AUDIO_ENABLE = no # Audio output on port C6
14UNICODE_ENABLE = no # Unicode 30UNICODE_ENABLE = no # Unicode
15BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID 31BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
@@ -18,4 +34,4 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
18 34
19ifndef QUANTUM_DIR 35ifndef QUANTUM_DIR
20 include ../../../../Makefile 36 include ../../../../Makefile
21endif \ No newline at end of file 37endif
diff --git a/quantum/template/keymaps/default/config.h b/quantum/template/keymaps/default/config.h
index df06a2620..f52a97bbc 100644
--- a/quantum/template/keymaps/default/config.h
+++ b/quantum/template/keymaps/default/config.h
@@ -1,3 +1,19 @@
1/* Copyright 2017 REPLACE_WITH_YOUR_NAME
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef CONFIG_USER_H 17#ifndef CONFIG_USER_H
2#define CONFIG_USER_H 18#define CONFIG_USER_H
3 19
@@ -5,4 +21,4 @@
5 21
6// place overrides here 22// place overrides here
7 23
8#endif \ No newline at end of file 24#endif
diff --git a/quantum/template/keymaps/default/keymap.c b/quantum/template/keymaps/default/keymap.c
index e28a4723e..a123cd7ba 100644
--- a/quantum/template/keymaps/default/keymap.c
+++ b/quantum/template/keymaps/default/keymap.c
@@ -1,3 +1,18 @@
1/* Copyright 2017 REPLACE_WITH_YOUR_NAME
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include "%KEYBOARD%.h" 16#include "%KEYBOARD%.h"
2 17
3const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 18const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -41,4 +56,4 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
41 56
42void led_set_user(uint8_t usb_led) { 57void led_set_user(uint8_t usb_led) {
43 58
44} \ No newline at end of file 59}
diff --git a/quantum/template/rules.mk b/quantum/template/rules.mk
index bad3387bf..a1f9377d8 100644
--- a/quantum/template/rules.mk
+++ b/quantum/template/rules.mk
@@ -61,7 +61,7 @@ SLEEP_LED_ENABLE ?= no # Breathing sleep LED during USB suspend
61# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 61# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
62NKRO_ENABLE ?= no # USB Nkey Rollover 62NKRO_ENABLE ?= no # USB Nkey Rollover
63BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default 63BACKLIGHT_ENABLE ?= no # Enable keyboard backlight functionality on B7 by default
64MIDI_ENABLE ?= no # MIDI controls 64MIDI_ENABLE ?= no # MIDI support (+2400 to 4200, depending on config)
65UNICODE_ENABLE ?= no # Unicode 65UNICODE_ENABLE ?= no # Unicode
66BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID 66BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
67AUDIO_ENABLE ?= no # Audio output on port C6 67AUDIO_ENABLE ?= no # Audio output on port C6
diff --git a/quantum/template/template.c b/quantum/template/template.c
index 5ef349583..97f788654 100644
--- a/quantum/template/template.c
+++ b/quantum/template/template.c
@@ -1,3 +1,18 @@
1/* Copyright 2017 REPLACE_WITH_YOUR_NAME
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#include "%KEYBOARD%.h" 16#include "%KEYBOARD%.h"
2 17
3void matrix_init_kb(void) { 18void matrix_init_kb(void) {
diff --git a/quantum/template/template.h b/quantum/template/template.h
index cd78a54e3..7e2b14f3c 100644
--- a/quantum/template/template.h
+++ b/quantum/template/template.h
@@ -1,3 +1,18 @@
1/* Copyright 2017 REPLACE_WITH_YOUR_NAME
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
1#ifndef %KEYBOARD_UPPERCASE%_H 16#ifndef %KEYBOARD_UPPERCASE%_H
2#define %KEYBOARD_UPPERCASE%_H 17#define %KEYBOARD_UPPERCASE%_H
3 18
@@ -5,7 +20,7 @@
5 20
6// This a shortcut to help you visually see your layout. 21// This a shortcut to help you visually see your layout.
7// The following is an example using the Planck MIT layout 22// The following is an example using the Planck MIT layout
8// The first section contains all of the arguements 23// The first section contains all of the arguments
9// The second converts the arguments into a two-dimensional array 24// The second converts the arguments into a two-dimensional array
10#define KEYMAP( \ 25#define KEYMAP( \
11 k00, k01, k02, \ 26 k00, k01, k02, \
diff --git a/quantum/variable_trace.c b/quantum/variable_trace.c
index de580244c..713747cfc 100644
--- a/quantum/variable_trace.c
+++ b/quantum/variable_trace.c
@@ -1,3 +1,19 @@
1/* Copyright 2016 Fred Sundvik
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#include "variable_trace.h" 17#include "variable_trace.h"
2#include <stddef.h> 18#include <stddef.h>
3#include <string.h> 19#include <string.h>
diff --git a/quantum/variable_trace.h b/quantum/variable_trace.h
index 46bd82786..dacc13858 100644
--- a/quantum/variable_trace.h
+++ b/quantum/variable_trace.h
@@ -1,3 +1,19 @@
1/* Copyright 2016 Fred Sundvik
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
1#ifndef VARIABLE_TRACE_H 17#ifndef VARIABLE_TRACE_H
2#define VARIABLE_TRACE_H 18#define VARIABLE_TRACE_H
3 19