summaryrefslogtreecommitdiffstats
path: root/Graphic_Equalizer/src/mouse.hcc
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2004-11-10 12:45:18 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2004-11-10 12:45:18 (GMT)
commit9451e82004bb59a95d9589058759169c1c486c91 (patch)
tree991c9238e4290ed097f0d02494dc80c0f10c68f1 /Graphic_Equalizer/src/mouse.hcc
parentb7b9f1ff4da4dae9d4c14ee5e03a7555b254c31c (diff)
downloadTASS-9451e82004bb59a95d9589058759169c1c486c91.zip
TASS-9451e82004bb59a95d9589058759169c1c486c91.tar.gz
TASS-9451e82004bb59a95d9589058759169c1c486c91.tar.bz2
First Real Version
Diffstat (limited to 'Graphic_Equalizer/src/mouse.hcc')
-rw-r--r--Graphic_Equalizer/src/mouse.hcc120
1 files changed, 120 insertions, 0 deletions
diff --git a/Graphic_Equalizer/src/mouse.hcc b/Graphic_Equalizer/src/mouse.hcc
new file mode 100644
index 0000000..7e7ca26
--- /dev/null
+++ b/Graphic_Equalizer/src/mouse.hcc
@@ -0,0 +1,120 @@
+/*! \file mousedriver.hcc
+ *
+ * \section generic This module takes care of mouse input. The mouse
+ * input function itself is however performed by the
+ * touchscreen of the RC200.
+ *
+ * \section project Project information.
+ * Project Graphic Equalizer\n
+ * \author O.M. Schinagl
+ * \date 20041011
+ * \version 0.1
+ *
+ * \section copyright Copyright
+ * Copyright ©2004 Koninklijke Philips Electronics N.V. All rights reserved
+ *
+ * \section history Change history
+ * 20041011: O.M. Schinagl\n Initial version
+ *
+ ********************************************************************/
+
+/******** System Includes *************/
+#include <stdlib.hch>
+
+#include "pal_master.hch"
+#include "pal_mouse.hch"
+
+/******** Application Includes ********/
+#include "mousedriver.hch"
+#include "mousedriver_shared.hch"
+
+
+
+/*
+ * Channel to notify others when new mousedata is available. If so
+ * Then mousedata struct is updated with shared data.
+ */
+chan unsigned 1 mousedata_notification;
+
+
+
+/*! \fn void mouse_main(mousedata_t *mousedata);
+ * \brief Main mousedriver. This function never returns! It calls the
+ * main mousehandler and returns the States and coordinates
+ * into the shared mpram.
+ *
+ * \param void None.
+ *
+ * \return Never Returns.
+ * \retval void
+ */
+void mouse_main(mousedata_t *mousedata)
+{
+ unsigned 14 touch_sampler;
+ unsigned 10 x, oldx;
+ unsigned 9 y, oldy;
+ unsigned 3 mousestate, oldmousestate;
+ unsigned 1 touch, touched, oldtouched;
+
+ /*
+ * We only check for mouse states once every 2^14 time. This to
+ * overcome the sampling of the 'Touch' state of the RC200 libs. When
+ * using newer libs this might be overkill, e.g. smaller values may due
+ * or sampling all together will be redundant.
+ */
+ for(touch_sampler = 1;;touch_sampler++) {
+ if (!touch_sampler) {
+ /*
+ * We are here ready to set mouse states. We compare
+ * current and previous states and thereby determine
+ * the state to send to others
+ */
+ if (touched) {
+ if(oldtouched) {
+ mousestate = MOUSE_STATE_DOWN;
+ } else {
+ mousestate = MOUSE_STATE_ON_PRESS;
+ }
+ oldtouched = TRUE;
+ } else {
+ if(oldtouched) {
+ mousestate = MOUSE_STATE_ON_RELEASE;
+ } else {
+ mousestate = MOUSE_STATE_UP;
+ }
+ oldtouched = FALSE;
+ }
+ /*
+ * We have now processed our Touch. Reset it for the
+ * next run.
+ */
+ touched = FALSE;
+
+ /*
+ * Compare Previous States and Coordinates to determine
+ * wether they have changed. If so, Copy them into
+ * shared memory, notify the listening processes and
+ * Set the new as previous values for the next run.
+ */
+ if ((oldmousestate != mousestate) || (oldx != x) || (oldy != y)) {
+ mousedata->x = x;
+ mousedata->y = y;
+ mousedata->state = mousestate;
+ mousedata_notification ! MOUSE_UPDATED;
+ oldx = x;
+ oldy = y;
+ oldmousestate = mousestate;
+ }
+ }
+
+ /*
+ * Read the current X and Y of the 'cursor' and register wether
+ * the display was touched. If touched store this in a local
+ * store. This we do to catch the sampling of the RC200 lib.
+ */
+ RC200TouchScreenReadScaled(&x, &y, &touch);
+ if (touch) {
+ touched = TRUE;
+ }
+ }
+} /* --- mouse_main_loop() --- */