From 8b059088ba9c310d3790d2839027e966f1082393 Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Sat, 26 Jun 2021 00:00:21 -0500 Subject: =?UTF-8?q?Keyboards/RGBKB/M=C3=BCn=20(#13239)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- keyboards/rgbkb/common/touch_encoder.h | 54 ++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 keyboards/rgbkb/common/touch_encoder.h (limited to 'keyboards/rgbkb/common/touch_encoder.h') diff --git a/keyboards/rgbkb/common/touch_encoder.h b/keyboards/rgbkb/common/touch_encoder.h new file mode 100644 index 0000000000..022f619063 --- /dev/null +++ b/keyboards/rgbkb/common/touch_encoder.h @@ -0,0 +1,54 @@ +/* + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * wrote this file. As long as you retain this + * notice you can do whatever you want with this stuff. If we meet some day, and + * you think this stuff is worth it, you can buy me a beer in return. Ryan Caltabiano + * ---------------------------------------------------------------------------- + */ + +#pragma once + +#include +#include + +#ifndef TOUCH_TERM +# define TOUCH_TERM 350 +#endif + +#ifndef TOUCH_SEGMENTS +# define TOUCH_SEGMENTS 3 +#elif TOUCH_SEGMENTS < 1 || TOUCH_SEGMENTS > 5 +# error TOUCH_SEGMENTS must be between 1 and 5. +#endif + +#ifndef TOUCH_DEADZONE +# define TOUCH_DEADZONE 50 +#endif + +#ifndef TOUCH_RESOLUTION +# define TOUCH_RESOLUTION 25 +#endif + +void touch_encoder_init(void); +void touch_encoder_update(int8_t transaction_id); + +void touch_encoder_calibrate(void); +bool touch_encoder_calibrating(void); + +void touch_encoder_toggle(void); +bool touch_encoder_toggled(void); + +// Called when touch encoder is tapped, weak function overridable by the kb +bool touch_encoder_tapped_kb(uint8_t index, uint8_t section); + +// Called when touch encoder is slid, weak function overridable by the kb +bool touch_encoder_update_kb(uint8_t index, bool clockwise); + +// Called when touch encoder is tapped, weak function overridable by the user +bool touch_encoder_tapped_user(uint8_t index, uint8_t section); + +// Called when touch encoder is slid, weak function overridable by the user +bool touch_encoder_update_user(uint8_t index, bool clockwise); + +void touch_encoder_slave_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer); -- cgit v1.2.3