![](/media/cache/profiles/74961657ae02e93fc17be9d9fc864620.50x50_q85.jpg)
Diff: main.c
- Revision:
- 1:2c52307d223f
- Child:
- 2:f034e862af1f
diff -r e255ce830c49 -r 2c52307d223f main.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.c Thu Dec 02 12:32:18 2010 +0000 @@ -0,0 +1,64 @@ +#include "LPC17xx.h" +#include "core_cm3.h" +#include "cmsis_nvic.h" +#include "Timer0.h" +#include "main.h" +#include "LPC1768.h" +#include "MCPWM.h" +#include "RIT.h" + +// BSP defines see main.h + +int main(void); +void dispatcher(void); + +Tinterrupt_flags i_flags; + +int main(void) { + + // Set the correct PLL value to match CCLK + PLL0_init(); + + // Enable the driving of the onboard LEDs + LED_init(); + + // Set the timer0, enable it and connect to ISR + Timer0_init(); + + // Set the RIT, enable it and connect to ISR + RIT_init(); + + // Initialize MCPWM + //MCPWM_init(); + + // Start the dispatcher + dispatcher(); + +} + +void dispatcher(void) { + + while (1) { + + // When the timer0 interrupt occurred + if (i_flags.Timer0_int == 1) { + if ((FIOPIN & LED1)==LED1) + FIOCLR |= LED1; + else + FIOSET |= LED1; + + i_flags.Timer0_int = 0; + } + + // When the RIT interrupt occurred + if (i_flags.RIT_int == 1) { + if ((FIOPIN & LED2)==LED2) + FIOCLR |= LED2; + else + FIOSET |= LED2; + + i_flags.RIT_int = 0; + } + } + +} \ No newline at end of file