Merged in paimonen/nuttx/pullreq_max11802_updates (pull request #756)

max11802: Fix compilation errors and allow setting PULL and SAMPLE registers.

Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
Petteri Aimonen 2018-11-09 13:53:11 +00:00 committed by GregoryN
parent 31485356b8
commit 3e5a05f819
2 changed files with 19 additions and 5 deletions

View File

@ -104,7 +104,7 @@ static int max11802_sample(FAR struct max11802_dev_s *priv,
static int max11802_waitsample(FAR struct max11802_dev_s *priv,
FAR struct max11802_sample_s *sample);
static void max11802_worker(FAR void *arg);
static int max11802_interrupt(int irq, FAR void *context);
static int max11802_interrupt(int irq, FAR void *context, FAR void *arg);
/* Character driver methods */
@ -633,7 +633,7 @@ static void max11802_worker(FAR void *arg)
/* Continue to sample the position while the pen is down */
(void)wd_start(priv->wdog, MAX11802_WDOG_DELAY, max11802_wdog, 1,
i (uint32_t)priv);
(uint32_t)priv);
/* Check if data is valid */
@ -711,7 +711,7 @@ ignored:
* Name: max11802_interrupt
****************************************************************************/
static int max11802_interrupt(int irq, FAR void *context)
static int max11802_interrupt(int irq, FAR void *context, FAR void *arg)
{
FAR struct max11802_dev_s *priv;
FAR struct max11802_config_s *config;
@ -1234,6 +1234,11 @@ int max11802_register(FAR struct spi_dev_s *spi,
(void)SPI_SEND(priv->spi, MAX11802_AVG);
SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), false);
SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), true);
(void)SPI_SEND(priv->spi, MAX11802_CMD_SAMPLE_WR);
(void)SPI_SEND(priv->spi, MAX11802_SAMPLE);
SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), false);
SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), true);
(void)SPI_SEND(priv->spi, MAX11802_CMD_TIMING_WR);
(void)SPI_SEND(priv->spi, MAX11802_TIMING);
@ -1244,6 +1249,11 @@ int max11802_register(FAR struct spi_dev_s *spi,
(void)SPI_SEND(priv->spi, MAX11802_DELAY);
SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), false);
SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), true);
(void)SPI_SEND(priv->spi, MAX11802_CMD_PULL_WR);
(void)SPI_SEND(priv->spi, MAX11802_PULL);
SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), false);
/* Test that the device access was successful. */
SPI_SELECT(priv->spi, SPIDEV_TOUCHSCREEN(0), true);

View File

@ -71,14 +71,18 @@
#define MAX11802_CMD_MODE_WR (0x0B << 1)
#define MAX11802_CMD_MODE_RD ((0x0B << 1) | 1)
#define MAX11802_CMD_AVG_WR (0x03 << 1)
#define MAX11802_CMD_SAMPLE_WR (0x04 << 1)
#define MAX11802_CMD_TIMING_WR (0x05 << 1)
#define MAX11802_CMD_DELAY_WR (0x06 << 1)
#define MAX11802_CMD_PULL_WR (0x07 << 1)
/* Register values to set */
#define MAX11802_MODE 0x0E
#define MAX11802_MODE 0x06
#define MAX11802_AVG 0x55
#define MAX11802_SAMPLE 0xAA
#define MAX11802_TIMING 0x77
#define MAX11802_DELAY 0x55
#define MAX11802_PULL 0x33
/* Driver support **************************************************************************/
/* This format is used to construct the /dev/input[n] device driver path. It
@ -144,7 +148,7 @@ struct max11802_dev_s
*/
#ifndef CONFIG_DISABLE_POLL
struct pollfd *fds[CONFIG_ADS7843E_NPOLLWAITERS];
struct pollfd *fds[CONFIG_MAX11802_NPOLLWAITERS];
#endif
};