aboutsummaryrefslogtreecommitdiffstats
path: root/src/ginput
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-09-26 16:32:00 +1000
committerinmarket <andrewh@inmarket.com.au>2014-09-26 16:32:00 +1000
commit174e60c76d2429de1b07d4afc00fa35999b7ccde (patch)
treefb7bfcc09c55620467a4e5ba216ce7bfe85fd340 /src/ginput
parente7bc175ca0fb1b1d2bd6a80d36696efa6dc0d171 (diff)
downloaduGFX-174e60c76d2429de1b07d4afc00fa35999b7ccde.tar.gz
uGFX-174e60c76d2429de1b07d4afc00fa35999b7ccde.tar.bz2
uGFX-174e60c76d2429de1b07d4afc00fa35999b7ccde.zip
GINPUT mouse updated - first working version of newmouse.
Note: drivers to be ported. Note: not tested well yet.
Diffstat (limited to 'src/ginput')
-rw-r--r--src/ginput/driver_mouse.h2
-rw-r--r--src/ginput/ginput_mouse.c36
-rw-r--r--src/ginput/ginput_mouse.h8
3 files changed, 26 insertions, 20 deletions
diff --git a/src/ginput/driver_mouse.h b/src/ginput/driver_mouse.h
index ababfef8..76367ba2 100644
--- a/src/ginput/driver_mouse.h
+++ b/src/ginput/driver_mouse.h
@@ -115,7 +115,7 @@ extern "C" {
* @notapi
* @{
*/
- bool_t _gmouseInitDriver(GDriver *g, unsigned driverinstance, unsigned systeminstance);
+ bool_t _gmouseInitDriver(GDriver *g, void *display, unsigned driverinstance, unsigned systeminstance);
void _gmousePostInitDriver(GDriver *g);
void _gmouseDeInitDriver(GDriver *g);
/** @} */
diff --git a/src/ginput/ginput_mouse.c b/src/ginput/ginput_mouse.c
index f33a74e0..ee6555b2 100644
--- a/src/ginput/ginput_mouse.c
+++ b/src/ginput/ginput_mouse.c
@@ -13,6 +13,11 @@
#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
+// Just to make code easier
+#if !GFX_USE_GDISP
+ #define GDISP 0
+#endif
+
// Local Settings
#define CALIBRATION_POLL_PERIOD 20 // milliseconds
#define CALIBRATION_MINPRESS_PERIOD 300 // milliseconds
@@ -618,7 +623,7 @@ void _gmouseInit(void) {
for(i = 0; i < sizeof(dclist)/sizeof(dclist[0]); i++) {
if (!(dclist[i]->flags & GMOUSE_VFLG_DYNAMICONLY))
- gdriverRegister(dclist[i]);
+ gdriverRegister(dclist[i], GDISP);
}
}
@@ -628,7 +633,7 @@ void _gmouseInit(void) {
extern GDriverVMTList GMOUSEVMT_OnlyOne;
if (!(GMOUSEVMT_OnlyOne->flags & GMOUSE_VFLG_DYNAMICONLY))
- gdriverRegister(GMOUSEVMT_OnlyOne);
+ gdriverRegister(GMOUSEVMT_OnlyOne, GDISP);
}
#endif
@@ -638,20 +643,23 @@ void _gmouseDeinit(void) {
gtimerDeinit(&MouseTimer);
}
-bool_t _gmouseInitDriver(GDriver *g, unsigned driverinstance, unsigned systeminstance) {
+bool_t _gmouseInitDriver(GDriver *g, void *display, unsigned driverinstance, unsigned systeminstance) {
#define m ((GMouse *)g)
(void) systeminstance;
- // Init the mouse
- if (!gmvmt(m)->init((GMouse *)g, driverinstance))
- return FALSE;
+ // The initial display is passed in the parameter for mice
+ m->display = display;
#if !GINPUT_TOUCH_NOTOUCH
- // Should this mouse start in finger mode?
+ // Should this mouse start in finger mode? (according to the VMT)
if ((gmvmt(m)->d.flags & GMOUSE_VFLG_DEFAULTFINGER))
m->flags |= GMOUSE_FLG_FINGERMODE;
#endif
+ // Init the mouse
+ if (!gmvmt(m)->init((GMouse *)g, driverinstance))
+ return FALSE;
+
// Ensure the Poll timer is started
if (!gtimerIsActive(&MouseTimer))
gtimerStart(&MouseTimer, MousePoll, 0, TRUE, GINPUT_MOUSE_POLL_PERIOD);
@@ -664,10 +672,6 @@ bool_t _gmouseInitDriver(GDriver *g, unsigned driverinstance, unsigned systemins
void _gmousePostInitDriver(GDriver *g) {
#define m ((GMouse *)g)
- // Make sure we have a valid mouse display
- if (!m->display)
- m->display = GDISP;
-
#if !GINPUT_TOUCH_NOCALIBRATE && !GINPUT_TOUCH_STARTRAW
if ((gmvmt(m)->d.flags & GMOUSE_VFLG_CALIBRATE)) {
GMouseCalibration *pc;
@@ -784,14 +788,16 @@ bool_t ginputGetMouseStatus(unsigned instance, GEventMouse *pe) {
#endif
/* Wake up the mouse driver from an interrupt service routine (there may be new readings available) */
-void ginputMouseWakeup(GMouse *m) {
- m->flags |= GMOUSE_FLG_NEEDREAD;
+void _gmouseWakeup(GMouse *m) {
+ if (m)
+ m->flags |= GMOUSE_FLG_NEEDREAD;
gtimerJab(&MouseTimer);
}
/* Wake up the mouse driver from an interrupt service routine (there may be new readings available) */
-void ginputMouseWakeupI(GMouse *m) {
- m->flags |= GMOUSE_FLG_NEEDREAD;
+void _gmouseWakeupI(GMouse *m) {
+ if (m)
+ m->flags |= GMOUSE_FLG_NEEDREAD;
gtimerJabI(&MouseTimer);
}
diff --git a/src/ginput/ginput_mouse.h b/src/ginput/ginput_mouse.h
index 1eff64f4..3e9c017b 100644
--- a/src/ginput/ginput_mouse.h
+++ b/src/ginput/ginput_mouse.h
@@ -46,10 +46,10 @@ typedef struct GEventMouse_t {
#define GMETA_MASK 0x00F0 // The "button transition" mask
#define GMETA_NONE 0x0000 // No "button transition" events
- #define GMETA_MOUSE_DOWN 0x0001 // Left mouse/touch has just gone down
- #define GMETA_MOUSE_UP 0x0002 // Left mouse/touch has just gone up
- #define GMETA_MOUSE_CLICK 0x0004 // Left mouse/touch has just gone through a click (short down - up cycle)
- #define GMETA_MOUSE_CXTCLICK 0x0008 // Right mouse has just been depressed or touch has gone through a long click
+ #define GMETA_MOUSE_DOWN 0x0010 // Left mouse/touch has just gone down
+ #define GMETA_MOUSE_UP 0x0020 // Left mouse/touch has just gone up
+ #define GMETA_MOUSE_CLICK 0x0040 // Left mouse/touch has just gone through a click (short down - up cycle)
+ #define GMETA_MOUSE_CXTCLICK 0x0080 // Right mouse has just been depressed or touch has gone through a long click
#define GINPUT_MISSED_MOUSE_EVENT 0x8000 // Oops - a mouse event has previously been missed