Lpcxpresso-Lpc54618 and FT5x06 driver. Some improvements in configuration and the touchscreen driver improves the behavior some. Now I get the calibration screen and detect touches (but no un-touches).

This commit is contained in:
Gregory Nutt 2017-12-18 17:22:35 -06:00
parent ead23dca30
commit d9997846b6
3 changed files with 62 additions and 43 deletions

View File

@ -201,6 +201,11 @@ Configurations
pressure : 0 pressure : 0
etc. etc.
NOTE that the touchscreen controlled must run in a polled mode! The
FT5x06 interrupt GPIO is on P4.0 and, as far as I know, GPIO
interrupts are not supported on P4. So polled mode only for this
puppy.
nsh: nsh:
Configures the NuttShell (nsh) application located at examples/nsh. Configures the NuttShell (nsh) application located at examples/nsh.
@ -314,24 +319,30 @@ Configurations
nxwm: nxwm:
This is a special configuration setup for the NxWM window manager This is a special configuration setup for the NxWM window manager
UnitTest. The NxWM window manager can be found here: UnitTest. This builds on top of the features that were unit tested in
by the fb configuration.
nuttx-code/NxWidgets/nxwm The NxWM window manager can be found here:
<nuttx-code>/NxWidgets/nxwm
The NxWM unit test can be found at: The NxWM unit test can be found at:
nuttx-code/NxWidgets/UnitTests/nxwm <nuttx-code>/NxWidgets/UnitTests/nxwm
Documentation for installing the NxWM unit test can be found here: Documentation for installing the NxWM unit test can be found here:
nuttx-code/NxWidgets/UnitTests/README.txt <nuttx-code>/NxWidgets/UnitTests/README.txt
Where <nuttx-code> is whatever path you have select to install
NuttX.
Here is the quick summary of the build steps (Assuming that all of Here is the quick summary of the build steps (Assuming that all of
the required packages are available in a directory ~/nuttx-code): the required packages are available in a directory ~/<nuttx-code>):
1. Install the nxwm configuration 1. Install the nxwm configuration
$ cd ~/nuttx-code/nuttx $ cd ~/<nuttx-code>/nuttx
$ tools/configure.sh [OPTIONS] lpcxpresso-lpc54628/nxwm $ tools/configure.sh [OPTIONS] lpcxpresso-lpc54628/nxwm
Use the -l option with the configure.sh script if you are using a Use the -l option with the configure.sh script if you are using a
@ -344,24 +355,24 @@ Configurations
3. Install the nxwm unit test 3. Install the nxwm unit test
$ cd ~/nuttx-code/NxWidgets $ cd ~/<nuttx-code>/NxWidgets
$ tools/install.sh ~/nuttx-code/apps nxwm $ tools/install.sh ~/<nuttx-code>/apps nxwm
Creating symbolic link Creating symbolic link
- To ~/nuttx-code/NxWidgets/UnitTests/nxwm - To ~/<nuttx-code>/NxWidgets/UnitTests/nxwm
- At ~/nuttx-code/apps/external - At ~/<nuttx-code>/apps/external
4. Build the NxWidgets library 4. Build the NxWidgets library
$ cd ~/nuttx-code/NxWidgets/libnxwidgets $ cd ~/<nuttx-code>/NxWidgets/libnxwidgets
$ make TOPDIR=~/nuttx-code/nuttx $ make TOPDIR=~/<nuttx-code>/nuttx
5. Build the NxWM library 5. Build the NxWM library
$ cd ~/nuttx-code/NxWidgets/nxwm $ cd ~/<nuttx-code>/NxWidgets/nxwm
$ make TOPDIR=~/nuttx-code/nuttx $ make TOPDIR=~/<nuttx-code>/nuttx
6. Built NuttX with the installed unit test as the application 6. Built NuttX with the installed unit test as the application
$ cd ~/nuttx-code/nuttx $ cd ~/<nuttx-code>/nuttx
$ make $ make

View File

@ -2,6 +2,7 @@
# CONFIG_NX_DISABLE_16BPP is not set # CONFIG_NX_DISABLE_16BPP is not set
# CONFIG_NXFONTS_DISABLE_16BPP is not set # CONFIG_NXFONTS_DISABLE_16BPP is not set
# CONFIG_NXTK_DEFAULT_BORDERCOLORS is not set # CONFIG_NXTK_DEFAULT_BORDERCOLORS is not set
# CONFIG_NXWM_TOUCHSCREEN_DEVINIT is not set
CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628=y CONFIG_ARCH_BOARD_LPCXPRESSO_LPC54628=y
CONFIG_ARCH_BOARD="lpcxpresso-lpc54628" CONFIG_ARCH_BOARD="lpcxpresso-lpc54628"
CONFIG_ARCH_CHIP_LPC54628=y CONFIG_ARCH_CHIP_LPC54628=y
@ -9,6 +10,7 @@ CONFIG_ARCH_CHIP_LPC54XX=y
CONFIG_ARCH_STACKDUMP=y CONFIG_ARCH_STACKDUMP=y
CONFIG_ARCH_STDARG_H=y CONFIG_ARCH_STDARG_H=y
CONFIG_ARCH="arm" CONFIG_ARCH="arm"
CONFIG_BOARD_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=18535 CONFIG_BOARD_LOOPSPERMSEC=18535
CONFIG_BUILTIN=y CONFIG_BUILTIN=y
CONFIG_FAT_LCNAMES=y CONFIG_FAT_LCNAMES=y
@ -20,7 +22,6 @@ CONFIG_FT5X06_SINGLEPOINT=y
CONFIG_FT5X06_SWAPXY=y CONFIG_FT5X06_SWAPXY=y
CONFIG_HAVE_CXX=y CONFIG_HAVE_CXX=y
CONFIG_HAVE_CXXINITIALIZE=y CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_I2CTOOL_MAXBUS=9
CONFIG_INPUT_FT5X06=y CONFIG_INPUT_FT5X06=y
CONFIG_INPUT=y CONFIG_INPUT=y
CONFIG_LIB_BOARDCTL=y CONFIG_LIB_BOARDCTL=y
@ -43,6 +44,7 @@ CONFIG_LPC54_USART0=y
CONFIG_MAX_TASKS=16 CONFIG_MAX_TASKS=16
CONFIG_MAX_WDOGPARMS=2 CONFIG_MAX_WDOGPARMS=2
CONFIG_MM_REGIONS=2 CONFIG_MM_REGIONS=2
CONFIG_MQ_MAXMSGSIZE=64
CONFIG_NFILE_DESCRIPTORS=8 CONFIG_NFILE_DESCRIPTORS=8
CONFIG_NFILE_STREAMS=8 CONFIG_NFILE_STREAMS=8
CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_BUILTIN_APPS=y
@ -95,8 +97,6 @@ CONFIG_SDCLONE_DISABLE=y
CONFIG_START_DAY=18 CONFIG_START_DAY=18
CONFIG_START_MONTH=12 CONFIG_START_MONTH=12
CONFIG_SYMTAB_ORDEREDBYNAME=y CONFIG_SYMTAB_ORDEREDBYNAME=y
CONFIG_SYSTEM_I2CTOOL=y
CONFIG_SYSTEM_RAMTEST=y
CONFIG_TASK_NAME_SIZE=0 CONFIG_TASK_NAME_SIZE=0
CONFIG_USART0_SERIAL_CONSOLE=y CONFIG_USART0_SERIAL_CONSOLE=y
CONFIG_USER_ENTRYPOINT="nxwm_main" CONFIG_USER_ENTRYPOINT="nxwm_main"

View File

@ -275,7 +275,6 @@ static void ft5x06_data_worker(FAR void *arg)
FAR struct ft5x06_touch_data_s *sample; FAR struct ft5x06_touch_data_s *sample;
struct i2c_msg_s msg[2]; struct i2c_msg_s msg[2];
uint8_t regaddr; uint8_t regaddr;
uint8_t ntouches;
int ret; int ret;
/* Get a pointer the callbacks for convenience */ /* Get a pointer the callbacks for convenience */
@ -307,7 +306,7 @@ static void ft5x06_data_worker(FAR void *arg)
/* Set up the data read operation. /* Set up the data read operation.
* *
* REVISIT: If CONFIG_FT5X06_SINGLEPOINT is selected, we we not just * REVISIT: If CONFIG_FT5X06_SINGLEPOINT is selected, could we not just
* set the length for one sample? Or is there some reason why we have to * set the length for one sample? Or is there some reason why we have to
* read all of the points? * read all of the points?
*/ */
@ -319,34 +318,43 @@ static void ft5x06_data_worker(FAR void *arg)
msg[1].length = FT5x06_TOUCH_DATA_LEN; msg[1].length = FT5x06_TOUCH_DATA_LEN;
ret = I2C_TRANSFER(priv->i2c, msg, 2); ret = I2C_TRANSFER(priv->i2c, msg, 2);
if (ret >= 0)
sample = (FAR struct ft5x06_touch_data_s *)priv->touchbuf;
ntouches = sample->tdstatus;
if (ret >= 0 && ntouches > 0)
{ {
/* Notify any waiters that new FT5x06 data is available */ /* In polled mode, we may read invalid touch data. If there is
* no touch data, the FT5x06 returns all 0xff.
*/
sample = (FAR struct ft5x06_touch_data_s *)priv->touchbuf;
/* Notify waiters (only if we ready some valid data) */
if (sample->tdstatus <= FT5x06_MAX_TOUCHES)
{
/* Notify any waiters that new FT5x06 data is available */
priv->valid = true;
ft5x06_notify(priv);
}
priv->valid = true;
ft5x06_notify(priv);
}
#ifdef CONFIG_FT5X06_POLLMODE #ifdef CONFIG_FT5X06_POLLMODE
else /* Update the poll rate */
{
ntouches = 0; if (sample->tdstatus > 0 && sample->tdstatus <= FT5x06_MAX_TOUCHES)
} {
/* Keep it at the minimum if touches are detected. */
/* Update the poll rate */
priv->delay = POLL_MINDELAY;
if (ntouches > 0) }
{ else if (priv->delay < POLL_MAXDELAY)
priv->delay = POLL_MINDELAY; {
} /* Let it rise gradually to the maximum if there is no touch */
else if (priv->delay < POLL_MAXDELAY)
{ priv->delay += POLL_INCREMENT;
priv->delay += POLL_INCREMENT; }
#endif
} }
#ifdef CONFIG_FT5X06_POLLMODE
/* Exit, re-starting the poll (unless there is no longer any task waiting /* Exit, re-starting the poll (unless there is no longer any task waiting
* for touch data). * for touch data).
*/ */