added tpIRQ()

ugfx_release_2.6
Tectu 2012-08-09 03:30:45 +02:00
parent 956f612544
commit 03c27adb1c
5 changed files with 42 additions and 4 deletions

View File

@ -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.

View File

@ -35,6 +35,7 @@
/* Driver hardware support. */
/*===========================================================================*/
#define TOUCHPAD_HAS_IRQ TRUE
#define TOUCHPAD_HAS_PRESSURE TRUE
#endif /* HAL_USE_TOUCHPAD */

View File

@ -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);

View File

@ -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

View File

@ -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.
*