diff options
author | Tectu <joel@unormal.org> | 2012-08-09 03:30:45 +0200 |
---|---|---|
committer | Tectu <joel@unormal.org> | 2012-08-09 03:30:45 +0200 |
commit | 03c27adb1c86d37548e695fd89937f01ed528954 (patch) | |
tree | c54b69bdc63a1011be0cd513f4a06ec5b237a115 /halext | |
parent | 956f6125446cd73fc839a58a999dbe57e5a35e97 (diff) | |
download | uGFX-03c27adb1c86d37548e695fd89937f01ed528954.tar.gz uGFX-03c27adb1c86d37548e695fd89937f01ed528954.tar.bz2 uGFX-03c27adb1c86d37548e695fd89937f01ed528954.zip |
added tpIRQ()
Diffstat (limited to 'halext')
-rw-r--r-- | halext/drivers/touchpad/touchpadXPT2046/touchpad_lld.c | 13 | ||||
-rw-r--r-- | halext/drivers/touchpad/touchpadXPT2046/touchpad_lld_config.h | 1 | ||||
-rw-r--r-- | halext/include/touchpad.h | 5 | ||||
-rw-r--r-- | halext/include/touchpad_lld.h | 10 | ||||
-rw-r--r-- | halext/src/touchpad.c | 17 |
5 files changed, 42 insertions, 4 deletions
diff --git a/halext/drivers/touchpad/touchpadXPT2046/touchpad_lld.c b/halext/drivers/touchpad/touchpadXPT2046/touchpad_lld.c index f85a68d9..d44d7212 100644 --- a/halext/drivers/touchpad/touchpadXPT2046/touchpad_lld.c +++ b/halext/drivers/touchpad/touchpadXPT2046/touchpad_lld.c @@ -134,6 +134,19 @@ uint16_t tp_lld_read_y(void) { }
/* ---- Optional Routines ---- */
+#if TOUCHPAD_HAS_IRQ || defined(__DOXYGEN__)
+ /*
+ * @brief for checking if touchpad is pressed or not.
+ *
+ * @return 1 if pressed / 0 if not pressed
+ *
+ * @noapi
+ */
+ uint8_t tp_lld_irq(void) {
+ return (!palReadPad(TP_IRQ_PORT, TP_IRQ));
+ }
+#endif
+
#if TOUCHPAD_HAS_PRESSURE || defined(__DOXYGEN__)
/*
* @brief Reads out the Z direction / pressure.
diff --git a/halext/drivers/touchpad/touchpadXPT2046/touchpad_lld_config.h b/halext/drivers/touchpad/touchpadXPT2046/touchpad_lld_config.h index 17f33dd4..399117f9 100644 --- a/halext/drivers/touchpad/touchpadXPT2046/touchpad_lld_config.h +++ b/halext/drivers/touchpad/touchpadXPT2046/touchpad_lld_config.h @@ -35,6 +35,7 @@ /* Driver hardware support. */
/*===========================================================================*/
+#define TOUCHPAD_HAS_IRQ TRUE
#define TOUCHPAD_HAS_PRESSURE TRUE
#endif /* HAL_USE_TOUCHPAD */
diff --git a/halext/include/touchpad.h b/halext/include/touchpad.h index 4f9dce1a..445d3202 100644 --- a/halext/include/touchpad.h +++ b/halext/include/touchpad.h @@ -73,7 +73,10 @@ extern "C" { void tpInit(TOUCHPADDriver *tp); uint16_t tpReadX(void); uint16_t tpReadY(void); -void tpCalibrate(void); + +#if TOUCHPAD_HAS_IRQ + uint8_t tpIRQ(void); +#endif #if TOUCHPAD_HAS_PRESSURE uint16_t tpReadZ(void); diff --git a/halext/include/touchpad_lld.h b/halext/include/touchpad_lld.h index 7b33f366..c0339e05 100644 --- a/halext/include/touchpad_lld.h +++ b/halext/include/touchpad_lld.h @@ -41,6 +41,10 @@ /* Error checks. */ /*===========================================================================*/ +#ifndef TOUCHPAD_HAS_IRQ + #define TOUCHPAD_HAS_IRQ FALSE +#endif + #ifndef TOUCHPAD_HAS_PRESSURE #define TOUCHPAD_HAS_PRESSURE FALSE #endif @@ -79,7 +83,11 @@ extern "C" { uint16_t tp_lld_read_x(void); uint16_t tp_lld_read_y(void); - #if TOUCHPAD_PRESSURE + #if TOUCHPAD_HAS_IRQ + uint8_t tp_lld_irq(void); + #endif + + #if TOUCHPAD_HAS_PRESSURE uint16_t tp_lld_read_z(void); #endif diff --git a/halext/src/touchpad.c b/halext/src/touchpad.c index 7f7c87f6..2b51504a 100644 --- a/halext/src/touchpad.c +++ b/halext/src/touchpad.c @@ -107,7 +107,7 @@ static uint16_t _tpReadRealY(void) { * @note This function is NOT currently implicitly invoked by @p halInit(). * It must be called manually. * - * @init + * @api */ void tpInit(TOUCHPADDriver *tp) { /* Initialise Mutex */ @@ -177,7 +177,20 @@ uint16_t tpReadY(void) { return y; } -#if TOUCHPAD_PRESSURE || defined(__DOXYGEN__) +#if TOUCHPAD_HAS_IRQ || defined(__DOXYGEN__) + /** + * @brief returns if touchpad is pressed or not + * + * @return 1 if pressed, 0 otherwise + * + * @api + */ + uint8_t tpIRQ(void) { + return tp_lld_irq(); + } +#endif + +#if TOUCHPAD_HAS_PRESSURE || defined(__DOXYGEN__) /** * @brief Get the pressure. * |