X-Git-Url: http://git.rohieb.name/hackover2013-badge-firmware.git/blobdiff_plain/9d18e10afb2439a6a9ba6978a799259746a837b7..9f4d9c8e095ee37b411008e81e6a12e7c20cb9c5:/sysinit.c diff --git a/sysinit.c b/sysinit.c index 60b4d3b..a3834b6 100644 --- a/sysinit.c +++ b/sysinit.c @@ -124,12 +124,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 +143,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,7 +195,7 @@ void systemInit() // Initialise the SSD1306 OLED display #ifdef CFG_SSD1306 - ssd1306Init(SSD1306_SWITCHCAPVCC); + ssd1306Init(SSD1306_INTERNALVCC); ssd1306ClearScreen(); // Clear the screen #endif