Implemented gpio_clear() for LPC17xx.

This commit is contained in:
Taylor Vesely 2012-03-27 16:42:36 -06:00
parent f7bf15343d
commit 66c5f91a87
3 changed files with 10 additions and 4 deletions

View File

@ -33,17 +33,17 @@ int main(void)
/* Blink LED0 (P3_0) on the board. */ /* Blink LED0 (P3_0) on the board. */
while (1) { while (1) {
/* Manually: */ /* Manually: */
//GPIO1_SET = (1 << 29); /* LED off */ //GPIO1_SET = (1 << 29); /* LED on */
//for (i = 0; i < 800000; i++) /* Wait a bit. */ //for (i = 0; i < 800000; i++) /* Wait a bit. */
// __asm__("nop"); // __asm__("nop");
//GPIO1_CLR = (1 << 29); /* LED on */ //GPIO1_CLR = (1 << 29); /* LED off */
//for (i = 0; i < 800000; i++) /* Wait a bit. */ //for (i = 0; i < 800000; i++) /* Wait a bit. */
// __asm__("nop"); // __asm__("nop");
gpio_set(GPIO1, GPIOPIN29); /* LED off */ gpio_set(GPIO1, GPIOPIN29); /* LED on */
for (i = 0; i < 800000; i++) /* Wait a bit. */ for (i = 0; i < 800000; i++) /* Wait a bit. */
__asm__("nop"); __asm__("nop");
GPIO1_CLR = (1 << 29); /* LED on */ gpio_clear(GPIO1, GPIOPIN29); /* LED off */
for (i = 0; i < 800000; i++) /* Wait a bit. */ for (i = 0; i < 800000; i++) /* Wait a bit. */
__asm__("nop"); __asm__("nop");
} }

View File

@ -133,5 +133,6 @@
#define GPIO_IS MMIO32(GPIOINTERRPUT_BASE + 0x80) #define GPIO_IS MMIO32(GPIOINTERRPUT_BASE + 0x80)
void gpio_set(u32 gpioport, u32 gpios); void gpio_set(u32 gpioport, u32 gpios);
void gpio_clear(u32 gpioport, u32 gpios);
#endif #endif

View File

@ -23,3 +23,8 @@ void gpio_set(u32 gpioport, u32 gpios)
{ {
GPIO_SET(gpioport) = gpios; GPIO_SET(gpioport) = gpios;
} }
void gpio_clear(u32 gpioport, u32 gpios)
{
GPIO_CLR(gpioport) = gpios;
}