summaryrefslogtreecommitdiff
path: root/quantum/fauxclicky.c
diff options
context:
space:
mode:
authorskullY <skullydazed@gmail.com>2019-08-30 11:19:03 -0700
committerFlorian Didron <fdidron@users.noreply.github.com>2019-10-01 10:21:12 +0900
commit93f6749e06b70ba81e15f8b77e5a18675dacddfe (patch)
treefcf75ef930800a948e5a3ba015d6759889f2284d /quantum/fauxclicky.c
parentda34bddba16ba7a8495dc30bfe4542551ba87ed4 (diff)
clang-format changes
Diffstat (limited to 'quantum/fauxclicky.c')
-rw-r--r--quantum/fauxclicky.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/quantum/fauxclicky.c b/quantum/fauxclicky.c
index c3341ca332..a57e2ed075 100644
--- a/quantum/fauxclicky.c
+++ b/quantum/fauxclicky.c
@@ -20,23 +20,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <stdbool.h>
#include <musical_notes.h>
-bool fauxclicky_enabled = true;
-uint16_t note_start = 0;
-bool note_playing = false;
-uint16_t note_period = 0;
+bool fauxclicky_enabled = true;
+uint16_t note_start = 0;
+bool note_playing = false;
+uint16_t note_period = 0;
-void fauxclicky_init()
-{
+void fauxclicky_init() {
// Set port PC6 (OC3A and /OC4A) as output
DDRC |= _BV(PORTC6);
// TCCR3A / TCCR3B: Timer/Counter #3 Control Registers
TCCR3A = (0 << COM3A1) | (0 << COM3A0) | (1 << WGM31) | (0 << WGM30);
- TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30);
+ TCCR3B = (1 << WGM33) | (1 << WGM32) | (0 << CS32) | (1 << CS31) | (0 << CS30);
}
-void fauxclicky_stop()
-{
+void fauxclicky_stop() {
FAUXCLICKY_DISABLE_OUTPUT;
note_playing = false;
}
@@ -45,10 +43,10 @@ void fauxclicky_play(float note[]) {
if (!fauxclicky_enabled) return;
if (note_playing) fauxclicky_stop();
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] / (float)16) * ((float)60 / (float)FAUXCLICKY_TEMPO) * 1000;
- note_start = timer_read();
+ FAUXCLICKY_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (note[0] * (float)FAUXCLICKY_CPU_PRESCALER)) / (float)2);
+ note_playing = true;
+ note_period = (note[1] / (float)16) * ((float)60 / (float)FAUXCLICKY_TEMPO) * 1000;
+ note_start = timer_read();
FAUXCLICKY_ENABLE_OUTPUT;
}