File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#include "status_led.h"
22
3+ #include <stdbool.h>
4+
35// LED on GPIO A15
46
57static GPIO_InitTypeDef GPIO_IS ;
68static LED_SPEED fast_blink ;
9+ static bool do_flip = false;
710
811void status_led_init (void ){
912 // activate peripheral clock
@@ -21,9 +24,12 @@ void status_led_init(void){
2124// call this at a regular interval (designed for 1ms interval)
2225uint32_t next_flip = 0 ;
2326void status_led_tick (uint32_t time_now ){
24- if (time_now > next_flip ){
25- status_led_xor ();
27+ if (time_now > next_flip // time to animate timer
28+ || (do_flip && fast_blink )){ // xor event & USB connected
29+ // status_led_xor();
30+ HAL_GPIO_TogglePin (GPIOA , GPIO_PIN_15 );
2631 next_flip = time_now + (fast_blink ? 2000 : 500 );
32+ do_flip = false;
2733 }
2834}
2935
@@ -36,5 +42,6 @@ void status_led_set(uint8_t is_on){
3642}
3743
3844void status_led_xor (void ){
39- HAL_GPIO_TogglePin (GPIOA , GPIO_PIN_15 );
45+ // HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_15);
46+ do_flip = true;
4047}
You can’t perform that action at this time.
0 commit comments