summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2023-07-21 09:17:39 +1000
committerGitHub <noreply@github.com>2023-07-21 09:17:39 +1000
commitb090354143612d2c0f5c8629510542de5bd4e29e (patch)
tree6985cc58bf943d910c83b880fe61ffd8184cd93f /quantum
parentb20b3604042536640b5f29f85656cd55ef459180 (diff)
haptic: naming cleanups (#21551)
Diffstat (limited to 'quantum')
-rw-r--r--quantum/haptic.c81
-rw-r--r--quantum/haptic.h9
-rw-r--r--quantum/process_keycode/process_space_cadet.c3
-rw-r--r--quantum/split_common/split_util.c1
4 files changed, 51 insertions, 43 deletions
diff --git a/quantum/haptic.c b/quantum/haptic.c
index c151547fca..13b2258eb8 100644
--- a/quantum/haptic.c
+++ b/quantum/haptic.c
@@ -14,17 +14,20 @@
* 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 "haptic.h"
#include "eeconfig.h"
#include "debug.h"
#include "usb_device_state.h"
#include "gpio.h"
-#ifdef DRV2605L
-# include "DRV2605L.h"
+
+#ifdef HAPTIC_DRV2605L
+# include "drv2605l.h"
#endif
-#ifdef SOLENOID_ENABLE
+#ifdef HAPTIC_SOLENOID
# include "solenoid.h"
#endif
+
#if defined(SPLIT_KEYBOARD) && defined(SPLIT_HAPTIC_ENABLE)
extern uint8_t split_haptic_play;
#endif
@@ -59,11 +62,11 @@ void haptic_init(void) {
eeconfig_init();
}
haptic_config.raw = eeconfig_read_haptic();
-#ifdef SOLENOID_ENABLE
+#ifdef HAPTIC_SOLENOID
solenoid_set_dwell(haptic_config.dwell);
#endif
if ((haptic_config.raw == 0)
-#ifdef SOLENOID_ENABLE
+#ifdef HAPTIC_SOLENOID
|| (haptic_config.dwell == 0)
#endif
) {
@@ -77,12 +80,12 @@ void haptic_init(void) {
// This is to execute any side effects of the configuration.
set_haptic_config_enable(haptic_config.enable);
}
-#ifdef SOLENOID_ENABLE
+#ifdef HAPTIC_SOLENOID
solenoid_setup();
dprintf("Solenoid driver initialized\n");
#endif
-#ifdef DRV2605L
- DRV_init();
+#ifdef HAPTIC_DRV2605L
+ drv2605l_init();
dprintf("DRV2605 driver initialized\n");
#endif
eeconfig_debug_haptic();
@@ -95,7 +98,7 @@ void haptic_init(void) {
}
void haptic_task(void) {
-#ifdef SOLENOID_ENABLE
+#ifdef HAPTIC_SOLENOID
solenoid_check();
#endif
}
@@ -108,13 +111,13 @@ void eeconfig_debug_haptic(void) {
void haptic_enable(void) {
set_haptic_config_enable(true);
- xprintf("haptic_config.enable = %u\n", haptic_config.enable);
+ dprintf("haptic_config.enable = %u\n", haptic_config.enable);
eeconfig_update_haptic(haptic_config.raw);
}
void haptic_disable(void) {
set_haptic_config_enable(false);
- xprintf("haptic_config.enable = %u\n", haptic_config.enable);
+ dprintf("haptic_config.enable = %u\n", haptic_config.enable);
eeconfig_update_haptic(haptic_config.raw);
}
@@ -130,7 +133,7 @@ void haptic_toggle(void) {
void haptic_feedback_toggle(void) {
haptic_config.feedback++;
if (haptic_config.feedback >= HAPTIC_FEEDBACK_MAX) haptic_config.feedback = KEY_PRESS;
- xprintf("haptic_config.feedback = %u\n", !haptic_config.feedback);
+ dprintf("haptic_config.feedback = %u\n", !haptic_config.feedback);
eeconfig_update_haptic(haptic_config.raw);
}
@@ -142,7 +145,7 @@ void haptic_buzz_toggle(void) {
void haptic_mode_increase(void) {
uint8_t mode = haptic_config.mode + 1;
-#ifdef DRV2605L
+#ifdef HAPTIC_DRV2605L
if (haptic_config.mode >= drv_effect_max) {
mode = 1;
}
@@ -152,7 +155,7 @@ void haptic_mode_increase(void) {
void haptic_mode_decrease(void) {
uint8_t mode = haptic_config.mode - 1;
-#ifdef DRV2605L
+#ifdef HAPTIC_DRV2605L
if (haptic_config.mode < 1) {
mode = (drv_effect_max - 1);
}
@@ -161,7 +164,7 @@ void haptic_mode_decrease(void) {
}
void haptic_dwell_increase(void) {
-#ifdef SOLENOID_ENABLE
+#ifdef HAPTIC_SOLENOID
int16_t next_dwell = ((int16_t)haptic_config.dwell) + SOLENOID_DWELL_STEP_SIZE;
if (haptic_config.dwell >= SOLENOID_MAX_DWELL) {
// if it's already at max, we wrap back to min
@@ -178,7 +181,7 @@ void haptic_dwell_increase(void) {
}
void haptic_dwell_decrease(void) {
-#ifdef SOLENOID_ENABLE
+#ifdef HAPTIC_SOLENOID
int16_t next_dwell = ((int16_t)haptic_config.dwell) - SOLENOID_DWELL_STEP_SIZE;
if (haptic_config.dwell <= SOLENOID_MIN_DWELL) {
// if it's already at min, we wrap to max
@@ -196,13 +199,13 @@ void haptic_dwell_decrease(void) {
void haptic_reset(void) {
set_haptic_config_enable(true);
- uint8_t feedback = HAPTIC_FEEDBACK_DEFAULT;
+ uint8_t feedback = HAPTIC_DEFAULT_FEEDBACK;
haptic_config.feedback = feedback;
-#ifdef DRV2605L
- uint8_t mode = HAPTIC_MODE_DEFAULT;
+#ifdef HAPTIC_DRV2605L
+ uint8_t mode = HAPTIC_DEFAULT_MODE;
haptic_config.mode = mode;
#endif
-#ifdef SOLENOID_ENABLE
+#ifdef HAPTIC_SOLENOID
uint8_t dwell = SOLENOID_DEFAULT_DWELL;
haptic_config.dwell = dwell;
haptic_config.buzz = SOLENOID_DEFAULT_BUZZ;
@@ -213,41 +216,41 @@ void haptic_reset(void) {
haptic_config.buzz = 0;
#endif
eeconfig_update_haptic(haptic_config.raw);
- xprintf("haptic_config.feedback = %u\n", haptic_config.feedback);
- xprintf("haptic_config.mode = %u\n", haptic_config.mode);
+ dprintf("haptic_config.feedback = %u\n", haptic_config.feedback);
+ dprintf("haptic_config.mode = %u\n", haptic_config.mode);
}
void haptic_set_feedback(uint8_t feedback) {
haptic_config.feedback = feedback;
eeconfig_update_haptic(haptic_config.raw);
- xprintf("haptic_config.feedback = %u\n", haptic_config.feedback);
+ dprintf("haptic_config.feedback = %u\n", haptic_config.feedback);
}
void haptic_set_mode(uint8_t mode) {
haptic_config.mode = mode;
eeconfig_update_haptic(haptic_config.raw);
- xprintf("haptic_config.mode = %u\n", haptic_config.mode);
+ dprintf("haptic_config.mode = %u\n", haptic_config.mode);
}
void haptic_set_amplitude(uint8_t amp) {
haptic_config.amplitude = amp;
eeconfig_update_haptic(haptic_config.raw);
- xprintf("haptic_config.amplitude = %u\n", haptic_config.amplitude);
-#ifdef DRV2605L
- DRV_amplitude(amp);
+ dprintf("haptic_config.amplitude = %u\n", haptic_config.amplitude);
+#ifdef HAPTIC_DRV2605L
+ drv2605l_amplitude(amp);
#endif
}
void haptic_set_buzz(uint8_t buzz) {
haptic_config.buzz = buzz;
eeconfig_update_haptic(haptic_config.raw);
- xprintf("haptic_config.buzz = %u\n", haptic_config.buzz);
+ dprintf("haptic_config.buzz = %u\n", haptic_config.buzz);
}
void haptic_set_dwell(uint8_t dwell) {
haptic_config.dwell = dwell;
eeconfig_update_haptic(haptic_config.raw);
- xprintf("haptic_config.dwell = %u\n", haptic_config.dwell);
+ dprintf("haptic_config.dwell = %u\n", haptic_config.dwell);
}
uint8_t haptic_get_enable(void) {
@@ -277,19 +280,19 @@ uint8_t haptic_get_dwell(void) {
void haptic_enable_continuous(void) {
haptic_config.cont = 1;
- xprintf("haptic_config.cont = %u\n", haptic_config.cont);
+ dprintf("haptic_config.cont = %u\n", haptic_config.cont);
eeconfig_update_haptic(haptic_config.raw);
-#ifdef DRV2605L
- DRV_rtp_init();
+#ifdef HAPTIC_DRV2605L
+ drv2605l_rtp_init();
#endif
}
void haptic_disable_continuous(void) {
haptic_config.cont = 0;
- xprintf("haptic_config.cont = %u\n", haptic_config.cont);
+ dprintf("haptic_config.cont = %u\n", haptic_config.cont);
eeconfig_update_haptic(haptic_config.raw);
-#ifdef DRV2605L
- DRV_write(DRV_MODE, 0x00);
+#ifdef HAPTIC_DRV2605L
+ drv2605l_write(DRV2605L_REG_MODE, 0x00);
#endif
}
@@ -318,15 +321,15 @@ void haptic_cont_decrease(void) {
}
void haptic_play(void) {
-#ifdef DRV2605L
+#ifdef HAPTIC_DRV2605L
uint8_t play_eff = 0;
play_eff = haptic_config.mode;
- DRV_pulse(play_eff);
+ drv2605l_pulse(play_eff);
# if defined(SPLIT_KEYBOARD) && defined(SPLIT_HAPTIC_ENABLE)
split_haptic_play = haptic_config.mode;
# endif
#endif
-#ifdef SOLENOID_ENABLE
+#ifdef HAPTIC_SOLENOID
solenoid_fire_handler();
# if defined(SPLIT_KEYBOARD) && defined(SPLIT_HAPTIC_ENABLE)
split_haptic_play = 1;
@@ -335,7 +338,7 @@ void haptic_play(void) {
}
void haptic_shutdown(void) {
-#ifdef SOLENOID_ENABLE
+#ifdef HAPTIC_SOLENOID
solenoid_shutdown();
#endif
}
diff --git a/quantum/haptic.h b/quantum/haptic.h
index 71d95cc61b..5bd1a71916 100644
--- a/quantum/haptic.h
+++ b/quantum/haptic.h
@@ -16,14 +16,15 @@
*/
#pragma once
+
#include <stdint.h>
#include <stdbool.h>
-#ifndef HAPTIC_FEEDBACK_DEFAULT
-# define HAPTIC_FEEDBACK_DEFAULT 0
+#ifndef HAPTIC_DEFAULT_FEEDBACK
+# define HAPTIC_DEFAULT_FEEDBACK 0
#endif
-#ifndef HAPTIC_MODE_DEFAULT
-# define HAPTIC_MODE_DEFAULT DRV_MODE_DEFAULT
+#ifndef HAPTIC_DEFAULT_MODE
+# define HAPTIC_DEFAULT_MODE DRV2605L_DEFAULT_MODE
#endif
/* EEPROM config settings */
diff --git a/quantum/process_keycode/process_space_cadet.c b/quantum/process_keycode/process_space_cadet.c
index 4d9f01077e..f948ad6238 100644
--- a/quantum/process_keycode/process_space_cadet.c
+++ b/quantum/process_keycode/process_space_cadet.c
@@ -13,10 +13,13 @@
* 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 "process_space_cadet.h"
#include "keycodes.h"
#include "timer.h"
+#include "action.h"
#include "action_tapping.h"
+#include "action_util.h"
// ********** OBSOLETE DEFINES, STOP USING! (pls?) **********
// Shift / paren setup
diff --git a/quantum/split_common/split_util.c b/quantum/split_common/split_util.c
index 87838c3195..fca95e0847 100644
--- a/quantum/split_common/split_util.c
+++ b/quantum/split_common/split_util.c
@@ -21,6 +21,7 @@
#include "wait.h"
#include "debug.h"
#include "usb_util.h"
+#include "bootloader.h"
#ifdef EE_HANDS
# include "eeconfig.h"