diff options
Diffstat (limited to 'quantum/fauxclicky.c')
| -rw-r--r-- | quantum/fauxclicky.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/quantum/fauxclicky.c b/quantum/fauxclicky.c index 13273e705..c3341ca33 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/>. | |||
| 20 | #include <stdbool.h> | 20 | #include <stdbool.h> |
| 21 | #include <musical_notes.h> | 21 | #include <musical_notes.h> |
| 22 | 22 | ||
| 23 | __attribute__ ((weak)) | ||
| 24 | float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_F3, 2); | ||
| 25 | __attribute__ ((weak)) | ||
| 26 | float fauxclicky_released_note[2] = MUSICAL_NOTE(_A3, 2); | ||
| 27 | __attribute__ ((weak)) | ||
| 28 | float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C3, 2); | ||
| 29 | |||
| 30 | bool fauxclicky_enabled = true; | 23 | bool fauxclicky_enabled = true; |
| 31 | uint16_t note_start = 0; | 24 | uint16_t note_start = 0; |
| 32 | bool note_playing = false; | 25 | bool note_playing = false; |
| @@ -48,13 +41,13 @@ void fauxclicky_stop() | |||
| 48 | note_playing = false; | 41 | note_playing = false; |
| 49 | } | 42 | } |
| 50 | 43 | ||
| 51 | void fauxclicky_play(float note[2]) { | 44 | void fauxclicky_play(float note[]) { |
| 52 | if (!fauxclicky_enabled) return; | 45 | if (!fauxclicky_enabled) return; |
| 53 | if (note_playing) fauxclicky_stop(); | 46 | if (note_playing) fauxclicky_stop(); |
| 54 | FAUXCLICKY_TIMER_PERIOD = (uint16_t)(((float)F_CPU) / (note[0] * FAUXCLICKY_CPU_PRESCALER)); | 47 | FAUXCLICKY_TIMER_PERIOD = (uint16_t)(((float)F_CPU) / (note[0] * (float)FAUXCLICKY_CPU_PRESCALER)); |
| 55 | FAUXCLICKY_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (note[0] * FAUXCLICKY_CPU_PRESCALER)) / 2); | 48 | FAUXCLICKY_DUTY_CYCLE = (uint16_t)((((float)F_CPU) / (note[0] * (float)FAUXCLICKY_CPU_PRESCALER)) / (float)2); |
| 56 | note_playing = true; | 49 | note_playing = true; |
| 57 | note_period = (note[1] / 16) * (60 / (float)FAUXCLICKY_TEMPO) * 100; // check this | 50 | note_period = (note[1] / (float)16) * ((float)60 / (float)FAUXCLICKY_TEMPO) * 1000; |
| 58 | note_start = timer_read(); | 51 | note_start = timer_read(); |
| 59 | FAUXCLICKY_ENABLE_OUTPUT; | 52 | FAUXCLICKY_ENABLE_OUTPUT; |
| 60 | } | 53 | } |
