drivers/lcd: Extend FT80x touchscreen initialization; add more touchscreen-related definitions.

This commit is contained in:
Gregory Nutt 2018-02-25 11:18:35 -06:00
parent b2d415da79
commit eeb40dc600
4 changed files with 37 additions and 12 deletions

View File

@ -199,14 +199,18 @@ static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable)
flags = enter_critical_section();
if (enable && priv->handler)
{
/* Configure the EXTI interrupt using the SAVED handler */
/* Configure the EXTI interrupt using the saved handler */
(void)stm32_gpiosetevent(GPIO_LCDTP_IRQ, true, true, true,
priv->handler, NULL);
}
else
{
/* Configure the EXTI interrupt with a NULL handler to disable it */
/* Configure the EXTI interrupt with a NULL handler to disable it.
*
* REVISIT: There is a problem here... interrupts received while
* the EXTI is de-configured will not pend but will be lost.
*/
(void)stm32_gpiosetevent(GPIO_LCDTP_IRQ, false, false, false,
NULL, NULL);

View File

@ -202,9 +202,9 @@ static void ft80x_enable(FAR const struct ft80x_config_s *lower,
flags = enter_critical_section();
if (enable && priv->handler)
{
/* Configure the EXTI interrupt using the SAVED handler */
/* Configure the EXTI interrupt using the saved handler */
(void)stm32_gpiosetevent(GPIO_LCDTP_IRQ, true, true, true,
(void)stm32_gpiosetevent(GPIO_FT80X_INT, true, true, true,
priv->handler, priv->arg);
}
else
@ -212,10 +212,10 @@ static void ft80x_enable(FAR const struct ft80x_config_s *lower,
/* Configure the EXTI interrupt with a NULL handler to disable it.
*
* REVISIT: There is a problem here... interrupts received while
* the EXIT is de-configured will not pend but will be lost.
* the EXTI is de-configured will not pend but will be lost.
*/
(void)stm32_gpiosetevent(GPIO_LCDTP_IRQ, false, false, false,
(void)stm32_gpiosetevent(GPIO_FT80X_INT, false, false, false,
NULL, NULL);
}

View File

@ -1388,19 +1388,28 @@ static int ft80x_initialize(FAR struct ft80x_dev_s *priv)
DEBUGASSERT(priv->lower->op_frequency <= 30000000);
priv->frequency = priv->lower->op_frequency;
/* Configure touch threshold.
* REVISIT: For FT800 set REG_TOUCH_RZTHRESH to 1200.
*/
/* Configure touch mode. Using default touch mode of FRAME_SYNC (~60Hz) */
ft80x_write_byte(priv, FT80X_REG_TOUCH_MODE, TOUCH_MODE_FRAMESYNC);
#if defined(CONFIG_LCD_FT800)
/* Configure the REG_TOUCH_RZTHRESH the value 1200 may need to be tweaked
/* Configure the touch threshold. The value 1200 may need to be tweaked
* for your application.
*/
ft80x_write_hword(priv, FT80X_REG_TOUCH_RZTHRESH, 1200);
#elif defined(CONFIG_LCD_FT801)
# warning Missing logic
#ifdef CONFIG_LCD_FT801_MULTITOUCH
/* Selected extended mode */
ft80x_write_byte(priv, FT80X_REG_CTOUCH_EXTENDED, 0);
#else
/* Selected compatibility mode */
ft80x_write_byte(priv, FT80X_REG_CTOUCH_EXTENDED, 1);
#endif
#else
# error No FT80x device configured
#endif

View File

@ -349,7 +349,7 @@
/* 0x1024d0 0x1024d4 Reserved */
# define FT80X_REG_CTOUCH_EXTENDED 0x1024f4 /* Set capacitive touch operation mode:
* 0: extended mode (multi-touch)
* 0: 1: FT800 compatibility mode (single touch) */
* 1: FT800 compatibility mode (single touch) */
# define FT80X_REG_CTOUCH_REG 0x1024f8 /* CTPM configure register write
* Bits [7:0]: configure register address
* Bits [15:8]: configure register value */
@ -415,6 +415,18 @@
#define TOUCH_TAG_MASK 0xff /* Bits 0-7: Tag of touched graphic object */
/* FT80X_REG_TOUCH_MODE */
#define TOUCH_MODE_OFF 0 /* Acquisition stopped, touch detection
* interrupt is still valid. */
#define TOUCH_MODE_ONESHOT 1 /* Perform acquisition once every write of 1
* to REG_TOUCH_MODE. */
#define TOUCH_MODE_FRAMESYNC 2 /* Perform acquisition for every frame sync
* (~60 data acquisition/second). */
#define TOUCH_MODE_CONTINUOUS 3 /* Perform acquisition continuously at
* approximately 1000 data acquisition /
* second. */
/* Interrupts *******************************************************************************/
/* The interrupt output pin is enabled by REG_INT_EN. When REG_INT_EN is 0, INT_N is
* tri-state (pulled to high by external pull-up resistor). When REG_INT_EN is 1, INT_N is