]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - quantum/audio/audio.c
Remove more commented out MCUs
[qmk_firmware.git] / quantum / audio / audio.c
index 3c6d18c4f6c4698126a4212512e303a4e2f5d22d..3da164c736ef44611ab77f7de713e199b927141f 100644 (file)
@@ -76,7 +76,7 @@
 
 #if defined(B5_AUDIO)
     #define BPIN_AUDIO
-    #define BPIN_SET_DIRECTION DDRC |= _BV(PORTB5);
+    #define BPIN_SET_DIRECTION DDRB |= _BV(PORTB5);
     #define INIT_AUDIO_COUNTER_1 TCCR1A = (0 << COM1A1) | (0 << COM1A0) | (1 << WGM11) | (0 << WGM10);
     #define ENABLE_AUDIO_COUNTER_1_ISR TIMSK1 |= _BV(OCIE1A)
     #define DISABLE_AUDIO_COUNTER_1_ISR TIMSK1 &= ~_BV(OCIE1A)
@@ -88,7 +88,7 @@
 #endif
 #if defined(B6_AUDIO)
     #define BPIN_AUDIO
-    #define BPIN_SET_DIRECTION DDRC |= _BV(PORTB6);
+    #define BPIN_SET_DIRECTION DDRB |= _BV(PORTB6);
     #define INIT_AUDIO_COUNTER_1 TCCR1A = (0 << COM1B1) | (0 << COM1B0) | (1 << WGM11) | (0 << WGM10);
     #define ENABLE_AUDIO_COUNTER_1_ISR TIMSK1 |= _BV(OCIE1B)
     #define DISABLE_AUDIO_COUNTER_1_ISR TIMSK1 &= ~_BV(OCIE1B)
 #endif
 #if defined(B7_AUDIO)
     #define BPIN_AUDIO
-    #define BPIN_SET_DIRECTION DDRC |= _BV(PORTB7);
+    #define BPIN_SET_DIRECTION DDRB |= _BV(PORTB7);
     #define INIT_AUDIO_COUNTER_1 TCCR1A = (0 << COM1C1) | (0 << COM1C0) | (1 << WGM11) | (0 << WGM10);
     #define ENABLE_AUDIO_COUNTER_1_ISR TIMSK1 |= _BV(OCIE1C)
     #define DISABLE_AUDIO_COUNTER_1_ISR TIMSK1 &= ~_BV(OCIE1C)
@@ -141,7 +141,7 @@ uint16_t notes_count;
 bool     notes_repeat;
 bool     note_resting = false;
 
-uint8_t current_note = 0;
+uint16_t current_note = 0;
 uint8_t rest_counter = 0;
 
 #ifdef VIBRATO_ENABLE
@@ -187,16 +187,11 @@ void audio_init()
         // Set audio ports as output
         #ifdef CPIN_AUDIO
           CPIN_SET_DIRECTION
+          DISABLE_AUDIO_COUNTER_3_ISR;
         #endif
         #ifdef BPIN_AUDIO
           BPIN_SET_DIRECTION
-        #endif
-
-        #ifdef CPIN_AUDIO
-            DISABLE_AUDIO_COUNTER_3_ISR;
-        #endif
-        #ifdef BPIN_AUDIO
-            DISABLE_AUDIO_COUNTER_1_ISR;
+          DISABLE_AUDIO_COUNTER_1_ISR;
         #endif
 
         // TCCR3A / TCCR3B: Timer/Counter #3 Control Registers TCCR3A/TCCR3B, TCCR1A/TCCR1B
@@ -228,7 +223,7 @@ void audio_init()
             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 
+        #endif
 
         audio_initialized = true;
     }
@@ -236,7 +231,7 @@ void audio_init()
     if (audio_config.enable) {
         PLAY_SONG(startup_song);
     }
-    
+
 }
 
 void stop_all_notes()
@@ -469,7 +464,7 @@ ISR(TIMER3_AUDIO_vect)
         note_position++;
         bool end_of_note = false;
         if (TIMER_3_PERIOD > 0) {
-            if (!note_resting) 
+            if (!note_resting)
                 end_of_note = (note_position >= (note_length / TIMER_3_PERIOD * 0xFFFF - 1));
             else
                 end_of_note = (note_position >= (note_length));
@@ -609,7 +604,7 @@ ISR(TIMER1_AUDIO_vect)
         note_position++;
         bool end_of_note = false;
         if (TIMER_1_PERIOD > 0) {
-            if (!note_resting) 
+            if (!note_resting)
                 end_of_note = (note_position >= (note_length / TIMER_1_PERIOD * 0xFFFF - 1));
             else
                 end_of_note = (note_position >= (note_length));