logo

qmk_firmware

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

4x6_4.c (2280B)


  1. /**
  2. * Copyright 2020 Christopher Courtney <drashna@live.com> (@drashna)
  3. * Copyright 2021 Quentin LEBASTARD <qlebastard@gmail.com>
  4. * Copyright 2022 Charly Delay <charly@codesink.dev> (@0xcharly)
  5. * Copyright 2023 casuanoob <casuanoob@hotmail.com> (@casuanoob)
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Publicw License as published by
  9. * the Free Software Foundation, either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #include "dilemma.h"
  21. #ifdef SWAP_HANDS_ENABLE
  22. const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
  23. /* Left hand, matrix positions */
  24. {{0, 5}, {1, 5}, {2, 5}, {3, 5}, {4, 5}, {5, 5}},
  25. {{0, 6}, {1, 6}, {2, 6}, {3, 6}, {4, 6}, {5, 6}},
  26. {{0, 7}, {1, 7}, {2, 7}, {3, 7}, {4, 7}, {5, 7}},
  27. {{0, 8}, {1, 8}, {2, 8}, {3, 8}, {4, 8}, {5, 8}},
  28. {{0, 9}, {1, 9}, {2, 9}, {3, 9}, {4, 9}, {5, 9}},
  29. /* Right hand, matrix positions */
  30. {{0, 0}, {1, 0}, {2, 0}, {3, 0}, {4, 0}, {5, 0}},
  31. {{0, 1}, {1, 1}, {2, 1}, {3, 1}, {4, 1}, {5, 1}},
  32. {{0, 2}, {1, 2}, {2, 2}, {3, 2}, {4, 2}, {5, 2}},
  33. {{0, 3}, {1, 3}, {2, 3}, {3, 3}, {4, 3}, {5, 3}},
  34. {{0, 4}, {1, 4}, {2, 4}, {3, 4}, {4, 4}, {5, 4}}
  35. };
  36. # ifdef ENCODER_MAP_ENABLE
  37. const uint8_t PROGMEM encoder_hand_swap_config[NUM_ENCODERS] = {1, 0};
  38. # endif
  39. #endif
  40. #ifdef ENCODER_ENABLE
  41. bool encoder_update_kb(uint8_t index, bool clockwise) {
  42. if (!encoder_update_user(index, clockwise)) {
  43. return false;
  44. }
  45. switch (index) {
  46. case 0: // Left-half encoder, mouse scroll.
  47. tap_code(clockwise ? KC_MS_WH_DOWN : KC_MS_WH_UP);
  48. break;
  49. case 1: // Right-half encoder, volume control.
  50. tap_code(clockwise ? KC_AUDIO_VOL_UP : KC_AUDIO_VOL_DOWN);
  51. break;
  52. }
  53. return true;
  54. }
  55. #endif // ENCODER_ENABLE