aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--keyboard/planck/keymaps/default/keymap.c10
-rw-r--r--keyboard/preonic/Makefile2
-rw-r--r--keyboard/preonic/config.h4
-rw-r--r--keyboard/preonic/keymaps/default/keymap.c17
-rw-r--r--quantum/audio.h6
-rw-r--r--quantum/keymap_common.c16
6 files changed, 29 insertions, 26 deletions
diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c
index a6edefefd..207af2a1d 100644
--- a/keyboard/planck/keymaps/default/keymap.c
+++ b/keyboard/planck/keymaps/default/keymap.c
@@ -194,7 +194,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
194 case _QW: 194 case _QW:
195 if (record->event.pressed) { 195 if (record->event.pressed) {
196 #ifdef AUDIO_ENABLE 196 #ifdef AUDIO_ENABLE
197 play_notes(&tone_qw, 4, false, 0); 197 PLAY_NOTE_ARRAY(tone_qw, false, 0);
198 #endif 198 #endif
199 default_layer_set(1UL<<_QW); 199 default_layer_set(1UL<<_QW);
200 } 200 }
@@ -202,7 +202,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
202 case _CM: 202 case _CM:
203 if (record->event.pressed) { 203 if (record->event.pressed) {
204 #ifdef AUDIO_ENABLE 204 #ifdef AUDIO_ENABLE
205 play_notes(&tone_cm, 6, false, 0); 205 PLAY_NOTE_ARRAY(tone_cm, false, 0);
206 #endif 206 #endif
207 default_layer_set(1UL<<_CM); 207 default_layer_set(1UL<<_CM);
208 } 208 }
@@ -210,7 +210,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
210 case _DV: 210 case _DV:
211 if (record->event.pressed) { 211 if (record->event.pressed) {
212 #ifdef AUDIO_ENABLE 212 #ifdef AUDIO_ENABLE
213 play_notes(&tone_dv, 8, false, 0); 213 PLAY_NOTE_ARRAY(tone_dv, false, 0);
214 #endif 214 #endif
215 default_layer_set(1UL<<_DV); 215 default_layer_set(1UL<<_DV);
216 } 216 }
@@ -254,7 +254,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
254 if (record->event.pressed) { 254 if (record->event.pressed) {
255 #ifdef AUDIO_ENABLE 255 #ifdef AUDIO_ENABLE
256 audio_on(); 256 audio_on();
257 play_notes(&start_up, 5, false, 0); 257 PLAY_NOTE_ARRAY(start_up, false, 0);
258 #endif 258 #endif
259 } 259 }
260 break; 260 break;
@@ -265,6 +265,6 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
265void matrix_init_user(void) { 265void matrix_init_user(void) {
266 #ifdef AUDIO_ENABLE 266 #ifdef AUDIO_ENABLE
267 init_notes(); 267 init_notes();
268 play_notes(&start_up, 5, false, 0); 268 PLAY_NOTE_ARRAY(start_up, false, 0);
269 #endif 269 #endif
270} 270}
diff --git a/keyboard/preonic/Makefile b/keyboard/preonic/Makefile
index 9199968c3..3504e2720 100644
--- a/keyboard/preonic/Makefile
+++ b/keyboard/preonic/Makefile
@@ -133,7 +133,7 @@ OPT_DEFS += -DBOOTLOADER_SIZE=4096
133BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000) 133BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
134MOUSEKEY_ENABLE = yes # Mouse keys(+4700) 134MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
135EXTRAKEY_ENABLE = yes # Audio control and System control(+450) 135EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
136CONSOLE_ENABLE = yes # Console for debug(+400) 136CONSOLE_ENABLE = no # Console for debug(+400)
137COMMAND_ENABLE = yes # Commands for debug and configuration 137COMMAND_ENABLE = yes # Commands for debug and configuration
138NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work 138NKRO_ENABLE = no # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
139BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality 139BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
diff --git a/keyboard/preonic/config.h b/keyboard/preonic/config.h
index 5528667fa..bb9d29dab 100644
--- a/keyboard/preonic/config.h
+++ b/keyboard/preonic/config.h
@@ -73,10 +73,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
73 */ 73 */
74 74
75/* disable debug print */ 75/* disable debug print */
76#define NO_DEBUG 76// #define NO_DEBUG
77 77
78/* disable print */ 78/* disable print */
79#define NO_PRINT 79// #define NO_PRINT
80 80
81/* disable action features */ 81/* disable action features */
82//#define NO_ACTION_LAYER 82//#define NO_ACTION_LAYER
diff --git a/keyboard/preonic/keymaps/default/keymap.c b/keyboard/preonic/keymaps/default/keymap.c
index 1223793cf..48bc72dab 100644
--- a/keyboard/preonic/keymaps/default/keymap.c
+++ b/keyboard/preonic/keymaps/default/keymap.c
@@ -3,11 +3,6 @@
3#include "eeconfig.h" 3#include "eeconfig.h"
4#ifdef AUDIO_ENABLE 4#ifdef AUDIO_ENABLE
5 #include "audio.h" 5 #include "audio.h"
6 #define SCALE (int []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \
7 0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \
8 0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \
9 0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \
10 0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), }
11#endif 6#endif
12 7
13// Each layer gets a name for readability, which is then used in the keymap matrix below. 8// Each layer gets a name for readability, which is then used in the keymap matrix below.
@@ -242,7 +237,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
242 case _QWERTY: 237 case _QWERTY:
243 if (record->event.pressed) { 238 if (record->event.pressed) {
244 #ifdef AUDIO_ENABLE 239 #ifdef AUDIO_ENABLE
245 play_notes(&tone_qwerty, 4, false, 0); 240 PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
246 #endif 241 #endif
247 persistant_default_layer_set(1UL<<_QWERTY); 242 persistant_default_layer_set(1UL<<_QWERTY);
248 } 243 }
@@ -250,7 +245,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
250 case _COLEMAK: 245 case _COLEMAK:
251 if (record->event.pressed) { 246 if (record->event.pressed) {
252 #ifdef AUDIO_ENABLE 247 #ifdef AUDIO_ENABLE
253 play_notes(&tone_colemak, 6, false, 1); 248 PLAY_NOTE_ARRAY(tone_colemak, false, 0);
254 #endif 249 #endif
255 persistant_default_layer_set(1UL<<_COLEMAK); 250 persistant_default_layer_set(1UL<<_COLEMAK);
256 } 251 }
@@ -258,7 +253,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
258 case _DVORAK: 253 case _DVORAK:
259 if (record->event.pressed) { 254 if (record->event.pressed) {
260 #ifdef AUDIO_ENABLE 255 #ifdef AUDIO_ENABLE
261 play_notes(&tone_dvorak, 8, false, 10); 256 PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
262 #endif 257 #endif
263 persistant_default_layer_set(1UL<<_DVORAK); 258 persistant_default_layer_set(1UL<<_DVORAK);
264 } 259 }
@@ -302,7 +297,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
302 if (record->event.pressed) { 297 if (record->event.pressed) {
303 #ifdef AUDIO_ENABLE 298 #ifdef AUDIO_ENABLE
304 audio_on(); 299 audio_on();
305 play_notes(&start_up, 4, false, 0); 300 PLAY_NOTE_ARRAY(start_up, false, 0);
306 #endif 301 #endif
307 } 302 }
308 break; 303 break;
@@ -317,7 +312,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
317 case 9: 312 case 9:
318 if (record->event.pressed) { 313 if (record->event.pressed) {
319 #ifdef AUDIO_ENABLE 314 #ifdef AUDIO_ENABLE
320 play_notes(&tone_music, 8, false, 0); 315 PLAY_NOTE_ARRAY(tone_music, false, 0);
321 layer_on(_MUSIC); 316 layer_on(_MUSIC);
322 #endif 317 #endif
323 } 318 }
@@ -344,6 +339,6 @@ void process_action_user(keyrecord_t *record) {
344void matrix_init_user(void) { 339void matrix_init_user(void) {
345 #ifdef AUDIO_ENABLE 340 #ifdef AUDIO_ENABLE
346 init_notes(); 341 init_notes();
347 play_notes(&start_up, 4, false, 0); 342 play_notes(&start_up, false, 0);
348 #endif 343 #endif
349} 344}
diff --git a/quantum/audio.h b/quantum/audio.h
index 762c98064..e1bc23ffe 100644
--- a/quantum/audio.h
+++ b/quantum/audio.h
@@ -27,6 +27,12 @@ void init_notes(void);
27void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat, float n_rest); 27void play_notes(float (*np)[][2], uint8_t n_length, bool n_repeat, float n_rest);
28 28
29 29
30#define SCALE (int []){ 0 + (12*0), 2 + (12*0), 4 + (12*0), 5 + (12*0), 7 + (12*0), 9 + (12*0), 11 + (12*0), \
31 0 + (12*1), 2 + (12*1), 4 + (12*1), 5 + (12*1), 7 + (12*1), 9 + (12*1), 11 + (12*1), \
32 0 + (12*2), 2 + (12*2), 4 + (12*2), 5 + (12*2), 7 + (12*2), 9 + (12*2), 11 + (12*2), \
33 0 + (12*3), 2 + (12*3), 4 + (12*3), 5 + (12*3), 7 + (12*3), 9 + (12*3), 11 + (12*3), \
34 0 + (12*4), 2 + (12*4), 4 + (12*4), 5 + (12*4), 7 + (12*4), 9 + (12*4), 11 + (12*4), }
35
30// These macros are used to allow play_notes to play an array of indeterminate 36// These macros are used to allow play_notes to play an array of indeterminate
31// length. This works around the limitation of C's sizeof operation on pointers. 37// length. This works around the limitation of C's sizeof operation on pointers.
32// The global float array for the song must be used here. 38// The global float array for the song must be used here.
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index 61a51aedb..02d3c74be 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -33,12 +33,14 @@ extern keymap_config_t keymap_config;
33#include <inttypes.h> 33#include <inttypes.h>
34#ifdef AUDIO_ENABLE 34#ifdef AUDIO_ENABLE
35 #include "audio.h" 35 #include "audio.h"
36 36 #ifndef GOODBYE_TUNE
37 float goodbye[][2] = { 37 #define GOODBYE_TUNE { \
38 {440.0*pow(2.0,(31)/12.0), 8}, 38 {440.0*pow(2.0,(31)/12.0), 8}, \
39 {440.0*pow(2.0,(24)/12.0), 8}, 39 {440.0*pow(2.0,(24)/12.0), 8}, \
40 {440.0*pow(2.0,(19)/12.0), 12}, 40 {440.0*pow(2.0,(19)/12.0), 12}, \
41 }; 41 }
42 #endif
43 float goodbye_tune[][2] = GOODBYE_TUNE;
42#endif 44#endif
43 45
44static action_t keycode_to_action(uint16_t keycode); 46static action_t keycode_to_action(uint16_t keycode);
@@ -189,7 +191,7 @@ static action_t keycode_to_action(uint16_t keycode)
189 case RESET: ; // RESET is 0x5000, which is why this is here 191 case RESET: ; // RESET is 0x5000, which is why this is here
190 clear_keyboard(); 192 clear_keyboard();
191 #ifdef AUDIO_ENABLE 193 #ifdef AUDIO_ENABLE
192 PLAY_NOTE_ARRAY(goodbye, false, 0); 194 PLAY_NOTE_ARRAY(goodbye_tune, false, 0);
193 #endif 195 #endif
194 _delay_ms(250); 196 _delay_ms(250);
195 #ifdef ATREUS_ASTAR 197 #ifdef ATREUS_ASTAR