aboutsummaryrefslogtreecommitdiff
path: root/quantum/haptic.h
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2021-07-26 03:14:58 +0100
committerGitHub <noreply@github.com>2021-07-25 19:14:58 -0700
commitf945c352e7db3fedb16c90f9f176b3df6e0b62ae (patch)
tree8b2cd252ad036b5199603c9c755c01be5cb326a2 /quantum/haptic.h
parent4bb595f94b5c77e7a961ff69d2b4d9c53a9094fc (diff)
downloadqmk_firmware-f945c352e7db3fedb16c90f9f176b3df6e0b62ae.tar.gz
qmk_firmware-f945c352e7db3fedb16c90f9f176b3df6e0b62ae.zip
Haptic: driver-> feature (#13713)
Diffstat (limited to 'quantum/haptic.h')
-rw-r--r--quantum/haptic.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/quantum/haptic.h b/quantum/haptic.h
new file mode 100644
index 000000000..fc7ca2f3e
--- /dev/null
+++ b/quantum/haptic.h
@@ -0,0 +1,77 @@
1/* Copyright 2019 ishtob
2 * Driver for haptic feedback written for QMK
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 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19#include <stdint.h>
20#include <stdbool.h>
21
22#ifndef HAPTIC_FEEDBACK_DEFAULT
23# define HAPTIC_FEEDBACK_DEFAULT 0
24#endif
25#ifndef HAPTIC_MODE_DEFAULT
26# define HAPTIC_MODE_DEFAULT DRV_MODE_DEFAULT
27#endif
28
29/* EEPROM config settings */
30typedef union {
31 uint32_t raw;
32 struct {
33 bool enable : 1;
34 uint8_t feedback : 2;
35 uint8_t mode : 7;
36 bool buzz : 1;
37 uint8_t dwell : 7;
38 bool cont : 1;
39 uint8_t amplitude : 8;
40 uint8_t reserved : 5;
41 };
42} haptic_config_t;
43
44typedef enum HAPTIC_FEEDBACK {
45 KEY_PRESS,
46 KEY_PRESS_RELEASE,
47 KEY_RELEASE,
48 HAPTIC_FEEDBACK_MAX,
49} HAPTIC_FEEDBACK;
50
51void haptic_init(void);
52void haptic_task(void);
53void eeconfig_debug_haptic(void);
54void haptic_enable(void);
55void haptic_disable(void);
56void haptic_toggle(void);
57void haptic_feedback_toggle(void);
58void haptic_mode_increase(void);
59void haptic_mode_decrease(void);
60void haptic_mode(uint8_t mode);
61void haptic_reset(void);
62void haptic_set_feedback(uint8_t feedback);
63void haptic_set_mode(uint8_t mode);
64void haptic_set_dwell(uint8_t dwell);
65void haptic_set_buzz(uint8_t buzz);
66void haptic_buzz_toggle(void);
67uint8_t haptic_get_enable(void);
68uint8_t haptic_get_mode(void);
69uint8_t haptic_get_feedback(void);
70void haptic_dwell_increase(void);
71void haptic_dwell_decrease(void);
72void haptic_toggle_continuous(void);
73void haptic_cont_increase(void);
74void haptic_cont_decrease(void);
75
76void haptic_play(void);
77void haptic_shutdown(void);