X-Git-Url: https://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/d537298fdd7d39e4cb0e74e8e6d227245d638afe..1f8ed489668d6d74b5f6bf89714c540bfc9cdac4:/sysinit.c diff --git a/sysinit.c b/sysinit.c index 80d2f5c..d1f440a 100644 --- 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" @@ -124,7 +123,6 @@ 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); @@ -144,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) @@ -192,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