@@ -65,13 +65,19 @@ Ticker swap_ticker;
65
65
66
66
bool debug_enabled = false ;
67
67
68
- static inline void swap_feedback () {
68
+ static void led_swap_feedback_off (void ) {
69
+ swap_ticker.detach ();
70
+ red = 1 ;
71
+ green = 1 ;
72
+ blue = 1 ;
73
+ }
74
+
75
+ static void led_swap_feedback () {
69
76
blue = !blue;
70
77
red = !red;
71
78
}
72
79
73
- static inline void LED_pulse (DigitalOut* led)
74
- {
80
+ static void led_pulse (DigitalOut* led) {
75
81
if (divisor++ % 40 ) {
76
82
return ;
77
83
}
@@ -109,13 +115,7 @@ int target_debug_init(void) {
109
115
return 0 ;
110
116
}
111
117
112
- int target_led_off (void ) {
113
- swap_ticker.detach ();
114
- red = 1 ;
115
- green = 1 ;
116
- blue = 1 ;
117
- return 0 ;
118
- }
118
+
119
119
120
120
#if MCUBOOT_APPLICATION_DFU
121
121
USBD_HandleTypeDef USBD_Device;
@@ -132,7 +132,7 @@ static int start_dfu(void) {
132
132
SetSysClock_PLL_HSE (1 , false );
133
133
SystemCoreClockUpdate ();
134
134
135
- target_led_off ();
135
+ led_swap_feedback_off ();
136
136
137
137
// turnDownEthernet();
138
138
@@ -170,7 +170,7 @@ static int start_dfu(void) {
170
170
HAL_PCD_IRQHandler (&hpcd);
171
171
}
172
172
#endif
173
- LED_pulse (&green);
173
+ led_pulse (&green);
174
174
}
175
175
176
176
return 0 ;
@@ -197,7 +197,7 @@ int start_secure_application(void) {
197
197
return -1 ;
198
198
}
199
199
200
- target_led_off ();
200
+ led_swap_feedback_off ();
201
201
202
202
// Run the application in the primary slot
203
203
// Add header size offset to calculate the actual start address of application
@@ -279,7 +279,7 @@ int main(void) {
279
279
280
280
} else {
281
281
/* MCUboot secure boot */
282
- swap_ticker.attach (&swap_feedback , 250ms);
282
+ swap_ticker.attach (&led_swap_feedback , 250ms);
283
283
RTCSetBKPRegister (RTC_BKP_DR0, 0 );
284
284
start_secure_application ();
285
285
}
0 commit comments