Simple radar simulator. Example of 2D graphics on DISCO-F746NG display.

Dependencies:   BSP_DISCO_F746NG Graphics mbed TS_DISCO_F746NG

PointingDevice/TouchScreen.cpp

Committer:
karpent
Date:
2016-11-05
Revision:
4:66f13188c26b
Parent:
2:8db224cc1fcb

File content as of revision 4:66f13188c26b:

//
// TouchScreen.cpp
//

#include "TouchScreen.h"

//Serial pc(USBTX, USBRX);

TouchScreen::TouchScreen(Display* display)
{
    _width = display != NULL ? display->DisplayWidth() - 1: 479;
    _height =  display != NULL ? display->DisplayHeight() - 1: 271;
}


void TouchScreen::Init()
{
    TS_DISCO_F746NG::Init(_width, _height);
}


pPoint TouchScreen::DetectTouch()
{
    GetState(&tsState);
    // Debug message
    //pc.printf(".");
    
    if(tsState.touchDetected > 0) {
        touchPoint.X = tsState.touchX[0];
        touchPoint.Y = tsState.touchY[0];

        // Debug message
        //pc.printf("Touch detected at (%d, %d)\r\n", touchPoint.X, touchPoint.Y);
    
        //ResetTouchData(&tsState);
        return &touchPoint;
    }

    return NULL;
}