Class library: Button class and ButtonGroup class for DISCO-F746NG. クラスライブラリ: DISCO-F746NG 用の,Button クラス,ButtonGroup クラス.

Dependents:   F746_SpectralAnalysis_NoPhoto F746_Fourier_series_of_square_wave_01 F746_ButtonGroup_Demo F746_Mandelbrot ... more

Files at this revision

API Documentation at this revision

Comitter:
MikamiUitOpen
Date:
Thu Feb 18 10:04:20 2016 +0000
Parent:
11:204bc17f59cc
Child:
13:af578b53ff0e
Commit message:
13

Changed in this revision

button.cpp Show annotated file Show diff for this revision Revisions of this file
button.hpp Show annotated file Show diff for this revision Revisions of this file
--- a/button.cpp	Wed Feb 17 06:27:45 2016 +0000
+++ b/button.cpp	Thu Feb 18 10:04:20 2016 +0000
@@ -1,7 +1,7 @@
 //-----------------------------------------------------------
-//  Button class
+//  Button class coping with multi-touch
 //
-//  2015/12/31, Copyright (c) 2015 MIKAMI, Naoki
+//  2016/02/18, Copyright (c) 2016 MIKAMI, Naoki
 //-----------------------------------------------------------
 
 #include "button.hpp"
@@ -31,19 +31,20 @@
     // Check touch detected
     bool Button::Touched()
     {
+        bool rtn = false;
         TS_StateTypeDef state;
         ts_.GetState(&state);
 
-        if (state.touchDetected)
+        for (int n=0; n<state.touchDetected; n++)
         {
-            uint16_t x = state.touchX[0];
-            uint16_t y = state.touchY[0];
+            uint16_t x = state.touchX[n];
+            uint16_t y = state.touchY[n];
 
-            return ( (X_ <= x) && (x <= X_+W_) &&
-                     (Y_ <= y) && (y <= Y_+H_) ) ? true : false;
+            if ( (X_ <= x) && (x <= X_+W_) &&
+                 (Y_ <= y) && (y <= Y_+H_) ) rtn = true;
+            if (rtn) break;
         }
-        else
-            return false;
+        return rtn;
     }
         
     // Check touch detected and redraw button
--- a/button.hpp	Wed Feb 17 06:27:45 2016 +0000
+++ b/button.hpp	Thu Feb 18 10:04:20 2016 +0000
@@ -1,7 +1,7 @@
 //-----------------------------------------------------------
-//  Button class -- Header
+//  Button class coping with multi-touch -- Header
 //
-//  2015/12/31, Copyright (c) 2015 MIKAMI, Naoki
+//  2016/02/18, Copyright (c) 2016 MIKAMI, Naoki
 //-----------------------------------------------------------
 
 #ifndef F746_BUTTON_HPP