rch_tcinitialize() and arch_tcunitinitialize() renamed to board_tsc_setup() and board_tsc_teardown(). These are not long called directly by applications but only indirectly throught the crappy boardctl() OS interface.

This commit is contained in:
Gregory Nutt
2015-03-31 13:21:25 -06:00
parent dd7d6d269c
commit cf95d1a995
32 changed files with 200 additions and 135 deletions
+5 -4
View File
@@ -52,6 +52,7 @@
#include <assert.h> #include <assert.h>
#include <debug.h> #include <debug.h>
#include <nuttx/board.h>
#include <nuttx/kmalloc.h> #include <nuttx/kmalloc.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/fs/fs.h> #include <nuttx/fs/fs.h>
@@ -625,7 +626,7 @@ errout:
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Configure the simulated touchscreen. This will register the driver as * Configure the simulated touchscreen. This will register the driver as
@@ -640,7 +641,7 @@ errout:
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
FAR struct up_dev_s *priv = ( FAR struct up_dev_s *)&g_simtouchscreen; FAR struct up_dev_s *priv = ( FAR struct up_dev_s *)&g_simtouchscreen;
char devname[DEV_NAMELEN]; char devname[DEV_NAMELEN];
@@ -687,7 +688,7 @@ errout_with_priv:
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Uninitialized the simulated touchscreen * Uninitialized the simulated touchscreen
@@ -700,7 +701,7 @@ errout_with_priv:
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
FAR struct up_dev_s *priv = ( FAR struct up_dev_s *)&g_simtouchscreen; FAR struct up_dev_s *priv = ( FAR struct up_dev_s *)&g_simtouchscreen;
char devname[DEV_NAMELEN]; char devname[DEV_NAMELEN];
+5
View File
@@ -1585,3 +1585,8 @@ endif
config LIB_BOARDCTL config LIB_BOARDCTL
bool "Enabled boardctl() interface" bool "Enabled boardctl() interface"
default n default n
config BOARDCTL_TSCTEST
bool "Enable touchscreen test interfaces"
default n
depends on LIB_BOARDCTL
+5 -4
View File
@@ -45,6 +45,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/spi/spi_bitbang.h> #include <nuttx/spi/spi_bitbang.h>
#include <nuttx/input/touchscreen.h> #include <nuttx/input/touchscreen.h>
@@ -335,7 +336,7 @@ static FAR struct spi_dev_s *sam_tsc_spiinitialize(void)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -352,7 +353,7 @@ static FAR struct spi_dev_s *sam_tsc_spiinitialize(void)
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
FAR struct spi_dev_s *dev; FAR struct spi_dev_s *dev;
static bool initialized = false; static bool initialized = false;
@@ -405,7 +406,7 @@ int arch_tcinitialize(int minor)
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -420,7 +421,7 @@ int arch_tcinitialize(int minor)
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* No support for un-initializing the touchscreen XPT2046 device. It will /* No support for un-initializing the touchscreen XPT2046 device. It will
* continue to run and process touch interrupts in the background. * continue to run and process touch interrupts in the background.
+21 -14
View File
@@ -98,24 +98,31 @@ int boardctl(unsigned int cmd, uintptr_t arg)
break; break;
#ifdef CONFIG_BOARDCTL_TSCTEST #ifdef CONFIG_BOARDCTL_TSCTEST
/* CMD: BOARDIOC_TSCTEST /* CMD: BOARDIOC_TSCTEST_SETUP
* DESCRIPTION: Touchscreen controller test configuration * DESCRIPTION: Touchscreen controller test configuration
* ARG: 0: Setup touchscreen test, 1: Teardown touchscreen test * ARG: Touch controller device minor number
* CONFIGURATION: CONFIG_LIB_BOARDCTL && * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST
* DEPENDENCIES: Board logic must provide board_tsc_setup() and * DEPENDENCIES: Board logic must provide board_tsc_setup()
* board_tsc_teardown().
*/ */
case BOARDIOC_TSCTEST: case BOARDIOC_TSCTEST_SETUP:
if (arg) {
{ ret = board_tsc_setup((int)arg);
ret = board_tsc_setup(); }
} break;
else
{
ret = board_tsc_teardown();
}
/* CMD: BOARDIOC_TSCTEST_TEARDOWN
* DESCRIPTION: Touchscreen controller test configuration
* ARG: None
* CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST
* DEPENDENCIES: Board logic must provide board_tsc_teardown()
*/
case BOARDIOC_TSCTEST_TEARDOWN:
{
board_tsc_teardown();
ret = OK;
}
break; break;
#endif #endif
+2
View File
@@ -714,6 +714,8 @@ CONFIG_EXAMPLES_NXIMAGE=y
# CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_THTTPD is not set
# CONFIG_EXAMPLES_TIFF is not set # CONFIG_EXAMPLES_TIFF is not set
CONFIG_EXAMPLES_TOUCHSCREEN=y CONFIG_EXAMPLES_TOUCHSCREEN=y
CONFIG_LIB_BOARDCTL=y
CONFIG_BOARDCTL_TSCTEST=y
CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT=y CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT=y
+8 -7
View File
@@ -45,12 +45,13 @@
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include "stm32.h" #include <nuttx/board.h>
#include "hymini_stm32v-internal.h"
#include <nuttx/input/touchscreen.h> #include <nuttx/input/touchscreen.h>
#include <nuttx/input/ads7843e.h> #include <nuttx/input/ads7843e.h>
#include "stm32.h"
#include "hymini_stm32v-internal.h"
/************************************************************************************ /************************************************************************************
* Pre-processor Defintiions * Pre-processor Defintiions
************************************************************************************/ ************************************************************************************/
@@ -131,7 +132,7 @@ static bool hymini_ts_pendown(FAR struct ads7843e_config_s *state)
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -148,7 +149,7 @@ static bool hymini_ts_pendown(FAR struct ads7843e_config_s *state)
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
FAR struct spi_dev_s *dev; FAR struct spi_dev_s *dev;
@@ -169,7 +170,7 @@ int arch_tcinitialize(int minor)
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -184,7 +185,7 @@ int arch_tcinitialize(int minor)
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* FIXME What can/should we do here ? */ /* FIXME What can/should we do here ? */
} }
@@ -1146,6 +1146,8 @@ CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4
# CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_THTTPD is not set
# CONFIG_EXAMPLES_TIFF is not set # CONFIG_EXAMPLES_TIFF is not set
CONFIG_EXAMPLES_TOUCHSCREEN=y CONFIG_EXAMPLES_TOUCHSCREEN=y
CONFIG_LIB_BOARDCTL=y
CONFIG_BOARDCTL_TSCTEST=y
CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
# CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE is not set # CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE is not set
@@ -50,6 +50,7 @@
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <nuttx/board.h>
#include <nuttx/clock.h> #include <nuttx/clock.h>
#include <nuttx/wqueue.h> #include <nuttx/wqueue.h>
#include <nuttx/fs/fs.h> #include <nuttx/fs/fs.h>
@@ -1473,7 +1474,7 @@ errout:
************************************************************************************/ ************************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -1490,7 +1491,7 @@ errout:
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
FAR struct tc_dev_s *priv; FAR struct tc_dev_s *priv;
char devname[DEV_NAMELEN]; char devname[DEV_NAMELEN];
@@ -1583,7 +1584,7 @@ errout_with_priv:
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -1598,7 +1599,7 @@ errout_with_priv:
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* Need to unregister the /dev/inputN device here. */ /* Need to unregister the /dev/inputN device here. */
} }
@@ -703,6 +703,8 @@ CONFIG_EXAMPLES_NSH=y
# CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_THTTPD is not set
# CONFIG_EXAMPLES_TIFF is not set # CONFIG_EXAMPLES_TIFF is not set
CONFIG_EXAMPLES_TOUCHSCREEN=y CONFIG_EXAMPLES_TOUCHSCREEN=y
CONFIG_LIB_BOARDCTL=y
CONFIG_BOARDCTL_TSCTEST=y
CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/mouse0" CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/mouse0"
CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE=y CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE=y
@@ -45,6 +45,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <nuttx/board.h>
#include <nuttx/usb/usbhost.h> #include <nuttx/usb/usbhost.h>
#include <nuttx/input/touchscreen.h> #include <nuttx/input/touchscreen.h>
@@ -90,7 +91,7 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this * Each board that supports a touchscreen device must provide this
@@ -108,7 +109,7 @@
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
static bool initialized = false; static bool initialized = false;
int ret; int ret;
@@ -142,7 +143,7 @@ int arch_tcinitialize(int minor)
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -157,7 +158,7 @@ int arch_tcinitialize(int minor)
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* No support for un-initializing the USB mouse driver. It will continue /* No support for un-initializing the USB mouse driver. It will continue
* to run and process touch interrupts in the background. * to run and process touch interrupts in the background.
+4 -4
View File
@@ -254,7 +254,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this * Each board that supports a touchscreen device must provide this
@@ -271,7 +271,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
static bool initialized = false; static bool initialized = false;
FAR struct spi_dev_s *dev; FAR struct spi_dev_s *dev;
@@ -323,7 +323,7 @@ int arch_tcinitialize(int minor)
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -338,7 +338,7 @@ int arch_tcinitialize(int minor)
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* No support for un-initializing the touchscreen XPT2046 device yet */ /* No support for un-initializing the touchscreen XPT2046 device yet */
} }
+5 -4
View File
@@ -48,6 +48,7 @@
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <nuttx/board.h>
#include <nuttx/clock.h> #include <nuttx/clock.h>
#include <nuttx/wqueue.h> #include <nuttx/wqueue.h>
#include <nuttx/fs/fs.h> #include <nuttx/fs/fs.h>
@@ -1343,7 +1344,7 @@ errout:
************************************************************************************/ ************************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -1360,7 +1361,7 @@ errout:
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
FAR struct tc_dev_s *priv; FAR struct tc_dev_s *priv;
char devname[DEV_NAMELEN]; char devname[DEV_NAMELEN];
@@ -1436,7 +1437,7 @@ errout_with_priv:
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -1451,7 +1452,7 @@ errout_with_priv:
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* Need to unregister the /dev/inputN device here. */ /* Need to unregister the /dev/inputN device here. */
} }
+5 -4
View File
@@ -45,6 +45,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/input/touchscreen.h> #include <nuttx/input/touchscreen.h>
#include <nuttx/input/ads7843e.h> #include <nuttx/input/ads7843e.h>
@@ -213,7 +214,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -230,7 +231,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
FAR struct spi_dev_s *dev; FAR struct spi_dev_s *dev;
int ret; int ret;
@@ -270,7 +271,7 @@ int arch_tcinitialize(int minor)
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -285,7 +286,7 @@ int arch_tcinitialize(int minor)
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* No support for un-initializing the touchscreen ADS7843E device yet */ /* No support for un-initializing the touchscreen ADS7843E device yet */
} }
+5 -4
View File
@@ -45,6 +45,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/input/touchscreen.h> #include <nuttx/input/touchscreen.h>
#include <nuttx/input/ads7843e.h> #include <nuttx/input/ads7843e.h>
@@ -210,7 +211,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -227,7 +228,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
FAR struct spi_dev_s *dev; FAR struct spi_dev_s *dev;
int ret; int ret;
@@ -267,7 +268,7 @@ int arch_tcinitialize(int minor)
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -282,7 +283,7 @@ int arch_tcinitialize(int minor)
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* No support for un-initializing the touchscreen ADS7843E device yet */ /* No support for un-initializing the touchscreen ADS7843E device yet */
} }
+6 -4
View File
@@ -47,6 +47,8 @@
#include "sam_tsd.h" #include "sam_tsd.h"
#include "sama5d3x-ek.h" #include "sama5d3x-ek.h"
#include <nuttx/board.h>
#ifdef CONFIG_SAMA5_TSD #ifdef CONFIG_SAMA5_TSD
/**************************************************************************** /****************************************************************************
@@ -83,7 +85,7 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this * Each board that supports a touchscreen device must provide this
@@ -100,7 +102,7 @@
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
struct sam_adc_s *adc; struct sam_adc_s *adc;
static bool initialized = false; static bool initialized = false;
@@ -141,7 +143,7 @@ int arch_tcinitialize(int minor)
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -156,7 +158,7 @@ int arch_tcinitialize(int minor)
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* No support for un-initializing the touchscreen yet */ /* No support for un-initializing the touchscreen yet */
} }
+2
View File
@@ -1220,6 +1220,8 @@ CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT=16
# CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_THTTPD is not set
# CONFIG_EXAMPLES_TIFF is not set # CONFIG_EXAMPLES_TIFF is not set
CONFIG_EXAMPLES_TOUCHSCREEN=y CONFIG_EXAMPLES_TOUCHSCREEN=y
CONFIG_LIB_BOARDCTL=y
CONFIG_BOARDCTL_TSCTEST=y
CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
# CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE is not set # CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE is not set
+2
View File
@@ -1222,6 +1222,8 @@ CONFIG_EXAMPLES_NX_TOOLBAR_HEIGHT=16
# CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_THTTPD is not set
# CONFIG_EXAMPLES_TIFF is not set # CONFIG_EXAMPLES_TIFF is not set
CONFIG_EXAMPLES_TOUCHSCREEN=y CONFIG_EXAMPLES_TOUCHSCREEN=y
CONFIG_LIB_BOARDCTL=y
CONFIG_BOARDCTL_TSCTEST=y
CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
# CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE is not set # CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE is not set
+5 -4
View File
@@ -45,6 +45,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/input/touchscreen.h> #include <nuttx/input/touchscreen.h>
#include <nuttx/input/mxt.h> #include <nuttx/input/mxt.h>
@@ -218,7 +219,7 @@ static int mxt_interrupt(int irq, FAR void *context)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -235,7 +236,7 @@ static int mxt_interrupt(int irq, FAR void *context)
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
FAR struct i2c_dev_s *i2c; FAR struct i2c_dev_s *i2c;
static bool initialized = false; static bool initialized = false;
@@ -290,7 +291,7 @@ int arch_tcinitialize(int minor)
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -305,7 +306,7 @@ int arch_tcinitialize(int minor)
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* No support for un-initializing the touchscreen maXTouch device. It will /* No support for un-initializing the touchscreen maXTouch device. It will
* continue to run and process touch interrupts in the background. * continue to run and process touch interrupts in the background.
+2
View File
@@ -792,6 +792,8 @@ CONFIG_EXAMPLES_NSH=y
# CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_THTTPD is not set
# CONFIG_EXAMPLES_TIFF is not set # CONFIG_EXAMPLES_TIFF is not set
CONFIG_EXAMPLES_TOUCHSCREEN=y CONFIG_EXAMPLES_TOUCHSCREEN=y
CONFIG_LIB_BOARDCTL=y
CONFIG_BOARDCTL_TSCTEST=y
CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
# CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE is not set # CONFIG_EXAMPLES_TOUCHSCREEN_MOUSE is not set
+5 -4
View File
@@ -45,6 +45,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/input/touchscreen.h> #include <nuttx/input/touchscreen.h>
#include <nuttx/input/mxt.h> #include <nuttx/input/mxt.h>
@@ -214,7 +215,7 @@ static int mxt_interrupt(int irq, FAR void *context)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -231,7 +232,7 @@ static int mxt_interrupt(int irq, FAR void *context)
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
FAR struct i2c_dev_s *i2c; FAR struct i2c_dev_s *i2c;
static bool initialized = false; static bool initialized = false;
@@ -286,7 +287,7 @@ int arch_tcinitialize(int minor)
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -301,7 +302,7 @@ int arch_tcinitialize(int minor)
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* No support for un-initializing the touchscreen maXTouch device. It will /* No support for un-initializing the touchscreen maXTouch device. It will
* continue to run and process touch interrupts in the background. * continue to run and process touch interrupts in the background.
+5 -4
View File
@@ -45,6 +45,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <nuttx/board.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/input/touchscreen.h> #include <nuttx/input/touchscreen.h>
@@ -228,7 +229,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -245,7 +246,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
FAR struct spi_dev_s *dev; FAR struct spi_dev_s *dev;
int ret; int ret;
@@ -280,7 +281,7 @@ int arch_tcinitialize(int minor)
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -295,7 +296,7 @@ int arch_tcinitialize(int minor)
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* No support for un-initializing the touchscreen ADS7843E device yet */ /* No support for un-initializing the touchscreen ADS7843E device yet */
} }
+1 -1
View File
@@ -490,7 +490,7 @@ nx11
CONFIG_SIM_TOUCHSCREEN=y CONFIG_SIM_TOUCHSCREEN=y
Then you must also have some application logic that will call Then you must also have some application logic that will call
arch_tcinitialize(0) to register the touchscreen driver. See board_tsc_setup(0) to register the touchscreen driver. See
also configuration "touchscreen" also configuration "touchscreen"
NOTES: NOTES:
+2
View File
@@ -517,6 +517,8 @@ CONFIG_EXAMPLES_NXLINES_BPP=32
# CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_THTTPD is not set
# CONFIG_EXAMPLES_TIFF is not set # CONFIG_EXAMPLES_TIFF is not set
CONFIG_EXAMPLES_TOUCHSCREEN=y CONFIG_EXAMPLES_TOUCHSCREEN=y
CONFIG_LIB_BOARDCTL=y
CONFIG_BOARDCTL_TSCTEST=y
CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT=y CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT=y
+7 -6
View File
@@ -44,6 +44,7 @@
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <nuttx/board.h>
#include <nuttx/video/fb.h> #include <nuttx/video/fb.h>
#include <nuttx/input/touchscreen.h> #include <nuttx/input/touchscreen.h>
#include <nuttx/nx/nx.h> #include <nuttx/nx/nx.h>
@@ -83,7 +84,7 @@ static struct sim_touchscreen_s g_simtc;
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize() * Name: board_tsc_setup()
* *
* Description: * Description:
* Perform architecuture-specific initialization of the touchscreen * Perform architecuture-specific initialization of the touchscreen
@@ -92,7 +93,7 @@ static struct sim_touchscreen_s g_simtc;
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
FAR NX_DRIVERTYPE *dev; FAR NX_DRIVERTYPE *dev;
nxgl_mxpixel_t color; nxgl_mxpixel_t color;
@@ -143,10 +144,10 @@ int arch_tcinitialize(int minor)
/* Finally, initialize the touchscreen simulation on the X window */ /* Finally, initialize the touchscreen simulation on the X window */
ret = arch_tcinitialize(minor); ret = board_tsc_setup(minor);
if (ret < 0) if (ret < 0)
{ {
idbg("arch_tcinitialize failed: %d\n", ret); idbg("board_tsc_setup failed: %d\n", ret);
goto errout_with_nx; goto errout_with_nx;
} }
return OK; return OK;
@@ -161,7 +162,7 @@ errout:
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize() * Name: board_tsc_teardown()
* *
* Description: * Description:
* Perform architecuture-specific un-initialization of the touchscreen * Perform architecuture-specific un-initialization of the touchscreen
@@ -170,7 +171,7 @@ errout:
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* Shut down the touchscreen driver */ /* Shut down the touchscreen driver */
+2
View File
@@ -511,6 +511,8 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512
# CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_THTTPD is not set
# CONFIG_EXAMPLES_TIFF is not set # CONFIG_EXAMPLES_TIFF is not set
CONFIG_EXAMPLES_TOUCHSCREEN=y CONFIG_EXAMPLES_TOUCHSCREEN=y
CONFIG_LIB_BOARDCTL=y
CONFIG_BOARDCTL_TSCTEST=y
CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0
CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0"
CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25 CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25
+5 -4
View File
@@ -44,6 +44,7 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include <nuttx/board.h>
#include <nuttx/i2c.h> #include <nuttx/i2c.h>
#include <nuttx/input/touchscreen.h> #include <nuttx/input/touchscreen.h>
#include <nuttx/input/stmpe811.h> #include <nuttx/input/stmpe811.h>
@@ -255,7 +256,7 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -272,7 +273,7 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state)
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
#ifndef CONFIG_STMPE811_TSC_DISABLE #ifndef CONFIG_STMPE811_TSC_DISABLE
FAR struct i2c_dev_s *dev; FAR struct i2c_dev_s *dev;
@@ -328,7 +329,7 @@ int arch_tcinitialize(int minor)
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -343,7 +344,7 @@ int arch_tcinitialize(int minor)
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* No support for un-initializing the touchscreen STMPE811 device yet */ /* No support for un-initializing the touchscreen STMPE811 device yet */
} }
+2 -2
View File
@@ -181,10 +181,10 @@ static int board_initthread(int argc, char *argv[])
/* Initialize the touchscreen */ /* Initialize the touchscreen */
#ifdef HAVE_TCINIT #ifdef HAVE_TCINIT
ret = arch_tcinitialize(CONFIG_NXWM_TOUCHSCREEN_DEVNO); ret = board_tsc_setup(CONFIG_NXWM_TOUCHSCREEN_DEVNO);
if (ret < 0) if (ret < 0)
{ {
gdbg("ERROR: arch_tcinitialize failed: %d\n", ret); gdbg("ERROR: board_tsc_setup failed: %d\n", ret);
} }
#endif #endif
+5 -4
View File
@@ -44,6 +44,7 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include <nuttx/board.h>
#include <nuttx/i2c.h> #include <nuttx/i2c.h>
#include <nuttx/input/touchscreen.h> #include <nuttx/input/touchscreen.h>
#include <nuttx/input/stmpe811.h> #include <nuttx/input/stmpe811.h>
@@ -255,7 +256,7 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -272,7 +273,7 @@ static void stmpe811_clear(FAR struct stmpe811_config_s *state)
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
#ifndef CONFIG_STMPE811_TSC_DISABLE #ifndef CONFIG_STMPE811_TSC_DISABLE
FAR struct i2c_dev_s *dev; FAR struct i2c_dev_s *dev;
@@ -328,7 +329,7 @@ int arch_tcinitialize(int minor)
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -343,7 +344,7 @@ int arch_tcinitialize(int minor)
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* No support for un-initializing the touchscreen STMPE811 device yet */ /* No support for un-initializing the touchscreen STMPE811 device yet */
} }
@@ -45,6 +45,7 @@
#include <assert.h> #include <assert.h>
#include <errno.h> #include <errno.h>
#include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/input/touchscreen.h> #include <nuttx/input/touchscreen.h>
#include <nuttx/input/ads7843e.h> #include <nuttx/input/ads7843e.h>
@@ -234,7 +235,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: arch_tcinitialize * Name: board_tsc_setup
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -251,7 +252,7 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
* *
****************************************************************************/ ****************************************************************************/
int arch_tcinitialize(int minor) int board_tsc_setup(int minor)
{ {
FAR struct spi_dev_s *dev; FAR struct spi_dev_s *dev;
static bool initialized = false; static bool initialized = false;
@@ -300,7 +301,7 @@ int arch_tcinitialize(int minor)
} }
/**************************************************************************** /****************************************************************************
* Name: arch_tcuninitialize * Name: board_tsc_teardown
* *
* Description: * Description:
* Each board that supports a touchscreen device must provide this function. * Each board that supports a touchscreen device must provide this function.
@@ -315,7 +316,7 @@ int arch_tcinitialize(int minor)
* *
****************************************************************************/ ****************************************************************************/
void arch_tcuninitialize(void) void board_tsc_teardown(void)
{ {
/* No support for un-initializing the touchscreen XPT2046 device. It will /* No support for un-initializing the touchscreen XPT2046 device. It will
* continue to run and process touch interrupts in the background. * continue to run and process touch interrupts in the background.
+53 -1
View File
@@ -142,7 +142,59 @@ void board_initialize(void);
#ifdef CONFIG_LIB_BOARDCTL #ifdef CONFIG_LIB_BOARDCTL
int board_app_initialize(void); int board_app_initialize(void);
#endif #endif /* CONFIG_LIB_BOARDCTL */
/****************************************************************************
* Name: board_tsc_setup
*
* Description:
* Each board that supports a touchscreen device must provide this function.
* This function is called by application-specific, setup logic to
* configure the touchscreen device. This function will register the driver
* as /dev/inputN where N is the minor device number.
*
* This is an internal OS interface but may be invoked indirectly from
* application-level touchscreen testing logic (perhaps by
* apps/examples/touchscreen). If CONFIG_LIB_BOARDCTL=y and
* CONFIG_BOARDCTL_TSCTEST=y, then this functions will be invoked via the
* (non-standard) boardctl() interface using the commands
* BOARDIOC_TSCTEST_SETUP command.
*
* Input Parameters:
* minor - The input device minor number
*
* Returned Value:
* Zero is returned on success. Otherwise, a negated errno value is
* returned to indicate the nature of the failure.
*
****************************************************************************/
int board_tsc_setup(int minor);
/****************************************************************************
* Name: board_tsc_teardown
*
* Description:
* Each board that supports a touchscreen device must provide this function.
* This function is called by application-specific, setup logic to
* uninitialize the touchscreen device.
*
* This is an internal OS interface but may be invoked indirectly from
* application-level touchscreen testing logic (perhaps by
* apps/examples/touchscreen). If CONFIG_LIB_BOARDCTL=y and
* CONFIG_BOARDCTL_TSCTEST=y, then this functions will be invoked via the
* (non-standard) boardctl() interface using the commands
* BOARDIOC_TSCTEST_TEARDOWN command.
*
* Input Parameters:
* None
*
* Returned Value:
* None.
*
****************************************************************************/
void board_tsc_teardown(void);
/**************************************************************************** /****************************************************************************
* Name: board_led_initialize * Name: board_led_initialize
-38
View File
@@ -134,44 +134,6 @@ extern "C"
#define EXTERN extern #define EXTERN extern
#endif #endif
/****************************************************************************
* Name: arch_tcinitialize
*
* Description:
* Each board that supports a touchscreen device must provide this function.
* This function is called by application-specific, setup logic to
* configure the touchscreen device. This function will register the driver
* as /dev/inputN where N is the minor device number.
*
* Input Parameters:
* minor - The input device minor number
*
* Returned Value:
* Zero is returned on success. Otherwise, a negated errno value is
* returned to indicate the nature of the failure.
*
****************************************************************************/
int arch_tcinitialize(int minor);
/****************************************************************************
* Name: arch_tcuninitialize
*
* Description:
* Each board that supports a touchscreen device must provide this function.
* This function is called by application-specific, setup logic to
* uninitialize the touchscreen device.
*
* Input Parameters:
* None
*
* Returned Value:
* None.
*
****************************************************************************/
void arch_tcuninitialize(void);
#undef EXTERN #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus
} }
+12 -6
View File
@@ -58,16 +58,22 @@
* CONFIGURATION: CONFIG_LIB_BOARDCTL * CONFIGURATION: CONFIG_LIB_BOARDCTL
* DEPENDENCIES: Board logic must provide board_app_initialization * DEPENDENCIES: Board logic must provide board_app_initialization
* *
* CMD: BOARDIOC_TSCTEST * CMD: BOARDIOC_TSCTEST_SETUP
* DESCRIPTION: Touchscreen controller test configuration * DESCRIPTION: Touchscreen controller test configuration
* ARG: 0: Setup touchscreen test, 1: Teardown touchscreen test * ARG: Touch controller device minor number
* CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST * CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST
* DEPENDENCIES: Board logic must provide board_tsc_setup() and * DEPENDENCIES: Board logic must provide board_tsc_setup()
* board_tsc_teardown(). *
* CMD: BOARDIOC_TSCTEST_TEARDOWN
* DESCRIPTION: Touchscreen controller test configuration
* ARG: None
* CONFIGURATION: CONFIG_LIB_BOARDCTL && CONFIG_BOARDCTL_TSCTEST
* DEPENDENCIES: Board logic must provide board_tsc_teardown()
*/ */
#define BOARDIOC_INIT _BOARDIOC(0x0001) #define BOARDIOC_INIT _BOARDIOC(0x0001)
#define BOARDIOC_TSCTEST _BOARDIOC(0x0002) #define BOARDIOC_TSCTEST_SETUP _BOARDIOC(0x0002)
#define BOARDIOC_TSCTEST_TEARDOWN _BOARDIOC(0x0003)
/**************************************************************************** /****************************************************************************
* Public Type Definitions * Public Type Definitions