diff options
author | inmarket <andrewh@inmarket.com.au> | 2018-06-23 13:02:07 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2018-06-23 13:02:07 +1000 |
commit | 41271d632b74f5cf47c30d3b699eb6b2786f2136 (patch) | |
tree | 78bcb729c6d6177ca598f28908fefd186c50e9b6 /src/ginput | |
parent | 3b97fb798e96514057bcf17263c1e5dbdcd7da26 (diff) | |
download | uGFX-41271d632b74f5cf47c30d3b699eb6b2786f2136.tar.gz uGFX-41271d632b74f5cf47c30d3b699eb6b2786f2136.tar.bz2 uGFX-41271d632b74f5cf47c30d3b699eb6b2786f2136.zip |
Added new type definitions - moving towards V3.0
Diffstat (limited to 'src/ginput')
-rw-r--r-- | src/ginput/ginput_dial.c | 10 | ||||
-rw-r--r-- | src/ginput/ginput_dial.h | 106 | ||||
-rw-r--r-- | src/ginput/ginput_driver_keyboard.h | 6 | ||||
-rw-r--r-- | src/ginput/ginput_driver_mouse.h | 10 | ||||
-rw-r--r-- | src/ginput/ginput_keyboard.c | 20 | ||||
-rw-r--r-- | src/ginput/ginput_keyboard.h | 52 | ||||
-rw-r--r-- | src/ginput/ginput_mouse.c | 18 | ||||
-rw-r--r-- | src/ginput/ginput_mouse.h | 202 | ||||
-rw-r--r-- | src/ginput/ginput_toggle.c | 18 | ||||
-rw-r--r-- | src/ginput/ginput_toggle.h | 60 |
10 files changed, 235 insertions, 267 deletions
diff --git a/src/ginput/ginput_dial.c b/src/ginput/ginput_dial.c index 0d853498..164b5e17 100644 --- a/src/ginput/ginput_dial.c +++ b/src/ginput/ginput_dial.c @@ -80,7 +80,7 @@ GSourceHandle ginputGetDial(uint16_t instance) { pds->lastvalue = 0; } ginput_lld_dial_init(); - gtimerStart(&DialTimer, (GTimerFunction)ginput_lld_dial_poll, DialCallback, TRUE, GINPUT_DIAL_POLL_PERIOD); + gtimerStart(&DialTimer, (GTimerFunction)ginput_lld_dial_poll, DialCallback, gTrue, GINPUT_DIAL_POLL_PERIOD); } // OK - return this input @@ -137,16 +137,16 @@ void ginputSetDialSensitivity(uint16_t instance, uint16_t diff) { * @param[in] instance The ID of the dial input instance * @param[in] pdial The dial event struct * - * @return Returns FALSE on an error (eg invalid instance) + * @return Returns gFalse on an error (eg invalid instance) */ -bool_t ginputGetDialStatus(uint16_t instance, GEventDial *pdial) { +gBool ginputGetDialStatus(uint16_t instance, GEventDial *pdial) { if (instance >= GINPUT_DIAL_NUM_PORTS) - return FALSE; + return gFalse; pdial->type = GEVENT_DIAL; pdial->instance = instance; pdial->value = DialStatus[instance].lastvalue; pdial->maxvalue = DialStatus[instance].max; - return TRUE; + return gTrue; } #endif /* GFX_USE_GINPUT && GINPUT_NEED_DIAL */ diff --git a/src/ginput/ginput_dial.h b/src/ginput/ginput_dial.h index 77c1b05c..af93391e 100644 --- a/src/ginput/ginput_dial.h +++ b/src/ginput/ginput_dial.h @@ -44,67 +44,59 @@ typedef struct GEventDial_t { /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - - /** - * @brief Create a dial input instance - * - * @param[in] instance The ID of the dial input instance (from 0 to 9999) - * - * @return The soure handle of the created dial instance - */ - GSourceHandle ginputGetDial(uint16_t instance); - - /** - * @brief Reset the value back to the hardware default - * - * @param[in] instance The ID of the dial input instance - */ - void ginputResetDialRange(uint16_t instance); +/** + * @brief Create a dial input instance + * + * @param[in] instance The ID of the dial input instance (from 0 to 9999) + * + * @return The soure handle of the created dial instance + */ +GSourceHandle ginputGetDial(uint16_t instance); - /** - * @brief Get the maximum value - * @details The readings are scaled to be 0 ... max. - * - * @param[in] instance The ID of the dial input instance - * - * @return The maximum value - */ - uint16_t ginputGetDialRange(uint16_t instance); +/** + * @brief Reset the value back to the hardware default + * + * @param[in] instance The ID of the dial input instance + */ +void ginputResetDialRange(uint16_t instance); - /** - * @brief Set the maximum value - * @details The readings are scaled to be 0 ... max. - * - * @param[in] instance The ID of the dial input instance - * @param[in] max The maximum value to be set - */ - void ginputSetDialRange(uint16_t instance, uint16_t max); +/** + * @brief Get the maximum value + * @details The readings are scaled to be 0 ... max. + * + * @param[in] instance The ID of the dial input instance + * + * @return The maximum value + */ +uint16_t ginputGetDialRange(uint16_t instance); - /** - * @brief Set the level change required before a dial even is generated (threshold) - * @note This is done after range scaling - * - * @param[in] instance The ID of the dial input instance - * @param[in] diff The amount of level changes - */ - void ginputSetDialSensitivity(uint16_t instance, uint16_t diff); - - /** - * @brief Get the current dial status - * - * @param[in] instance The ID of the dial input instance - * @param[in] pdial The dial event struct - * - * @return Returns FALSE on an error (eg invalid instance) - */ - bool_t ginputGetDialStatus(uint16_t instance, GEventDial *pdial); +/** + * @brief Set the maximum value + * @details The readings are scaled to be 0 ... max. + * + * @param[in] instance The ID of the dial input instance + * @param[in] max The maximum value to be set + */ +void ginputSetDialRange(uint16_t instance, uint16_t max); -#ifdef __cplusplus -} -#endif +/** + * @brief Set the level change required before a dial even is generated (threshold) + * @note This is done after range scaling + * + * @param[in] instance The ID of the dial input instance + * @param[in] diff The amount of level changes + */ +void ginputSetDialSensitivity(uint16_t instance, uint16_t diff); + +/** + * @brief Get the current dial status + * + * @param[in] instance The ID of the dial input instance + * @param[in] pdial The dial event struct + * + * @return Returns gFalse on an error (eg invalid instance) + */ +gBool ginputGetDialStatus(uint16_t instance, GEventDial *pdial); #endif /* GINPUT_NEED_DIAL */ diff --git a/src/ginput/ginput_driver_keyboard.h b/src/ginput/ginput_driver_keyboard.h index 1e0c6c2a..1d9fabf9 100644 --- a/src/ginput/ginput_driver_keyboard.h +++ b/src/ginput/ginput_driver_keyboard.h @@ -41,7 +41,7 @@ typedef struct GKeyboardVMT { #define GKEYBOARD_VFLG_NOPOLL 0x0001 // Do not poll this device - it is purely interrupt driven #define GKEYBOARD_VFLG_DYNAMICONLY 0x8000 // This keyboard driver should not be statically initialized eg Win32 const uint8_t * defLayout; // The default keyboard layout - bool_t (*init)(GKeyboard *m, unsigned driverinstance); // Required + gBool (*init)(GKeyboard *m, unsigned driverinstance); // Required void (*deinit)(GKeyboard *m); // Optional int (*getdata)(GKeyboard *k, uint8_t *pch, int sz); // Required. Get zero or more scancode bytes. Returns the number of scancode bytes returns void (*putdata)(GKeyboard *k, char ch); // Optional. Send a single byte to the keyboard. @@ -70,13 +70,13 @@ extern "C" { * @param[in] driverinstance The driver instance ToDo: Add some more details * @param[in] systeminstance The mouse instance ToDo: Add some more details * - * @return TRUE on success, FALSE otherwise + * @return gTrue on success, gFalse otherwise * @note This routine is provided by the high level code for * use in the driver VMT's GMouseVMT.d structure. * * @notapi */ - bool_t _gkeyboardInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance); + gBool _gkeyboardInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance); /** * @brief Routine that is called after initialization diff --git a/src/ginput/ginput_driver_mouse.h b/src/ginput/ginput_driver_mouse.h index 858d847a..ac5fb02d 100644 --- a/src/ginput/ginput_driver_mouse.h +++ b/src/ginput/ginput_driver_mouse.h @@ -85,11 +85,11 @@ typedef struct GMouseVMT { GMouseJitter pen_jitter; // PEN MODE: Jitter settings GMouseJitter finger_jitter; // FINGER MODE: Jitter settings - bool_t (*init)(GMouse *m, unsigned driverinstance); // Required + gBool (*init)(GMouse *m, unsigned driverinstance); // Required void (*deinit)(GMouse *m); // Optional - bool_t (*get)(GMouse *m, GMouseReading *prd); // Required + gBool (*get)(GMouse *m, GMouseReading *prd); // Required void (*calsave)(GMouse *m, const void *buf, size_t sz); // Optional - bool_t (*calload)(GMouse *m, void *buf, size_t sz); // Optional + gBool (*calload)(GMouse *m, void *buf, size_t sz); // Optional } GMouseVMT; #define gmvmt(m) ((const GMouseVMT const *)((m)->d.vmt)) @@ -115,13 +115,13 @@ extern "C" { * @param[in] driverinstance The driver instance ToDo: Add some more details * @param[in] systeminstance The mouse instance ToDo: Add some more details * - * @return TRUE on success, FALSE otherwise + * @return gTrue on success, gFalse otherwise * @note This routine is provided by the high level code for * use in the driver VMT's GMouseVMT.d structure. * * @notapi */ - bool_t _gmouseInitDriver(GDriver *g, void *display, unsigned driverinstance, unsigned systeminstance); + gBool _gmouseInitDriver(GDriver *g, void *display, unsigned driverinstance, unsigned systeminstance); /** * @brief Routine that is called after initialization diff --git a/src/ginput/ginput_keyboard.c b/src/ginput/ginput_keyboard.c index 68f05cea..b50cbc24 100644 --- a/src/ginput/ginput_keyboard.c +++ b/src/ginput/ginput_keyboard.c @@ -492,7 +492,7 @@ void _gkeyboardDeinit(void) { gtimerDeinit(&KeyboardTimer); } -bool_t _gkeyboardInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance) { +gBool _gkeyboardInitDriver(GDriver *g, void *param, unsigned driverinstance, unsigned systeminstance) { #define k ((GKeyboard *)g) (void) param; (void) systeminstance; @@ -502,13 +502,13 @@ bool_t _gkeyboardInitDriver(GDriver *g, void *param, unsigned driverinstance, un // Init the mouse if (!gkvmt(k)->init((GKeyboard *)g, driverinstance)) - return FALSE; + return gFalse; // Ensure the Poll timer is started if (!gtimerIsActive(&KeyboardTimer)) - gtimerStart(&KeyboardTimer, KeyboardPoll, 0, TRUE, GINPUT_KEYBOARD_POLL_PERIOD); + gtimerStart(&KeyboardTimer, KeyboardPoll, 0, gTrue, GINPUT_KEYBOARD_POLL_PERIOD); - return TRUE; + return gTrue; #undef k } @@ -532,7 +532,7 @@ GSourceHandle ginputGetKeyboard(unsigned instance) { return (GSourceHandle)gdriverGetInstance(GDRIVER_TYPE_KEYBOARD, instance); } -bool_t ginputGetKeyboardStatus(unsigned instance, GEventKeyboard *pe) { +gBool ginputGetKeyboardStatus(unsigned instance, GEventKeyboard *pe) { GKeyboard *k; // Win32 threads don't seem to recognise priority and/or pre-emption @@ -540,26 +540,26 @@ bool_t ginputGetKeyboardStatus(unsigned instance, GEventKeyboard *pe) { gfxSleepMilliseconds(1); if (!(k = (GKeyboard *)gdriverGetInstance(GDRIVER_TYPE_KEYBOARD, instance))) - return FALSE; + return gFalse; pe->type = GEVENT_KEYBOARD; // TODO - return TRUE; + return gTrue; } #if !GKEYBOARD_LAYOUT_OFF - bool_t ginputSetKeyboardLayout(unsigned instance, const void *pLayout) { + gBool ginputSetKeyboardLayout(unsigned instance, const void *pLayout) { GKeyboard *k; if (!(k = (GKeyboard *)gdriverGetInstance(GDRIVER_TYPE_KEYBOARD, instance))) - return FALSE; + return gFalse; if (pLayout) k->pLayout = pLayout; else k->pLayout = gkvmt(k)->defLayout; - return TRUE; + return gTrue; } #endif diff --git a/src/ginput/ginput_keyboard.h b/src/ginput/ginput_keyboard.h index a80e23d0..61a7a8af 100644 --- a/src/ginput/ginput_keyboard.h +++ b/src/ginput/ginput_keyboard.h @@ -175,47 +175,39 @@ typedef struct GEventKeyboard_t { /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif +/** + * @brief Create a keyboard input instance + * + * @param[in] instance The ID of the keyboard input instance (from 0 to 9999) + * + * @return The source handle of the created input instance + */ +GSourceHandle ginputGetKeyboard(unsigned instance); + +#if GINPUT_NEED_KEYBOARD || defined(__DOXYGEN__) /** - * @brief Create a keyboard input instance + * @brief Get the current keyboard status * - * @param[in] instance The ID of the keyboard input instance (from 0 to 9999) + * @param[in] instance The ID of the keyboard input instance + * @param[in] pkeyboard The keyboard event struct * - * @return The source handle of the created input instance + * @return Returns gFalse on an error (eg invalid instance) */ - GSourceHandle ginputGetKeyboard(unsigned instance); - - #if GINPUT_NEED_KEYBOARD || defined(__DOXYGEN__) + gBool ginputGetKeyboardStatus(unsigned instance, GEventKeyboard *pkeyboard); + #if !GKEYBOARD_LAYOUT_OFF || defined(__DOXYGEN__) /** - * @brief Get the current keyboard status + * @brief Set the keyboard layout * * @param[in] instance The ID of the keyboard input instance - * @param[in] pkeyboard The keyboard event struct + * @param[in] pLayout The keyboard layout micro-code. Passing NULL defaults to the driver's default layout. * - * @return Returns FALSE on an error (eg invalid instance) + * @return Returns gFalse on an error (eg invalid instance) */ - bool_t ginputGetKeyboardStatus(unsigned instance, GEventKeyboard *pkeyboard); - - #if !GKEYBOARD_LAYOUT_OFF || defined(__DOXYGEN__) - /** - * @brief Set the keyboard layout - * - * @param[in] instance The ID of the keyboard input instance - * @param[in] pLayout The keyboard layout micro-code. Passing NULL defaults to the driver's default layout. - * - * @return Returns FALSE on an error (eg invalid instance) - */ - bool_t ginputSetKeyboardLayout(unsigned instance, const void *pLayout); - #endif - #endif /* GINPUT_NEED_KEYBOARD */ - -#ifdef __cplusplus -} -#endif + gBool ginputSetKeyboardLayout(unsigned instance, const void *pLayout); + #endif +#endif /* GINPUT_NEED_KEYBOARD */ #endif /* _GINPUT_KEYBOARD_H */ /** @} */ diff --git a/src/ginput/ginput_mouse.c b/src/ginput/ginput_mouse.c index 356ad11e..ca032623 100644 --- a/src/ginput/ginput_mouse.c +++ b/src/ginput/ginput_mouse.c @@ -676,7 +676,7 @@ void _gmouseDeinit(void) { gtimerDeinit(&MouseTimer); } -bool_t _gmouseInitDriver(GDriver *g, void *display, unsigned driverinstance, unsigned systeminstance) { +gBool _gmouseInitDriver(GDriver *g, void *display, unsigned driverinstance, unsigned systeminstance) { #define m ((GMouse *)g) (void) systeminstance; @@ -691,13 +691,13 @@ bool_t _gmouseInitDriver(GDriver *g, void *display, unsigned driverinstance, uns // Init the mouse if (!gmvmt(m)->init((GMouse *)g, driverinstance)) - return FALSE; + return gFalse; // Ensure the Poll timer is started if (!gtimerIsActive(&MouseTimer)) - gtimerStart(&MouseTimer, MousePoll, 0, TRUE, GINPUT_MOUSE_POLL_PERIOD); + gtimerStart(&MouseTimer, MousePoll, 0, gTrue, GINPUT_MOUSE_POLL_PERIOD); - return TRUE; + return gTrue; #undef m } @@ -759,7 +759,7 @@ GDisplay *ginputGetMouseDisplay(unsigned instance) { return m->display; } -bool_t ginputGetMouseStatus(unsigned instance, GEventMouse *pe) { +gBool ginputGetMouseStatus(unsigned instance, GEventMouse *pe) { GMouse *m; // Win32 threads don't seem to recognise priority and/or pre-emption @@ -767,11 +767,11 @@ bool_t ginputGetMouseStatus(unsigned instance, GEventMouse *pe) { gfxSleepMilliseconds(1); if (!(m = (GMouse *)gdriverGetInstance(GDRIVER_TYPE_MOUSE, instance))) - return FALSE; + return gFalse; #if !GINPUT_TOUCH_NOCALIBRATE_GUI if ((m->flags & GMOUSE_FLG_IN_CAL)) - return FALSE; + return gFalse; #endif #if !GINPUT_TOUCH_NOTOUCH @@ -784,11 +784,11 @@ bool_t ginputGetMouseStatus(unsigned instance, GEventMouse *pe) { pe->z = m->r.z; pe->buttons = m->r.buttons; pe->display = m->display; - return TRUE; + return gTrue; } #if !GINPUT_TOUCH_NOTOUCH - void ginputSetFingerMode(unsigned instance, bool_t on) { + void ginputSetFingerMode(unsigned instance, gBool on) { GMouse *m; if (!(m = (GMouse *)gdriverGetInstance(GDRIVER_TYPE_MOUSE, instance))) diff --git a/src/ginput/ginput_mouse.h b/src/ginput/ginput_mouse.h index 8d8b3b9a..0d641d90 100644 --- a/src/ginput/ginput_mouse.h +++ b/src/ginput/ginput_mouse.h @@ -77,111 +77,103 @@ typedef struct GEventMouse_t { /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - - /** - * @brief Get the Source handler for a mouse using the instance number - * - * @param[in] instance The mouse instance number - * - * @return The source handle of the mouse or NULL - * @note You can use the special value of GMOUSE_ALL_INSTANCES to - * get a source handle that returns events for all mice rather - * than a specific mouse. Using GMOUSE_ALL_INSTANCES will always - * return a valid spurce handle even if there are currently no mice - * in the system. - */ - GSourceHandle ginputGetMouse(unsigned instance); - - /** - * @brief Should this device be in Pen mode or Finger mode - * @note A touch device (and even theoritically a mouse) can operate - * in either pen or finger mode. In finger mode typically a - * touch device will be far more tolerant of movement and other - * inaccuracies. Each driver specifies its own tolerances for - * pen versus finger mode. - * - * @param[in] instance The ID of the mouse input instance - * @param[in] on If true then finger mode is turned on. - */ - void ginputSetFingerMode(unsigned instance, bool_t on); - - /** - * @brief Assign the display associated with the mouse - * @note This only needs to be called if the mouse is associated with a display - * other than the current default display. It must be called before - * @p ginputGetMouse() if the new display is to be used during the calibration - * process. Other than calibration the display is used for range checking, - * and may also be used to display a mouse pointer. - * - * @param[in] instance The ID of the mouse input instance - * @param[in] g The GDisplay to which this mouse belongs - */ - void ginputSetMouseDisplay(unsigned instance, GDisplay *g); - - /** - * @brief Get the display currently associated with the mouse - * @return A pointer to the display - * - * @param[in] instance The ID of the mouse input instance - */ - GDisplay *ginputGetMouseDisplay(unsigned instance); - - /** - * @brief Get the current mouse position and button status - * @note Unlinke a listener event, this status cannot record meta events such as - * "CLICK". - * - * @param[in] instance The ID of the mouse input instance - * @param[in] pmouse The mouse event - * - * @return FALSE on an error (eg. invalid instance) - */ - bool_t ginputGetMouseStatus(unsigned instance, GEventMouse *pmouse); - - /** - * @brief Performs a calibration - * - * @param[in] instance The ID of the mouse input instance - * - * @return The calibration error squared if calibration fails, or 0 on success or if the driver dosen't need calibration. - * @note An invalid instance will also return 0. - */ - uint32_t ginputCalibrateMouse(unsigned instance); - - /** - * @brief Load a set of mouse calibration data - * @return A pointer to the data or NULL on failure - * - * @param[in] instance The mouse input instance number - * @param[in] data Where the data should be placed - * @param[in] sz The size in bytes of the data to retrieve. - * - * @note This routine is provided by the user application. It is only - * called if GINPUT_TOUCH_USER_CALIBRATION_LOAD has been set to GFXON in the - * users gfxconf.h file. - */ - bool_t LoadMouseCalibration(unsigned instance, void *data, size_t sz); - - /** - * @brief Save a set of mouse calibration data - * @return TRUE if the save operation was successful. - * - * @param[in] instance The mouse input instance number - * @param[in] data The data to save - * @param[in] sz The size in bytes of the data to retrieve. - * - * @note This routine is provided by the user application. It is only - * called if GINPUT_TOUCH_USER_CALIBRATION_SAVE has been set to GFXON in the - * users gfxconf.h file. - */ - bool_t SaveMouseCalibration(unsigned instance, const void *data, size_t sz); - -#ifdef __cplusplus -} -#endif +/** + * @brief Get the Source handler for a mouse using the instance number + * + * @param[in] instance The mouse instance number + * + * @return The source handle of the mouse or NULL + * @note You can use the special value of GMOUSE_ALL_INSTANCES to + * get a source handle that returns events for all mice rather + * than a specific mouse. Using GMOUSE_ALL_INSTANCES will always + * return a valid spurce handle even if there are currently no mice + * in the system. + */ +GSourceHandle ginputGetMouse(unsigned instance); + +/** + * @brief Should this device be in Pen mode or Finger mode + * @note A touch device (and even theoritically a mouse) can operate + * in either pen or finger mode. In finger mode typically a + * touch device will be far more tolerant of movement and other + * inaccuracies. Each driver specifies its own tolerances for + * pen versus finger mode. + * + * @param[in] instance The ID of the mouse input instance + * @param[in] on If true then finger mode is turned on. + */ +void ginputSetFingerMode(unsigned instance, gBool on); + +/** + * @brief Assign the display associated with the mouse + * @note This only needs to be called if the mouse is associated with a display + * other than the current default display. It must be called before + * @p ginputGetMouse() if the new display is to be used during the calibration + * process. Other than calibration the display is used for range checking, + * and may also be used to display a mouse pointer. + * + * @param[in] instance The ID of the mouse input instance + * @param[in] g The GDisplay to which this mouse belongs + */ +void ginputSetMouseDisplay(unsigned instance, GDisplay *g); + +/** + * @brief Get the display currently associated with the mouse + * @return A pointer to the display + * + * @param[in] instance The ID of the mouse input instance + */ +GDisplay *ginputGetMouseDisplay(unsigned instance); + +/** + * @brief Get the current mouse position and button status + * @note Unlinke a listener event, this status cannot record meta events such as + * "CLICK". + * + * @param[in] instance The ID of the mouse input instance + * @param[in] pmouse The mouse event + * + * @return gFalse on an error (eg. invalid instance) + */ +gBool ginputGetMouseStatus(unsigned instance, GEventMouse *pmouse); + +/** + * @brief Performs a calibration + * + * @param[in] instance The ID of the mouse input instance + * + * @return The calibration error squared if calibration fails, or 0 on success or if the driver dosen't need calibration. + * @note An invalid instance will also return 0. + */ +uint32_t ginputCalibrateMouse(unsigned instance); + +/** + * @brief Load a set of mouse calibration data + * @return A pointer to the data or NULL on failure + * + * @param[in] instance The mouse input instance number + * @param[in] data Where the data should be placed + * @param[in] sz The size in bytes of the data to retrieve. + * + * @note This routine is provided by the user application. It is only + * called if GINPUT_TOUCH_USER_CALIBRATION_LOAD has been set to GFXON in the + * users gfxconf.h file. + */ +gBool LoadMouseCalibration(unsigned instance, void *data, size_t sz); + +/** + * @brief Save a set of mouse calibration data + * @return gTrue if the save operation was successful. + * + * @param[in] instance The mouse input instance number + * @param[in] data The data to save + * @param[in] sz The size in bytes of the data to retrieve. + * + * @note This routine is provided by the user application. It is only + * called if GINPUT_TOUCH_USER_CALIBRATION_SAVE has been set to GFXON in the + * users gfxconf.h file. + */ +gBool SaveMouseCalibration(unsigned instance, const void *data, size_t sz); #endif /* GINPUT_NEED_MOUSE */ diff --git a/src/ginput/ginput_toggle.c b/src/ginput/ginput_toggle.c index eb65d6e0..592d6b18 100644 --- a/src/ginput/ginput_toggle.c +++ b/src/ginput/ginput_toggle.c @@ -71,14 +71,14 @@ static void TogglePoll(void *param) { if ((psl->listenflags & GLISTEN_TOGGLE_ON)) { pe->type = GEVENT_TOGGLE; pe->instance = i; - pe->on = TRUE; + pe->on = gTrue; geventSendEvent(psl); } } else { if ((psl->listenflags & GLISTEN_TOGGLE_OFF)) { pe->type = GEVENT_TOGGLE; pe->instance = i; - pe->on = FALSE; + pe->on = gFalse; geventSendEvent(psl); } } @@ -102,7 +102,7 @@ GSourceHandle ginputGetToggle(uint16_t instance) { if (!gtimerIsActive(&ToggleTimer)) { for(ptc = GInputToggleConfigTable; ptc < GInputToggleConfigTable+sizeof(GInputToggleConfigTable)/sizeof(GInputToggleConfigTable[0]); ptc++) ginput_lld_toggle_init(ptc); - gtimerStart(&ToggleTimer, TogglePoll, 0, TRUE, GINPUT_TOGGLE_POLL_PERIOD); + gtimerStart(&ToggleTimer, TogglePoll, 0, gTrue, GINPUT_TOGGLE_POLL_PERIOD); } // OK - return this input @@ -110,7 +110,7 @@ GSourceHandle ginputGetToggle(uint16_t instance) { } // If invert is true, invert the on/off sense for the toggle -void ginputInvertToggle(uint16_t instance, bool_t invert) { +void ginputInvertToggle(uint16_t instance, gBool invert) { if (instance >= GINPUT_TOGGLE_NUM_PORTS) return; if (invert) { @@ -127,19 +127,19 @@ void ginputInvertToggle(uint16_t instance, bool_t invert) { } /* Get the current toggle status. - * Returns FALSE on error (eg invalid instance) + * Returns gFalse on error (eg invalid instance) */ -bool_t ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle) { +gBool ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle) { // Win32 threads don't seem to recognise priority and/or pre-emption // so we add a sleep here to prevent 100% polled applications from locking up. gfxSleepMilliseconds(1); if (instance >= GINPUT_TOGGLE_NUM_PORTS) - return FALSE; + return gFalse; ptoggle->type = GEVENT_TOGGLE; ptoggle->instance = instance; - ptoggle->on = (ToggleStatus[instance].status & GINPUT_TOGGLE_ISON) ? TRUE : FALSE; - return TRUE; + ptoggle->on = (ToggleStatus[instance].status & GINPUT_TOGGLE_ISON) ? gTrue : gFalse; + return gTrue; } /* Wake up the mouse driver from an interrupt service routine (there may be new readings available) */ diff --git a/src/ginput/ginput_toggle.h b/src/ginput/ginput_toggle.h index 7d028301..a8719db6 100644 --- a/src/ginput/ginput_toggle.h +++ b/src/ginput/ginput_toggle.h @@ -48,7 +48,7 @@ typedef struct GEventToggle_t { GEventType type; // The type of this event (GEVENT_TOGGLE) uint16_t instance; // The toggle instance - bool_t on; // True if the toggle/button is on + gBool on; // True if the toggle/button is on } GEventToggle; // Toggle Listen Flags - passed to geventAddSourceToListener() @@ -59,40 +59,32 @@ typedef struct GEventToggle_t { /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif +/** + * @brief Create a toggle input instance + * + * @param[in] instance The ID of the toggle input instance (from 0 to 9999) + * + * @return The source handle of the created instance + */ +GSourceHandle ginputGetToggle(uint16_t instance); - /** - * @brief Create a toggle input instance - * - * @param[in] instance The ID of the toggle input instance (from 0 to 9999) - * - * @return The source handle of the created instance - */ - GSourceHandle ginputGetToggle(uint16_t instance); - - /** - * @brief Can be used to invert the sense of a toggle - * - * @param[in] instance The ID of the toggle input instance - * @param[in] invert If TRUE, will be inverted - */ - void ginputInvertToggle(uint16_t instance, bool_t invert); - - /** - * @brief Get the current toggle status - * - * @param[in] instance The ID of the toggle input instance - * @param[in] ptoggle The toggle event struct - * - * @return Returns FALSE on an error (eg invalid instance) - */ - bool_t ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle); - -#ifdef __cplusplus -} -#endif +/** + * @brief Can be used to invert the sense of a toggle + * + * @param[in] instance The ID of the toggle input instance + * @param[in] invert If gTrue, will be inverted + */ +void ginputInvertToggle(uint16_t instance, gBool invert); + +/** + * @brief Get the current toggle status + * + * @param[in] instance The ID of the toggle input instance + * @param[in] ptoggle The toggle event struct + * + * @return Returns gFalse on an error (eg invalid instance) + */ +gBool ginputGetToggleStatus(uint16_t instance, GEventToggle *ptoggle); #endif /* GINPUT_NEED_TOGGLE */ |