Miroslaw K. / Mbed 2 deprecated RadarDemo

Dependencies:   BSP_DISCO_F746NG Graphics mbed TS_DISCO_F746NG

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TouchScreen.cpp Source File

TouchScreen.cpp

00001 //
00002 // TouchScreen.cpp
00003 //
00004 
00005 #include "TouchScreen.h"
00006 
00007 //Serial pc(USBTX, USBRX);
00008 
00009 TouchScreen::TouchScreen(Display* display)
00010 {
00011     _width = display != NULL ? display->DisplayWidth() - 1: 479;
00012     _height =  display != NULL ? display->DisplayHeight() - 1: 271;
00013 }
00014 
00015 
00016 void TouchScreen::Init()
00017 {
00018     TS_DISCO_F746NG::Init(_width, _height);
00019 }
00020 
00021 
00022 pPoint TouchScreen::DetectTouch()
00023 {
00024     GetState(&tsState);
00025     // Debug message
00026     //pc.printf(".");
00027     
00028     if(tsState.touchDetected > 0) {
00029         touchPoint.X = tsState.touchX[0];
00030         touchPoint.Y = tsState.touchY[0];
00031 
00032         // Debug message
00033         //pc.printf("Touch detected at (%d, %d)\r\n", touchPoint.X, touchPoint.Y);
00034     
00035         //ResetTouchData(&tsState);
00036         return &touchPoint;
00037     }
00038 
00039     return NULL;
00040 }