Skip to content

Commit

Permalink
Fault Handler Task Framework (#93)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicholas DePatie <[email protected]>
  • Loading branch information
Rand-Sai and nwdepatie authored Nov 10, 2023
1 parent ac94666 commit 5753e7b
Show file tree
Hide file tree
Showing 3 changed files with 676 additions and 636 deletions.
5 changes: 5 additions & 0 deletions Core/Inc/fault.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ typedef struct {
// and then expose _that_ to the user
extern osMessageQueueId_t fault_handle_queue;

/* Defining Fault Hanlder Task */
void vFaultHandler(void *pv_params);
extern osThreadId_t fault_handle;
extern const osThreadAttr_t fault_handle_attributes;

#endif // FAULT_H
35 changes: 35 additions & 0 deletions Core/Src/fault.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
#include "fault.h"

osMessageQueueId_t fault_handle_queue;

osThreadId_t fault_handle;
const osThreadAttr_t fault_handle_attributes = {
.name = "FaultHandler",
.stack_size = 128 * 4,
.priority = (osPriority_t)osPriorityISR,
};

//Function assign a priority and tell the kernel to schedule on boot
void vFaultHandler(void* pv_params) {
fault_data_t fault_data;
osStatus_t status;
//Wait until a message is in the queue, send messages when they are in the queue
for(;;) {
status = osMessageQueueGet(fault_handle_queue, &fault_data, NULL, 0U); // wait for message
if (status == osOK) {

// process data
switch (fault_data.severity) {
case DEFCON1: //Higest(1st) Priority
break;
case DEFCON2: //2nd Highest Priority
break;
case DEFCON3: //3rd Highest Priority
break;
case DEFCON4: //Slight Above Lowest Priority
break;
case DEFCON5: //Lowest Priority
break;
default: //Unable To Identify 'fault_sev_t'
break;
}
}
}
}
Loading

0 comments on commit 5753e7b

Please sign in to comment.