See changelog v0.9.8
[hackover2013-badge-firmware.git] / sysinit.c
index 60b4d3b..9734d23 100644 (file)
--- a/sysinit.c
+++ b/sysinit.c
@@ -44,7 +44,6 @@
 
 #include "core/cpu/cpu.h"
 #include "core/pmu/pmu.h"
-#include "core/adc/adc.h"
 
 #ifdef CFG_PRINTF_UART
   #include "core/uart/uart.h"
 #endif
 
 #ifdef CFG_ST7565
-  #include "drivers/lcd/bitmap/st7565/st7565.h"
-  #include "drivers/lcd/smallfonts.h"
+  #include "drivers/displays/bitmap/st7565/st7565.h"
+  #include "drivers/displays/smallfonts.h"
 #endif
 
 #ifdef CFG_SSD1306
-  #include "drivers/lcd/bitmap/ssd1306/ssd1306.h"
-  #include "drivers/lcd/smallfonts.h"
+  #include "drivers/displays/bitmap/ssd1306/ssd1306.h"
+  #include "drivers/displays/smallfonts.h"
 #endif
 
 #ifdef CFG_TFTLCD
-  #include "drivers/lcd/tft/lcd.h"
-  #include "drivers/lcd/tft/touchscreen.h"
-  #include "drivers/lcd/tft/drawing.h"  
+  #include "drivers/displays/tft/lcd.h"
+  #include "drivers/displays/tft/touchscreen.h"
+  #include "drivers/displays/tft/drawing.h"  
 #endif
 
 #ifdef CFG_I2CEEPROM
@@ -124,12 +123,18 @@ void systemInit()
   systickInit(CFG_SYSTICK_DELAY_IN_MS);     // Start systick timer
   gpioInit();                               // Enable GPIO
   pmuInit();                                // Configure power management
-  adcInit();                                // Config adc pins to save power
 
   // Set LED pin as output and turn LED off
   gpioSetDir(CFG_LED_PORT, CFG_LED_PIN, 1);
   gpioSetValue(CFG_LED_PORT, CFG_LED_PIN, CFG_LED_OFF);
 
+  // Config alt reset pin if requested (really only relevant to LPC1343 LCD Board)
+  #ifdef CFG_ALTRESET
+    gpioSetDir (CFG_ALTRESET_PORT, CFG_ALTRESET_PIN, gpioDirection_Input);
+    gpioSetInterrupt (CFG_ALTRESET_PORT, CFG_ALTRESET_PIN, gpioInterruptSense_Level, gpioInterruptEdge_Single, gpioInterruptEvent_ActiveHigh);
+    gpioIntEnable (CFG_ALTRESET_PORT, CFG_ALTRESET_PIN); 
+  #endif
+
   // Initialise EEPROM
   #ifdef CFG_I2CEEPROM
     mcp24aaInit();
@@ -137,15 +142,19 @@ void systemInit()
 
   // Initialise UART with the default baud rate
   #ifdef CFG_PRINTF_UART
-    uint32_t uart = eepromReadU32(CFG_EEPROM_UART_SPEED);
-    if ((uart == 0xFFFFFFFF) || (uart > 115200))
-    {
-      uartInit(CFG_UART_BAUDRATE);  // Use default baud rate
-    }
-    else
-    {
-      uartInit(uart);               // Use baud rate from EEPROM
-    }
+    #ifdef CFG_I2CEEPROM
+      uint32_t uart = eepromReadU32(CFG_EEPROM_UART_SPEED);
+      if ((uart == 0xFFFFFFFF) || (uart > 115200))
+      {
+        uartInit(CFG_UART_BAUDRATE);  // Use default baud rate
+      }
+      else
+      {
+        uartInit(uart);               // Use baud rate from EEPROM
+      }
+    #else
+      uartInit(CFG_UART_BAUDRATE);
+    #endif
   #endif
 
   // Initialise PWM (requires 16-bit Timer 1 and P1.9)
@@ -185,13 +194,26 @@ void systemInit()
 
   // Initialise the SSD1306 OLED display
   #ifdef CFG_SSD1306
-    ssd1306Init(SSD1306_SWITCHCAPVCC);
+    ssd1306Init(SSD1306_INTERNALVCC);
     ssd1306ClearScreen();   // Clear the screen  
   #endif
 
   // Initialise TFT LCD Display
   #ifdef CFG_TFTLCD
     lcdInit();
+    // You may need to call the tsCalibrate() function to calibrate 
+    // the touch screen is this has never been done.  This only needs
+    // to be done once and the values are saved to EEPROM.  This 
+    // function can also be called from tsInit if it's more
+    // convenient
+    /*
+    #ifdef CFG_I2CEEPROM
+    if (eepromReadU8(CFG_EEPROM_TOUCHSCREEN_CALIBRATED) != 1)
+    {
+      tsCalibrate();
+    }
+    #endif
+    */
   #endif
 
   // Initialise Chibi
This page took 0.028533 seconds and 4 git commands to generate.