NxWM: Finishes touchscreen implementation; NuttX: Standardize touchscreen initialization interfaces for all boards
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4721 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
257ccf82a1
commit
940b9fedf1
@ -135,19 +135,6 @@ extern void weak_function stm32_spiinitialize(void);
|
||||
|
||||
extern void weak_function stm32_usbinitialize(void);
|
||||
|
||||
#if defined(CONFIG_INPUT_ADS7843E)
|
||||
|
||||
/************************************************************************************
|
||||
* Name: Touchscreen initialization
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
extern int arch_tcinitialize(int minor);
|
||||
|
||||
extern void arch_tcuninitialize(void);
|
||||
|
||||
#endif /* CONFIG_INPUT_ADS7843E */
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
#endif /* __CONFIGS_HYMINI_STM32V_INTERNAL_H */
|
||||
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "stm32_internal.h"
|
||||
#include "hymini_stm32v-internal.h"
|
||||
|
||||
#include <nuttx/input/touchscreen.h>
|
||||
#include <nuttx/input/ads7843e.h>
|
||||
|
||||
#if !defined(CONFIG_STM32_SPI1)
|
||||
@ -120,11 +121,20 @@ static bool hymini_ts_pendown(FAR struct ads7843e_config_s *state)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arch_tcinitialize()
|
||||
* Name: arch_tcinitialize
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific initialization of the touchscreen.
|
||||
* This function must be called directly from application.
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@ -132,12 +142,12 @@ int arch_tcinitialize(int minor)
|
||||
{
|
||||
FAR struct spi_dev_s *dev;
|
||||
|
||||
idbg("arch_tcinitialize: minor %d\n", minor);
|
||||
idbg("minor %d\n", minor);
|
||||
|
||||
dev = up_spiinitialize(1);
|
||||
if (!dev)
|
||||
{
|
||||
idbg("arch_tcinitialize: Failed to initialize SPI bus\n");
|
||||
idbg("Failed to initialize SPI bus\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -149,11 +159,18 @@ int arch_tcinitialize(int minor)
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: arch_tcuninitialize()
|
||||
* Name: arch_tcuninitialize
|
||||
*
|
||||
* Description:
|
||||
* Perform architecture-specific un-initialization of the touchscreen
|
||||
* hardware. This function must be called directly from application.
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* configs/sam3u-ek/src/up_touchscreen.c
|
||||
* arch/arm/src/board/up_touchscreen.c
|
||||
*
|
||||
* Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -43,6 +43,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <debug.h>
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/spi.h>
|
||||
@ -213,16 +214,27 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
|
||||
* Name: arch_tcinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the touchscreen device
|
||||
* 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(void)
|
||||
int arch_tcinitialize(int minor)
|
||||
{
|
||||
FAR struct spi_dev_s *dev;
|
||||
int ret;
|
||||
|
||||
ivdbg("Initializing\n");
|
||||
idbg("minor %d\n", minor);
|
||||
DEBUGASSERT(minor == 0);
|
||||
|
||||
/* Configure and enable the ADS7843E interrupt pin as an input */
|
||||
|
||||
@ -259,7 +271,15 @@ int arch_tcinitialize(void)
|
||||
* Name: arch_tcuninitialize
|
||||
*
|
||||
* Description:
|
||||
* Un-initialize the touchscreen device
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
@ -342,7 +342,7 @@ nx11
|
||||
CONFIG_SIM_TOUCHSCREEN=y
|
||||
|
||||
Then you must also have some application logic that will call
|
||||
sim_tcinitialize(0) to register the touchscreen driver. See
|
||||
arch_tcinitialize(0) to register the touchscreen driver. See
|
||||
also configuration "touchscreen"
|
||||
|
||||
NOTES:
|
||||
|
@ -143,10 +143,10 @@ int arch_tcinitialize(int minor)
|
||||
|
||||
/* Finally, initialize the touchscreen simulation on the X window */
|
||||
|
||||
ret = sim_tcinitialize(minor);
|
||||
ret = arch_tcinitialize(minor);
|
||||
if (ret < 0)
|
||||
{
|
||||
idbg("sim_tcinitialize failed: %d\n", ret);
|
||||
idbg("arch_tcinitialize failed: %d\n", ret);
|
||||
goto errout_with_nx;
|
||||
}
|
||||
return OK;
|
||||
|
@ -33,8 +33,9 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# The NSH Library -- NOTE: The NxWM unit must be installed in order
|
||||
# to build this example.
|
||||
# The NSH Library -- NOTE: The NxWM unit test must be installed at
|
||||
# apps/external in order to build this example. See
|
||||
# NxWidgets/UnitTests/README.txt for additional information
|
||||
|
||||
CONFIGURED_APPS += system/readline
|
||||
CONFIGURED_APPS += nshlib
|
||||
|
@ -252,16 +252,29 @@ static void stmpe11_clear(FAR struct stmpe11_config_s *state)
|
||||
* Name: arch_tcinitialize
|
||||
*
|
||||
* Description:
|
||||
* Initialize the touchscreen device
|
||||
* 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(void)
|
||||
int arch_tcinitialize(int minor)
|
||||
{
|
||||
#ifndef CONFIG_STMPE11_TSC_DISABLE
|
||||
FAR struct i2c_dev_s *dev;
|
||||
int ret;
|
||||
|
||||
idbg("minor %d\n", minor);
|
||||
DEBUGASSERT(minor == 0);
|
||||
|
||||
/* Check if we are already initialized */
|
||||
|
||||
if (!g_stmpe11config.handle)
|
||||
@ -312,7 +325,15 @@ int arch_tcinitialize(void)
|
||||
* Name: arch_tcuninitialize
|
||||
*
|
||||
* Description:
|
||||
* Un-initialize the touchscreen device
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user