@@ -178,7 +178,8 @@ In order to implement the callback the user can override the default callback fu
178
178
```C
179
179
mbed_error_ctx my_error_ctx;
180
180
//Callback during reboot
181
- void mbed_error_reboot_callback(mbed_error_ctx *error_context) {
181
+ void mbed_error_reboot_callback(mbed_error_ctx *error_context)
182
+ {
182
183
printf("Error callback received");
183
184
//Copy the error context in a local struct for processing it later
184
185
memcpy(&my_error_ctx, error_context, sizeof(mbed_error_ctx));
@@ -195,17 +196,18 @@ mbed_error_ctx error_ctx;
195
196
int reboot_error_detected = 0 ;
196
197
197
198
// Callback during reboot
198
- void mbed_error_reboot_callback (mbed_error_ctx * error_context) {
199
+ void mbed_error_reboot_callback (mbed_error_ctx * error_context)
200
+ {
199
201
printf("error callback received");
200
202
reboot_error_detected = 1;
201
203
}
202
204
203
205
// main() runs in its own thread in the OS
204
- int main() {
205
-
206
- if(reboot_error_detected == 1) {
207
- if(MBED_SUCCESS == mbed_get_reboot_error_info(&error_ctx)) {
208
- printf("\nSuccessfully read error context\n");
206
+ int main()
207
+ {
208
+ if (reboot_error_detected == 1) {
209
+ if (MBED_SUCCESS == mbed_get_reboot_error_info(&error_ctx)) {
210
+ printf("\nSuccessfully read error context\n");
209
211
}
210
212
//main continues...
211
213
}
@@ -222,19 +224,20 @@ mbed_fault_context_t fault_ctx;
222
224
int reboot_error_detected = 0;
223
225
224
226
//Callback during reboot
225
- void mbed_error_reboot_callback(mbed_error_ctx *error_context) {
227
+ void mbed_error_reboot_callback(mbed_error_ctx * error_context)
228
+ {
226
229
printf("error callback received");
227
230
reboot_error_detected = 1;
228
231
}
229
232
230
233
// main() runs in its own thread in the OS
231
- int main() {
232
-
233
- if(reboot_error_detected == 1) {
234
- if(MBED_SUCCESS == mbed_get_reboot_error_info(&error_ctx)) {
234
+ int main()
235
+ {
236
+ if (reboot_error_detected == 1) {
237
+ if (MBED_SUCCESS == mbed_get_reboot_error_info(&error_ctx)) {
235
238
printf("\nRead in reboot info\n");
236
- if(error_ctx.error_status == MBED_ERROR_HARDFAULT_EXCEPTION) {
237
- if(MBED_SUCCESS == mbed_get_reboot_fault_context(&fault_ctx)) {
239
+ if (error_ctx.error_status == MBED_ERROR_HARDFAULT_EXCEPTION) {
240
+ if (MBED_SUCCESS == mbed_get_reboot_fault_context(&fault_ctx)) {
238
241
printf("\nRead in fault context info\n");
239
242
}
240
243
}
0 commit comments