summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-02-09 09:49:05 -0800
committerGitHub <noreply@github.com>2021-02-09 09:49:05 -0800
commit7161d650705afb86b0874d95d72d15cf134f4148 (patch)
treefeddeedd645c41bebcd1b8ab3972ee634bebe697 /quantum
parent738bd263c18de8f78cc98311b40c79a84ae3be33 (diff)
Remove FAUXCLICKY feature (deprecated) (#11829)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/fauxclicky.c59
-rw-r--r--quantum/fauxclicky.h97
-rw-r--r--quantum/quantum.c15
-rw-r--r--quantum/quantum_keycodes.h10
4 files changed, 3 insertions, 178 deletions
diff --git a/quantum/fauxclicky.c b/quantum/fauxclicky.c
deleted file mode 100644
index 53499c9c1e..0000000000
--- a/quantum/fauxclicky.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-Copyright 2017 Priyadi Iman Nurcahyo
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <avr/interrupt.h>
-#include <avr/io.h>
-#include "timer.h"
-#include "fauxclicky.h"
-#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;
-
-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);
-}
-
-void fauxclicky_stop() {
- FAUXCLICKY_DISABLE_OUTPUT;
- note_playing = false;
-}
-
-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_ENABLE_OUTPUT;
-}
-
-void fauxclicky_check() {
- if (!note_playing) return;
-
- if (timer_elapsed(note_start) > note_period) {
- fauxclicky_stop();
- }
-}
diff --git a/quantum/fauxclicky.h b/quantum/fauxclicky.h
deleted file mode 100644
index ed54d0edcf..0000000000
--- a/quantum/fauxclicky.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
-Copyright 2017 Priyadi Iman Nurcahyo
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifdef AUDIO_ENABLE
-# error "AUDIO_ENABLE and FAUXCLICKY_ENABLE cannot be both enabled"
-#endif
-
-#include "musical_notes.h"
-#include <stdbool.h>
-
-__attribute__((weak)) float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_D4, 0.25);
-__attribute__((weak)) float fauxclicky_released_note[2] = MUSICAL_NOTE(_C4, 0.125);
-__attribute__((weak)) float fauxclicky_beep_note[2] = MUSICAL_NOTE(_C4, 0.25);
-
-extern bool fauxclicky_enabled;
-
-//
-// tempo in BPM
-//
-
-#ifndef FAUXCLICKY_TEMPO
-# define FAUXCLICKY_TEMPO TEMPO_DEFAULT
-#endif
-
-// beep on press
-#define FAUXCLICKY_ACTION_PRESS fauxclicky_play(fauxclicky_pressed_note)
-
-// beep on release
-#define FAUXCLICKY_ACTION_RELEASE fauxclicky_play(fauxclicky_released_note)
-
-// general purpose beep
-#define FAUXCLICKY_BEEP fauxclicky_play(fauxclicky_beep_note)
-
-// enable
-#define FAUXCLICKY_ON fauxclicky_enabled = true
-
-// disable
-#define FAUXCLICKY_OFF \
- do { \
- fauxclicky_enabled = false; \
- fauxclicky_stop(); \
- } while (0)
-
-// toggle
-#define FAUXCLICKY_TOGGLE \
- do { \
- if (fauxclicky_enabled) { \
- FAUXCLICKY_OFF; \
- } else { \
- FAUXCLICKY_ON; \
- } \
- } while (0)
-
-//
-// pin configuration
-//
-
-#ifndef FAUXCLICKY_CPU_PRESCALER
-# define FAUXCLICKY_CPU_PRESCALER 8
-#endif
-
-#ifndef FAUXCLICKY_ENABLE_OUTPUT
-# define FAUXCLICKY_ENABLE_OUTPUT TCCR3A |= _BV(COM3A1)
-#endif
-
-#ifndef FAUXCLICKY_DISABLE_OUTPUT
-# define FAUXCLICKY_DISABLE_OUTPUT TCCR3A &= ~(_BV(COM3A1) | _BV(COM3A0))
-#endif
-
-#ifndef FAUXCLICKY_TIMER_PERIOD
-# define FAUXCLICKY_TIMER_PERIOD ICR3
-#endif
-
-#ifndef FAUXCLICKY_DUTY_CYCLE
-# define FAUXCLICKY_DUTY_CYCLE OCR3A
-#endif
-
-//
-// definitions
-//
-
-void fauxclicky_init(void);
-void fauxclicky_stop(void);
-void fauxclicky_play(float note[2]);
-void fauxclicky_check(void);
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 8ae487bec2..6d202c515c 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -25,10 +25,6 @@
# include "backlight.h"
#endif
-#ifdef FAUXCLICKY_ENABLE
-# include "fauxclicky.h"
-#endif
-
#ifdef API_ENABLE
# include "api.h"
#endif
@@ -310,17 +306,6 @@ bool process_record_quantum(keyrecord_t *record) {
case EEPROM_RESET:
eeconfig_init();
return false;
-#ifdef FAUXCLICKY_ENABLE
- case FC_TOG:
- FAUXCLICKY_TOGGLE;
- return false;
- case FC_ON:
- FAUXCLICKY_ON;
- return false;
- case FC_OFF:
- FAUXCLICKY_OFF;
- return false;
-#endif
#ifdef VELOCIKEY_ENABLE
case VLK_TOG:
velocikey_toggle();
diff --git a/quantum/quantum_keycodes.h b/quantum/quantum_keycodes.h
index 0160c5586d..e0f5dbc61e 100644
--- a/quantum/quantum_keycodes.h
+++ b/quantum/quantum_keycodes.h
@@ -150,13 +150,6 @@ enum quantum_keycodes {
CLICKY_DOWN,
CLICKY_RESET,
-#ifdef FAUXCLICKY_ENABLE
- // Faux clicky
- FC_ON,
- FC_OFF,
- FC_TOG,
-#endif
-
// Music mode on/off/toggle
MU_ON,
MU_OFF,
@@ -717,6 +710,9 @@ enum quantum_keycodes {
#define CK_DOWN CLICKY_DOWN
#define CK_ON CLICKY_ENABLE
#define CK_OFF CLICKY_DISABLE
+#define FC_ON CLICKY_ENABLE
+#define FC_OFF CLICKY_DISABLE
+#define FC_TOGG CLICKY_TOGGLE
#define RGB_MOD RGB_MODE_FORWARD
#define RGB_RMOD RGB_MODE_REVERSE