1
0
Fork 0

Haptic feedback generalized - DRV2605 and solenoids (#4939)

* initial work to add eeprom to haptic feedback and decouple the feedback process from keyboards

* Haptic feedback enhancements: on/off toggle working, feedback order working
todo:
-work on modes switching
-get modes switching to save to eeprom

* haptic enhancement - eeprom and modes added

* Added set and get functions for haptic feedback

* initial implementation of solenoids under haptic feedback

* changed eeprom to 32 bits to reserve blocks for future features

* start documentation of haptic feedback

* change keycode per comment from reviewers

* typo fixes

* added eeprom for solenoid configs

* added solenoid and docs

* Add/fix default parameters configs, improve docs

* more doc cleanup

* add in solenoid buzz toggle, clean up doc

* some fixes for error in compiling solenoid

* fix a chibios specific i2c read function and added one for AVR controllers in DRV2605L.c

* fixes for avr side issues

* update keymap

* fix keymap compile error

* fix bugs found during solenoid testing

* set pin that is not powered during bootloader

* added warning about certain pins on the MCU may trip solenoid during DFU/bootloader
This commit is contained in:
ishtob 2019-02-16 21:39:30 -05:00 committed by MechMerlin
parent a7a647b7f6
commit 2cee371bf1
18 changed files with 750 additions and 48 deletions

View file

@ -192,4 +192,7 @@
//#define DRIVER_LED_TOTAL RGBLED_NUM
//#define RGB_MATRIX_KEYPRESSES
#define SOLENOID_PIN A14
#endif

View file

@ -190,8 +190,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `--------------------------------------------------------------------------------------------------------'
*/
[_ADJUST] = LAYOUT(
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \
RESET, HPT_TOG, HPT_FBK, HPT_MODI, HPT_MODD, HPT_RST , _______, _______, _______, _______, _______, _______, \
_______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \
_______, _______, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, CK_RST, CK_DOWN, CK_UP, CK_TOGG\

View file

@ -165,7 +165,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* `--------------------------------------------------------------------------------------------------------'
*/
[_ADJUST] = LAYOUT_wrapper(
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, \
_______, HPT_TOG, HPT_FBK, HPT_MODI, HPT_MODD, HPT_RST, _______, _______, _______, _______, _______, _______, \
RESET, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, _______, _______, _______, _______, _______, KC_DEL, \
_______, MAGIC_TOGGLE_NKRO, _______, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, AG_SWAP, QWERTY, COLEMAK, _______, _______, _______, \
_______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, _______, _______, _______, _______, BL_DEC, BL_INC, BL_STEP, BL_TOGG, \

View file

@ -52,6 +52,6 @@ NKRO_ENABLE = yes # USB Nkey Rollover
CUSTOM_MATRIX = yes # Custom matrix file
AUDIO_ENABLE = yes
RGBLIGHT_ENABLE = no
HAPTIC_ENABLE = DRV2605L
HAPTIC_ENABLE += DRV2605L
QWIIC_ENABLE += MICRO_OLED
# SERIAL_LINK_ENABLE = yes

View file

@ -17,7 +17,7 @@
#include "qwiic.h"
#include "action_layer.h"
#include "matrix.h"
#include "DRV2605L.h"
#include "haptic.h"
#ifdef QWIIC_MICRO_OLED_ENABLE
@ -167,20 +167,12 @@ void encoder_update_kb(uint8_t index, bool clockwise) {
#endif
void matrix_init_kb(void) {
#ifdef DRV2605L
DRV_init();
#endif
queue_for_send = true;
matrix_init_user();
}
void matrix_scan_kb(void) {
if (queue_for_send) {
#ifdef DRV2605L
DRV_EFFECT play_eff = strong_click;
DRV_pulse(play_eff);
#endif
#ifdef QWIIC_MICRO_OLED_ENABLE
read_host_led_state();
draw_ui();