2012-08-13 02:12:42 +00:00
|
|
|
/*
|
2012-09-26 18:18:18 +00:00
|
|
|
ChibiOS/GFX - Copyright (C) 2012
|
2012-08-13 02:12:42 +00:00
|
|
|
Joel Bodenmann aka Tectu <joel@unormal.org>
|
|
|
|
|
2012-09-24 22:19:10 +00:00
|
|
|
This file is part of ChibiOS/GFX.
|
2012-08-13 02:12:42 +00:00
|
|
|
|
2012-09-24 22:19:10 +00:00
|
|
|
ChibiOS/GFX is free software; you can redistribute it and/or modify
|
2012-08-13 02:12:42 +00:00
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
2012-09-24 22:19:10 +00:00
|
|
|
ChibiOS/GFX is distributed in the hope that it will be useful,
|
2012-08-13 02:12:42 +00:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file touchpad.h
|
|
|
|
* @brief TOUCHPAD Touchpad Driver subsystem header file.
|
|
|
|
*
|
|
|
|
* @addgroup TOUCHPAD
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
#ifndef _TOUCHPAD_H
|
|
|
|
#define _TOUCHPAD_H
|
|
|
|
|
2012-10-20 23:47:11 +00:00
|
|
|
#if GFX_USE_TOUCHPAD || defined(__DOXYGEN__)
|
2012-08-13 02:12:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief specifies how many conversions are made for a readout.
|
|
|
|
*
|
|
|
|
* @note higher is more accurate, but takes more time
|
|
|
|
*/
|
|
|
|
#define CONVERSIONS 3
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Driver constants. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Low Level Driver details and error checks. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/* Include the low level driver information */
|
|
|
|
#include "touchpad_lld.h"
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Type definitions */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Struct used for calibration
|
|
|
|
*/
|
2012-10-10 11:46:18 +00:00
|
|
|
typedef struct cal_t {
|
2012-08-13 02:12:42 +00:00
|
|
|
float xm;
|
|
|
|
float ym;
|
|
|
|
float xn;
|
|
|
|
float yn;
|
2012-10-10 11:46:18 +00:00
|
|
|
} cal_t;
|
2012-08-13 02:12:42 +00:00
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* External declarations. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-10-12 23:05:20 +00:00
|
|
|
void tpInit(const TOUCHPADDriver *tp);
|
2012-08-13 02:12:42 +00:00
|
|
|
uint16_t tpReadX(void);
|
|
|
|
uint16_t tpReadY(void);
|
2012-09-07 20:57:35 +00:00
|
|
|
void tpCalibrate(void);
|
2012-08-13 02:12:42 +00:00
|
|
|
|
|
|
|
#if TOUCHPAD_HAS_IRQ
|
|
|
|
uint8_t tpIRQ(void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if TOUCHPAD_HAS_PRESSURE
|
|
|
|
uint16_t tpReadZ(void);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-10-20 23:47:11 +00:00
|
|
|
#endif /* GFX_USE_TOUCHPAD */
|
2012-08-13 02:12:42 +00:00
|
|
|
|
|
|
|
#endif /* _TOUCHPAD_H */
|
|
|
|
/** @} */
|
|
|
|
|