Simple program to test BlockMove API on the RA8875 display. Tested with RA8875 v148 and mbed v148

Dependencies:   mbed RA8875

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ResistiveTouchCal.cpp Source File

ResistiveTouchCal.cpp

00001 #include "ResistiveTouchCal.h"
00002 
00003 void CalibrateTS(RA8875 & lcd)
00004 {
00005     FILE * fh;
00006     tpMatrix_t matrix;
00007     RetCode_t r;
00008     Timer testperiod;
00009  
00010     r = lcd.TouchPanelCalibrate("Calibrate the touch panel", &matrix);
00011     if (r == noerror) {
00012         fh = fopen("/local/tpcal.cfg", "wb");
00013         if (fh) {
00014             fwrite(&matrix, sizeof(tpMatrix_t), 1, fh);
00015             fclose(fh);
00016             printf("  tp cal written.\r\n");
00017             lcd.cls();
00018         } else {
00019             printf("  couldn't open tpcal file.\r\n");
00020         }
00021     } else {
00022         printf("error return: %d\r\n", r);
00023     }
00024     lcd.cls();
00025 }
00026 
00027 void InitTS(RA8875 & lcd)
00028 {
00029     FILE * fh;
00030     tpMatrix_t matrix;
00031 
00032     fh = fopen("/local/tpcal.cfg", "rb");
00033     if (fh) {
00034         fread(&matrix, sizeof(tpMatrix_t), 1, fh);
00035         fclose(fh);
00036         lcd.TouchPanelSetMatrix(&matrix);
00037         printf("  tp cal loaded.\r\n");
00038     } else {
00039         CalibrateTS(lcd);
00040     }
00041 }