示例#1
0
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);
          #ifdef BACKLIGHT_ENABLE
            backlight_set(BACKLIGHT_LEVELS);
          #endif
          default_layer_and(0); 
          default_layer_or((1<<5));

          // uint8_t low = boot_lock_fuse_bits_get(0x0000);
          // uint8_t high = boot_lock_fuse_bits_get(0x0003);
          // uint8_t ext = boot_lock_fuse_bits_get(0x0002);
          // uint8_t lock = boot_lock_fuse_bits_get(0x0001);

          // register_code(hextokeycode((low & 0xF0) >> 4));
          // unregister_code(hextokeycode((low & 0xF0) >> 4));
          // register_code(hextokeycode((low & 0x0F)));
          // unregister_code(hextokeycode((low & 0x0F)));


          // register_code(hextokeycode((high & 0xF0) >> 4));
          // unregister_code(hextokeycode((high & 0xF0) >> 4));
          // register_code(hextokeycode((high & 0x0F)));
          // unregister_code(hextokeycode((high & 0x0F)));


          // register_code(hextokeycode((ext & 0xF0) >> 4));
          // unregister_code(hextokeycode((ext & 0xF0) >> 4));
          // register_code(hextokeycode((ext & 0x0F)));
          // unregister_code(hextokeycode((ext & 0x0F)));


          // register_code(hextokeycode((lock & 0xF0) >> 4));
          // unregister_code(hextokeycode((lock & 0xF0) >> 4));
          // register_code(hextokeycode((lock & 0x0F)));
          // unregister_code(hextokeycode((lock & 0x0F)));

        } else {
          unregister_code(KC_RSFT);
          play_notes(&walk_dn, 3, false);
          #ifdef BACKLIGHT_ENABLE
            backlight_set(0);
          #endif
          default_layer_and(0); 
          default_layer_or(0);
        }
        break;
      } 
    return MACRO_NONE;
};
示例#2
0
void process_action_user(keyrecord_t *record) {
#ifdef AUDIO_ENABLE
  if (record->event.pressed) {
    float keypress[][2] = {
      {440.0*pow(2.0,(record->event.key.col*7)/12.0), 600}
    };
    play_notes(&keypress, 1, false);
  }
#endif
}
示例#3
0
void matrix_init_user(void) {
#ifdef AUDIO_ENABLE
    init_notes();
    play_notes(&start_up, 12, false);
#endif
}
示例#4
0
void beeps() {
 //    DDRB |= (1<<7);
 //    PORTB &= ~(1<<7);
    
 //    // Use full 16-bit resolution. 
 //    ICR1 = 0xFFFF;

 //    // I could write a wall of text here to explain... but TL;DW
 //    // Go read the ATmega32u4 datasheet.
 //    // And this: http://blog.saikoled.com/post/43165849837/secret-konami-cheat-code-to-high-resolution-pwm-on
    
 //    // Pin PB7 = OCR1C (Timer 1, Channel C)
 //    // Compare Output Mode = Clear on compare match, Channel C = COM1C1=1 COM1C0=0
 //    // (i.e. start high, go low when counter matches.)
 //    // WGM Mode 14 (Fast PWM) = WGM13=1 WGM12=1 WGM11=1 WGM10=0
 //    // Clock Select = clk/1 (no prescaling) = CS12=0 CS11=0 CS10=1
    
 //    TCCR1A = _BV(COM1C1) | _BV(WGM11); // = 0b00001010;
 //    TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS10); // = 0b00011001;


 //    // Turn off PWM control on PB7, revert to output low.
 //    // TCCR1A &= ~(_BV(COM1C1));
 //    // CHANNEL = ((1 << level) - 1);

 //    // Turn on PWM control of PB7
 //    TCCR1A |= _BV(COM1C1);
 //    // CHANNEL = level << OFFSET | 0x0FFF;
 //    // CHANNEL = 0b1010101010101010;

 //    float x = 12;
 //    float y = 24;
 //    float length = 50;
 //    float scale = 1;

 // //    int f1 = 1000000/440;
 // //    int f2 = 1000000/880;
	// // for (uint32_t i = 0; i < length * 1000; i++) {
	// // 	// int frequency = 1/((sin(PI*2*i*scale*pow(2, x/12.0))*.5+1 + sin(PI*2*i*scale*pow(2, y/12.0))*.5+1) / 2); 

	// // 	ICR1 = f1; // Set max to the period
	// // 	OCR1C = f1 >> 1; // Set compare to half the period
 // //     	// _delay_us(10);
	// // }
 //    int frequency = 1000000/440;
	// ICR1 = frequency; // Set max to the period
	// OCR1C = frequency >> 1; // Set compare to half the period
 //    _delay_us(500000);

 //    TCCR1A &= ~(_BV(COM1C1));
 //    CHANNEL = 0;
play_notes();


	// play_note(55*pow(2, 0/12.0), 	1);
	// play_note(55*pow(2, 12/12.0), 	1);
	// play_note(55*pow(2, 24/12.0), 	1);
	// play_note(55*pow(2, 0/12.0), 	1);
	// play_note(55*pow(2, 12/12.0), 	1);
	// play_note(55*pow(2, 24/12.0), 	1);

	// play_note(0, 					4);

	// play_note(55*pow(2, 0/12.0), 	8);
	// play_note(55*pow(2, 12/12.0), 	4);
	// play_note(55*pow(2, 10/12.0), 	4);
	// play_note(55*pow(2, 12/12.0), 	8);
	// play_note(55*pow(2, 10/12.0), 	4);
	// play_note(55*pow(2, 7/12.0), 	2);
	// play_note(55*pow(2, 8/12.0), 	2);
	// play_note(55*pow(2, 7/12.0), 	16);
	// play_note(0, 					4);
	// play_note(55*pow(2, 3/12.0), 	8);
	// play_note(55*pow(2, 5/12.0), 	4);
	// play_note(55*pow(2, 7/12.0), 	4);
	// play_note(55*pow(2, 7/12.0), 	8);
	// play_note(55*pow(2, 5/12.0), 	4);
	// play_note(55*pow(2, 3/12.0), 	4);
	// play_note(55*pow(2, 2/12.0), 	16);


}
示例#5
0
void * matrix_init_user(void) {
    init_notes();
    play_notes(&start_up, 9, false);
}