You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
842 B
C

#include <stdint.h> // C99 standard integers
#include "bsp.h"
typedef void (*task_handler)(void);
int main() {
BSP_init();
while(1) { // "superloop"
BSP_intDisable();
if (ready_set == 0) {
BSP_goToSleep(); // enter with interrupts DISABLED
// BSP_goToSleep() exits with interrupts ENABLED
}
else {
task_handler task;
if (ready_set & ISR_1) {
ready_set &= ~ISR_1;
task = &BSP_deployAirbag;
}
else if (ready_set & ISR_2) {
ready_set &= ~ISR_2;
task = &BSP_engageABS;
}
else {
assert_failed(__FILE__, __LINE__);
}
BSP_intEnable();
(*task)(); // Execute the selected task
}
}
}