logo

qmk_firmware

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

rgb_matrix_user.inc (27833B)


  1. /*
  2. Copyright 2020 Evy Dekkers
  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. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. RGB_MATRIX_EFFECT(solid_esc)
  15. RGB_MATRIX_EFFECT(solid_f13)
  16. RGB_MATRIX_EFFECT(solid_clus)
  17. RGB_MATRIX_EFFECT(breathing_all)
  18. RGB_MATRIX_EFFECT(breathing_esc)
  19. RGB_MATRIX_EFFECT(breathing_f13)
  20. RGB_MATRIX_EFFECT(breathing_clus)
  21. RGB_MATRIX_EFFECT(band_val_all)
  22. RGB_MATRIX_EFFECT(band_val_esc)
  23. RGB_MATRIX_EFFECT(band_val_f13)
  24. RGB_MATRIX_EFFECT(band_val_clus)
  25. RGB_MATRIX_EFFECT(cycle_up_down_all)
  26. RGB_MATRIX_EFFECT(cycle_up_down_esc)
  27. RGB_MATRIX_EFFECT(cycle_up_down_f13)
  28. RGB_MATRIX_EFFECT(cycle_up_down_clus)
  29. RGB_MATRIX_EFFECT(cycle_out_in_dual_all)
  30. RGB_MATRIX_EFFECT(cycle_out_in_dual_esc)
  31. RGB_MATRIX_EFFECT(cycle_out_in_dual_f13)
  32. RGB_MATRIX_EFFECT(cycle_out_in_dual_clus)
  33. RGB_MATRIX_EFFECT(rainbow_moving_chevron_all)
  34. RGB_MATRIX_EFFECT(rainbow_moving_chevron_esc)
  35. RGB_MATRIX_EFFECT(rainbow_moving_chevron_f13)
  36. RGB_MATRIX_EFFECT(rainbow_moving_chevron_clus)
  37. RGB_MATRIX_EFFECT(cycle_pimwheel_all)
  38. RGB_MATRIX_EFFECT(cycle_pimwheel_esc)
  39. RGB_MATRIX_EFFECT(cycle_pimwheel_f13)
  40. RGB_MATRIX_EFFECT(cycle_pimwheel_clus)
  41. RGB_MATRIX_EFFECT(rainbow_beacon_all)
  42. RGB_MATRIX_EFFECT(rainbow_beacon_esc)
  43. RGB_MATRIX_EFFECT(rainbow_beacon_f13)
  44. RGB_MATRIX_EFFECT(rainbow_beacon_clus)
  45. RGB_MATRIX_EFFECT(raindrops_all)
  46. RGB_MATRIX_EFFECT(raindrops_esc)
  47. RGB_MATRIX_EFFECT(raindrops_f13)
  48. RGB_MATRIX_EFFECT(raindrops_clus)
  49. #ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
  50. bool effect_runner_all(effect_params_t* params, i_f effect_func) {
  51. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  52. uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 4, 1));
  53. for (uint8_t i = led_min; i < led_max; i++) {
  54. RGB_MATRIX_TEST_LED_FLAGS();
  55. rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time));
  56. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  57. }
  58. return led_max < RGB_MATRIX_LED_COUNT;
  59. }
  60. bool effect_runner_esc(effect_params_t* params, i_f effect_func) {
  61. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  62. uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 4, 1));
  63. for (uint8_t i = led_min; i < led_max; i++) {
  64. RGB_MATRIX_TEST_LED_FLAGS();
  65. rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time));
  66. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  67. }
  68. for (uint8_t i = 1; i < 18; i++) {
  69. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  70. }
  71. return led_max < RGB_MATRIX_LED_COUNT;
  72. }
  73. bool effect_runner_f13(effect_params_t* params, i_f effect_func) {
  74. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  75. uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 4, 1));
  76. for (uint8_t i = led_min; i < led_max; i++) {
  77. RGB_MATRIX_TEST_LED_FLAGS();
  78. rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time));
  79. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  80. rgb_matrix_set_color(15, 0x00, 0x00, 0x00);
  81. rgb_matrix_set_color(16, 0x00, 0x00, 0x00);
  82. rgb_matrix_set_color(17, 0x00, 0x00, 0x00);
  83. }
  84. for (uint8_t i = 0; i < 14; i++) {
  85. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  86. }
  87. return led_max < RGB_MATRIX_LED_COUNT;
  88. }
  89. bool effect_runner_clus(effect_params_t* params, i_f effect_func) {
  90. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  91. uint8_t time = scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed / 4, 1));
  92. for (uint8_t i = led_min; i < led_max; i++) {
  93. RGB_MATRIX_TEST_LED_FLAGS();
  94. rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, i, time));
  95. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  96. }
  97. for (uint8_t i = 0; i < 15; i++) {
  98. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  99. }
  100. return led_max < RGB_MATRIX_LED_COUNT;
  101. }
  102. bool effect_runner_dx_dy_all(effect_params_t* params, dx_dy_f effect_func) {
  103. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  104. uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 2);
  105. for (uint8_t i = led_min; i < led_max; i++) {
  106. RGB_MATRIX_TEST_LED_FLAGS();
  107. int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x;
  108. int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y;
  109. rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time));
  110. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  111. }
  112. return led_max < RGB_MATRIX_LED_COUNT;
  113. }
  114. bool effect_runner_dx_dy_esc(effect_params_t* params, dx_dy_f effect_func) {
  115. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  116. uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 2);
  117. for (uint8_t i = led_min; i < led_max; i++) {
  118. RGB_MATRIX_TEST_LED_FLAGS();
  119. int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x;
  120. int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y;
  121. rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time));
  122. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  123. }
  124. for (uint8_t i = 1; i < 18; i++) {
  125. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  126. }
  127. return led_max < RGB_MATRIX_LED_COUNT;
  128. }
  129. bool effect_runner_dx_dy_f13(effect_params_t* params, dx_dy_f effect_func) {
  130. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  131. uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 2);
  132. for (uint8_t i = led_min; i < led_max; i++) {
  133. RGB_MATRIX_TEST_LED_FLAGS();
  134. int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x;
  135. int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y;
  136. rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time));
  137. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  138. rgb_matrix_set_color(15, 0x00, 0x00, 0x00);
  139. rgb_matrix_set_color(16, 0x00, 0x00, 0x00);
  140. rgb_matrix_set_color(17, 0x00, 0x00, 0x00);
  141. }
  142. for (uint8_t i = 0; i < 14; i++) {
  143. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  144. }
  145. return led_max < RGB_MATRIX_LED_COUNT;
  146. }
  147. bool effect_runner_dx_dy_clus(effect_params_t* params, dx_dy_f effect_func) {
  148. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  149. uint8_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 2);
  150. for (uint8_t i = led_min; i < led_max; i++) {
  151. RGB_MATRIX_TEST_LED_FLAGS();
  152. int16_t dx = g_led_config.point[i].x - k_rgb_matrix_center.x;
  153. int16_t dy = g_led_config.point[i].y - k_rgb_matrix_center.y;
  154. rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, dx, dy, time));
  155. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  156. }
  157. for (uint8_t i = 0; i < 15; i++) {
  158. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  159. }
  160. return led_max < RGB_MATRIX_LED_COUNT;
  161. }
  162. bool effect_runner_sin_cos_all(effect_params_t* params, sin_cos_i_f effect_func) {
  163. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  164. uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4);
  165. int8_t cos_value = cos8(time) - 128;
  166. int8_t sin_value = sin8(time) - 128;
  167. for (uint8_t i = led_min; i < led_max; i++) {
  168. RGB_MATRIX_TEST_LED_FLAGS();
  169. rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time));
  170. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  171. }
  172. return led_max < RGB_MATRIX_LED_COUNT;
  173. }
  174. bool effect_runner_sin_cos_esc(effect_params_t* params, sin_cos_i_f effect_func) {
  175. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  176. uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4);
  177. int8_t cos_value = cos8(time) - 128;
  178. int8_t sin_value = sin8(time) - 128;
  179. for (uint8_t i = led_min; i < led_max; i++) {
  180. RGB_MATRIX_TEST_LED_FLAGS();
  181. rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time));
  182. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  183. }
  184. for (uint8_t i = 1; i < 18; i++) {
  185. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  186. }
  187. return led_max < RGB_MATRIX_LED_COUNT;
  188. }
  189. bool effect_runner_sin_cos_f13(effect_params_t* params, sin_cos_i_f effect_func) {
  190. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  191. uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4);
  192. int8_t cos_value = cos8(time) - 128;
  193. int8_t sin_value = sin8(time) - 128;
  194. for (uint8_t i = led_min; i < led_max; i++) {
  195. RGB_MATRIX_TEST_LED_FLAGS();
  196. rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time));
  197. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  198. rgb_matrix_set_color(15, 0x00, 0x00, 0x00);
  199. rgb_matrix_set_color(16, 0x00, 0x00, 0x00);
  200. rgb_matrix_set_color(17, 0x00, 0x00, 0x00);
  201. }
  202. for (uint8_t i = 0; i < 14; i++) {
  203. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  204. }
  205. return led_max < RGB_MATRIX_LED_COUNT;
  206. }
  207. bool effect_runner_sin_cos_clus(effect_params_t* params, sin_cos_i_f effect_func) {
  208. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  209. uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 4);
  210. int8_t cos_value = cos8(time) - 128;
  211. int8_t sin_value = sin8(time) - 128;
  212. for (uint8_t i = led_min; i < led_max; i++) {
  213. RGB_MATRIX_TEST_LED_FLAGS();
  214. rgb_t rgb = rgb_matrix_hsv_to_rgb(effect_func(rgb_matrix_config.hsv, cos_value, sin_value, i, time));
  215. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  216. }
  217. for (uint8_t i = 0; i < 15; i++) {
  218. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  219. }
  220. return led_max < RGB_MATRIX_LED_COUNT;
  221. }
  222. static void raindrops_set_color_all(int i, effect_params_t* params) {
  223. if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
  224. hsv_t hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v};
  225. // Take the shortest path between hues
  226. int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4;
  227. if (deltaH > 127) {
  228. deltaH -= 256;
  229. } else if (deltaH < -127) {
  230. deltaH += 256;
  231. }
  232. hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03));
  233. rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
  234. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  235. }
  236. static void raindrops_set_color_esc(int i, effect_params_t* params) {
  237. if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
  238. hsv_t hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v};
  239. // Take the shortest path between hues
  240. int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4;
  241. if (deltaH > 127) {
  242. deltaH -= 256;
  243. } else if (deltaH < -127) {
  244. deltaH += 256;
  245. }
  246. hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03));
  247. rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
  248. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  249. for (uint8_t i = 1; i < 18; i++) {
  250. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  251. }
  252. }
  253. static void raindrops_set_color_f13(int i, effect_params_t* params) {
  254. if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
  255. hsv_t hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v};
  256. // Take the shortest path between hues
  257. int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4;
  258. if (deltaH > 127) {
  259. deltaH -= 256;
  260. } else if (deltaH < -127) {
  261. deltaH += 256;
  262. }
  263. hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03));
  264. rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
  265. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  266. rgb_matrix_set_color(15, 0x00, 0x00, 0x00);
  267. rgb_matrix_set_color(16, 0x00, 0x00, 0x00);
  268. rgb_matrix_set_color(17, 0x00, 0x00, 0x00);
  269. for (uint8_t i = 0; i < 14; i++) {
  270. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  271. }
  272. }
  273. static void raindrops_set_color_clus(int i, effect_params_t* params) {
  274. if (!HAS_ANY_FLAGS(g_led_config.flags[i], params->flags)) return;
  275. hsv_t hsv = {0, rgb_matrix_config.hsv.s, rgb_matrix_config.hsv.v};
  276. // Take the shortest path between hues
  277. int16_t deltaH = ((rgb_matrix_config.hsv.h + 180) % 360 - rgb_matrix_config.hsv.h) / 4;
  278. if (deltaH > 127) {
  279. deltaH -= 256;
  280. } else if (deltaH < -127) {
  281. deltaH += 256;
  282. }
  283. hsv.h = rgb_matrix_config.hsv.h + (deltaH * (rand() & 0x03));
  284. rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
  285. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  286. for (uint8_t i = 0; i < 15; i++) {
  287. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  288. }
  289. }
  290. static hsv_t BAND_VAL_CUSTOM(hsv_t hsv, uint8_t i, uint8_t time) {
  291. int16_t v = hsv.v - abs(scale8(g_led_config.point[i].x, 228) + 28 - time) * 8;
  292. hsv.v = scale8(v < 0 ? 0 : v, hsv.v);
  293. return hsv;
  294. }
  295. static hsv_t CYCLE_UP_DOWN_CUSTOM(hsv_t hsv, uint8_t i, uint8_t time) {
  296. hsv.h = g_led_config.point[i].y - time;
  297. return hsv;
  298. }
  299. static hsv_t CYCLE_OUT_IN_DUAL_CUSTOM(hsv_t hsv, int16_t dx, int16_t dy, uint8_t time) {
  300. dx = (k_rgb_matrix_center.x / 2) - abs8(dx);
  301. uint8_t dist = sqrt16(dx * dx + dy * dy);
  302. hsv.h = 3 * dist + time;
  303. return hsv;
  304. }
  305. static hsv_t RAINBOW_MOVING_CHEVRON_CUSTOM(hsv_t hsv, uint8_t i, uint8_t time) {
  306. hsv.h += abs8(g_led_config.point[i].y - k_rgb_matrix_center.y) + (g_led_config.point[i].x - time);
  307. return hsv;
  308. }
  309. static hsv_t CYCLE_PINWHEEL_CUSTOM(hsv_t hsv, int16_t dx, int16_t dy, uint8_t time) {
  310. hsv.h = atan2_8(dy, dx) + time;
  311. return hsv;
  312. }
  313. static hsv_t RAINBOW_BEACON_CUSTOM(hsv_t hsv, int8_t sin, int8_t cos, uint8_t i, uint8_t time) {
  314. hsv.h += ((g_led_config.point[i].y - k_rgb_matrix_center.y) * 2 * cos + (g_led_config.point[i].x - k_rgb_matrix_center.x) * 2 * sin) / 128;
  315. return hsv;
  316. }
  317. // Solid ESC
  318. static bool solid_esc(effect_params_t* params) {
  319. hsv_t hsv = rgb_matrix_config.hsv;
  320. rgb_t rgb = hsv_to_rgb(hsv);
  321. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  322. for (uint8_t i = led_min ; i < led_max; i++) {
  323. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  324. }
  325. for (uint8_t i = 18 ; i < led_max; i++) {
  326. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  327. rgb_matrix_set_color(0, rgb.r, rgb.g, rgb.b);
  328. }
  329. return led_max < RGB_MATRIX_LED_COUNT;
  330. }
  331. // Solid F13
  332. static bool solid_f13(effect_params_t* params) {
  333. hsv_t hsv = rgb_matrix_config.hsv;
  334. rgb_t rgb = hsv_to_rgb(hsv);
  335. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  336. for (uint8_t i = led_min ; i < led_max; i++) {
  337. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  338. }
  339. for (uint8_t i = 18 ; i < led_max; i++) {
  340. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  341. rgb_matrix_set_color(14, rgb.r, rgb.g, rgb.b);
  342. }
  343. return led_max < RGB_MATRIX_LED_COUNT;
  344. }
  345. // Solid cluster
  346. static bool solid_clus(effect_params_t* params) {
  347. hsv_t hsv = rgb_matrix_config.hsv;
  348. rgb_t rgb = hsv_to_rgb(hsv);
  349. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  350. for (uint8_t i = led_min ; i < led_max; i++) {
  351. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  352. }
  353. for (uint8_t i = 15 ; i < led_max; i++) {
  354. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  355. }
  356. return led_max < RGB_MATRIX_LED_COUNT;
  357. }
  358. // Breathing all
  359. bool breathing_all(effect_params_t* params) {
  360. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  361. hsv_t hsv = rgb_matrix_config.hsv;
  362. uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8);
  363. hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
  364. rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
  365. for (uint8_t i = led_min; i < led_max; i++) {
  366. RGB_MATRIX_TEST_LED_FLAGS();
  367. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  368. }
  369. return led_max < RGB_MATRIX_LED_COUNT;
  370. }
  371. // Breathing ESC
  372. static bool breathing_esc(effect_params_t* params) {
  373. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  374. hsv_t hsv = rgb_matrix_config.hsv;
  375. uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8);
  376. hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
  377. rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
  378. for (uint8_t i = led_min ; i < led_max; i++) {
  379. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  380. }
  381. for (uint8_t i = 18; i < led_max; i++) {
  382. RGB_MATRIX_TEST_LED_FLAGS();
  383. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  384. }
  385. rgb_matrix_set_color(0, rgb.r, rgb.g, rgb.b);
  386. return led_max < RGB_MATRIX_LED_COUNT;
  387. }
  388. // Breathing F13
  389. static bool breathing_f13(effect_params_t* params) {
  390. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  391. hsv_t hsv = rgb_matrix_config.hsv;
  392. uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8);
  393. hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
  394. rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
  395. for (uint8_t i = led_min ; i < led_max; i++) {
  396. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  397. }
  398. for (uint8_t i = 18; i < led_max; i++) {
  399. RGB_MATRIX_TEST_LED_FLAGS();
  400. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  401. }
  402. rgb_matrix_set_color(14, rgb.r, rgb.g, rgb.b);
  403. return led_max < RGB_MATRIX_LED_COUNT;
  404. }
  405. // Breathing cluster
  406. static bool breathing_clus(effect_params_t* params) {
  407. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  408. hsv_t hsv = rgb_matrix_config.hsv;
  409. uint16_t time = scale16by8(g_rgb_timer, rgb_matrix_config.speed / 8);
  410. hsv.v = scale8(abs8(sin8(time) - 128) * 2, hsv.v);
  411. rgb_t rgb = rgb_matrix_hsv_to_rgb(hsv);
  412. for (uint8_t i = led_min ; i < led_max; i++) {
  413. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  414. }
  415. for (uint8_t i = 15; i < led_max; i++) {
  416. RGB_MATRIX_TEST_LED_FLAGS();
  417. rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
  418. }
  419. return led_max < RGB_MATRIX_LED_COUNT;
  420. }
  421. // Band Val all
  422. bool band_val_all(effect_params_t* params) {
  423. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  424. for (uint8_t i = led_min ; i < led_max; i++) {
  425. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  426. }
  427. return effect_runner_all(params, &BAND_VAL_CUSTOM);
  428. }
  429. // Band Val ESC
  430. bool band_val_esc(effect_params_t* params) {
  431. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  432. for (uint8_t i = led_min ; i < led_max; i++) {
  433. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  434. }
  435. return effect_runner_esc(params, &BAND_VAL_CUSTOM);
  436. }
  437. // Band Val F13
  438. bool band_val_f13(effect_params_t* params) {
  439. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  440. for (uint8_t i = led_min ; i < led_max; i++) {
  441. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  442. }
  443. return effect_runner_f13(params, &BAND_VAL_CUSTOM);
  444. }
  445. // Band Val Cluster
  446. bool band_val_clus(effect_params_t* params) {
  447. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  448. for (uint8_t i = led_min ; i < led_max; i++) {
  449. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  450. }
  451. return effect_runner_clus(params, &BAND_VAL_CUSTOM);
  452. }
  453. // Cycle Up Down All
  454. static bool cycle_up_down_all(effect_params_t* params) {
  455. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  456. for (uint8_t i = led_min ; i < led_max; i++) {
  457. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  458. }
  459. return effect_runner_all(params, &CYCLE_UP_DOWN_CUSTOM);
  460. }
  461. // Cycle Up Down ESC
  462. static bool cycle_up_down_esc(effect_params_t* params) {
  463. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  464. for (uint8_t i = led_min ; i < led_max; i++) {
  465. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  466. }
  467. return effect_runner_esc(params, &CYCLE_UP_DOWN_CUSTOM);
  468. }
  469. // Cycle up down F13
  470. static bool cycle_up_down_f13(effect_params_t* params) {
  471. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  472. for (uint8_t i = led_min ; i < led_max; i++) {
  473. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  474. }
  475. return effect_runner_f13(params, &CYCLE_UP_DOWN_CUSTOM);
  476. }
  477. // Cycle up down cluster
  478. static bool cycle_up_down_clus(effect_params_t* params) {
  479. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  480. for (uint8_t i = led_min ; i < led_max; i++) {
  481. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  482. }
  483. return effect_runner_clus(params, &CYCLE_UP_DOWN_CUSTOM);
  484. }
  485. // Cycle out in dual All
  486. static bool cycle_out_in_dual_all(effect_params_t* params) {
  487. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  488. for (uint8_t i = led_min ; i < led_max; i++) {
  489. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  490. }
  491. return effect_runner_dx_dy_all(params, &CYCLE_OUT_IN_DUAL_CUSTOM);
  492. }
  493. // Cycle out in dual ESC
  494. static bool cycle_out_in_dual_esc(effect_params_t* params) {
  495. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  496. for (uint8_t i = led_min ; i < led_max; i++) {
  497. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  498. }
  499. return effect_runner_dx_dy_esc(params, &CYCLE_OUT_IN_DUAL_CUSTOM);
  500. }
  501. // Cycle out in dual f13
  502. static bool cycle_out_in_dual_f13(effect_params_t* params) {
  503. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  504. for (uint8_t i = led_min ; i < led_max; i++) {
  505. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  506. }
  507. return effect_runner_dx_dy_f13(params, &CYCLE_OUT_IN_DUAL_CUSTOM);
  508. }
  509. // Cycle out in dual cluster
  510. static bool cycle_out_in_dual_clus(effect_params_t* params) {
  511. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  512. for (uint8_t i = led_min ; i < led_max; i++) {
  513. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  514. }
  515. return effect_runner_dx_dy_clus(params, &CYCLE_OUT_IN_DUAL_CUSTOM);
  516. }
  517. // Moving chevron all
  518. static bool rainbow_moving_chevron_all(effect_params_t* params) {
  519. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  520. for (uint8_t i = led_min ; i < led_max; i++) {
  521. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  522. }
  523. return effect_runner_all(params, &RAINBOW_MOVING_CHEVRON_CUSTOM);
  524. }
  525. // Moving chevron ESC
  526. static bool rainbow_moving_chevron_esc(effect_params_t* params) {
  527. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  528. for (uint8_t i = led_min ; i < led_max; i++) {
  529. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  530. }
  531. return effect_runner_esc(params, &RAINBOW_MOVING_CHEVRON_CUSTOM);
  532. }
  533. // Moving chevron F13
  534. static bool rainbow_moving_chevron_f13(effect_params_t* params) {
  535. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  536. for (uint8_t i = led_min ; i < led_max; i++) {
  537. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  538. }
  539. return effect_runner_f13(params, &RAINBOW_MOVING_CHEVRON_CUSTOM);
  540. }
  541. // Moving chevron cluster
  542. static bool rainbow_moving_chevron_clus(effect_params_t* params) {
  543. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  544. for (uint8_t i = led_min ; i < led_max; i++) {
  545. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  546. }
  547. return effect_runner_clus(params, &RAINBOW_MOVING_CHEVRON_CUSTOM);
  548. }
  549. // Moving cycle pimwheel all
  550. static bool cycle_pimwheel_all(effect_params_t* params) {
  551. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  552. for (uint8_t i = led_min ; i < led_max; i++) {
  553. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  554. }
  555. return effect_runner_dx_dy_all(params, &CYCLE_PINWHEEL_CUSTOM);
  556. }
  557. // Moving cycle pimwheel esc
  558. static bool cycle_pimwheel_esc(effect_params_t* params) {
  559. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  560. for (uint8_t i = led_min ; i < led_max; i++) {
  561. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  562. }
  563. return effect_runner_dx_dy_esc(params, &CYCLE_PINWHEEL_CUSTOM);
  564. }
  565. // Moving cycle pimwheel f13
  566. static bool cycle_pimwheel_f13(effect_params_t* params) {
  567. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  568. for (uint8_t i = led_min ; i < led_max; i++) {
  569. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  570. }
  571. return effect_runner_dx_dy_f13(params, &CYCLE_PINWHEEL_CUSTOM);
  572. }
  573. // Moving cycle pimwheel cluster
  574. static bool cycle_pimwheel_clus(effect_params_t* params) {
  575. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  576. for (uint8_t i = led_min ; i < led_max; i++) {
  577. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  578. }
  579. return effect_runner_dx_dy_clus(params, &CYCLE_PINWHEEL_CUSTOM);
  580. }
  581. // Moving rainbow beacon all
  582. static bool rainbow_beacon_all(effect_params_t* params) {
  583. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  584. for (uint8_t i = led_min ; i < led_max; i++) {
  585. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  586. }
  587. return effect_runner_sin_cos_all(params, &RAINBOW_BEACON_CUSTOM);
  588. }
  589. // Moving rainbow beacon esc
  590. static bool rainbow_beacon_esc(effect_params_t* params) {
  591. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  592. for (uint8_t i = led_min ; i < led_max; i++) {
  593. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  594. }
  595. return effect_runner_sin_cos_esc(params, &RAINBOW_BEACON_CUSTOM);
  596. }
  597. // Moving rainbow beacon f13
  598. static bool rainbow_beacon_f13(effect_params_t* params) {
  599. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  600. for (uint8_t i = led_min ; i < led_max; i++) {
  601. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  602. }
  603. return effect_runner_sin_cos_f13(params, &RAINBOW_BEACON_CUSTOM);
  604. }
  605. // Moving rainbow beacon cluster
  606. static bool rainbow_beacon_clus(effect_params_t* params) {
  607. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  608. for (uint8_t i = led_min ; i < led_max; i++) {
  609. rgb_matrix_set_color(i, 0x00, 0x00, 0x00);
  610. }
  611. return effect_runner_sin_cos_clus(params, &RAINBOW_BEACON_CUSTOM);
  612. }
  613. // Raindrops all
  614. static bool raindrops_all(effect_params_t* params) {
  615. if (!params->init) {
  616. // Change one LED every tick, make sure speed is not 0
  617. if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
  618. raindrops_set_color_all(rand() % RGB_MATRIX_LED_COUNT, params);
  619. }
  620. return false;
  621. }
  622. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  623. for (int i = led_min; i < led_max; i++) {
  624. raindrops_set_color_all(i, params);
  625. }
  626. return led_max < RGB_MATRIX_LED_COUNT;
  627. }
  628. // Raindrops ESC
  629. static bool raindrops_esc(effect_params_t* params) {
  630. if (!params->init) {
  631. // Change one LED every tick, make sure speed is not 0
  632. if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
  633. raindrops_set_color_esc(rand() % RGB_MATRIX_LED_COUNT, params);
  634. }
  635. return false;
  636. }
  637. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  638. for (int i = led_min; i < led_max; i++) {
  639. raindrops_set_color_esc(i, params);
  640. }
  641. return led_max < RGB_MATRIX_LED_COUNT;
  642. }
  643. // Raindrops F13
  644. static bool raindrops_f13(effect_params_t* params) {
  645. if (!params->init) {
  646. // Change one LED every tick, make sure speed is not 0
  647. if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
  648. raindrops_set_color_f13(rand() % RGB_MATRIX_LED_COUNT, params);
  649. }
  650. return false;
  651. }
  652. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  653. for (int i = led_min; i < led_max; i++) {
  654. raindrops_set_color_f13(i, params);
  655. }
  656. return led_max < RGB_MATRIX_LED_COUNT;
  657. }
  658. // Raindrops Cluster
  659. static bool raindrops_clus(effect_params_t* params) {
  660. if (!params->init) {
  661. // Change one LED every tick, make sure speed is not 0
  662. if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
  663. raindrops_set_color_clus(rand() % RGB_MATRIX_LED_COUNT, params);
  664. }
  665. return false;
  666. }
  667. RGB_MATRIX_USE_LIMITS(led_min, led_max);
  668. for (int i = led_min; i < led_max; i++) {
  669. raindrops_set_color_clus(i, params);
  670. }
  671. return led_max < RGB_MATRIX_LED_COUNT;
  672. }
  673. #endif // RGB_MATRIX_CUSTOM_EFFECT_IMPLS