summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/led.c20
-rw-r--r--firmware/drivers/led.h8
2 files changed, 16 insertions, 12 deletions
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 <LPC17xx.h>
-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__*/