1
0
Fork 0

Merge remote-tracking branch 'refs/remotes/jackhumbert/master' into personal_atomic_planck

This commit is contained in:
IBNobody 2016-04-17 23:16:36 -05:00
commit 82ec81660e
3 changed files with 9 additions and 5 deletions

View file

@ -224,6 +224,7 @@ float tone_music[][2] = {
{440.0*pow(2.0,(23)/12.0), 8}, {440.0*pow(2.0,(23)/12.0), 8},
{440.0*pow(2.0,(24)/12.0), 8} {440.0*pow(2.0,(24)/12.0), 8}
}; };
float ode_to_joy[][2] = SONG(ODE_TO_JOY);
#endif #endif
void persistant_default_layer_set(uint16_t default_layer) { void persistant_default_layer_set(uint16_t default_layer) {
@ -312,7 +313,9 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
case 9: case 9:
if (record->event.pressed) { if (record->event.pressed) {
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
PLAY_NOTE_ARRAY(tone_music, false, 0); init_notes();
set_tempo(150);
PLAY_NOTE_ARRAY(ode_to_joy, false, .25);
layer_on(_MUSIC); layer_on(_MUSIC);
#endif #endif
} }
@ -339,6 +342,6 @@ void process_action_user(keyrecord_t *record) {
void matrix_init_user(void) { void matrix_init_user(void) {
#ifdef AUDIO_ENABLE #ifdef AUDIO_ENABLE
init_notes(); init_notes();
play_notes(&start_up, false, 0); PLAY_NOTE_ARRAY(start_up, false, 0);
#endif #endif
} }

View file

@ -257,7 +257,7 @@ ISR(TIMER3_COMPA_vect) {
place = 0.0; place = 0.0;
} }
ICR3 = (int)(((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)); // Set max to the period ICR3 = (int)(((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)); // Set max to the period
OCR3A = (int)((((double)F_CPU) /(frequencies[voice_place] * CPU_PRESCALER)) * note_timbre); // Set compare to half the period OCR3A = (int)((((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)) * note_timbre); // Set compare to half the period
//OCR3A = (int)(((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)) >> 1 * duty_place; // Set compare to half the period //OCR3A = (int)(((double)F_CPU) / (frequencies[voice_place] * CPU_PRESCALER)) >> 1 * duty_place; // Set compare to half the period
place++; place++;
// if (duty_counter > (frequencies[voice_place] / 500)) { // if (duty_counter > (frequencies[voice_place] / 500)) {
@ -354,6 +354,7 @@ if (audio_config.enable) {
// Cancel note if a note is playing // Cancel note if a note is playing
if (note) if (note)
stop_all_notes(); stop_all_notes();
notes = true;
notes_pointer = np; notes_pointer = np;
notes_count = n_count; notes_count = n_count;
@ -379,7 +380,6 @@ if (audio_config.enable) {
TCCR3A |= _BV(COM3A1); TCCR3A |= _BV(COM3A1);
#endif #endif
notes = true;
} }
} }
@ -410,6 +410,7 @@ if (audio_config.enable && voices < 8) {
// Cancel notes if notes are playing // Cancel notes if notes are playing
if (notes) if (notes)
stop_all_notes(); stop_all_notes();
note = true;
#ifdef PWM_AUDIO #ifdef PWM_AUDIO
freq = freq / SAMPLE_RATE; freq = freq / SAMPLE_RATE;
#endif #endif
@ -441,7 +442,6 @@ if (audio_config.enable && voices < 8) {
TCCR3A |= _BV(COM3A1); TCCR3A |= _BV(COM3A1);
#endif #endif
note = true;
} }
} }

View file

@ -24,6 +24,7 @@ void led_set_kb(uint8_t usb_led) {
} }
__attribute__ ((weak))
void led_set(uint8_t usb_led) void led_set(uint8_t usb_led)
{ {