diff --git a/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c b/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c index 4fd722243fa2d95c333945987164c412e7f704a7..df2cd8c8b7a7ee1ebe914121067bffcfdc6bf802 100644 --- a/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c +++ b/configs/lpcxpresso-lpc54628/src/lpc54_ft5x06.c @@ -63,11 +63,11 @@ ****************************************************************************/ static int lpc54_ft5x06_attach(FAR const struct ft5x06_config_s *config, - enum ft5x06_irqsource_e irqsrc, xcpt_t isr, FAR void *arg); + xcpt_t isr, FAR void *arg); static void lpc54_ft5x06_enable(FAR const struct ft5x06_config_s *config, - enum ft5x06_irqsource_e irqsrc, bool enable); -static void lpc54_ft5x06_clear(FAR const struct ft5x06_config_s *config, - enum ft5x06_irqsource_e irqsrc); + bool enable); +static void lpc54_ft5x06_clear(FAR const struct ft5x06_config_s *config); +static void lpc54_ft5x06_wakeup(FAR const struct ft5x06_config_s *config); static void lpc54_ft5x06_nreset(FAR const struct ft5x06_config_s *config, bool state); @@ -82,6 +82,7 @@ static const struct ft5x06_config_s g_ft5x06_config = .attach = lpc54_ft5x06_attach, .enable = lpc54_ft5x06_enable, .clear = lpc54_ft5x06_clear, + .wakeup = lpc54_ft5x06_wakeup, .nreset = lpc54_ft5x06_nreset }; @@ -100,17 +101,9 @@ static uint8_t g_ft5x06_irq; ****************************************************************************/ static int lpc54_ft5x06_attach(FAR const struct ft5x06_config_s *config, - enum ft5x06_irqsource_e irqsrc, xcpt_t isr, - FAR void *arg) + xcpt_t isr, FAR void *arg) { - if (irqsrc == FT5X06_DATA_SOURCE) - { - return irq_attach(g_ft5x06_irq, isr, arg); - } - else - { - return -ENOSYS; - } + return irq_attach(g_ft5x06_irq, isr, arg); } /**************************************************************************** @@ -122,12 +115,16 @@ static int lpc54_ft5x06_attach(FAR const struct ft5x06_config_s *config, ****************************************************************************/ static void lpc54_ft5x06_enable(FAR const struct ft5x06_config_s *config, - enum ft5x06_irqsource_e irqsrc, bool enable) + bool enable) { - if (irqsrc == FT5X06_DATA_SOURCE) + if (enable) { up_enable_irq(g_ft5x06_irq); } + else + { + up_disable_irq(g_ft5x06_irq); + } } /**************************************************************************** @@ -138,13 +135,23 @@ static void lpc54_ft5x06_enable(FAR const struct ft5x06_config_s *config, * ****************************************************************************/ -static void lpc54_ft5x06_clear(FAR const struct ft5x06_config_s *config, - enum ft5x06_irqsource_e irqsrc) +static void lpc54_ft5x06_clear(FAR const struct ft5x06_config_s *config) { - if (irqsrc == FT5X06_DATA_SOURCE) - { - (void)lpc54_gpio_ackedge(g_ft5x06_irq); - } + (void)lpc54_gpio_ackedge(g_ft5x06_irq); +} + +/**************************************************************************** + * Name: lpc54_ft5x06_wakeup + * + * Description: + * Issue WAKE interrupt to FT5x06 to change the FT5x06 from Hibernate to + * Active mode. + * + ****************************************************************************/ + +static void lpc54_ft5x06_wakeup(FAR const struct ft5x06_config_s *config) +{ + /* We do not have access to the WAKE pin in the implementation */ } /**************************************************************************** diff --git a/drivers/input/ft5x06.c b/drivers/input/ft5x06.c index 24610491196130ec2565ad1b5a19738456e6a6d0..5d04a3b7c69440ebc4992bab76cc99b98e99c383 100644 --- a/drivers/input/ft5x06.c +++ b/drivers/input/ft5x06.c @@ -299,7 +299,7 @@ static void ft5x06_data_worker(FAR void *arg) /* Exit, re-enabling FT5x06 interrupts */ - config->enable(config, FT5X06_DATA_SOURCE, true); + config->enable(config, true); nxsem_post(&priv->devsem); } @@ -322,7 +322,7 @@ static int ft5x06_data_interrupt(int irq, FAR void *context, FAR void *arg) /* Disable further interrupts */ - config->enable(config, FT5X06_DATA_SOURCE, false); + config->enable(config, false); /* Transfer processing to the worker thread. Since FT5x06 interrupts are * disabled while the work is pending, no special action should be required @@ -338,7 +338,7 @@ static int ft5x06_data_interrupt(int irq, FAR void *context, FAR void *arg) /* Clear any pending interrupts and return success */ - config->clear(config, FT5X06_DATA_SOURCE); + config->clear(config); return OK; } @@ -384,6 +384,8 @@ static ssize_t ft5x06_sample(FAR struct ft5x06_dev_s *priv, FAR char *buffer, return 0; /* No touches read. */ } + DEBUGASSERT(ntouches <= FT5x06_MAX_TOUCHES); + /* User data buffer points (sink) */ sample = (FAR struct touch_sample_s *)buffer; @@ -523,8 +525,8 @@ static int ft5x06_bringup(FAR struct ft5x06_dev_s *priv) /* Enable FT5x06 interrupts */ - config->clear(config, FT5X06_DATA_SOURCE); - config->enable(config, FT5X06_DATA_SOURCE, true); + config->clear(config); + config->enable(config, true); return OK; } @@ -536,17 +538,14 @@ static void ft5x06_shutdown(FAR struct ft5x06_dev_s *priv) { FAR const struct ft5x06_config_s *config = priv->config; - /* Make sure that interrupts are disabled */ - - config->clear(config, FT5X06_DATA_SOURCE); - config->enable(config, FT5X06_DATA_SOURCE, false); + /* Make sure that the FT5x06 interrupt is disabled */ - config->clear(config, FT5X06_WAKE_SOURCE); - config->enable(config, FT5X06_WAKE_SOURCE, false); + config->clear(config); + config->enable(config, false); /* Attach the interrupt handler */ - (void)config->attach(config, FT5X06_DATA_SOURCE, NULL, NULL); + (void)config->attach(config, NULL, NULL); } /**************************************************************************** @@ -957,17 +956,14 @@ int ft5x06_register(FAR struct i2c_master_s *i2c, nxsem_setprotocol(&priv->waitsem, SEM_PRIO_NONE); - /* Make sure that interrupts are disabled */ - - config->clear(config, FT5X06_DATA_SOURCE); - config->enable(config, FT5X06_DATA_SOURCE, false); + /* Make sure that the FT5x06 interrupt interrupt is disabled */ - config->clear(config, FT5X06_WAKE_SOURCE); - config->enable(config, FT5X06_WAKE_SOURCE, false); + config->clear(config); + config->enable(config, false); /* Attach the interrupt handler */ - ret = config->attach(config, FT5X06_DATA_SOURCE, ft5x06_data_interrupt, + ret = config->attach(config, ft5x06_data_interrupt, priv); if (ret < 0) { diff --git a/drivers/ioexpander/pcf8574.c b/drivers/ioexpander/pcf8574.c index 01d5e9e75a086f3039fa5925910fdc73f69cf81b..ba8bca8c1ff9871fc0a515aa6815dcd9714f6b42 100644 --- a/drivers/ioexpander/pcf8574.c +++ b/drivers/ioexpander/pcf8574.c @@ -776,6 +776,7 @@ static FAR void *pcf8574_attach(FAR struct ioexpander_dev_s *dev, * 0 on success, else a negative error code * ****************************************************************************/ + #ifdef CONFIG_PCF8574_INT_ENABLE static int pcf8574_detach(FAR struct ioexpander_dev_s *dev, FAR void *handle) { diff --git a/include/nuttx/input/ft5x06.h b/include/nuttx/input/ft5x06.h index fb38ce00141114e6f2e83f0f220b1c17157823b2..0ec8641ce3ff83d63a656d5fedd3273bafbd8885 100644 --- a/include/nuttx/input/ft5x06.h +++ b/include/nuttx/input/ft5x06.h @@ -85,22 +85,6 @@ /**************************************************************************** * Public Types ****************************************************************************/ -/* The FT5x08 provides two interrupts pins: - * - * INT -A n interrupt signal to inform the host processor that touch data - * is ready for ready to be read. - * WAKE - An interrupt signal for the host to change FT5x06 from Hibernate - * to Active mode. - * - * A value from this enumeration must be passed to each interrupt-related - * interface method to distinguish the interrupt sources. - */ - -enum ft5x06_irqsource_e -{ - FT5X06_DATA_SOURCE = 0, - FT5X06_WAKE_SOURCE, -}; /* A reference to a structure of this type must be passed to the FT5X06 * driver. This structure provides information about the configuration @@ -126,15 +110,17 @@ struct ft5x06_config_s * attach - Attach an FT5x06 interrupt handler to a GPIO interrupt * enable - Enable or disable a GPIO interrupt * clear - Acknowledge/clear any pending GPIO interrupt + * wakeup - Issue WAKE interrupt to FT5x06 to change the FT5x06 from + * Hibernate to Active mode. * nreset - Control the chip reset pin (active low) + */ - int (*attach)(FAR const struct ft5x06_config_s *config, - enum ft5x06_irqsource_e irqsrc, xcpt_t isr, FAR void *arg); - void (*enable)(FAR const struct ft5x06_config_s *config, - enum ft5x06_irqsource_e irqsrc, bool enable); - void (*clear)(FAR const struct ft5x06_config_s *config, - enum ft5x06_irqsource_e irqsrc); + int (*attach)(FAR const struct ft5x06_config_s *config, xcpt_t isr, + FAR void *arg); + void (*enable)(FAR const struct ft5x06_config_s *config, bool enable); + void (*clear)(FAR const struct ft5x06_config_s *config); + void (*wakeup)(FAR const struct ft5x06_config_s *config); void (*nreset)(FAR const struct ft5x06_config_s *config, bool state); };