nibble_encoder.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* Copyright 2020 Jay Greco
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #pragma once
  17. #include QMK_KEYBOARD_H
  18. #include "eeprom.h"
  19. #define EEPROM_ENABLED_ENCODER_MODES (VIA_EEPROM_CUSTOM_CONFIG_ADDR)
  20. #define EEPROM_CUSTOM_ENCODER (VIA_EEPROM_CUSTOM_CONFIG_ADDR+1)
  21. enum encoder_modes {
  22. ENC_MODE_VOLUME,
  23. ENC_MODE_MEDIA,
  24. ENC_MODE_SCROLL,
  25. ENC_MODE_BRIGHTNESS,
  26. ENC_MODE_BACKLIGHT,
  27. ENC_MODE_CUSTOM0,
  28. ENC_MODE_CUSTOM1,
  29. ENC_MODE_CUSTOM2,
  30. _NUM_ENCODER_MODES,
  31. };
  32. enum custom_encoder_behavior {
  33. ENC_CUSTOM_CW = 0,
  34. ENC_CUSTOM_CCW,
  35. ENC_CUSTOM_PRESS
  36. };
  37. uint16_t
  38. retrieve_custom_encoder_config(uint8_t encoder_idx, uint8_t behavior),
  39. handle_encoder_cw(void),
  40. handle_encoder_ccw(void);
  41. void set_custom_encoder_config(uint8_t encoder_idx, uint8_t behavior, uint16_t new_code),
  42. pre_encoder_mode_change(void),
  43. post_encoder_mode_change(void),
  44. change_encoder_mode(bool clockwise);