Simple radar simulator. Example of 2D graphics on DISCO-F746NG display.
Dependencies: BSP_DISCO_F746NG Graphics mbed TS_DISCO_F746NG
Diff: PointingDevice/TouchScreen.cpp
- Revision:
- 4:66f13188c26b
- Parent:
- 2:8db224cc1fcb
diff -r 732f7144ec81 -r 66f13188c26b PointingDevice/TouchScreen.cpp --- a/PointingDevice/TouchScreen.cpp Sat Nov 05 15:36:59 2016 +0000 +++ b/PointingDevice/TouchScreen.cpp Sat Nov 05 20:24:59 2016 +0000 @@ -4,10 +4,37 @@ #include "TouchScreen.h" -TouchScreen::TouchScreen(RK043FN48H* display) +//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() { - if(display != NULL) - { + 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; } \ No newline at end of file