aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/touchpad
diff options
context:
space:
mode:
authorTectu <joel@unormal.org>2012-06-17 01:30:12 +0200
committerTectu <joel@unormal.org>2012-06-17 01:30:12 +0200
commitd4625a1e6a21640a4eed51bf4f6162e611aac5c4 (patch)
treef7bc602792c4ed5b799fe1c3e3813aee87cb00b4 /drivers/touchpad
parent49b3daab083a62ca96f73745fc415bbd78f6034e (diff)
downloaduGFX-d4625a1e6a21640a4eed51bf4f6162e611aac5c4.tar.gz
uGFX-d4625a1e6a21640a4eed51bf4f6162e611aac5c4.tar.bz2
uGFX-d4625a1e6a21640a4eed51bf4f6162e611aac5c4.zip
restructure
Diffstat (limited to 'drivers/touchpad')
-rw-r--r--drivers/touchpad/ads7843_lld.c43
-rw-r--r--drivers/touchpad/ads7843_lld.h15
-rw-r--r--drivers/touchpad/xpt2046_lld.c43
-rw-r--r--drivers/touchpad/xpt2046_lld.h15
4 files changed, 116 insertions, 0 deletions
diff --git a/drivers/touchpad/ads7843_lld.c b/drivers/touchpad/ads7843_lld.c
new file mode 100644
index 00000000..76e11123
--- /dev/null
+++ b/drivers/touchpad/ads7843_lld.c
@@ -0,0 +1,43 @@
+#include "ads7843_lld.h"
+
+#ifdef TOUCHPAD_USE_ADS7843
+
+__inline uint16_t lld_readX(void) {
+ uint8_t txbuf[1];
+ uint8_t rxbuf[2];
+ uint16_t x;
+
+ txbuf[0] = 0xd0;
+ SET_CS(0);
+ spiSend(&SPID1, 1, txbuf);
+ spiReceive(&SPID1, 2, rxbuf);
+ SET_CS(1);
+
+ x = rxbuf[0] << 4;
+ x |= rxbuf[1] >> 4;
+
+ return x;
+}
+
+__inline uint16_t lld_readY(void) {
+ uint8_t txbuf[1];
+ uint8_t rxbuf[2];
+ uint16_t y;
+
+ txbuf[0] = 0x90;
+ SET_CS(0);
+ spiSend(&SPID1, 1, txbuf);
+ spiReceive(&SPID1, 2, rxbuf);
+ SET_CS(1);
+
+ y = rxbuf[0] << 4;
+ y |= rxbuf[1] >> 4;
+
+ return y;
+}
+
+__inline uint16_t lld_readZ(void) {
+ return 0;
+}
+
+#endif
diff --git a/drivers/touchpad/ads7843_lld.h b/drivers/touchpad/ads7843_lld.h
new file mode 100644
index 00000000..388aacc8
--- /dev/null
+++ b/drivers/touchpad/ads7843_lld.h
@@ -0,0 +1,15 @@
+#ifndef ADS7843_LLD_H
+#define ADS7843_LLD_H
+
+#include "glcdconf.h"
+#include "touchpad.h"
+
+#ifdef TOUCHPAD_USE_ADS7843
+
+uint16_t lld_readX(void);
+uint16_t lld_readY(void);
+uint16_t lld_readZ(void);
+
+#endif
+#endif
+
diff --git a/drivers/touchpad/xpt2046_lld.c b/drivers/touchpad/xpt2046_lld.c
new file mode 100644
index 00000000..731ff8c5
--- /dev/null
+++ b/drivers/touchpad/xpt2046_lld.c
@@ -0,0 +1,43 @@
+#include "xpt2046_lld.h"
+
+#ifdef TOUCHPAD_USE_XPT2046
+
+__inline uint16_t lld_readX(void) {
+ uint8_t txbuf[1];
+ uint8_t rxbuf[2];
+ uint16_t x;
+
+ txbuf[0] = 0xd0;
+ SET_CS(0);
+ spiSend(&SPID1, 1, txbuf);
+ spiReceive(&SPID1, 2, rxbuf);
+ SET_CS(1);
+
+ x = rxbuf[0] << 4;
+ x |= rxbuf[1] >> 4;
+
+ return x;
+}
+
+__inline uint16_t lld_readY(void) {
+ uint8_t txbuf[1];
+ uint8_t rxbuf[2];
+ uint16_t y;
+
+ txbuf[0] = 0x90;
+ SET_CS(0);
+ spiSend(&SPID1, 1, txbuf);
+ spiReceive(&SPID1, 2, rxbuf);
+ SET_CS(1);
+
+ y = rxbuf[0] << 4;
+ y |= rxbuf[1] >> 4;
+
+ return y;
+}
+
+__inline uint16_t lld_readZ(void) {
+ return 0;
+}
+
+#endif
diff --git a/drivers/touchpad/xpt2046_lld.h b/drivers/touchpad/xpt2046_lld.h
new file mode 100644
index 00000000..ed7a0d09
--- /dev/null
+++ b/drivers/touchpad/xpt2046_lld.h
@@ -0,0 +1,15 @@
+#ifndef XPT2046_LLD_H
+#define XPT2046_LLD_H
+
+#include "glcdconf.h"
+#include "touchpad.h"
+
+#ifdef TOUCHPAD_USE_XPT2046
+
+uint16_t lld_readX(void);
+uint16_t lld_readY(void);
+uint16_t lld_readZ(void);
+
+#endif
+#endif
+