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);
// 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)
// 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