2017-02-11 17:42:25 +08:00
|
|
|
|
|
|
|
#include <chip.h>
|
2017-02-12 05:22:30 +08:00
|
|
|
#include <delay.h>
|
2017-02-11 17:42:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
/*=======================================================================*/
|
|
|
|
/* Configuration */
|
|
|
|
#define SYS_TICK_PERIOD_IN_MS 100
|
|
|
|
|
|
|
|
|
|
|
|
/*=======================================================================*/
|
|
|
|
/* system procedures and sys tick master task */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
volatile uint32_t sys_tick_irq_cnt=0;
|
|
|
|
|
|
|
|
|
|
|
|
void __attribute__ ((interrupt)) SysTick_Handler(void)
|
|
|
|
{
|
|
|
|
sys_tick_irq_cnt++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*=======================================================================*/
|
|
|
|
/*
|
|
|
|
setup the hardware and start interrupts.
|
|
|
|
called by "Reset_Handler"
|
|
|
|
*/
|
|
|
|
int __attribute__ ((noinline)) main(void)
|
|
|
|
{
|
|
|
|
|
2017-02-12 05:22:30 +08:00
|
|
|
/* call to the lpc lib setup procedure. This will set the IRC as clk src and main clk to 24 MHz */
|
2017-02-11 17:42:25 +08:00
|
|
|
Chip_SystemInit();
|
|
|
|
|
|
|
|
/* if the clock or PLL has been changed, also update the global variable SystemCoreClock */
|
|
|
|
SystemCoreClockUpdate();
|
|
|
|
|
|
|
|
/* set systick and start systick interrupt */
|
|
|
|
SysTick_Config(SystemCoreClock/1000UL*(unsigned long)SYS_TICK_PERIOD_IN_MS);
|
2017-02-12 05:22:30 +08:00
|
|
|
|
|
|
|
/* enable clock for several subsystems */
|
|
|
|
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON | SYSCTL_CLOCK_GPIO | SYSCTL_CLOCK_SWM);
|
|
|
|
|
|
|
|
/* turn on GPIO */
|
|
|
|
Chip_GPIO_Init(LPC_GPIO_PORT); /* Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_GPIO); */
|
|
|
|
|
|
|
|
|
|
|
|
//Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 15, IOCON_FUNC1); /* RxD */
|
|
|
|
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 0, 15);
|
|
|
|
|
|
|
|
for(;;)
|
|
|
|
{
|
|
|
|
Chip_GPIO_SetPinOutHigh(LPC_GPIO_PORT, 0, 15);
|
|
|
|
delay_micro_seconds(1000000);
|
|
|
|
Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 0, 15);
|
|
|
|
delay_micro_seconds(1000000);
|
|
|
|
}
|
2017-02-11 17:42:25 +08:00
|
|
|
}
|