]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - quantum/audio.c
[Erez & Jack] Makes tri-layer available across Quantum
[qmk_firmware.git] / quantum / audio.c
index f29d941d7cce0be321a060b38ae2278806a9223c..50e5505fe0826dd6f74b833df26eb58558ab4ed8 100644 (file)
@@ -255,7 +255,12 @@ ISR(TIMER3_COMPA_vect) {
 
 
         note_position++;
-        if (note_position >= note_length) {
+        bool end_of_note = false;
+        if (ICR3 > 0) 
+            end_of_note = (note_position >= (note_length / ICR3 * 0xFFFF));
+        else 
+            end_of_note = (note_position >= (note_length * 0x7FF));
+        if (end_of_note) {
             current_note++;
             if (current_note >= notes_length) {
                 if (notes_repeat) {