summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorPriyadi Iman Nurcahyo <priyadi@priyadi.net>2017-04-19 12:04:15 +0700
committerPriyadi Iman Nurcahyo <priyadi@priyadi.net>2017-04-19 12:04:15 +0700
commit3c7db55ec5cfa95bbe2901d017de02b617789268 (patch)
treeeac5815f53a9c3cd784b9f045281ee11ce21169f /quantum
parentce0efa6b9a92387af395fded796e8ccb8927b52d (diff)
parentbe0afd24bffb62bdef1195583e2d98f4714ade49 (diff)
Merge remote-tracking branch 'upstream/master' into promethium
Diffstat (limited to 'quantum')
-rw-r--r--quantum/fauxclicky.c15
-rw-r--r--quantum/fauxclicky.h10
2 files changed, 9 insertions, 16 deletions
diff --git a/quantum/fauxclicky.c b/quantum/fauxclicky.c
index 13273e7058..c3341ca332 100644
--- a/quantum/fauxclicky.c
+++ b/quantum/fauxclicky.c
@@ -20,13 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdbool.h>
#include <musical_notes.h>
-__attribute__ ((weak))
-float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_F3, 2);
-__attribute__ ((weak))
-float fauxclicky_released_note[2] = MUSICAL_NOTE(_A3, 2);
-__attribute__ ((weak))
-float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C3, 2);
-
bool fauxclicky_enabled = true;
uint16_t note_start = 0;
bool note_playing = false;
@@ -48,13 +41,13 @@ void fauxclicky_stop()
note_playing = false;
}
-void fauxclicky_play(float note[2]) {
+void fauxclicky_play(float note[]) {
if (!fauxclicky_enabled) return;
if (note_playing) fauxclicky_stop();
- FAUXCLICKY_TIMER_PERIOD = (uint16_t)(((float)F_CPU) / (note[0] * FAUXCLICKY_CPU_PRESCALER));
- FAUXCLICKY_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (note[0] * FAUXCLICKY_CPU_PRESCALER)) / 2);
+ FAUXCLICKY_TIMER_PERIOD = (uint16_t)(((float)F_CPU) / (note[0] * (float)FAUXCLICKY_CPU_PRESCALER));
+ FAUXCLICKY_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (note[0] * (float)FAUXCLICKY_CPU_PRESCALER)) / (float)2);
note_playing = true;
- note_period = (note[1] / 16) * (60 / (float)FAUXCLICKY_TEMPO) * 100; // check this
+ note_period = (note[1] / (float)16) * ((float)60 / (float)FAUXCLICKY_TEMPO) * 1000;
note_start = timer_read();
FAUXCLICKY_ENABLE_OUTPUT;
}
diff --git a/quantum/fauxclicky.h b/quantum/fauxclicky.h
index 109bd0d83e..1a8e188dd5 100644
--- a/quantum/fauxclicky.h
+++ b/quantum/fauxclicky.h
@@ -21,11 +21,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "stdbool.h"
__attribute__ ((weak))
-float fauxclicky_pressed_note[2];
+float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_D4, 0.25);
__attribute__ ((weak))
-float fauxclicky_released_note[2];
+float fauxclicky_released_note[2] = MUSICAL_NOTE(_C4, 0.125);
__attribute__ ((weak))
-float fauxclicky_beep_note[2];
+float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C4, 0.25);
bool fauxclicky_enabled;
@@ -73,11 +73,11 @@ bool fauxclicky_enabled;
#endif
#ifndef FAUXCLICKY_ENABLE_OUTPUT
-#define FAUXCLICKY_ENABLE_OUTPUT TCCR3A |= _BV(COM3A1);
+#define FAUXCLICKY_ENABLE_OUTPUT TCCR3A |= _BV(COM3A1)
#endif
#ifndef FAUXCLICKY_DISABLE_OUTPUT
-#define FAUXCLICKY_DISABLE_OUTPUT TCCR3A &= ~(_BV(COM3A1) | _BV(COM3A0));
+#define FAUXCLICKY_DISABLE_OUTPUT TCCR3A &= ~(_BV(COM3A1) | _BV(COM3A0))
#endif
#ifndef FAUXCLICKY_TIMER_PERIOD