logo

qmk_firmware

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

la_plus.c (3259B)


  1. /* Copyright 2021 Harrison Chan (Xelus)
  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 "la_plus.h"
  17. #include "print.h"
  18. #define _____ NO_LED
  19. keyboard_config_t keyboard_config;
  20. led_config_t g_led_config = { {
  21. // Key Matrix to LED Index
  22. { _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____ },
  23. { _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____ },
  24. { _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____ },
  25. { _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____ },
  26. { _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____, _____ }
  27. }, {
  28. // LED Index to Physical Position
  29. { 2, 38 },
  30. { 0, 31 },
  31. { 2, 24 },
  32. { 0, 17 },
  33. { 2, 10 },
  34. { 0, 4 },
  35. { 4, 1 },
  36. { 14, 1 },
  37. { 30, 1 },
  38. { 47, 1 },
  39. { 63, 1 },
  40. { 79, 1 },
  41. { 95, 1 },
  42. {111, 1 },
  43. {144, 1 },
  44. {159, 1 },
  45. {176, 1 },
  46. {192, 1 },
  47. {208, 1 },
  48. {224, 1 },
  49. {241, 1 },
  50. {250, 0 },
  51. {255, 4 },
  52. {253, 10 },
  53. {255, 17 },
  54. {253, 24 },
  55. {255, 31 },
  56. {253, 38 },
  57. {241, 64 },
  58. {165, 64 },
  59. { 90, 64 },
  60. { 14, 64 }
  61. }, {
  62. // LED Index to Flag
  63. 8, 8, 8, 8, 8, 8, 8, 8,
  64. 8, 8, 8, 8, 8, 8, 8, 8,
  65. 8, 8, 8, 8, 8, 8, 8, 8,
  66. 8, 8, 8, 8, 8, 8, 8, 8
  67. } };
  68. void keyboard_post_init_kb(void) {
  69. // Call the post init code.
  70. // debug_enable=true;
  71. keyboard_config.raw = eeconfig_read_kb();
  72. if (keyboard_config.startup_animation_dots) {
  73. rgb_matrix_mode_noeeprom(RGB_MATRIX_CUSTOM_startup_animation_dots);
  74. } else {
  75. rgb_matrix_mode_noeeprom(RGB_MATRIX_CUSTOM_startup_animation_solid);
  76. }
  77. keyboard_post_init_user();
  78. }
  79. void eeconfig_init_kb(void) {
  80. #ifdef STARTUP_ANIMATION_DOTS
  81. keyboard_config.startup_animation_dots = false;
  82. #else
  83. keyboard_config.startup_animation_dots = true;
  84. #endif
  85. eeconfig_update_kb(keyboard_config.raw);
  86. eeconfig_init_user();
  87. }
  88. bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
  89. if (!process_record_user(keycode, record)) {
  90. return false;
  91. }
  92. if (keycode == STARTUP_ANIMATION_CONFIG && record->event.pressed) {
  93. keyboard_config.startup_animation_dots = !(keyboard_config.startup_animation_dots);
  94. #ifdef CONSOLE_ENABLE
  95. uprintf("keyboard_config startup_animation_dots: %b\n", keyboard_config.startup_animation_dots);
  96. #endif
  97. eeconfig_update_kb(keyboard_config.raw);
  98. }
  99. return true;
  100. }