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(); } }
unsigned short tsGetThreshhold(void) { // Check if custom threshold has been set in eeprom unsigned short thold = eepromReadU16(CFG_EEPROM_TOUCHSCREEN_THRESHHOLD); if (thold != 0xFFFF) { // Use value from EEPROM _tsThreshhold = thold; } else { // Use the default value from projectconfig.h _tsThreshhold = CFG_TFTLCD_TS_DEFAULTTHRESHOLD; } return _tsThreshhold; }