rev3.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include "rev3.h"
  2. #ifdef SWAP_HANDS_ENABLE
  3. __attribute__ ((weak))
  4. // swap-hands action needs a matrix to define the swap
  5. const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
  6. /* Left hand, matrix positions */
  7. {{0,5}, {1,5}, {2,5}, {3,5}, {4,5}, {5,5}},
  8. {{0,6}, {1,6}, {2,6}, {3,6}, {4,6}, {5,6}},
  9. {{0,7}, {1,7}, {2,7}, {3,7}, {4,7}, {5,7}},
  10. {{0,8}, {1,8}, {2,8}, {3,8}, {4,8}, {5,8}},
  11. {{0,9}, {1,9}, {2,9}, {3,9}, {4,9}, {5,9}},
  12. /* Right hand, matrix positions */
  13. {{0,0}, {1,0}, {2,0}, {3,0}, {4,0}, {5,0}},
  14. {{0,1}, {1,1}, {2,1}, {3,1}, {4,1}, {5,1}},
  15. {{0,2}, {1,2}, {2,2}, {3,2}, {4,2}, {5,2}},
  16. {{0,3}, {1,3}, {2,3}, {3,3}, {4,3}, {5,3}},
  17. {{0,4}, {1,4}, {2,4}, {3,4}, {4,4}, {5,4}},
  18. };
  19. # ifdef ENCODER_MAP_ENABLE
  20. const uint8_t PROGMEM encoder_hand_swap_config[NUM_ENCODERS] = {1, 0};
  21. # endif
  22. #endif
  23. void eeconfig_init_kb(void) {
  24. #ifdef BACKLIGHT_ENABLE
  25. backlight_enable();
  26. backlight_level(3);
  27. #endif
  28. #ifdef RGBLIGHT_ENABLE
  29. rgblight_enable(); // Enable RGB by default
  30. rgblight_sethsv(0, 255, 255); // Set default HSV - red hue, full saturation, full brightness
  31. #ifdef RGBLIGHT_ANIMATIONS
  32. rgblight_mode(RGBLIGHT_MODE_RAINBOW_SWIRL + 2); // set to RGB_RAINBOW_SWIRL by default
  33. #endif
  34. #endif
  35. eeconfig_update_kb(0);
  36. eeconfig_init_user();
  37. }
  38. #ifdef ENCODER_ENABLE
  39. bool encoder_update_kb(uint8_t index, bool clockwise) {
  40. if (!encoder_update_user(index, clockwise)) { return false; }
  41. if (index == 0) {
  42. if (clockwise) {
  43. tap_code(KC_VOLU);
  44. } else {
  45. tap_code(KC_VOLD);
  46. }
  47. } else if (index == 1) {
  48. if (clockwise) {
  49. tap_code(KC_PGDN);
  50. } else {
  51. tap_code(KC_PGUP);
  52. }
  53. }
  54. return false;
  55. }
  56. #endif