From df8cfae7a0039ec269c6308d19e44774cde1c2fa Mon Sep 17 00:00:00 2001 From: Tectu Date: Mon, 11 Jun 2012 13:23:57 +0200 Subject: Revert "added ads7843 lld functions" This reverts commit 163a42e48eae8f611075d88a6151ffc6dd343bba. --- touchpad.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'touchpad.c') diff --git a/touchpad.c b/touchpad.c index 611bd6bc..6f786f77 100644 --- a/touchpad.c +++ b/touchpad.c @@ -17,11 +17,37 @@ void tpInit(SPIDriver *spip) { } static __inline uint16_t readX(void) { - return lld_readX(); + 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; } static __inline uint16_t readY(void) { - return lld_readY(); + 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; } uint8_t tpIRQ(void) { -- cgit v1.2.3