aboutsummaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorIan O'Dea <ianodea@gmail.com>2019-01-07 09:36:28 -0600
committerIan O'Dea <ianodea@gmail.com>2019-01-07 09:36:28 -0600
commitd55dc9b8168dc4582751b4d7ee4b2de3f5b4e3ab (patch)
tree4c00891aeca6bbcc39b7ae8221f9922677afcbe9 /tmk_core
parent28986998046b4dbdbc228dbb7889836de2a3ee18 (diff)
downloadqmk_firmware-d55dc9b8168dc4582751b4d7ee4b2de3f5b4e3ab.tar.gz
qmk_firmware-d55dc9b8168dc4582751b4d7ee4b2de3f5b4e3ab.zip
Add ability to animate arm_atsam led matrix from the center of a circle
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/protocol/arm_atsam/led_matrix.c20
-rw-r--r--tmk_core/protocol/arm_atsam/led_matrix.h1
2 files changed, 15 insertions, 6 deletions
diff --git a/tmk_core/protocol/arm_atsam/led_matrix.c b/tmk_core/protocol/arm_atsam/led_matrix.c
index e914fc80e..3e07fbe6c 100644
--- a/tmk_core/protocol/arm_atsam/led_matrix.c
+++ b/tmk_core/protocol/arm_atsam/led_matrix.c
@@ -18,6 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
18#include "arm_atsam_protocol.h" 18#include "arm_atsam_protocol.h"
19#include "tmk_core/common/led.h" 19#include "tmk_core/common/led.h"
20#include <string.h> 20#include <string.h>
21#include <math.h>
21 22
22void SERCOM1_0_Handler( void ) 23void SERCOM1_0_Handler( void )
23{ 24{
@@ -249,6 +250,7 @@ uint8_t led_animation_breathing;
249uint8_t led_animation_breathe_cur; 250uint8_t led_animation_breathe_cur;
250uint8_t breathe_step; 251uint8_t breathe_step;
251uint8_t breathe_dir; 252uint8_t breathe_dir;
253uint8_t led_animation_circular;
252uint64_t led_next_run; 254uint64_t led_next_run;
253 255
254uint8_t led_animation_id; 256uint8_t led_animation_id;
@@ -327,13 +329,18 @@ void led_matrix_run(void)
327 for (fcur = 0; fcur < fmax; fcur++) 329 for (fcur = 0; fcur < fmax; fcur++)
328 { 330 {
329 331
330 if (led_animation_orientation) 332 if (led_animation_circular) {
331 { 333 po = sqrtf((powf(fabsf(50 - led_cur->py), 2) + powf(fabsf(50 - led_cur->px), 2)));
332 po = led_cur->py;
333 } 334 }
334 else 335 else {
335 { 336 if (led_animation_orientation)
336 po = led_cur->px; 337 {
338 po = led_cur->py;
339 }
340 else
341 {
342 po = led_cur->px;
343 }
337 } 344 }
338 345
339 float pomod; 346 float pomod;
@@ -466,6 +473,7 @@ uint8_t led_matrix_init(void)
466 led_animation_breathe_cur = BREATHE_MIN_STEP; 473 led_animation_breathe_cur = BREATHE_MIN_STEP;
467 breathe_step = 1; 474 breathe_step = 1;
468 breathe_dir = 1; 475 breathe_dir = 1;
476 led_animation_circular = 0;
469 477
470 gcr_min_counter = 0; 478 gcr_min_counter = 0;
471 v_5v_cat_hit = 0; 479 v_5v_cat_hit = 0;
diff --git a/tmk_core/protocol/arm_atsam/led_matrix.h b/tmk_core/protocol/arm_atsam/led_matrix.h
index cedea8a85..f0d452834 100644
--- a/tmk_core/protocol/arm_atsam/led_matrix.h
+++ b/tmk_core/protocol/arm_atsam/led_matrix.h
@@ -129,6 +129,7 @@ extern uint8_t led_animation_orientation;
129extern uint8_t led_animation_breathing; 129extern uint8_t led_animation_breathing;
130extern uint8_t led_animation_breathe_cur; 130extern uint8_t led_animation_breathe_cur;
131extern uint8_t breathe_dir; 131extern uint8_t breathe_dir;
132extern uint8_t led_animation_circular;
132extern const uint8_t led_setups_count; 133extern const uint8_t led_setups_count;
133 134
134extern void *led_setups[]; 135extern void *led_setups[];