void tsInit(void) { // Make sure that ADC is initialised adcInit(); // Set initialisation flag _tsInitialised = TRUE; // Check if the touch-screen has been calibrated if (eepromReadU8(CFG_EEPROM_TOUCHSCREEN_CALIBRATED) == 1) { // Load calibration data _calibration.offsetLeft = eepromReadU16(CFG_EEPROM_TOUCHSCREEN_OFFSET_LEFT); _calibration.offsetRight = eepromReadU16(CFG_EEPROM_TOUCHSCREEN_OFFSET_RIGHT); _calibration.offsetTop = eepromReadU16(CFG_EEPROM_TOUCHSCREEN_OFFSET_TOP); _calibration.offsetBottom = eepromReadU16(CFG_EEPROM_TOUCHSCREEN_OFFSET_BOT); _calibration.divisorX = eepromReadU16(CFG_EEPROM_TOUCHSCREEN_OFFSET_DIVX); _calibration.divisorY = eepromReadU16(CFG_EEPROM_TOUCHSCREEN_OFFSET_DIVY); } else { // Start touch-screen calibration tsCalibrate(); } }
void cmd_calibrate(uint8_t argc, char **argv) { printf("Starting touch-screen calibration%s", CFG_PRINTF_NEWLINE); // Run through the calibration process tsCalibrate(); printf("Calibration complete%s", CFG_PRINTF_NEWLINE); }