summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteveB <sbattazzo@gmail.com>2015-05-27 15:59:57 -0500
committerJoel Sherrill <joel.sherrill@oarcorp.com>2015-05-28 14:13:29 -0500
commita0c21e019ce0d218fd89b644ee6770d995ed0fdc (patch)
treead125ff6c31614416c1b6f4b4ba2344d1f6273dc
parent5054217ba43954d2821178b7840fbc8dc111bb90 (diff)
Added code to turn on and off LED for STM32F4 Discovery Board4.11.34.11.24.11.14.11.04.11
-rw-r--r--led/led.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/led/led.h b/led/led.h
index 3fee684..9675aa2 100644
--- a/led/led.h
+++ b/led/led.h
@@ -80,6 +80,29 @@ uint8_t MPC8313_LED_Count;
#define LED_ON() do { unsigned int *gpio = (unsigned int *)BCM2835_GPIO_REGS_BASE; GPIO_CLR_EXT = 1 << (47 % 32);} while(0)
#define LED_OFF() do { unsigned int *gpio = (unsigned int *)BCM2835_GPIO_REGS_BASE; GPIO_SET_EXT = 1 << (47 % 32);} while(0)
+#elif defined(STM32F4_FAMILY_F4XXXX)
+
+#include <bsp/io.h> //Everything we need is in io.h
+
+//STM32F4 Discovery Board, LED4: PORTD, 12
+stm32f4_gpio_config led3config =
+{
+ .fields={
+ .pin_first = STM32F4_GPIO_PIN(3, 12),
+ .pin_last = STM32F4_GPIO_PIN(3, 12),
+ .mode = STM32F4_GPIO_MODE_OUTPUT,
+ .otype = STM32F4_GPIO_OTYPE_PUSH_PULL,
+ .ospeed = STM32F4_GPIO_OSPEED_2_MHZ,
+ .pupd = STM32F4_GPIO_NO_PULL,
+ .output = 1,
+ .af = 0
+ }
+};
+
+#define LED_INIT() stm32f4_gpio_set_config(&led3config)
+#define LED_ON() stm32f4_gpio_set_output(STM32F4_GPIO_PIN(3,12), 1)
+#define LED_OFF() stm32f4_gpio_set_output(STM32F4_GPIO_PIN(3,12), 0)
+
#else
/* default case is to print */