From 8bdfc52efed023b492c47bbfd5976db145074b55 Mon Sep 17 00:00:00 2001
From: Joel Bodenmann <joel@unormal.org>
Date: Tue, 27 Nov 2012 00:42:51 +0100
Subject: FireBull STM32F103 board file for GINPUT

---
 drivers/ginput/touch/ADS7843/ginput_lld_mouse.c       |  2 +-
 .../ginput_lld_mouse_board_firebull_stm32f103.h       | 19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/ginput/touch/ADS7843/ginput_lld_mouse.c b/drivers/ginput/touch/ADS7843/ginput_lld_mouse.c
index 57508171..9c1a582b 100644
--- a/drivers/ginput/touch/ADS7843/ginput_lld_mouse.c
+++ b/drivers/ginput/touch/ADS7843/ginput_lld_mouse.c
@@ -32,9 +32,9 @@
 #if (GFX_USE_GINPUT && GINPUT_NEED_MOUSE) /*|| defined(__DOXYGEN__)*/
 
 #include "gdisp.h" /* for coord_t */
+#include "gevent.h"
 #include "ginput/ginput_mouse.h" /* for GINPUT_TOUCH_PRESSED */
 #include "lld/ginput/mouse.h"
-#include "gevent.h"
 
 #if defined(GINPUT_MOUSE_USE_CUSTOM_BOARD) && GINPUT_MOUSE_USE_CUSTOM_BOARD
 	#include "ginput_lld_mouse_board.h"
diff --git a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h b/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h
index ea939858..cba9497d 100644
--- a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h
+++ b/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h
@@ -52,16 +52,15 @@ static __inline void init_board(void) {
  * @notapi
  */
 static __inline bool_t getpin_pressed(void) {
-	return;
+	return (!palReadPad(GPIOC, 4));
 }
-
 /**
  * @brief   Aquire the bus ready for readings
  *
  * @notapi
  */
 static __inline void aquire_bus(void) {
-	return;
+	spiAcquireBus(&SPID1);
 }
 
 /**
@@ -70,7 +69,7 @@ static __inline void aquire_bus(void) {
  * @notapi
  */
 static __inline void release_bus(void) {
-	return;
+	spiReleaseBus(&SPID1);
 }
 
 /**
@@ -82,7 +81,17 @@ static __inline void release_bus(void) {
  * @notapi
  */
 static __inline uint16_t read_value(uint16_t port) {
-	(void)port;
+    static uint8_t txbuf[3] = {0};
+    static uint8_t rxbuf[3] = {0};
+    uint16_t ret;
+
+    txbuf[0] = port;
+
+    spiExchange(&SPID1, 3, txbuf, rxbuf);
+
+    ret = (rxbuf[1] << 5) | (rxbuf[2] >> 3); 
+
+    return ret;
 }
 
 #endif /* _GINPUT_LLD_MOUSE_BOARD_H */
-- 
cgit v1.2.3