Commit e9c5c84 1 parent 6afbc9b commit e9c5c84 Copy full SHA for e9c5c84
File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 1
1
#include "status_led.h"
2
2
3
+ #include <stdbool.h>
4
+
3
5
// LED on GPIO A15
4
6
5
7
static GPIO_InitTypeDef GPIO_IS ;
6
8
static LED_SPEED fast_blink ;
9
+ static bool do_flip = false;
7
10
8
11
void status_led_init (void ){
9
12
// activate peripheral clock
@@ -21,9 +24,12 @@ void status_led_init(void){
21
24
// call this at a regular interval (designed for 1ms interval)
22
25
uint32_t next_flip = 0 ;
23
26
void 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 );
26
31
next_flip = time_now + (fast_blink ? 2000 : 500 );
32
+ do_flip = false;
27
33
}
28
34
}
29
35
@@ -36,5 +42,6 @@ void status_led_set(uint8_t is_on){
36
42
}
37
43
38
44
void status_led_xor (void ){
39
- HAL_GPIO_TogglePin (GPIOA , GPIO_PIN_15 );
45
+ // HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_15);
46
+ do_flip = true;
40
47
}
You can’t perform that action at this time.
0 commit comments