logo

qmk_firmware

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

keymap.c (1540B)


  1. /* Copyright 2020 Snipeye
  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. #include QMK_KEYBOARD_H
  17. enum uno_keycode
  18. {
  19. UNO = SAFE_RANGE
  20. };
  21. enum encoder_names {
  22. _ENCODER,
  23. };
  24. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  25. [0] = LAYOUT(
  26. UNO
  27. )
  28. };
  29. bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  30. switch (keycode) {
  31. case UNO:
  32. if (record->event.pressed) {
  33. SEND_STRING("Hello!");
  34. }
  35. break;
  36. return false;
  37. }
  38. return true;
  39. }
  40. void keyboard_post_init_user(void) {
  41. rgblight_enable_noeeprom();
  42. rgblight_sethsv_noeeprom(255, 255, 255);
  43. rgblight_mode_noeeprom(RGBLIGHT_MODE_RAINBOW_MOOD);
  44. }
  45. bool encoder_update_user(uint8_t index, bool clockwise) {
  46. if (index == _ENCODER) { /* First encoder */
  47. if (clockwise) {
  48. tap_code(KC_A);
  49. } else {
  50. tap_code(KC_B);
  51. }
  52. return false;
  53. }
  54. return true;
  55. }