aboutsummaryrefslogtreecommitdiff
path: root/keyboard
diff options
context:
space:
mode:
Diffstat (limited to 'keyboard')
-rw-r--r--keyboard/atomic/keymaps/pvc/keymap.c44
-rw-r--r--keyboard/planck/keymaps/default/keymap.c10
-rw-r--r--keyboard/preonic/keymaps/default/keymap.c15
3 files changed, 19 insertions, 50 deletions
diff --git a/keyboard/atomic/keymaps/pvc/keymap.c b/keyboard/atomic/keymaps/pvc/keymap.c
index 229708344..c2081f525 100644
--- a/keyboard/atomic/keymaps/pvc/keymap.c
+++ b/keyboard/atomic/keymaps/pvc/keymap.c
@@ -75,8 +75,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
75 }, 75 },
76}; 76};
77 77
78#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer)))
79#define IS_LAYER_OFF(layer) (!IS_LAYER_ON(layer))
80 78
81#ifdef AUDIO_ENABLE 79#ifdef AUDIO_ENABLE
82 80
@@ -201,24 +199,14 @@ Q_NOTE(_B8 ) ,
201}; 199};
202 200
203float tone_rs[][2] = { 201float tone_rs[][2] = {
204Q_NOTE(_F8 ) , 202Q_NOTE(_A4 ) ,
205Q_NOTE(_G8 ) , 203Q_NOTE(_A4 ) ,
206Q_NOTE(_GS8 ) , 204Q_NOTE(_A4 ) ,
207Q_NOTE(_A8 ) , 205Q_NOTE(_A4 ) ,
208Q_NOTE(_AS8 ) , 206Q_NOTE(_AS8 ) ,
209Q_NOTE(_B8 ) , 207Q_NOTE(_B8 ) ,
210}; 208};
211 209
212float tone_fn[][2] = {
213 {440.0*pow(2.0,(59)/12.0), 8},
214 {440.0*pow(2.0,(60)/12.0), 8},
215 {0, 4},
216 {440.0*pow(2.0,(67)/12.0), 16},
217 {0, 4},
218 {440.0*pow(2.0,(69)/12.0), 16},
219 {0, 4},
220 {440.0*pow(2.0,(67)/12.0), 16}
221};
222#endif 210#endif
223 211
224void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order) 212void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t layer4, bool order)
@@ -253,18 +241,18 @@ void update_quad_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3, uint8_t l
253const uint16_t PROGMEM fn_actions[] = { 241const uint16_t PROGMEM fn_actions[] = {
254}; 242};
255 243
256#define ARRAY_SIZE(x) ((sizeof x) / (sizeof *x)) 244//#define MUSIC_ARRAY_SIZE(x) (((int)(sizeof(x) / (sizeof(x[0][0])))) / 2)
257 245
258const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 246const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
259{ 247{
248
260 // MACRODOWN only works in this function 249 // MACRODOWN only works in this function
261 switch(id) { 250 switch(id) {
262 case M_LW: 251 case M_LW:
263 if (record->event.pressed) { 252 if (record->event.pressed) {
264 #ifdef AUDIO_ENABLE 253 #ifdef AUDIO_ENABLE
265 println("PlayNotes LW"); 254 println("PlayNotes LW");
266 print_val_hex32(ARRAY_SIZE(tone_lw)); 255 PLAY_NOTE_ARRAY(tone_lw, false, STACCATO);
267 play_notes(&tone_lw, 96, false);
268 #endif 256 #endif
269 layer_on(_LW); 257 layer_on(_LW);
270 update_tri_layer(_LW, _RS, _FN); 258 update_tri_layer(_LW, _RS, _FN);
@@ -277,7 +265,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
277 if (record->event.pressed) { 265 if (record->event.pressed) {
278 #ifdef AUDIO_ENABLE 266 #ifdef AUDIO_ENABLE
279 println("PlayNotes RS"); 267 println("PlayNotes RS");
280 play_notes(&tone_rs, 6, false); 268 PLAY_NOTE_ARRAY(tone_rs, false, LEGATO);
281 #endif 269 #endif
282 layer_on(_RS); 270 layer_on(_RS);
283 update_tri_layer(_LW, _RS, _FN); 271 update_tri_layer(_LW, _RS, _FN);
@@ -295,33 +283,19 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
295#ifdef AUDIO_ENABLE 283#ifdef AUDIO_ENABLE
296float start_up[][2] = { 284float start_up[][2] = {
297Q_NOTE(_E4 ) , 285Q_NOTE(_E4 ) ,
298{0,1} ,
299Q_NOTE(_E4 ) , 286Q_NOTE(_E4 ) ,
300{0,1} ,
301Q_NOTE(_F4 ) , 287Q_NOTE(_F4 ) ,
302{0,1} ,
303Q_NOTE(_G4 ) , 288Q_NOTE(_G4 ) ,
304{0,1} ,
305Q_NOTE(_G4 ) , 289Q_NOTE(_G4 ) ,
306{0,1} ,
307Q_NOTE(_F4 ) , 290Q_NOTE(_F4 ) ,
308{0,1} ,
309Q_NOTE(_E4 ) , 291Q_NOTE(_E4 ) ,
310{0,1} ,
311Q_NOTE(_D4 ) , 292Q_NOTE(_D4 ) ,
312{0,1} ,
313Q_NOTE(_C4 ) , 293Q_NOTE(_C4 ) ,
314{0,1} ,
315Q_NOTE(_C4 ) , 294Q_NOTE(_C4 ) ,
316{0,1} ,
317Q_NOTE(_D4 ) , 295Q_NOTE(_D4 ) ,
318{0,1} ,
319Q_NOTE(_E4 ) , 296Q_NOTE(_E4 ) ,
320{0,1} ,
321H_NOTE(_E4 ) , 297H_NOTE(_E4 ) ,
322{0,1} ,
323Q_NOTE(_D4 ) , 298Q_NOTE(_D4 ) ,
324{0,1} ,
325H_NOTE(_D4 ) , 299H_NOTE(_D4 ) ,
326}; 300};
327#endif 301#endif
@@ -329,7 +303,7 @@ H_NOTE(_D4 ) ,
329void matrix_init_user(void) { 303void matrix_init_user(void) {
330 #ifdef AUDIO_ENABLE 304 #ifdef AUDIO_ENABLE
331 init_notes(); 305 init_notes();
332 play_notes(&start_up, 29, false); 306 PLAY_NOTE_ARRAY(start_up, false, STACCATO);
333 println("Matrix Init"); 307 println("Matrix Init");
334 #endif 308 #endif
335} 309}
diff --git a/keyboard/planck/keymaps/default/keymap.c b/keyboard/planck/keymaps/default/keymap.c
index 5591b337d..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, 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, 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, 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, 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, false, 0); 268 PLAY_NOTE_ARRAY(start_up, false, 0);
269 #endif 269 #endif
270} 270}
diff --git a/keyboard/preonic/keymaps/default/keymap.c b/keyboard/preonic/keymaps/default/keymap.c
index c7b6b89f2..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, 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, false, 0); 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, false, 0); 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, 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, false, 0); 315 PLAY_NOTE_ARRAY(tone_music, false, 0);
321 layer_on(_MUSIC); 316 layer_on(_MUSIC);
322 #endif 317 #endif
323 } 318 }