Repository for import to local machine

Dependencies:   DMBasicGUI DMSupport

Committer:
jmitc91516
Date:
Mon Jul 31 15:37:57 2017 +0000
Revision:
8:26e49e6955bd
Parent:
1:a5258871b33d
Method ramp scrolling improved, and more bitmaps moved to QSPI memory

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jmitc91516 1:a5258871b33d 1 #ifndef SIMPLIFIEDTOUCHLISTENER_H
jmitc91516 1:a5258871b33d 2 #define SIMPLIFIEDTOUCHLISTENER_H
jmitc91516 1:a5258871b33d 3
jmitc91516 1:a5258871b33d 4 #include "mbed.h"
jmitc91516 1:a5258871b33d 5 #include "DMBoard.h"
jmitc91516 1:a5258871b33d 6
jmitc91516 1:a5258871b33d 7 #include "ThreadSignalEnums.h"
jmitc91516 1:a5258871b33d 8
jmitc91516 1:a5258871b33d 9 #define GET_TOUCH_COORDS_AT_TOUCH_TIME
jmitc91516 1:a5258871b33d 10
jmitc91516 1:a5258871b33d 11 #define MULTI_TOUCH_TECHNIQUE_5 // See GetGCStatusLoop.cpp for the other four
jmitc91516 1:a5258871b33d 12
jmitc91516 1:a5258871b33d 13 /*
jmitc91516 1:a5258871b33d 14 This class handles the touch panel on the LPC4088.
jmitc91516 1:a5258871b33d 15
jmitc91516 1:a5258871b33d 16 It is a greatly simplified version of the original TouchListener class, to minimise the amount of code executed (and functions called)
jmitc91516 1:a5258871b33d 17 in response to the user touching the screen.
jmitc91516 1:a5258871b33d 18
jmitc91516 1:a5258871b33d 19 When the user touches the 'touch panel', all this class does is send a thread signal to the main thread, nothing else.
jmitc91516 1:a5258871b33d 20 The main thread does the rest.
jmitc91516 1:a5258871b33d 21
jmitc91516 1:a5258871b33d 22 Requires the ID of the thread it is to signal in response to a touch event, and a pointer to the touch panel.
jmitc91516 1:a5258871b33d 23 */
jmitc91516 1:a5258871b33d 24
jmitc91516 1:a5258871b33d 25 // Note that SimplifiedTouchListener is a singleton - we do not need or want there to be more than one instance of it
jmitc91516 1:a5258871b33d 26 // (there is only one LPC4088, and only one touch panel)
jmitc91516 1:a5258871b33d 27 class SimplifiedTouchListener {
jmitc91516 1:a5258871b33d 28 public:
jmitc91516 1:a5258871b33d 29 /**
jmitc91516 1:a5258871b33d 30 * Static method to create (if necessary) and retrieve the single SimplifiedTouchListener instance
jmitc91516 1:a5258871b33d 31 */
jmitc91516 1:a5258871b33d 32 static SimplifiedTouchListener * GetInstance(osThreadId newAppThread, TouchPanel* newTouchPanel);
jmitc91516 1:a5258871b33d 33
jmitc91516 1:a5258871b33d 34 static void ListenerFunction(void);
jmitc91516 1:a5258871b33d 35
jmitc91516 1:a5258871b33d 36 bool GotTouchEvent(short *x, short *y, short *z);
jmitc91516 1:a5258871b33d 37
jmitc91516 1:a5258871b33d 38 private:
jmitc91516 1:a5258871b33d 39 static SimplifiedTouchListener * theSimplifiedTouchListener;
jmitc91516 1:a5258871b33d 40
jmitc91516 1:a5258871b33d 41 // singleton class -> constructor is private
jmitc91516 1:a5258871b33d 42 SimplifiedTouchListener(osThreadId newAppThread, TouchPanel* newTouchPanel);
jmitc91516 1:a5258871b33d 43
jmitc91516 1:a5258871b33d 44 TouchPanel* touchPanel;
jmitc91516 1:a5258871b33d 45 bool gotTouchEvent;
jmitc91516 1:a5258871b33d 46 osThreadId appThread;
jmitc91516 1:a5258871b33d 47
jmitc91516 1:a5258871b33d 48 static FunctionPointer functionPointer;
jmitc91516 1:a5258871b33d 49
jmitc91516 1:a5258871b33d 50 // If we get the touch coords in the listener function, as soon as we are notified
jmitc91516 1:a5258871b33d 51 // of the touch event, we can be sure that they will match the event.
jmitc91516 1:a5258871b33d 52 // Otherwise, we wait for the main thread to respond to our signal,
jmitc91516 1:a5258871b33d 53 // and we get the coords then. We are seeing behaviour that indicates
jmitc91516 1:a5258871b33d 54 // that the coords we obtain may sometimes not be correct (Display (LPC4088) Bug Reports bug #4).
jmitc91516 1:a5258871b33d 55 #ifdef GET_TOUCH_COORDS_AT_TOUCH_TIME
jmitc91516 1:a5258871b33d 56 static touch_coordinate_t touchCoords;
jmitc91516 1:a5258871b33d 57 #endif // GET_TOUCH_COORDS_AT_TOUCH_TIME
jmitc91516 1:a5258871b33d 58
jmitc91516 1:a5258871b33d 59 #ifdef MULTI_TOUCH_TECHNIQUE_5
jmitc91516 1:a5258871b33d 60 static Timer touchTimer;
jmitc91516 1:a5258871b33d 61 static const uint32_t touchIntervalMilliSec;
jmitc91516 1:a5258871b33d 62 #endif
jmitc91516 1:a5258871b33d 63 };
jmitc91516 1:a5258871b33d 64
jmitc91516 1:a5258871b33d 65 #endif