void flashLight(int timeMS, int OnOrOff) { GPIOSetDir( LED_PORT, LED_BIT, OnOrOff ); //delay for time delaySysTick(timeMS/10); GPIOSetDir( LED_PORT, LED_BIT, 0 ); }
int main (void) { SystemCoreClockUpdate(); /* Enable AHB clock to the GPIO domain. */ /* Called for system library in core_cmx.h(x=0 or 3). */ SysTick_Config( SYSTICK_DELAY ); /* Enable AHB clock to the GPIO domain. */ LPC_SYSCON->SYSAHBCLKCTRL |= (1<<6); /* Set port 2_0 to output */ GPIOSetDir( 2, 0, 1 ); while (1) /* Loop forever */ { delaySysTick(10); GPIOSetValue( 2, 0, 0 ); delaySysTick(10); GPIOSetValue( 2, 0, 1 ); } }
int main (void) { /* Basic chip initialization is taken care of in SystemInit() called * from the startup code. SystemInit() and chip settings are defined * in the CMSIS system_<part family>.c file. */ /* Called for system library in core_cmx.h(x=0 or 3). */ SysTick_Config( SysTick->CALIB + 1 ); /* Set port 0_7 - LED2 on LPCXpresso board to output */ SetGPIOOut( LED_PORT, LED_BIT ); while (1) /* Loop forever */ { delaySysTick(LED_TOGGLE_TICKS/2); ToggleGPIOBit( LED_PORT, LED_BIT ); } }