David Smart
/
PUB_RA8875_BlockMove
Simple program to test BlockMove API on the RA8875 display. Tested with RA8875 v148 and mbed v148
Diff: ResistiveTouchCal.cpp
- Revision:
- 0:d06677ab6ca6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ResistiveTouchCal.cpp Sun Aug 06 14:29:55 2017 +0000 @@ -0,0 +1,41 @@ +#include "ResistiveTouchCal.h" + +void CalibrateTS(RA8875 & lcd) +{ + FILE * fh; + tpMatrix_t matrix; + RetCode_t r; + Timer testperiod; + + r = lcd.TouchPanelCalibrate("Calibrate the touch panel", &matrix); + if (r == noerror) { + fh = fopen("/local/tpcal.cfg", "wb"); + if (fh) { + fwrite(&matrix, sizeof(tpMatrix_t), 1, fh); + fclose(fh); + printf(" tp cal written.\r\n"); + lcd.cls(); + } else { + printf(" couldn't open tpcal file.\r\n"); + } + } else { + printf("error return: %d\r\n", r); + } + lcd.cls(); +} + +void InitTS(RA8875 & lcd) +{ + FILE * fh; + tpMatrix_t matrix; + + fh = fopen("/local/tpcal.cfg", "rb"); + if (fh) { + fread(&matrix, sizeof(tpMatrix_t), 1, fh); + fclose(fh); + lcd.TouchPanelSetMatrix(&matrix); + printf(" tp cal loaded.\r\n"); + } else { + CalibrateTS(lcd); + } +}