logo

qmk_firmware

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

keymap.c (1874B)


  1. /* Copyright 2021 Glorious, LLC <salman@pcgamingrace.com>
  2. * Modified 2022 by rustedaperture for qmk_firmware
  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. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #include QMK_KEYBOARD_H
  15. #include "analog.h"
  16. #include "qmk_midi.h"
  17. // clang-format off
  18. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  19. // NUM / * -
  20. // 7 8 9 +
  21. // 4 5 6 ENCODER
  22. // 1 2 3 RET
  23. // 0 .
  24. [0] = LAYOUT(
  25. MO(1), KC_PSLS, KC_PAST, KC_PMNS,
  26. KC_P7, KC_P8, KC_P9, KC_PPLS,
  27. KC_P4, KC_P5, KC_P6, KC_CALC,
  28. KC_P1, KC_P2, KC_P3, KC_PENT,
  29. KC_P0, KC_PDOT
  30. ),
  31. [1] = LAYOUT(
  32. _______, KC_PSLS, KC_PAST, KC_PMNS,
  33. KC_P7, RM_VALU, KC_P9, KC_PPLS,
  34. RM_PREV, KC_P5, RM_NEXT, KC_CALC,
  35. KC_P1, RM_VALD, KC_P3, KC_PENT,
  36. RM_TOGG, QK_BOOT
  37. )
  38. };
  39. // Potentiometer Slider, MIDI Control
  40. uint8_t divisor = 0;
  41. void slider(void) {
  42. if (divisor++) { /* only run the slider function 1/256 times it's called */
  43. return;
  44. }
  45. midi_send_cc(&midi_device, 2, 0x3E, 0x7F + (analogReadPin(SLIDER_PIN) >> 3));
  46. }
  47. void housekeeping_task_user(void) {
  48. slider();
  49. }