logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

touch_encoder.h (1810B)


  1. /*
  2. * ----------------------------------------------------------------------------
  3. * "THE BEER-WARE LICENSE" (Revision 42):
  4. * <https://github.com/XScorpion2> wrote this file. As long as you retain this
  5. * notice you can do whatever you want with this stuff. If we meet some day, and
  6. * you think this stuff is worth it, you can buy me a beer in return. Ryan Caltabiano
  7. * ----------------------------------------------------------------------------
  8. */
  9. #pragma once
  10. #include <stdint.h>
  11. #include <stdbool.h>
  12. #ifndef TOUCH_TERM
  13. # define TOUCH_TERM 350
  14. #endif
  15. #ifndef TOUCH_SEGMENTS
  16. # define TOUCH_SEGMENTS 3
  17. #elif TOUCH_SEGMENTS < 1 || TOUCH_SEGMENTS > 5
  18. # error TOUCH_SEGMENTS must be between 1 and 5.
  19. #endif
  20. #ifndef TOUCH_DEADZONE
  21. # define TOUCH_DEADZONE 50
  22. #endif
  23. #ifndef TOUCH_RESOLUTION
  24. # define TOUCH_RESOLUTION 25
  25. #endif
  26. void touch_encoder_init(void);
  27. void touch_encoder_update(int8_t transaction_id);
  28. void touch_encoder_calibrate(void);
  29. bool touch_encoder_is_calibrating(void);
  30. void touch_encoder_toggle(void);
  31. bool touch_encoder_is_on(void);
  32. // Called when touch encoder is tapped, weak function overridable by the kb
  33. bool touch_encoder_tapped_kb(uint8_t index, uint8_t section);
  34. // Called when touch encoder is slid, weak function overridable by the kb
  35. bool touch_encoder_update_kb(uint8_t index, bool clockwise);
  36. // Called when touch encoder is tapped, weak function overridable by the user
  37. bool touch_encoder_tapped_user(uint8_t index, uint8_t section);
  38. // Called when touch encoder is slid, weak function overridable by the user
  39. bool touch_encoder_update_user(uint8_t index, bool clockwise);
  40. void touch_encoder_slave_sync(uint8_t initiator2target_buffer_size, const void* initiator2target_buffer, uint8_t target2initiator_buffer_size, void* target2initiator_buffer);