/******************************************************************************
*  Simpel blinky demoprogram for MicroCore 64 board (by Paul Seerden)
*******************************************************************************/

#include <LPC11Uxx.h>                          // LPC11Uxx definitions

volatile long SysTickCnt;                      // System Tick Counter (each 10 msec)

void SysTick_Handler (void)
{
    SysTickCnt++;
}

void delay (long tick)                         // delay function
{
  long cnt;

    cnt = SysTickCnt;
    while ((SysTickCnt - cnt) < tick) ;
}

int main (void)
{
	  SysTick_Config(SystemCoreClock/100);       // generate IRQ each 10 ms
    LPC_SYSCON->SYSAHBCLKCTRL |= (1 << 6);     // enable clock for GPIO

    LPC_GPIO->DIR[1] |= (1 << 26);             // configure P1.26 (LED1) as output

    while (1) {                                // loop forever
        LPC_GPIO->CLR[1] = 1 << 26;            // turn on LED1
        delay(20);
        LPC_GPIO->SET[1] = 1 << 26;            // turn off LED1
        delay(20);
    }
}
