keymap.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #include QMK_KEYBOARD_H
  2. const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
  3. /*
  4. * ,-----------------------,
  5. * | 7 | 8 | 9 | / |
  6. * |-----+-----+-----+-----|
  7. * | 4 | 5 | 6 | * |
  8. * |-----+-----+-----+-----|
  9. * | 1 | 2 | 3 | - |
  10. * |-----+-----+-----+-----|
  11. * | 0 | . | = | + |
  12. * `-----------------------'
  13. */
  14. LAYOUT_ortho_4x4(
  15. KC_P7, KC_P8, KC_P9, KC_PSLS,
  16. KC_P4, KC_P5, KC_P6, KC_PAST,
  17. KC_P1, KC_P2, KC_P3, KC_PMNS,
  18. KC_P0, KC_PDOT, KC_PEQL, KC_PPLS
  19. )
  20. };
  21. // Set led state during power-up
  22. // There is also a LED_GREEN
  23. // Only for Rev1 & Rev2
  24. #ifdef LED_RED
  25. void keyboard_post_init_user(void) {
  26. writePinHigh(LED_RED);
  27. }
  28. #endif
  29. // Rev3 and above only
  30. #ifdef OLED_ENABLE
  31. bool oled_task_user(void) {
  32. oled_write_ln_P(PSTR("Plaid-Pad ///////////"), false);
  33. return false;
  34. }
  35. #endif
  36. #ifdef ENCODER_ENABLE
  37. bool encoder_update_user(uint8_t index, bool clockwise) {
  38. /*
  39. Rev1.1 Rev1
  40. ,-----------------------, ,-----------------------,
  41. | E1 | E2 | E3 | E4 | | E1 | | | E2 |
  42. |-----+-----+-----+-----| |-----+-----+-----+-----|
  43. | | | | E3 | | | | | |
  44. |-----+-----+-----+-----| |-----+-----+-----+-----|
  45. | | | | E2 | | | | | |
  46. |-----+-----+-----+-----| |-----+-----+-----+-----|
  47. | | | | E1 | | | | | |
  48. `-----------------------' `-----------------------'
  49. */
  50. // First encoder (E1)
  51. if (index == 0) {
  52. if (clockwise) {
  53. tap_code(KC_F17);
  54. } else {
  55. tap_code(KC_F18);
  56. }
  57. // Second encoder (E2)
  58. } else if (index == 1) {
  59. if (clockwise) {
  60. tap_code(KC_F19);
  61. } else {
  62. tap_code(KC_F20);
  63. }
  64. // Third encoder (E3)
  65. } else if (index == 2) {
  66. if (clockwise) {
  67. tap_code(KC_F21);
  68. } else {
  69. tap_code(KC_F22);
  70. }
  71. // Forth encoder (E4)
  72. } else if (index == 3) {
  73. if (clockwise) {
  74. tap_code(KC_F23);
  75. } else {
  76. tap_code(KC_F24);
  77. }
  78. }
  79. return true;
  80. }
  81. #endif