2 Copyright 2017 Priyadi Iman Nurcahyo
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 2 of the License, or
7 (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #error "AUDIO_ENABLE and FAUXCLICKY_ENABLE cannot be both enabled"
20 #include "musical_notes.h"
22 __attribute__ ((weak))
23 float fauxclicky_pressed_note[2];
24 __attribute__ ((weak))
25 float fauxclicky_released_note[2];
26 __attribute__ ((weak))
27 float fauxclicky_beep_note[2];
33 #ifndef FAUXCLICKY_TEMPO
34 #define FAUXCLICKY_TEMPO TEMPO_DEFAULT
38 #define FAUXCLICKY_ACTION_PRESS fauxclicky_play(fauxclicky_pressed_note)
41 #define FAUXCLICKY_ACTION_RELEASE fauxclicky_play(fauxclicky_released_note)
43 // general purpose beep
44 #define FAUXCLICKY_BEEP fauxclicky_play(fauxclicky_beep_note)
47 #define FAUXCLICKY_ON fauxclicky_enabled = true
50 #define FAUXCLICKY_OFF do { \
51 fauxclicky_enabled = false; \
59 #ifndef FAUXCLICKY_CPU_PRESCALER
60 #define FAUXCLICKY_CPU_PRESCALER 8
63 #ifndef FAUXCLICKY_ENABLE_OUTPUT
64 #define FAUXCLICKY_ENABLE_OUTPUT TCCR3A |= _BV(COM3A1);
67 #ifndef FAUXCLICKY_DISABLE_OUTPUT
68 #define FAUXCLICKY_DISABLE_OUTPUT TCCR3A &= ~(_BV(COM3A1) | _BV(COM3A0));
71 #ifndef FAUXCLICKY_TIMER_PERIOD
72 #define FAUXCLICKY_TIMER_PERIOD ICR3
75 #ifndef FAUXCLICKY_DUTY_CYCLE
76 #define FAUXCLICKY_DUTY_CYCLE OCR3A
83 void fauxclicky_init(void);
84 void fauxclicky_stop(void);
85 void fauxclicky_play(float note[2]);
86 void fauxclicky_check(void);