From 5a4b6a5e6979fa034d537a803d43c04181a5ade7 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 1 Sep 2014 21:02:51 +0200 Subject: Rename LED functions to be more in thread with the rest of the code. --- firmware/drivers/led.c | 20 ++++++++++++-------- firmware/drivers/led.h | 8 ++++---- 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'firmware/drivers') diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c index fe8d6f5..293d627 100644 --- a/firmware/drivers/led.c +++ b/firmware/drivers/led.c @@ -28,28 +28,32 @@ #include -int led_state = 0; +static int led_state = 0; -void LED_Init() +void led_init() { - LPC_SC->PCONP |= ( 1 << 15 ); // power up GPIO + // See table 46, pg. 63 + uint32_t *pconp = (uint32_t*)0x400FC0C4; + *pconp |= (0b1 << 15); // power up GPIO + + // See table 104, pg. 124 LPC_GPIO1->FIODIR |= 1 << 29; // puts P1.29 into output mode. } -void LED_on() +void led_on() { led_state = 1; LPC_GPIO1->FIOPIN |= 1 << 29; // make P1.29 high } -void LED_off() +void led_off() { led_state = 0; LPC_GPIO1->FIOPIN &= ~( 1 << 29 ); // make P1.29 low } -void LED_toggle() +void led_toggle() { - if(led_state) LED_off(); - else LED_on(); + if(led_state) led_off(); + else led_on(); } diff --git a/firmware/drivers/led.h b/firmware/drivers/led.h index 2c81474..d2af83f 100644 --- a/firmware/drivers/led.h +++ b/firmware/drivers/led.h @@ -27,9 +27,9 @@ #ifndef __PEDAL2METAL_LED_H__ #define __PEDAL2METAL_LED_H__ -void LED_Init(); -void LED_on(); -void LED_off(); -void LED_toggle(); +void led_init(); +void led_on(); +void led_off(); +void led_toggle(); #endif/*__PEDAL2METAL_LED_H__*/ -- cgit v1.2.3