File tree Expand file tree Collapse file tree 2 files changed +14
-40
lines changed
Expand file tree Collapse file tree 2 files changed +14
-40
lines changed Original file line number Diff line number Diff line change @@ -51,54 +51,17 @@ volatile uint8_t ledTargetValue = 20;
5151volatile int8_t ledDirection = 1 ;
5252volatile int divisor = 0 ;
5353
54+ DigitalOut red (PK_5, 1 );
5455DigitalOut green (PK_6, 1 );
5556DigitalOut blue (PK_7, 1 );
5657
5758Ticker swap_ticker;
58- int mcuboot_swap_index = -1 ;
5959
6060bool debug_enabled = false ;
6161
6262static inline void swap_feedback () {
63-
64- static int blink_idx = 0 ;
65- static int blink_state = 0 ;
66-
67- if (mcuboot_swap_index >= 0 ){
68- switch (blink_state) {
69- case 0 : {
70- if (blink_idx < mcuboot_swap_index) {
71- if (blue == 0 ){
72- blue = 1 ;
73- } else {
74- blue = 0 ;
75- blink_idx++;
76- }
77- } else {
78- blink_idx = 0 ;
79- blink_state = 1 ;
80- }
81- green = 1 ;
82- }
83- break ;
84-
85- case 1 : {
86- if (blink_idx < (15 - mcuboot_swap_index)) {
87- if (green == 0 ){
88- green = 1 ;
89- } else {
90- green = 0 ;
91- blink_idx++;
92- }
93- } else {
94- blink_idx = 0 ;
95- blink_state = 0 ;
96- }
97- blue = 1 ;
98- }
99- break ;
100- }
101- }
63+ blue = !blue;
64+ red = !red;
10265}
10366
10467static inline void LED_pulse (DigitalOut* led)
@@ -166,6 +129,14 @@ int target_debug_init(void) {
166129 return 0 ;
167130}
168131
132+ int target_led_off (void ) {
133+ swap_ticker.detach ();
134+ red = 1 ;
135+ green = 1 ;
136+ blue = 1 ;
137+ return 0 ;
138+ }
139+
169140
170141int target_init (void ) {
171142 DigitalIn boot_sel (PI_8,PullDown);
@@ -309,6 +280,8 @@ int target_loop(void) {
309280 SetSysClock_PLL_HSE (1 , false );
310281 SystemCoreClockUpdate ();
311282
283+ target_led_off ();
284+
312285 // turnDownEthernet();
313286
314287#if MCUBOOT_APPLICATION_DFU
Original file line number Diff line number Diff line change 7474int target_debug_init (void );
7575int target_loop (void );
7676int target_debug (void );
77+ int target_led_off (void );
7778
7879#endif /* __TARGET_INIT_H */
You can’t perform that action at this time.
0 commit comments