diff options
Diffstat (limited to 'drivers/haptic/haptic.h')
| -rw-r--r-- | drivers/haptic/haptic.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/drivers/haptic/haptic.h b/drivers/haptic/haptic.h new file mode 100644 index 000000000..d39dc5c3b --- /dev/null +++ b/drivers/haptic/haptic.h | |||
| @@ -0,0 +1,82 @@ | |||
| 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 | #include "quantum.h" | ||
| 22 | #ifdef DRV2605L | ||
| 23 | #include "DRV2605L.h" | ||
| 24 | #endif | ||
| 25 | |||
| 26 | |||
| 27 | #ifndef HAPTIC_FEEDBACK_DEFAULT | ||
| 28 | #define HAPTIC_FEEDBACK_DEFAULT 0 | ||
| 29 | #endif | ||
| 30 | #ifndef HAPTIC_MODE_DEFAULT | ||
| 31 | #define HAPTIC_MODE_DEFAULT DRV_MODE_DEFAULT | ||
| 32 | #endif | ||
| 33 | |||
| 34 | /* EEPROM config settings */ | ||
| 35 | typedef union { | ||
| 36 | uint32_t raw; | ||
| 37 | struct { | ||
| 38 | bool enable :1; | ||
| 39 | uint8_t feedback :2; | ||
| 40 | uint8_t mode :7; | ||
| 41 | bool buzz :1; | ||
| 42 | uint8_t dwell :7; | ||
| 43 | uint16_t reserved :16; | ||
| 44 | }; | ||
| 45 | } haptic_config_t; | ||
| 46 | |||
| 47 | typedef enum HAPTIC_FEEDBACK{ | ||
| 48 | KEY_PRESS, | ||
| 49 | KEY_PRESS_RELEASE, | ||
| 50 | KEY_RELEASE, | ||
| 51 | HAPTIC_FEEDBACK_MAX, | ||
| 52 | } HAPTIC_FEEDBACK; | ||
| 53 | |||
| 54 | bool process_haptic(uint16_t keycode, keyrecord_t *record); | ||
| 55 | void haptic_init(void); | ||
| 56 | void haptic_task(void); | ||
| 57 | void eeconfig_debug_haptic(void); | ||
| 58 | void haptic_enable(void); | ||
| 59 | void haptic_disable(void); | ||
| 60 | void haptic_toggle(void); | ||
| 61 | void haptic_feedback_toggle(void); | ||
| 62 | void haptic_mode_increase(void); | ||
| 63 | void haptic_mode_decrease(void); | ||
| 64 | void haptic_mode(uint8_t mode); | ||
| 65 | void haptic_reset(void); | ||
| 66 | void haptic_set_feedback(uint8_t feedback); | ||
| 67 | void haptic_set_mode(uint8_t mode); | ||
| 68 | void haptic_set_dwell(uint8_t dwell); | ||
| 69 | void haptic_set_buzz(uint8_t buzz); | ||
| 70 | void haptic_buzz_toggle(void); | ||
| 71 | uint8_t haptic_get_mode(void); | ||
| 72 | uint8_t haptic_get_feedback(void); | ||
| 73 | void haptic_dwell_increase(void); | ||
| 74 | void haptic_dwell_decrease(void); | ||
| 75 | |||
| 76 | void haptic_play(void); | ||
| 77 | void haptic_shutdown(void); | ||
| 78 | |||
| 79 | |||
| 80 | |||
| 81 | |||
| 82 | |||
