reset can flags and flush buffer
This commit is contained in:
		| @@ -2,39 +2,38 @@ | ||||
| #include "xf/xf.h" | ||||
| #include "app/factory/factory.h" | ||||
|  | ||||
| /* | ||||
|  * 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(); | ||||
|     //WWDT_SoftEnable(); | ||||
|  | ||||
|     // 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); | ||||
|     // Enable the Global Interrupts | ||||
|      | ||||
|      | ||||
|     ECAN_Initialize(); | ||||
|     RXB0CONbits.RXFUL = 0; | ||||
|     RXB1CONbits.RXFUL = 0; | ||||
|     B0CONbits.RXFUL = 0; | ||||
|     B1CONbits.RXFUL = 0; | ||||
|     B2CONbits.RXFUL = 0; | ||||
|     B3CONbits.RXFUL = 0; | ||||
|     B4CONbits.RXFUL = 0; | ||||
|     B5CONbits.RXFUL = 0; | ||||
|     PIR5bits.RXBnIF = 0; | ||||
|     INTERRUPT_GlobalInterruptEnable(); | ||||
|  | ||||
|     while (1) | ||||
|     { | ||||
|         //handle the next event if there is any in the queue | ||||
|          | ||||
|         WWDT_TimerClear(); | ||||
|         XF_executeOnce(); | ||||
|         //maybe sleep a short while to save energy | ||||
|          | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user