Schrift fest in Firmware eingebacken, damit die auch funktioniert, wenn auf dem
[hackover2013-badge-firmware.git] / badge / init.c
index 4623b8e..cc4d044 100644 (file)
@@ -9,10 +9,11 @@
 static void badge_init_backlight(void) {
   HOB_SET_PIN_FUNC(HOB_LCD_BACKLIGHT, CLKOUT);
 
-  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;
+  SCB_CLKOUTCLKDIV = 75;
 }
 
 void badge_init(void) {
@@ -22,6 +23,14 @@ void badge_init(void) {
     gpioSetPullup(&HOB_IOCON(spec), (mode));                           \
   } while(0)
 
+#ifdef HOB_REV2
+  INPUT_PIN_CONFIG(HOB_BTN_UP    , gpioPullupMode_PullUp);
+  INPUT_PIN_CONFIG(HOB_BTN_RIGHT , gpioPullupMode_PullUp);
+  INPUT_PIN_CONFIG(HOB_BTN_DOWN  , gpioPullupMode_PullUp);
+  INPUT_PIN_CONFIG(HOB_BTN_LEFT  , gpioPullupMode_PullUp);
+  INPUT_PIN_CONFIG(HOB_BTN_A     , gpioPullupMode_PullUp);
+  INPUT_PIN_CONFIG(HOB_BTN_B     , gpioPullupMode_PullUp);
+#else
   INPUT_PIN_CONFIG(HOB_BTN_UP    , gpioPullupMode_PullDown);
   INPUT_PIN_CONFIG(HOB_BTN_RIGHT , gpioPullupMode_PullDown);
   INPUT_PIN_CONFIG(HOB_BTN_DOWN  , gpioPullupMode_PullDown);
@@ -29,6 +38,8 @@ void badge_init(void) {
   INPUT_PIN_CONFIG(HOB_BTN_CENTER, gpioPullupMode_PullDown);
   INPUT_PIN_CONFIG(HOB_BTN_A     , gpioPullupMode_PullDown);
   INPUT_PIN_CONFIG(HOB_BTN_B     , gpioPullupMode_PullDown);
+#endif
+
 #undef INPUT_PIN_CONFIG
 
 #define OUTPUT_PIN_CONFIG(spec, value) do {                            \
@@ -41,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();
This page took 0.023211 seconds and 4 git commands to generate.