From: Wintermute Date: Sun, 13 Oct 2013 02:17:39 +0000 (+0200) Subject: LEDs an Prototyp2 X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/commitdiff_plain/1cca029c8d64a4c55cc146c331c41f04735c7c8f?ds=sidebyside LEDs an Prototyp2 --- diff --git a/badge/init.c b/badge/init.c index 8a8983e..bb49df1 100644 --- a/badge/init.c +++ b/badge/init.c @@ -9,8 +9,8 @@ static void badge_init_backlight(void) { HOB_SET_PIN_FUNC(HOB_LCD_BACKLIGHT, CLKOUT); - // wdtInit(false); - SCB_CLKOUTCLKSEL = SCB_MAINCLKSEL_SOURCE_INTERNALOSC; + wdtInit(false); + SCB_CLKOUTCLKSEL = SCB_MAINCLKSEL_SOURCE_WDTOSC; SCB_CLKOUTCLKUEN = SCB_CLKOUTCLKUEN_DISABLE; SCB_CLKOUTCLKUEN = SCB_CLKOUTCLKUEN_UPDATE; SCB_CLKOUTCLKDIV = 30; @@ -52,6 +52,12 @@ void badge_init(void) { OUTPUT_PIN_CONFIG(HOB_LCD_CS , 1); OUTPUT_PIN_CONFIG(HOB_LCD_RST , 1); OUTPUT_PIN_CONFIG(HOB_DATAFLASH_CS, 1); + +#ifdef HOB_REV2 + OUTPUT_PIN_CONFIG(HOB_LED_LEFT , 0); + OUTPUT_PIN_CONFIG(HOB_LED_RIGHT , 0); +#endif + #undef OUTPUT_PIN_CONFIG badge_init_backlight(); diff --git a/badge/main.c b/badge/main.c index 156d8e2..cb7966b 100644 --- a/badge/main.c +++ b/badge/main.c @@ -64,6 +64,8 @@ #include "drivers/fatfs/ff.h" +#include "badge/pinconfig.h" + #ifdef R0KET #include "r0ketports.h" @@ -201,6 +203,12 @@ int main(void) badge_init(); #endif +#ifdef HOB_REV2 + gpioSetValue(HOB_PORT(HOB_LED_LEFT), HOB_PIN(HOB_LED_LEFT), 1); + systickDelay(1000); + gpioSetValue(HOB_PORT(HOB_LED_RIGHT), HOB_PIN(HOB_LED_RIGHT), 1); +#endif + { // f_mkfs(0, 1, 0); badge_framebuffer fb; diff --git a/badge/pinconfig.h b/badge/pinconfig.h index 7f39856..1b4a1b9 100644 --- a/badge/pinconfig.h +++ b/badge/pinconfig.h @@ -25,6 +25,9 @@ #define HOB_USB_CONNECT (0, 6) +#define HOB_LED_LEFT (2, 8) +#define HOB_LED_RIGHT (2, 6) + #else #define HOB_BTN_UP (3, 2)