From 72d994626f750a86a7a92b2c7ef87a3cceededb3 Mon Sep 17 00:00:00 2001 From: Tectu Date: Tue, 14 Aug 2012 02:12:59 +0200 Subject: removed touchpad prefix on touchpad drivers --- docs/usage.txt | 2 +- drivers/touchpad/ADS7843/readme.txt | 9 ++ drivers/touchpad/ADS7843/touchpad_lld.c | 146 +++++++++++++++++++ drivers/touchpad/ADS7843/touchpad_lld.mk | 6 + drivers/touchpad/ADS7843/touchpad_lld_config.h | 44 ++++++ drivers/touchpad/XPT2046/readme.txt | 9 ++ drivers/touchpad/XPT2046/touchpad_lld.c | 158 +++++++++++++++++++++ drivers/touchpad/XPT2046/touchpad_lld.mk | 6 + drivers/touchpad/XPT2046/touchpad_lld_config.h | 44 ++++++ drivers/touchpad/touchpadADS7843/readme.txt | 9 -- drivers/touchpad/touchpadADS7843/touchpad_lld.c | 146 ------------------- drivers/touchpad/touchpadADS7843/touchpad_lld.mk | 6 - .../touchpad/touchpadADS7843/touchpad_lld_config.h | 44 ------ drivers/touchpad/touchpadXPT2046/readme.txt | 9 -- drivers/touchpad/touchpadXPT2046/touchpad_lld.c | 158 --------------------- drivers/touchpad/touchpadXPT2046/touchpad_lld.mk | 6 - .../touchpad/touchpadXPT2046/touchpad_lld_config.h | 44 ------ 17 files changed, 423 insertions(+), 423 deletions(-) create mode 100644 drivers/touchpad/ADS7843/readme.txt create mode 100644 drivers/touchpad/ADS7843/touchpad_lld.c create mode 100644 drivers/touchpad/ADS7843/touchpad_lld.mk create mode 100644 drivers/touchpad/ADS7843/touchpad_lld_config.h create mode 100644 drivers/touchpad/XPT2046/readme.txt create mode 100644 drivers/touchpad/XPT2046/touchpad_lld.c create mode 100644 drivers/touchpad/XPT2046/touchpad_lld.mk create mode 100644 drivers/touchpad/XPT2046/touchpad_lld_config.h delete mode 100644 drivers/touchpad/touchpadADS7843/readme.txt delete mode 100644 drivers/touchpad/touchpadADS7843/touchpad_lld.c delete mode 100644 drivers/touchpad/touchpadADS7843/touchpad_lld.mk delete mode 100644 drivers/touchpad/touchpadADS7843/touchpad_lld_config.h delete mode 100644 drivers/touchpad/touchpadXPT2046/readme.txt delete mode 100644 drivers/touchpad/touchpadXPT2046/touchpad_lld.c delete mode 100644 drivers/touchpad/touchpadXPT2046/touchpad_lld.mk delete mode 100644 drivers/touchpad/touchpadXPT2046/touchpad_lld_config.h diff --git a/docs/usage.txt b/docs/usage.txt index 52222ddc..961fa2c6 100644 --- a/docs/usage.txt +++ b/docs/usage.txt @@ -8,7 +8,7 @@ To include any of these functions/drivers in your project... 3/ Add $(LCDSRC) and $(LCDINC) to your SRCS and INCDIR of your projects Makefile 4/ In your project Makefile add the makefiles for any specific drivers you want e.g - include $(LCDLIB)/halext/drivers/touchpad/touchpadXPT2046/touchpad_lld.mk + include $(LCDLIB)/halext/drivers/touchpad/XPT2046/touchpad_lld.mk include $(LCDLIB)/halext/drivers/gdisp/Nokia6610/gdisp_lld.mk 5/ In your project halconf.h turn on the support you want eg. diff --git a/drivers/touchpad/ADS7843/readme.txt b/drivers/touchpad/ADS7843/readme.txt new file mode 100644 index 00000000..34a57bc0 --- /dev/null +++ b/drivers/touchpad/ADS7843/readme.txt @@ -0,0 +1,9 @@ +To use this driver: + +1. Add in your halconf.h: + a) #define HAL_USE_TOUCHPAD TRUE + +2. To your makefile add the following lines: + include $(LCDLIB)/lcd.mk + include $(LCDLIB)/halext/drivers/touchpad/touchpadADS7843/touchpad_lld.mk + diff --git a/drivers/touchpad/ADS7843/touchpad_lld.c b/drivers/touchpad/ADS7843/touchpad_lld.c new file mode 100644 index 00000000..8fc334b2 --- /dev/null +++ b/drivers/touchpad/ADS7843/touchpad_lld.c @@ -0,0 +1,146 @@ +/* + ChibiOS-LCD-Driver - Copyright (C) 2012 + Joel Bodenmann aka Tectu + + This file is part of ChibiOS-LCD-Driver. + + ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify + 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. + + ChibiOS-LCD-Driver is distributed in the hope that it will be useful, + 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 . +*/ + +/** + * @file touchpadADS7843/touchpad_lld.c + * @brief Touchpad Driver subsystem low level driver source. + * + * @addtogroup TOUCHPAD + * @{ + */ + +#include "ch.h" +#include "hal.h" +#include "touchpad.h" + +#if HAL_USE_TOUCHPAD || defined(__DOXYGEN__) + +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + +#define TP_CS_HIGH palSetPad(TP_CS_PORT, TP_CS) +#define TP_CS_LOW palClearPad(TP_CS_PORT, TP_CS) + +#ifdef UNUSED +#elif defined(__GNUC__) +# define UNUSED(x) UNUSED_ ## x __attribute__((unused)) +#elif defined(__LCLINT__) +# define UNUSED(x) /*@unused@*/ x +#else +# define UNUSED(x) x +#endif + +/*===========================================================================*/ +/* Driver exported variables. */ +/*===========================================================================*/ + +#if !defined(__DOXYGEN__) + TOUCHPADDriver Touchpad; +#endif + +/*===========================================================================*/ +/* Driver local variables. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver local functions. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver interrupt handlers. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver exported functions. */ +/*===========================================================================*/ + +/* ---- Required Routines ---- */ + +/** + * @brief Low level Touchpad driver initialization. + * + * @notapi + */ +void tp_lld_init(TOUCHPADDriver *tp) { + spiStart(tp->spid, tp->spicfg); +} + +/** + * @brief Reads out the X direction. + * + * @notapi + */ +uint16_t tp_lld_read_x(void) { + uint8_t txbuf[1]; + uint8_t rxbuf[2]; + uint16_t x; + + txbuf[0] = 0xd0; + TP_CS_LOW; + spiSend(&SPID1, 1, txbuf); + spiReceive(&SPID1, 2, rxbuf); + TP_CS_HIGH; + + x = rxbuf[0] << 4; + x |= rxbuf[1] >> 4; + + return x; +} + +/* + * @brief Reads out the Y direction. + * + * @notapi + */ +uint16_t tp_lld_read_y(void) { + uint8_t txbuf[1]; + uint8_t rxbuf[2]; + uint16_t y; + + txbuf[0] = 0x90; + TP_CS_LOW; + spiSend(&SPID1, 1, txbuf); + spiReceive(&SPID1, 2, rxbuf); + TP_CS_HIGH; + + y = rxbuf[0] << 4; + y |= rxbuf[1] >> 4; + + return y; +} + +/* ---- 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 + +#endif /* HAL_USE_TOUCHPAD */ +/** @} */ + diff --git a/drivers/touchpad/ADS7843/touchpad_lld.mk b/drivers/touchpad/ADS7843/touchpad_lld.mk new file mode 100644 index 00000000..b17b1726 --- /dev/null +++ b/drivers/touchpad/ADS7843/touchpad_lld.mk @@ -0,0 +1,6 @@ +# List the required driver. +LCDSRC += $(LCDLIB)/drivers/touchpad/ADS7843/touchpad_lld.c + +# Required include directories +LCDINC += $(LCDLIB)/drivers/touchpad/ADS7843 + diff --git a/drivers/touchpad/ADS7843/touchpad_lld_config.h b/drivers/touchpad/ADS7843/touchpad_lld_config.h new file mode 100644 index 00000000..1e878795 --- /dev/null +++ b/drivers/touchpad/ADS7843/touchpad_lld_config.h @@ -0,0 +1,44 @@ +/* + ChibiOS-LCD-Driver - Copyright (C) 2012 + Joel Bodenmann aka Tectu + + This file is part of ChibiOS-LCD-Driver. + + ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify + 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. + + ChibiOS-LCD-Driver is distributed in the hope that it will be useful, + 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 . +*/ + +/** + * @file touchpadADS7843/touchpad_lld_config.h + * @brief Touchpad Driver subsystem low level driver. + * + * @addtogroup TOUCHPAD + * @{ + */ + +#ifndef _TOUCHPAD_LLD_CONFIG_H +#define _TOUCHPAD_LLD_CONFIG_H + +#if HAL_USE_TOUCHPAD || defined(__DOXYGEN__) + +/*===========================================================================*/ +/* Driver hardware support. */ +/*===========================================================================*/ + +#define TOUCHPAD_HAS_IRQ TRUE +#define TOUCHPAD_HAS_PRESSURE FALSE + +#endif /* HAL_USE_TOUCHPAD */ + +#endif /* _TOUCHPAD_LLD_CONFIG_H */ +/** @} */ diff --git a/drivers/touchpad/XPT2046/readme.txt b/drivers/touchpad/XPT2046/readme.txt new file mode 100644 index 00000000..992d346d --- /dev/null +++ b/drivers/touchpad/XPT2046/readme.txt @@ -0,0 +1,9 @@ +To use this driver: + +1. Add in your halconf.h: + a) #define HAL_USE_TOUCHPAD TRUE + +2. To your makefile add the following lines: + include $(LCDLIB)/lcd.mk + include $(LCDLIB)/halext/drivers/touchpad/touchpadXPT2046/touchpad_lld.mk + diff --git a/drivers/touchpad/XPT2046/touchpad_lld.c b/drivers/touchpad/XPT2046/touchpad_lld.c new file mode 100644 index 00000000..24afcab4 --- /dev/null +++ b/drivers/touchpad/XPT2046/touchpad_lld.c @@ -0,0 +1,158 @@ +/* + ChibiOS-LCD-Driver - Copyright (C) 2012 + Joel Bodenmann aka Tectu + + This file is part of ChibiOS-LCD-Driver. + + ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify + 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. + + ChibiOS-LCD-Driver is distributed in the hope that it will be useful, + 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 . +*/ + +/** + * @file touchpadXPT2046/touchpad_lld.c + * @brief Touchpad Driver subsystem low level driver source. + * + * @addtogroup TOUCHPAD + * @{ + */ + +#include "ch.h" +#include "hal.h" +#include "touchpad.h" + +#if HAL_USE_TOUCHPAD || defined(__DOXYGEN__) + +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + +#define TP_CS_HIGH palSetPad(TP_CS_PORT, TP_CS) +#define TP_CS_LOW palClearPad(TP_CS_PORT, TP_CS) + +#ifdef UNUSED +#elif defined(__GNUC__) +# define UNUSED(x) UNUSED_ ## x __attribute__((unused)) +#elif defined(__LCLINT__) +# define UNUSED(x) /*@unused@*/ x +#else +# define UNUSED(x) x +#endif + +/*===========================================================================*/ +/* Driver exported variables. */ +/*===========================================================================*/ + +#if !defined(__DOXYGEN__) + TOUCHPADDriver Touchpad; +#endif + +/*===========================================================================*/ +/* Driver local variables. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver local functions. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver interrupt handlers. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver exported functions. */ +/*===========================================================================*/ + +/* ---- Required Routines ---- */ + +/** + * @brief Low level Touchpad driver initialization. + * + * @notapi + */ +void tp_lld_init(TOUCHPADDriver *tp) { + spiStart(tp->spid, tp->spicfg); +} + +/** + * @brief Reads out the X direction. + * + * @notapi + */ +uint16_t tp_lld_read_x(void) { + uint8_t txbuf[1]; + uint8_t rxbuf[2]; + uint16_t x; + + txbuf[0] = 0xd0; + TP_CS_LOW; + spiSend(&SPID1, 1, txbuf); + spiReceive(&SPID1, 2, rxbuf); + TP_CS_HIGH; + + x = rxbuf[0] << 4; + x |= rxbuf[1] >> 4; + + return x; +} + +/* + * @brief Reads out the Y direction. + * + * @notapi + */ +uint16_t tp_lld_read_y(void) { + uint8_t txbuf[1]; + uint8_t rxbuf[2]; + uint16_t y; + + txbuf[0] = 0x90; + TP_CS_LOW; + spiSend(&SPID1, 1, txbuf); + spiReceive(&SPID1, 2, rxbuf); + TP_CS_HIGH; + + y = rxbuf[0] << 4; + y |= rxbuf[1] >> 4; + + return y; +} + +/* ---- 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 + * + * @notapi + */ + 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. + * + * @notapi + */ + uint16_t tp_lld_read_z(void) { + /* ToDo */ + return 42; + } +#endif + +#endif /* HAL_USE_TOUCHPAD */ +/** @} */ + diff --git a/drivers/touchpad/XPT2046/touchpad_lld.mk b/drivers/touchpad/XPT2046/touchpad_lld.mk new file mode 100644 index 00000000..362fb452 --- /dev/null +++ b/drivers/touchpad/XPT2046/touchpad_lld.mk @@ -0,0 +1,6 @@ +# List the required driver. +LCDSRC += $(LCDLIB)/drivers/touchpad/XPT2046/touchpad_lld.c + +# Required include directories +LCDINC += $(LCDLIB)/drivers/touchpad/XPT2046 + diff --git a/drivers/touchpad/XPT2046/touchpad_lld_config.h b/drivers/touchpad/XPT2046/touchpad_lld_config.h new file mode 100644 index 00000000..4ddd8da0 --- /dev/null +++ b/drivers/touchpad/XPT2046/touchpad_lld_config.h @@ -0,0 +1,44 @@ +/* + ChibiOS-LCD-Driver - Copyright (C) 2012 + Joel Bodenmann aka Tectu + + This file is part of ChibiOS-LCD-Driver. + + ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify + 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. + + ChibiOS-LCD-Driver is distributed in the hope that it will be useful, + 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 . +*/ + +/** + * @file touchpadXPT2046/touchpad_lld_config.h + * @brief Touchppad Driver subsystem low level driver. + * + * @addtogroup TOUCHPAD + * @{ + */ + +#ifndef _TOUCHPAD_LLD_CONFIG_H +#define _TOUCHPAD_LLD_CONFIG_H + +#if HAL_USE_TOUCHPAD || defined(__DOXYGEN__) + +/*===========================================================================*/ +/* Driver hardware support. */ +/*===========================================================================*/ + +#define TOUCHPAD_HAS_IRQ TRUE +#define TOUCHPAD_HAS_PRESSURE TRUE + +#endif /* HAL_USE_TOUCHPAD */ + +#endif /* _TOUCHPAD_LLD_CONFIG_H */ +/** @} */ diff --git a/drivers/touchpad/touchpadADS7843/readme.txt b/drivers/touchpad/touchpadADS7843/readme.txt deleted file mode 100644 index 34a57bc0..00000000 --- a/drivers/touchpad/touchpadADS7843/readme.txt +++ /dev/null @@ -1,9 +0,0 @@ -To use this driver: - -1. Add in your halconf.h: - a) #define HAL_USE_TOUCHPAD TRUE - -2. To your makefile add the following lines: - include $(LCDLIB)/lcd.mk - include $(LCDLIB)/halext/drivers/touchpad/touchpadADS7843/touchpad_lld.mk - diff --git a/drivers/touchpad/touchpadADS7843/touchpad_lld.c b/drivers/touchpad/touchpadADS7843/touchpad_lld.c deleted file mode 100644 index 8fc334b2..00000000 --- a/drivers/touchpad/touchpadADS7843/touchpad_lld.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - ChibiOS-LCD-Driver - Copyright (C) 2012 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS-LCD-Driver. - - ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify - 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. - - ChibiOS-LCD-Driver is distributed in the hope that it will be useful, - 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 . -*/ - -/** - * @file touchpadADS7843/touchpad_lld.c - * @brief Touchpad Driver subsystem low level driver source. - * - * @addtogroup TOUCHPAD - * @{ - */ - -#include "ch.h" -#include "hal.h" -#include "touchpad.h" - -#if HAL_USE_TOUCHPAD || defined(__DOXYGEN__) - -/*===========================================================================*/ -/* Driver local definitions. */ -/*===========================================================================*/ - -#define TP_CS_HIGH palSetPad(TP_CS_PORT, TP_CS) -#define TP_CS_LOW palClearPad(TP_CS_PORT, TP_CS) - -#ifdef UNUSED -#elif defined(__GNUC__) -# define UNUSED(x) UNUSED_ ## x __attribute__((unused)) -#elif defined(__LCLINT__) -# define UNUSED(x) /*@unused@*/ x -#else -# define UNUSED(x) x -#endif - -/*===========================================================================*/ -/* Driver exported variables. */ -/*===========================================================================*/ - -#if !defined(__DOXYGEN__) - TOUCHPADDriver Touchpad; -#endif - -/*===========================================================================*/ -/* Driver local variables. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Driver local functions. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Driver interrupt handlers. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Driver exported functions. */ -/*===========================================================================*/ - -/* ---- Required Routines ---- */ - -/** - * @brief Low level Touchpad driver initialization. - * - * @notapi - */ -void tp_lld_init(TOUCHPADDriver *tp) { - spiStart(tp->spid, tp->spicfg); -} - -/** - * @brief Reads out the X direction. - * - * @notapi - */ -uint16_t tp_lld_read_x(void) { - uint8_t txbuf[1]; - uint8_t rxbuf[2]; - uint16_t x; - - txbuf[0] = 0xd0; - TP_CS_LOW; - spiSend(&SPID1, 1, txbuf); - spiReceive(&SPID1, 2, rxbuf); - TP_CS_HIGH; - - x = rxbuf[0] << 4; - x |= rxbuf[1] >> 4; - - return x; -} - -/* - * @brief Reads out the Y direction. - * - * @notapi - */ -uint16_t tp_lld_read_y(void) { - uint8_t txbuf[1]; - uint8_t rxbuf[2]; - uint16_t y; - - txbuf[0] = 0x90; - TP_CS_LOW; - spiSend(&SPID1, 1, txbuf); - spiReceive(&SPID1, 2, rxbuf); - TP_CS_HIGH; - - y = rxbuf[0] << 4; - y |= rxbuf[1] >> 4; - - return y; -} - -/* ---- 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 - -#endif /* HAL_USE_TOUCHPAD */ -/** @} */ - diff --git a/drivers/touchpad/touchpadADS7843/touchpad_lld.mk b/drivers/touchpad/touchpadADS7843/touchpad_lld.mk deleted file mode 100644 index f70f0dd1..00000000 --- a/drivers/touchpad/touchpadADS7843/touchpad_lld.mk +++ /dev/null @@ -1,6 +0,0 @@ -# List the required driver. -LCDSRC += $(LCDLIB)/drivers/touchpad/touchpadADS7843/touchpad_lld.c - -# Required include directories -LCDINC += $(LCDLIB)/drivers/touchpad/touchpadADS7843 - diff --git a/drivers/touchpad/touchpadADS7843/touchpad_lld_config.h b/drivers/touchpad/touchpadADS7843/touchpad_lld_config.h deleted file mode 100644 index 1e878795..00000000 --- a/drivers/touchpad/touchpadADS7843/touchpad_lld_config.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - ChibiOS-LCD-Driver - Copyright (C) 2012 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS-LCD-Driver. - - ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify - 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. - - ChibiOS-LCD-Driver is distributed in the hope that it will be useful, - 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 . -*/ - -/** - * @file touchpadADS7843/touchpad_lld_config.h - * @brief Touchpad Driver subsystem low level driver. - * - * @addtogroup TOUCHPAD - * @{ - */ - -#ifndef _TOUCHPAD_LLD_CONFIG_H -#define _TOUCHPAD_LLD_CONFIG_H - -#if HAL_USE_TOUCHPAD || defined(__DOXYGEN__) - -/*===========================================================================*/ -/* Driver hardware support. */ -/*===========================================================================*/ - -#define TOUCHPAD_HAS_IRQ TRUE -#define TOUCHPAD_HAS_PRESSURE FALSE - -#endif /* HAL_USE_TOUCHPAD */ - -#endif /* _TOUCHPAD_LLD_CONFIG_H */ -/** @} */ diff --git a/drivers/touchpad/touchpadXPT2046/readme.txt b/drivers/touchpad/touchpadXPT2046/readme.txt deleted file mode 100644 index 992d346d..00000000 --- a/drivers/touchpad/touchpadXPT2046/readme.txt +++ /dev/null @@ -1,9 +0,0 @@ -To use this driver: - -1. Add in your halconf.h: - a) #define HAL_USE_TOUCHPAD TRUE - -2. To your makefile add the following lines: - include $(LCDLIB)/lcd.mk - include $(LCDLIB)/halext/drivers/touchpad/touchpadXPT2046/touchpad_lld.mk - diff --git a/drivers/touchpad/touchpadXPT2046/touchpad_lld.c b/drivers/touchpad/touchpadXPT2046/touchpad_lld.c deleted file mode 100644 index 24afcab4..00000000 --- a/drivers/touchpad/touchpadXPT2046/touchpad_lld.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - ChibiOS-LCD-Driver - Copyright (C) 2012 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS-LCD-Driver. - - ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify - 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. - - ChibiOS-LCD-Driver is distributed in the hope that it will be useful, - 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 . -*/ - -/** - * @file touchpadXPT2046/touchpad_lld.c - * @brief Touchpad Driver subsystem low level driver source. - * - * @addtogroup TOUCHPAD - * @{ - */ - -#include "ch.h" -#include "hal.h" -#include "touchpad.h" - -#if HAL_USE_TOUCHPAD || defined(__DOXYGEN__) - -/*===========================================================================*/ -/* Driver local definitions. */ -/*===========================================================================*/ - -#define TP_CS_HIGH palSetPad(TP_CS_PORT, TP_CS) -#define TP_CS_LOW palClearPad(TP_CS_PORT, TP_CS) - -#ifdef UNUSED -#elif defined(__GNUC__) -# define UNUSED(x) UNUSED_ ## x __attribute__((unused)) -#elif defined(__LCLINT__) -# define UNUSED(x) /*@unused@*/ x -#else -# define UNUSED(x) x -#endif - -/*===========================================================================*/ -/* Driver exported variables. */ -/*===========================================================================*/ - -#if !defined(__DOXYGEN__) - TOUCHPADDriver Touchpad; -#endif - -/*===========================================================================*/ -/* Driver local variables. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Driver local functions. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Driver interrupt handlers. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Driver exported functions. */ -/*===========================================================================*/ - -/* ---- Required Routines ---- */ - -/** - * @brief Low level Touchpad driver initialization. - * - * @notapi - */ -void tp_lld_init(TOUCHPADDriver *tp) { - spiStart(tp->spid, tp->spicfg); -} - -/** - * @brief Reads out the X direction. - * - * @notapi - */ -uint16_t tp_lld_read_x(void) { - uint8_t txbuf[1]; - uint8_t rxbuf[2]; - uint16_t x; - - txbuf[0] = 0xd0; - TP_CS_LOW; - spiSend(&SPID1, 1, txbuf); - spiReceive(&SPID1, 2, rxbuf); - TP_CS_HIGH; - - x = rxbuf[0] << 4; - x |= rxbuf[1] >> 4; - - return x; -} - -/* - * @brief Reads out the Y direction. - * - * @notapi - */ -uint16_t tp_lld_read_y(void) { - uint8_t txbuf[1]; - uint8_t rxbuf[2]; - uint16_t y; - - txbuf[0] = 0x90; - TP_CS_LOW; - spiSend(&SPID1, 1, txbuf); - spiReceive(&SPID1, 2, rxbuf); - TP_CS_HIGH; - - y = rxbuf[0] << 4; - y |= rxbuf[1] >> 4; - - return y; -} - -/* ---- 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 - * - * @notapi - */ - 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. - * - * @notapi - */ - uint16_t tp_lld_read_z(void) { - /* ToDo */ - return 42; - } -#endif - -#endif /* HAL_USE_TOUCHPAD */ -/** @} */ - diff --git a/drivers/touchpad/touchpadXPT2046/touchpad_lld.mk b/drivers/touchpad/touchpadXPT2046/touchpad_lld.mk deleted file mode 100644 index 26e27c1c..00000000 --- a/drivers/touchpad/touchpadXPT2046/touchpad_lld.mk +++ /dev/null @@ -1,6 +0,0 @@ -# List the required driver. -LCDSRC += $(LCDLIB)/drivers/touchpad/touchpadXPT2046/touchpad_lld.c - -# Required include directories -LCDINC += $(LCDLIB)/drivers/touchpad/touchpadXPT2046 - diff --git a/drivers/touchpad/touchpadXPT2046/touchpad_lld_config.h b/drivers/touchpad/touchpadXPT2046/touchpad_lld_config.h deleted file mode 100644 index 4ddd8da0..00000000 --- a/drivers/touchpad/touchpadXPT2046/touchpad_lld_config.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - ChibiOS-LCD-Driver - Copyright (C) 2012 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS-LCD-Driver. - - ChibiOS-LCD-Driver is free software; you can redistribute it and/or modify - 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. - - ChibiOS-LCD-Driver is distributed in the hope that it will be useful, - 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 . -*/ - -/** - * @file touchpadXPT2046/touchpad_lld_config.h - * @brief Touchppad Driver subsystem low level driver. - * - * @addtogroup TOUCHPAD - * @{ - */ - -#ifndef _TOUCHPAD_LLD_CONFIG_H -#define _TOUCHPAD_LLD_CONFIG_H - -#if HAL_USE_TOUCHPAD || defined(__DOXYGEN__) - -/*===========================================================================*/ -/* Driver hardware support. */ -/*===========================================================================*/ - -#define TOUCHPAD_HAS_IRQ TRUE -#define TOUCHPAD_HAS_PRESSURE TRUE - -#endif /* HAL_USE_TOUCHPAD */ - -#endif /* _TOUCHPAD_LLD_CONFIG_H */ -/** @} */ -- cgit v1.2.3