From c8a4f69a691cbf190728358526643dde13f93807 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 2 Jul 2013 13:52:09 -0600 Subject: [PATCH] Several fixes to get a clean compile of the Arduino touch screen --- configs/arduino-due/README.txt | 14 ++++++++++ configs/arduino-due/src/arduino-due.h | 2 +- configs/arduino-due/src/sam_touchscreen.c | 33 ++++++----------------- configs/sam3u-ek/README.txt | 2 +- 4 files changed, 24 insertions(+), 27 deletions(-) diff --git a/configs/arduino-due/README.txt b/configs/arduino-due/README.txt index 976322e43e..92b3437a79 100644 --- a/configs/arduino-due/README.txt +++ b/configs/arduino-due/README.txt @@ -1024,6 +1024,9 @@ Configuration sub-directories Application Configuration -> NSH Library CONFIG_NSH_ARCHINIT=y : Board has architecture-specific initialization + STATUS: + 2013-7-2: SD card is not responding. All 0's received on SPI. + 3. This configuration has been used for verifying the touchscreen on on the ITEAD TFT Shield. With the modifications below, you can include the touchscreen test program at apps/examples/touchscreen as @@ -1043,6 +1046,13 @@ Configuration sub-directories CONFIG_SPI_BITBANG=y : Enable SPI bit-bang support CONFIG_INPUT=y : Enable support for input devices + CONFIG_INPUT_ADS7843E=y : Enable support for the XPT2046 + CONFIG_ADS7843E_SPIDEV=0 : (Doesn't matter) + CONFIG_ADS7843E_SPIMODE=0 : Use SPI mode 0 + CONFIG_ADS7843E_FREQUENCY=1000000 : SPI BAUD 1MHz + CONFIG_ADS7843E_SWAPXY=y : If landscpe orientation + CONFIG_ADS7843E_THRESHX=51 : These will probably need to be tuned + CONFIG_ADS7843E_THRESHY=39 System Type: CONFIG_GPIO_IRQ=y : GPIO interrupt support @@ -1064,3 +1074,7 @@ Configuration sub-directories CONFIG_DEBUG=y : Enable debug features CONFIG_DEBUG_VERBOSE=y : Enable verbose debug output CONFIG_DEBUG_INPUT=y : Enable debug output from input devices + + STATUS: + 2013-7-2: TSC is not responding. All 0's received on SPI. + diff --git a/configs/arduino-due/src/arduino-due.h b/configs/arduino-due/src/arduino-due.h index 0679f6ea41..34a33b3a6c 100644 --- a/configs/arduino-due/src/arduino-due.h +++ b/configs/arduino-due/src/arduino-due.h @@ -248,7 +248,7 @@ # define GPIO_TSC_IRQ (GPIO_INPUT | GPIO_CFG_PULLUP | GPIO_INT_BOTHEDGES | \ GPIO_PORT_PIOC | GPIO_PIN21) -# define SAM_TCS_IRQ SAM_IRQ_PC21 +# define SAM_TSC_IRQ SAM_IRQ_PC21 # endif /* Only CONFIG_LCD is expected to enable the TFT LCD */ diff --git a/configs/arduino-due/src/sam_touchscreen.c b/configs/arduino-due/src/sam_touchscreen.c index 0ed62cb637..7aefb1279e 100644 --- a/configs/arduino-due/src/sam_touchscreen.c +++ b/configs/arduino-due/src/sam_touchscreen.c @@ -264,22 +264,22 @@ static int tsc_attach(FAR struct ads7843e_config_s *state, xcpt_t isr) { /* Attach the XPT2046 interrupt */ - ivdbg("Attaching %p to IRQ %d\n", isr, SAM_TCS_IRQ); - return irq_attach(SAM_TCS_IRQ, isr); + ivdbg("Attaching %p to IRQ %d\n", isr, SAM_TSC_IRQ); + return irq_attach(SAM_TSC_IRQ, isr); } static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable) { /* Attach and enable, or detach and disable */ - ivdbg("IRQ:%d enable:%d\n", SAM_TCS_IRQ, enable); + ivdbg("IRQ:%d enable:%d\n", SAM_TSC_IRQ, enable); if (enable) { - sam_gpioirqenable(SAM_TCS_IRQ); + sam_gpioirqenable(SAM_TSC_IRQ); } else { - sam_gpioirqdisable(SAM_TCS_IRQ); + sam_gpioirqdisable(SAM_TSC_IRQ); } } @@ -290,31 +290,14 @@ static void tsc_clear(FAR struct ads7843e_config_s *state) static bool tsc_busy(FAR struct ads7843e_config_s *state) { -#if defined(CONFIG_DEBUG_INPUT) && defined(CONFIG_DEBUG_VERBOSE) - static bool last = (bool)-1; -#endif - - /* BUSY is high impedance when CS is high (not selected). When CS is - * is low, BUSY is active high. - */ - - bool busy = sam_gpioread(GPIO_TCS_BUSY); -#if defined(CONFIG_DEBUG_INPUT) && defined(CONFIG_DEBUG_VERBOSE) - if (busy != last) - { - ivdbg("busy:%d\n", busy); - last = busy; - } -#endif - - return busy; + return false; /* The BUSY signal is not connected */ } static bool tsc_pendown(FAR struct ads7843e_config_s *state) { /* The /PENIRQ value is active low */ - bool pendown = !sam_gpioread(GPIO_TCS_IRQ); + bool pendown = !sam_gpioread(GPIO_TSC_IRQ); ivdbg("pendown:%d\n", pendown); return pendown; } @@ -382,7 +365,7 @@ int arch_tcinitialize(int minor) /* Configure the PIO interrupt */ - sam_gpioirq(SAM_TCS_IRQ); + sam_gpioirq(SAM_TSC_IRQ); /* Get an instance of the SPI interface for the touchscreen chip select */ diff --git a/configs/sam3u-ek/README.txt b/configs/sam3u-ek/README.txt index e6c77331f6..c1193b8314 100644 --- a/configs/sam3u-ek/README.txt +++ b/configs/sam3u-ek/README.txt @@ -589,7 +589,7 @@ Configurations CONFIG_SPI_OWNBUS=y : Smaller code if this is the only SPI device CONFIG_INPUT=y : Enable support for input devices - CONFIG_INPUT_ADS7843E=y : Enable support for the XPT2048 + CONFIG_INPUT_ADS7843E=y : Enable support for the XPT2046 CONFIG_ADS7843E_SPIDEV=2 : Use SPI CS 2 for communication CONFIG_ADS7843E_SPIMODE=0 : Use SPI mode 0 CONFIG_ADS7843E_FREQUENCY=1000000 : SPI BAUD 1MHz