2 * LED blinking example for the mbed LPC1768-based board.
4 * See also: http://bitbucket.org/jpc/lpc1768/
6 * Copyright (c) 2010 LoEE - Jakub Piotr Cłapa
7 * This program is released under the new BSD license.
9 #include "CMSIS/LPC17xx.h"
19 #define LED_ON(i) (pin_write (LED##i, 1))
20 #define LED_OFF(i) (pin_write (LED##i, 0))
22 volatile uint32_t current_time;
24 void SysTick_Handler (void)
29 void delay (uint32_t interval)
31 uint32_t start = current_time;
32 while (current_time - start < interval);
37 // Setup SysTick interrupts at 1kHz (1ms)
38 SysTick_Config (SystemCoreClock / 1000);
40 // Configure as output pins.
41 pin_dir (LED1, PIN_OUT);
42 pin_dir (LED2, PIN_OUT);
43 pin_dir (LED3, PIN_OUT);
44 pin_dir (LED4, PIN_OUT);
48 LED_OFF(1); delay (120); LED_ON(1);
49 LED_ON(2); delay (120); LED_OFF(2);
50 LED_ON(3); delay (120); LED_OFF(3);
51 LED_ON(4); delay (120); LED_OFF(4);
52 LED_ON(3); delay (120); LED_OFF(3);
53 LED_ON(2); delay (120); LED_OFF(2);