logo

qmk_firmware

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

pan.c (5860B)


  1. /* Copyright 2020 RGBKB
  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 "quantum.h"
  17. #include "rgb_matrix_types.h"
  18. #if defined RGB_MATRIX_ENABLE
  19. # if defined(KEYBOARD_rgbkb_pan_rev1)
  20. # include "ws2812.h"
  21. // Set an led in the buffer to a color
  22. static inline void setled(int i, uint8_t r, uint8_t g, uint8_t b) {
  23. # if defined(RGB_ENCODERS) || defined(STAGGERED_RGB_ENCODERS)
  24. if (i == 0 || i == 1) { // if encoder LEDs, change LEDs
  25. ws2812_set_color(i, g, b, r);
  26. } else
  27. # endif
  28. {
  29. ws2812_set_color(i, r, g, b);
  30. }
  31. }
  32. const rgb_matrix_driver_t rgb_matrix_driver = {
  33. .init = ws2812_init,
  34. .flush = ws2812_flush,
  35. .set_color = setled,
  36. .set_color_all = ws2812_set_color_all,
  37. };
  38. # endif
  39. // clang-format off
  40. led_config_t g_led_config = { {
  41. { 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 },
  42. { 0, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15 },
  43. { 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 1 },
  44. { 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40 },
  45. { 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, NO_LED }
  46. }, {
  47. # ifdef STAGGERED_RGB_ENCODERS
  48. {0, -19},{228, -19},
  49. {0, 0}, {14, 0}, {33, 0}, {52, 0}, {71, 0}, {90, 0}, {109, 0}, {128, 0}, {147, 0}, {166, 0}, {185, 0}, {204, 0}, {223, 0},
  50. {209, 19}, {190, 19}, {171, 19}, {152, 19}, {133, 19}, {114, 19}, {95, 19}, {76, 19}, {57, 19}, {38, 19}, {19, 19}, {0, 19},
  51. {0, 38}, {19, 38}, {38, 38}, {57, 38}, {76, 38}, {95, 38}, {114, 38}, {133, 38}, {152, 38}, {171, 38}, {190, 38}, {209, 38},
  52. {223, 57}, {204, 57}, {185, 57}, {171, 57}, {147, 57}, {128, 57}, {109, 57}, {90, 57}, {71, 57}, {52, 57}, {33, 57}, {14, 57}, {0, 57},
  53. {0, 76}, {19, 76}, {38, 76}, {57, 76}, {76, 76}, {95, 76}, {114, 76}, {133, 76}, {152, 76}, {171, 76}, {190, 76}, {209, 76},
  54. # elif defined RGB_ENCODERS
  55. {0, -19},{228, -19},
  56. {0, 0}, {19, 0}, {38, 0}, {57, 0}, {76, 0}, {95, 0}, {114, 0}, {133, 0}, {152, 0}, {171, 0}, {190, 0}, {209, 0},
  57. {209, 19}, {190, 19}, {171, 19}, {152, 19}, {133, 19}, {114, 19}, {95, 19}, {76, 19}, {57, 19}, {38, 19}, {19, 19}, {0, 19},
  58. {0, 38}, {19, 38}, {38, 38}, {57, 38}, {76, 38}, {95, 38}, {114, 38}, {133, 38}, {152, 38}, {171, 38}, {190, 38}, {209, 38},
  59. {209, 57}, {190, 57}, {171, 57}, {152, 57}, {133, 57}, {114, 57}, {95, 57}, {76, 57}, {57, 57}, {38, 57}, {19, 57}, {0, 57},
  60. {0, 76}, {19, 76}, {38, 76}, {57, 76}, {76, 76}, {95, 76}, {114, 76}, {133, 76}, {152, 76}, {171, 76}, {190, 76}, {209, 76},
  61. {0, 95},{19, 95}, //not used
  62. # elif defined STAGGERED_LAYOUT
  63. {0, 0}, {19, 0}, {38, 0}, {57, 0}, {76, 0}, {95, 0}, {114, 0}, {133, 0}, {152, 0}, {171, 0}, {190, 0}, {209, 0}, {0, 0},
  64. {209, 19}, {190, 19}, {171, 19}, {152, 19}, {133, 19}, {114, 19}, {95, 19}, {76, 19}, {57, 19}, {38, 19}, {19, 19}, {0, 19},
  65. {0, 38}, {19, 38}, {38, 38}, {57, 38}, {76, 38}, {95, 38}, {114, 38}, {133, 38}, {152, 38}, {171, 38}, {190, 38}, {209, 38},
  66. {209, 57}, {190, 57}, {171, 57}, {152, 57}, {133, 57}, {114, 57}, {95, 57}, {76, 57}, {57, 57}, {38, 57}, {19, 57}, {0, 57}, {0, 0},
  67. {0, 76}, {19, 76}, {38, 76}, {57, 76}, {76, 76}, {95, 76}, {114, 76}, {133, 76}, {152, 76}, {171, 76}, {190, 76}, {209, 76},
  68. {0, 95},{19, 95},//not used
  69. # else
  70. {0, 0}, {19, 0}, {38, 0}, {57, 0}, {76, 0}, {95, 0}, {114, 0}, {133, 0}, {152, 0}, {171, 0}, {190, 0}, {209, 0},
  71. {209, 19}, {190, 19}, {171, 19}, {152, 19}, {133, 19}, {114, 19}, {95, 19}, {76, 19}, {57, 19}, {38, 19}, {19, 19}, {0, 19},
  72. {0, 38}, {19, 38}, {38, 38}, {57, 38}, {76, 38}, {95, 38}, {114, 38}, {133, 38}, {152, 38}, {171, 38}, {190, 38}, {209, 38},
  73. {209, 57}, {190, 57}, {171, 57}, {152, 57}, {133, 57}, {114, 57}, {95, 57}, {76, 57}, {57, 57}, {38, 57}, {19, 57}, {0, 57},
  74. {0, 76}, {19, 76}, {38, 76}, {57, 76}, {76, 76}, {95, 76}, {114, 76}, {133, 76}, {152, 76}, {171, 76}, {190, 76}, {209, 76},
  75. {0, 0},{0, 0}, {0, 0},{0, 0},//not used
  76. # endif
  77. }, {
  78. # ifdef STAGGERED_RGB_ENCODERS
  79. 1, 1,
  80. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  81. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  82. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  83. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  84. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
  85. # elif defined RGB_ENCODERS
  86. 1, 1,
  87. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  88. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  89. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  90. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  91. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
  92. # elif defined STAGGERED_LAYOUT
  93. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  94. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  95. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  96. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  97. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
  98. # else
  99. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  100. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  101. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  102. 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1,
  103. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
  104. # endif
  105. } };
  106. // clang-format on
  107. #endif