note seq, start-up beeps, function beeps
This commit is contained in:
		
							parent
							
								
									263344d42f
								
							
						
					
					
						commit
						4c100dbbef
					
				
					 3 changed files with 183 additions and 46 deletions
				
			
		| 
						 | 
				
			
			@ -2,6 +2,7 @@
 | 
			
		|||
// #include "backlight.h"
 | 
			
		||||
#include "action_layer.h"
 | 
			
		||||
#include "keymap_midi.h"
 | 
			
		||||
#include "beeps.h"
 | 
			
		||||
#include <avr/boot.h>
 | 
			
		||||
 | 
			
		||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
			
		||||
| 
						 | 
				
			
			@ -63,12 +64,26 @@ uint16_t hextokeycode(int hex) {
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
float walk_up[][2] = {
 | 
			
		||||
  {440.0*pow(2.0,(60)/12.0), 400},
 | 
			
		||||
  {0, 50},
 | 
			
		||||
  {440.0*pow(2.0,(67)/12.0), 400},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
float walk_dn[][2] = {
 | 
			
		||||
  {440.0*pow(2.0,(67)/12.0), 400},
 | 
			
		||||
  {0, 50},
 | 
			
		||||
  {440.0*pow(2.0,(60)/12.0), 400},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 
 | 
			
		||||
{
 | 
			
		||||
  // MACRODOWN only works in this function
 | 
			
		||||
      switch(id) {
 | 
			
		||||
        case 0:   
 | 
			
		||||
        if (record->event.pressed) {
 | 
			
		||||
 | 
			
		||||
          play_notes(&walk_up, 3, false);
 | 
			
		||||
          // play_note(440, 20);
 | 
			
		||||
          // register_code(KC_RSFT);
 | 
			
		||||
          // backlight_set(BACKLIGHT_LEVELS);
 | 
			
		||||
| 
						 | 
				
			
			@ -107,7 +122,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
 | 
			
		|||
          // note(0+24, 20);
 | 
			
		||||
        } else {
 | 
			
		||||
          unregister_code(KC_RSFT);
 | 
			
		||||
          stop_all_notes();
 | 
			
		||||
          play_notes(&walk_dn, 3, false);
 | 
			
		||||
          // backlight_set(0);
 | 
			
		||||
          default_layer_and(0); 
 | 
			
		||||
          default_layer_or(0);
 | 
			
		||||
| 
						 | 
				
			
			@ -120,32 +135,58 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
 | 
			
		|||
    return MACRO_NONE;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
float start_up[][2] = {
 | 
			
		||||
  {440.0*pow(2.0,(67)/12.0), 600},
 | 
			
		||||
  {0, 50},
 | 
			
		||||
  {440.0*pow(2.0,(64)/12.0), 400},
 | 
			
		||||
  {0, 50},
 | 
			
		||||
  {440.0*pow(2.0,(55)/12.0), 400},
 | 
			
		||||
  {0, 50},
 | 
			
		||||
  {440.0*pow(2.0,(60)/12.0), 400},
 | 
			
		||||
  {0, 50},
 | 
			
		||||
  {440.0*pow(2.0,(64)/12.0), 1000},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void * matrix_init_user(void) {
 | 
			
		||||
    init_notes();
 | 
			
		||||
 | 
			
		||||
    play_note(((double)261.6*3)*pow(2.0,(36)/12.0), 0xF);
 | 
			
		||||
    _delay_ms(50);
 | 
			
		||||
    play_notes(&start_up, 9, false);
 | 
			
		||||
    // play_note(((double)261.6*3)*pow(2.0,(36)/12.0), 0xF);
 | 
			
		||||
    // _delay_ms(50);
 | 
			
		||||
 | 
			
		||||
    play_note(((double)261.6*3)*pow(2.0,(48)/12.0), 0xF);
 | 
			
		||||
    _delay_ms(25);
 | 
			
		||||
    stop_note(((double)261.6*3)*pow(2.0,(48)/12.0));
 | 
			
		||||
    // play_note(((double)261.6*3)*pow(2.0,(48)/12.0), 0xF);
 | 
			
		||||
    // _delay_ms(25);
 | 
			
		||||
    // stop_note(((double)261.6*3)*pow(2.0,(48)/12.0));
 | 
			
		||||
 | 
			
		||||
    play_note(((double)261.6*3)*pow(2.0,(48)/12.0), 0xF);
 | 
			
		||||
    _delay_ms(25);
 | 
			
		||||
    stop_note(((double)261.6*3)*pow(2.0,(48)/12.0));
 | 
			
		||||
    // play_note(((double)261.6*3)*pow(2.0,(48)/12.0), 0xF);
 | 
			
		||||
    // _delay_ms(25);
 | 
			
		||||
    // stop_note(((double)261.6*3)*pow(2.0,(48)/12.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    stop_note(((double)261.6*3)*pow(2.0,(36)/12.0));
 | 
			
		||||
    // stop_note(((double)261.6*3)*pow(2.0,(36)/12.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    play_note(((double)261.6*3)*pow(2.0,(62)/12.0), 0xF);
 | 
			
		||||
    _delay_ms(50);
 | 
			
		||||
    stop_note(((double)261.6*3)*pow(2.0,(62)/12.0));
 | 
			
		||||
    // play_note(((double)261.6*3)*pow(2.0,(62)/12.0), 0xF);
 | 
			
		||||
    // _delay_ms(50);
 | 
			
		||||
    // stop_note(((double)261.6*3)*pow(2.0,(62)/12.0));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    play_note(((double)261.6*3)*pow(2.0,(64)/12.0), 0xF);
 | 
			
		||||
    _delay_ms(50);
 | 
			
		||||
    stop_note(((double)261.6*3)*pow(2.0,(64)/12.0));
 | 
			
		||||
    // play_note(((double)261.6*3)*pow(2.0,(64)/12.0), 0xF);
 | 
			
		||||
    // _delay_ms(50);
 | 
			
		||||
    // stop_note(((double)261.6*3)*pow(2.0,(64)/12.0));
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// void * matrix_scan_user(void) {
 | 
			
		||||
//   if (layer_state & (1<<2)) {
 | 
			
		||||
//     if (!playing_notes)
 | 
			
		||||
//       play_notes(&start_up, 9, true);
 | 
			
		||||
//   } else if (layer_state & (1<<3)) {
 | 
			
		||||
//     if (!playing_notes)
 | 
			
		||||
//       play_notes(&start_up, 9, true);
 | 
			
		||||
//   } else {
 | 
			
		||||
//     if (playing_notes)
 | 
			
		||||
//       stop_all_notes();
 | 
			
		||||
//   }
 | 
			
		||||
// }
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue