Correction
Dependencies: TS_DISCO_F746NG mbed LCD_DISCO_F746NG BSP_DISCO_F746NG
touches.cpp
- Committer:
- DValente
- Date:
- 2019-12-10
- Revision:
- 1:467f801bd037
File content as of revision 1:467f801bd037:
#include "touches.h" uint8_t readTouchApp(void) { TS_DISCO_F746NG ts; // instanciation du Touch Screen TS_StateTypeDef TS_State; // Structure liée au Touch Screen uint16_t X,Y,X1,Y1,X2,Y2; // Coordonnées de la touche et des icônes uint8_t Row,Line,Touch=0; // ligne et colonnes de l'icône ts.GetState(&TS_State); if (TS_State.touchDetected) { X=TS_State.touchX[0]; // Lecture de la coordonnée X de la touche Y=TS_State.touchY[0]; // Lecture de la coordonnée Y de la touche for(Line=0;Line<2;Line++) { for(Row=0;Row<4;Row++) { X1=ICON_H_GAP*(Row+1)+ICON_WIDTH*Row; Y1=ICON_V_GAP*(Line+1)+ICON_HEIGHT*Line; X2=X1+ICON_WIDTH; Y2=X2+ICON_HEIGHT; if((X>X1) && (X<X2) && (Y>Y1)&& (Y<Y2)) Touch=(Line*4)+Row+1; } } } return Touch; } bool readTouchClose(uint16_t X1,uint16_t Y1,uint16_t X2,uint16_t Y2) { TS_DISCO_F746NG ts; // instanciation du Touch Screen TS_StateTypeDef TS_State; // Structure liée au Touch Screen uint16_t X,Y; // Coordonnées de la touche et des icônes bool Touch=false; ts.GetState(&TS_State); if (TS_State.touchDetected) { X=TS_State.touchX[0]; // Lecture de la coordonnée X de la touche Y=TS_State.touchY[0]; // Lecture de la coordonnée Y de la touche X2=X1+ICON_WIDTH; Y2=X2+ICON_HEIGHT; if((X>X1) && (X<X2) && (Y>Y1)&& (Y<Y2)) Touch=true; } return Touch; }