logo

qmk_firmware

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

rgb_matrix_kb.inc (1783B)


  1. // Step 1.
  2. // Declare custom effects using the RGB_MATRIX_EFFECT macro
  3. // (note the lack of semicolon after the macro!)
  4. RGB_MATRIX_EFFECT(startup_animation_dots)
  5. RGB_MATRIX_EFFECT(startup_animation_solid)
  6. // Step 2.
  7. // Define effects inside the `RGB_MATRIX_CUSTOM_EFFECT_IMPLS` ifdef block
  8. #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
  9. #include "eeprom.h"
  10. #include "eeconfig.h"
  11. static void startup_animation_setleds(effect_params_t* params, bool dots) {
  12. uint8_t factor = 5;
  13. hsv_t hsv = rgb_matrix_config.hsv;
  14. rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
  15. if (dots) {
  16. rgb_matrix_set_color_all(0, 0, 0);
  17. }
  18. int32_t num = (g_rgb_timer & (0b11111 << factor)) >> factor;
  19. if (num == 17 || num == 18 || num == 19 ||
  20. num == 20 || num == 21) {
  21. if (dots == true) {
  22. for (int i = 0; i < 28; i++) {
  23. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  24. }
  25. }
  26. return;
  27. } else if (num == 0 || num == 1 || num == 2) {
  28. return;
  29. } else if (num >= 22) {
  30. eeconfig_read_rgb_matrix(&rgb_matrix_config);
  31. rgb_matrix_mode_noeeprom(rgb_matrix_config.mode);
  32. return;
  33. }
  34. int32_t num2 = (27/2) + num - 2;
  35. int32_t num1 = 27 - num2;
  36. #ifdef CONSOLE_ENABLE
  37. uprintf("num: %u\n", num);
  38. uprintf("num1: %u\n", num1);
  39. uprintf("num2: %u\n", num2);
  40. #endif
  41. rgb_matrix_set_color(num1, rgb.r, rgb.g, rgb.b);
  42. rgb_matrix_set_color(num2, rgb.r, rgb.g, rgb.b);
  43. }
  44. static bool startup_animation_dots(effect_params_t* params) {
  45. startup_animation_setleds(params, true);
  46. return false;
  47. }
  48. static bool startup_animation_solid(effect_params_t* params) {
  49. startup_animation_setleds(params, false);
  50. return false;
  51. }
  52. #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS