diff options
Diffstat (limited to 'quantum/fauxclicky.h')
| -rw-r--r-- | quantum/fauxclicky.h | 97 |
1 files changed, 0 insertions, 97 deletions
diff --git a/quantum/fauxclicky.h b/quantum/fauxclicky.h deleted file mode 100644 index ed54d0edc..000000000 --- a/quantum/fauxclicky.h +++ /dev/null | |||
| @@ -1,97 +0,0 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2017 Priyadi Iman Nurcahyo | ||
| 3 | |||
| 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/>. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifdef AUDIO_ENABLE | ||
| 17 | # error "AUDIO_ENABLE and FAUXCLICKY_ENABLE cannot be both enabled" | ||
| 18 | #endif | ||
| 19 | |||
| 20 | #include "musical_notes.h" | ||
| 21 | #include <stdbool.h> | ||
| 22 | |||
| 23 | __attribute__((weak)) float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_D4, 0.25); | ||
| 24 | __attribute__((weak)) float fauxclicky_released_note[2] = MUSICAL_NOTE(_C4, 0.125); | ||
| 25 | __attribute__((weak)) float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C4, 0.25); | ||
| 26 | |||
| 27 | extern bool fauxclicky_enabled; | ||
| 28 | |||
| 29 | // | ||
| 30 | // tempo in BPM | ||
| 31 | // | ||
| 32 | |||
| 33 | #ifndef FAUXCLICKY_TEMPO | ||
| 34 | # define FAUXCLICKY_TEMPO TEMPO_DEFAULT | ||
| 35 | #endif | ||
| 36 | |||
| 37 | // beep on press | ||
| 38 | #define FAUXCLICKY_ACTION_PRESS fauxclicky_play(fauxclicky_pressed_note) | ||
| 39 | |||
| 40 | // beep on release | ||
| 41 | #define FAUXCLICKY_ACTION_RELEASE fauxclicky_play(fauxclicky_released_note) | ||
| 42 | |||
| 43 | // general purpose beep | ||
| 44 | #define FAUXCLICKY_BEEP fauxclicky_play(fauxclicky_beep_note) | ||
| 45 | |||
| 46 | // enable | ||
| 47 | #define FAUXCLICKY_ON fauxclicky_enabled = true | ||
| 48 | |||
| 49 | // disable | ||
| 50 | #define FAUXCLICKY_OFF \ | ||
| 51 | do { \ | ||
| 52 | fauxclicky_enabled = false; \ | ||
| 53 | fauxclicky_stop(); \ | ||
| 54 | } while (0) | ||
| 55 | |||
| 56 | // toggle | ||
| 57 | #define FAUXCLICKY_TOGGLE \ | ||
| 58 | do { \ | ||
| 59 | if (fauxclicky_enabled) { \ | ||
| 60 | FAUXCLICKY_OFF; \ | ||
| 61 | } else { \ | ||
| 62 | FAUXCLICKY_ON; \ | ||
| 63 | } \ | ||
| 64 | } while (0) | ||
| 65 | |||
| 66 | // | ||
| 67 | // pin configuration | ||
| 68 | // | ||
| 69 | |||
| 70 | #ifndef FAUXCLICKY_CPU_PRESCALER | ||
| 71 | # define FAUXCLICKY_CPU_PRESCALER 8 | ||
| 72 | #endif | ||
| 73 | |||
| 74 | #ifndef FAUXCLICKY_ENABLE_OUTPUT | ||
| 75 | # define FAUXCLICKY_ENABLE_OUTPUT TCCR3A |= _BV(COM3A1) | ||
| 76 | #endif | ||
| 77 | |||
| 78 | #ifndef FAUXCLICKY_DISABLE_OUTPUT | ||
| 79 | # define FAUXCLICKY_DISABLE_OUTPUT TCCR3A &= ~(_BV(COM3A1) | _BV(COM3A0)) | ||
| 80 | #endif | ||
| 81 | |||
| 82 | #ifndef FAUXCLICKY_TIMER_PERIOD | ||
| 83 | # define FAUXCLICKY_TIMER_PERIOD ICR3 | ||
| 84 | #endif | ||
| 85 | |||
| 86 | #ifndef FAUXCLICKY_DUTY_CYCLE | ||
| 87 | # define FAUXCLICKY_DUTY_CYCLE OCR3A | ||
| 88 | #endif | ||
| 89 | |||
| 90 | // | ||
| 91 | // definitions | ||
| 92 | // | ||
| 93 | |||
| 94 | void fauxclicky_init(void); | ||
| 95 | void fauxclicky_stop(void); | ||
| 96 | void fauxclicky_play(float note[2]); | ||
| 97 | void fauxclicky_check(void); | ||
