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

Dependencies:   mbed RA8875

ResistiveTouchCal.cpp

Committer:
WiredHome
Date:
2020-03-29
Revision:
4:e5375f29d8d4
Parent:
0:d06677ab6ca6

File content as of revision 4:e5375f29d8d4:

#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);
    }
}