This repository has been archived on 2024-01-25. You can view files and clone it, but cannot push or open issues or pull requests.
SummerSchool2-Controller/306-controller_interface.X/main.c

40 lines
1.0 KiB
C
Raw Normal View History

2023-08-24 15:26:42 +00:00
#include "mcc_generated_files/mcc.h"
#include "xf/xf.h"
#include "app/factory/factory.h"
2023-08-22 07:22:00 +00:00
/*
* the main function
*/
void main(void)
{
// Initialize the device
SYSTEM_Initialize();
// Disable the Global Interrupts
// INTERRUPT_GlobalInterruptDisable();
// initialize the XF
XF_init();
// produce the system
Factory_init();
Factory_build();
Factory_start();
2023-09-05 09:06:23 +00:00
//WWDT_SoftEnable();
2023-08-22 07:22:00 +00:00
// let the XF timers handling become the TMR0 interrupt handler
// this means that the XF timers are always decremented when the
// TMR0 is interrupting. Important: Set the TICKINTERVAL define in
//the xf.h file to the same value as the TMR0 value.
TMR0_SetInterruptHandler(XF_decrementAndQueueTimers);
2023-08-29 13:18:04 +00:00
// Enable the Global Interrupts
INTERRUPT_GlobalInterruptEnable();
2023-08-22 07:22:00 +00:00
while (1)
{
//handle the next event if there is any in the queue
2023-09-05 09:06:23 +00:00
WWDT_TimerClear();
2023-08-22 07:22:00 +00:00
XF_executeOnce();
//maybe sleep a short while to save energy
}
}