summary refs log tree commit diff
path: root/quantum
diff options
context:
space:
mode:
authorIBNobody <ibnobody@gmail.com>2016-04-16 19:32:29 -0500
committerIBNobody <ibnobody@gmail.com>2016-04-16 19:32:29 -0500
commitbc65f73c649b3e8edffcff841a84f9d1e0798bab (patch)
tree839609cd12ea2a4168ad1bb92a398c850f22bddf /quantum
parent4aea806aa8aa585930a89b67d7206050ac6adb3a (diff)
parentc83aa16f1d614c1c10f7597a67ffb9f2ae871951 (diff)
Merge remote-tracking branch 'remotes/jackhumbert/master' into personal_atomic_planck
Diffstat (limited to 'quantum')
-rw-r--r--quantum/audio.c12
-rw-r--r--quantum/keymap_common.c6
2 files changed, 10 insertions, 8 deletions
diff --git a/quantum/audio.c b/quantum/audio.c
index 5edcccdbe1..470dc8e0c7 100644
--- a/quantum/audio.c
+++ b/quantum/audio.c
@@ -12,6 +12,8 @@
 
 #define PI 3.14159265
 
+#define CPU_PRESCALER 8
+
 // #define PWM_AUDIO
 
 #ifdef PWM_AUDIO
@@ -244,12 +246,12 @@ ISR(TIMER3_COMPA_vect) {
                 // ICR3 = (int)(((double)F_CPU) / frequency); // Set max to the period
                 // OCR3A = (int)(((double)F_CPU) / frequency) >> 1; // Set compare to half the period
                 voice_place %= voices;
-                if (place > (frequencies[voice_place] / 500)) {
+                if (place > (frequencies[voice_place] / 50)) {
                     voice_place = (voice_place + 1) % voices;
                     place = 0.0;
                 }
-                ICR3 = (int)(((double)F_CPU) / frequencies[voice_place]); // Set max to the period
-                OCR3A = (int)(((double)F_CPU) / frequencies[voice_place]) >> 1 * duty_place; // Set compare to half 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)) >> 1 * duty_place; // Set compare to half the period
                 place++;
                 // if (duty_counter > (frequencies[voice_place] / 500)) {
                 //     duty_place = (duty_place % 3) + 1;
@@ -281,8 +283,8 @@ ISR(TIMER3_COMPA_vect) {
                 place -= SINE_LENGTH;
         #else
             if (note_frequency > 0) {
-                ICR3 = (int)(((double)F_CPU) / note_frequency); // Set max to the period
-                OCR3A = (int)(((double)F_CPU) / note_frequency) >> 1; // Set compare to half the period
+                ICR3 = (int)(((double)F_CPU) / (note_frequency * CPU_PRESCALER)); // Set max to the period
+                OCR3A = (int)(((double)F_CPU) / (note_frequency * CPU_PRESCALER)) >> 1; // Set compare to half the period
             } else {
                 ICR3 = 0;
                 OCR3A = 0;
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index b919166853..899437f447 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -35,9 +35,9 @@ extern keymap_config_t keymap_config;
     #include "audio.h"
 
     float goodbye[][2] = {
-        {440.0*pow(2.0,(67)/12.0), 8},
-        {440.0*pow(2.0,(60)/12.0), 8},
-        {440.0*pow(2.0,(55)/12.0), 12},
+        {440.0*pow(2.0,(31)/12.0), 8},
+        {440.0*pow(2.0,(24)/12.0), 8},
+        {440.0*pow(2.0,(19)/12.0), 12},
     };
 #endif