These are the examples provided for [[/users/frank26080115/libraries/LPC1700CMSIS_Lib/]] Note, the entire "program" is not compilable!
Diff: EMAC/uIP/lpc17xx_port/clock-arch.c
- Revision:
- 0:bf7b9fba3924
diff -r 000000000000 -r bf7b9fba3924 EMAC/uIP/lpc17xx_port/clock-arch.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EMAC/uIP/lpc17xx_port/clock-arch.c Sun Mar 20 05:38:56 2011 +0000 @@ -0,0 +1,34 @@ +#include "clock-arch.h" +#include "LPC17xx.h" + +__IO clock_time_t Ticks; + +#define LED_PIN (1<<6) + +/* SysTick timer interrupt handler */ +void SysTick_Handler (void) +{ + ++Ticks; + if (!(Ticks & 0x07)){ + LPC_GPIO2->FIOPIN ^= LED_PIN; + } +} + +/* Timer init */ +void clock_init(void) +{ + Ticks = 0; + + // NXP: Initialize System tick timer + // Generate interrupt each SYSTICK_PERIOD microsecond + if (SysTick_Config((SystemCoreClock/CLOCK_CONF_SECOND))){ + // Capture error + while (1); + } +} + +/* returned The current clock time, measured in system ticks */ +clock_time_t clock_time(void) +{ + return(Ticks); +}