]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - quantum/audio/audio.c
Add `SGUI()` and `SGUI_T()` for consistency with `KC_GUI` (#2442)
[qmk_firmware.git] / quantum / audio / audio.c
index e08233486a30a7b07f9b0af67b0b844161edac2d..85220e16307115bb4db4052e849feab99ced0dd6 100644 (file)
@@ -151,16 +151,16 @@ void audio_init()
 
         #ifdef C6_AUDIO
             DDRC |= _BV(PORTC6);
-        #else
-            DDRC |= _BV(PORTC6);
-            PORTC &= ~_BV(PORTC6);
+        //#else
+        //    DDRC |= _BV(PORTC6); // Why is PC6 being set as output low, if C6_audio isn't defined?
+        //    PORTC &= ~_BV(PORTC6); 
         #endif
 
         #ifdef B5_AUDIO
             DDRB |= _BV(PORTB5);
-        #else
-            DDRB |= _BV(PORTB5);
-            PORTB &= ~_BV(PORTB5);
+        //#else
+        //    DDRB |= _BV(PORTB5); // Same as with PC6
+        //    PORTB &= ~_BV(PORTB5);
         #endif
 
         #ifdef C6_AUDIO
@@ -184,6 +184,9 @@ void audio_init()
         #ifdef B5_AUDIO
             TCCR1A = (0 << COM1A1) | (0 << COM1A0) | (1 << WGM11) | (0 << WGM10);
             TCCR1B = (1 << WGM13)  | (1 << WGM12)  | (0 << CS12)  | (1 << CS11) | (0 << CS10);
+
+            TIMER_1_PERIOD = (uint16_t)(((float)F_CPU) / (440 * CPU_PRESCALER));
+            TIMER_1_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (440 * CPU_PRESCALER)) * note_timbre);
         #endif
 
         audio_initialized = true;
@@ -192,7 +195,7 @@ void audio_init()
     if (audio_config.enable) {
         PLAY_SONG(startup_song);
     }
-
+    
 }
 
 void stop_all_notes()