configs: Since the touch screen initialization is now called from one-time board-initialization logic, it no longer needs protection from re-entry.
This commit is contained in:
parent
301bf1ee77
commit
43390c78ea
@ -355,50 +355,36 @@ static FAR struct spi_dev_s *sam_tsc_spiinitialize(void)
|
|||||||
int sam_tsc_setup(int minor)
|
int sam_tsc_setup(int minor)
|
||||||
{
|
{
|
||||||
FAR struct spi_dev_s *dev;
|
FAR struct spi_dev_s *dev;
|
||||||
static bool initialized = false;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
iinfo("minor %d\n", minor);
|
iinfo("minor %d\n", minor);
|
||||||
DEBUGASSERT(minor == 0);
|
DEBUGASSERT(minor == 0);
|
||||||
|
|
||||||
/* Have we already initialized? Since we never uninitialize we must prevent
|
/* Configure and enable the XPT2046 interrupt pin as an input */
|
||||||
* multiple initializations. This is necessary, for example, when the
|
|
||||||
* touchscreen example is used as a built-in application in NSH and can be
|
|
||||||
* called numerous time. It will attempt to initialize each time.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!initialized)
|
(void)sam_configgpio(GPIO_TSC_IRQ);
|
||||||
|
|
||||||
|
/* Configure the PIO interrupt */
|
||||||
|
|
||||||
|
sam_gpioirq(SAM_TSC_IRQ);
|
||||||
|
|
||||||
|
/* Get an instance of the SPI interface for the touchscreen chip select */
|
||||||
|
|
||||||
|
dev = sam_tsc_spiinitialize();
|
||||||
|
if (!dev)
|
||||||
{
|
{
|
||||||
/* Configure and enable the XPT2046 interrupt pin as an input */
|
ierr("ERROR: Failed to initialize bit bang SPI\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
(void)sam_configgpio(GPIO_TSC_IRQ);
|
/* Initialize and register the SPI touschscreen device */
|
||||||
|
|
||||||
/* Configure the PIO interrupt */
|
ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR);
|
||||||
|
if (ret < 0)
|
||||||
sam_gpioirq(SAM_TSC_IRQ);
|
{
|
||||||
|
ierr("ERROR: Failed to register touchscreen device\n");
|
||||||
/* Get an instance of the SPI interface for the touchscreen chip select */
|
/* up_spiuninitialize(dev); */
|
||||||
|
return -ENODEV;
|
||||||
dev = sam_tsc_spiinitialize();
|
|
||||||
if (!dev)
|
|
||||||
{
|
|
||||||
ierr("ERROR: Failed to initialize bit bang SPI\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize and register the SPI touschscreen device */
|
|
||||||
|
|
||||||
ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
ierr("ERROR: Failed to register touchscreen device\n");
|
|
||||||
/* up_spiuninitialize(dev); */
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now we are initialized */
|
|
||||||
|
|
||||||
initialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -272,50 +272,40 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
|
|||||||
|
|
||||||
int open1788_tsc_setup(int minor)
|
int open1788_tsc_setup(int minor)
|
||||||
{
|
{
|
||||||
static bool initialized = false;
|
|
||||||
FAR struct spi_dev_s *dev;
|
FAR struct spi_dev_s *dev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
iinfo("initialized:%d minor:%d\n", initialized, minor);
|
iinfo("minor:%d\n", minor);
|
||||||
DEBUGASSERT(minor == 0);
|
DEBUGASSERT(minor == 0);
|
||||||
|
|
||||||
/* Since there is no uninitialized logic, this initialization can be
|
/* Configure and enable the XPT2046 PENIRQ pin as an interrupting input. */
|
||||||
* performed only one time.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!initialized)
|
(void)lpc17_configgpio(GPIO_TC_PENIRQ);
|
||||||
{
|
|
||||||
/* Configure and enable the XPT2046 PENIRQ pin as an interrupting input. */
|
|
||||||
|
|
||||||
(void)lpc17_configgpio(GPIO_TC_PENIRQ);
|
/* Configure the XPT2046 BUSY pin as a normal input. */
|
||||||
|
|
||||||
/* Configure the XPT2046 BUSY pin as a normal input. */
|
|
||||||
|
|
||||||
#ifndef XPT2046_NO_BUSY
|
#ifndef XPT2046_NO_BUSY
|
||||||
(void)lpc17_configgpio(GPIO_TC_BUSY);
|
(void)lpc17_configgpio(GPIO_TC_BUSY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Get an instance of the SPI interface */
|
/* Get an instance of the SPI interface */
|
||||||
|
|
||||||
dev = lpc17_sspbus_initialize(CONFIG_ADS7843E_SPIDEV);
|
dev = lpc17_sspbus_initialize(CONFIG_ADS7843E_SPIDEV);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
{
|
{
|
||||||
ierr("ERROR: Failed to initialize SPI bus %d\n", CONFIG_ADS7843E_SPIDEV);
|
ierr("ERROR: Failed to initialize SPI bus %d\n", CONFIG_ADS7843E_SPIDEV);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize and register the SPI touchscreen device */
|
/* Initialize and register the SPI touchscreen device */
|
||||||
|
|
||||||
ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR);
|
ret = ads7843e_register(dev, &g_tscinfo, CONFIG_ADS7843E_DEVMINOR);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
ierr("ERROR: Failed to register touchscreen device minor=%d\n",
|
ierr("ERROR: Failed to register touchscreen device minor=%d\n",
|
||||||
CONFIG_ADS7843E_DEVMINOR);
|
CONFIG_ADS7843E_DEVMINOR);
|
||||||
/* up_spiuninitialize(dev); */
|
/* up_spiuninitialize(dev); */
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
|
||||||
|
|
||||||
initialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -88,38 +88,28 @@
|
|||||||
int sam_tsc_setup(int minor)
|
int sam_tsc_setup(int minor)
|
||||||
{
|
{
|
||||||
struct sam_adc_s *adc;
|
struct sam_adc_s *adc;
|
||||||
static bool initialized = false;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
iinfo("initialized:%d minor:%d\n", initialized, minor);
|
iinfo("minor:%d\n", minor);
|
||||||
DEBUGASSERT(minor == 0);
|
DEBUGASSERT(minor == 0);
|
||||||
|
|
||||||
/* Since there is no uninitialized logic, this initialization can be
|
/* Initialize the ADC driver */
|
||||||
* performed only one time.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!initialized)
|
adc = sam_adc_initialize();
|
||||||
|
if (!adc)
|
||||||
{
|
{
|
||||||
/* Initialize the ADC driver */
|
ierr("ERROR: Failed to initialize the ADC driver\n");
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
adc = sam_adc_initialize();
|
/* Initialize and register the SPI touchscreen device */
|
||||||
if (!adc)
|
|
||||||
{
|
|
||||||
ierr("ERROR: Failed to initialize the ADC driver\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize and register the SPI touchscreen device */
|
ret = sam_tsd_register(adc, CONFIG_SAMA5D3xEK_TSD_DEVMINOR);
|
||||||
|
if (ret < 0)
|
||||||
ret = sam_tsd_register(adc, CONFIG_SAMA5D3xEK_TSD_DEVMINOR);
|
{
|
||||||
if (ret < 0)
|
ierr("ERROR: Failed to register touchscreen device /dev/input%d: %d\n",
|
||||||
{
|
CONFIG_SAMA5D3xEK_TSD_DEVMINOR, ret);
|
||||||
ierr("ERROR: Failed to register touchscreen device /dev/input%d: %d\n",
|
return -ENODEV;
|
||||||
CONFIG_SAMA5D3xEK_TSD_DEVMINOR, ret);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
initialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -238,52 +238,38 @@ static int mxt_interrupt(int irq, FAR void *context, FAR void *arg)
|
|||||||
int sam_tsc_setup(int minor)
|
int sam_tsc_setup(int minor)
|
||||||
{
|
{
|
||||||
FAR struct i2c_master_s *i2c;
|
FAR struct i2c_master_s *i2c;
|
||||||
static bool initialized = false;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
iinfo("minor %d\n", minor);
|
iinfo("minor %d\n", minor);
|
||||||
DEBUGASSERT(minor == 0);
|
DEBUGASSERT(minor == 0);
|
||||||
|
|
||||||
/* Have we already initialized? Since we never uninitialize we must prevent
|
/* Configure the maXTouch CHG interrupt pin */
|
||||||
* multiple initializations. This is necessary, for example, when the
|
|
||||||
* touchscreen example is used as a built-in application in NSH and can be
|
|
||||||
* called numerous time. It will attempt to initialize each time.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!initialized)
|
(void)sam_configpio(PIO_CHG_MXT);
|
||||||
|
|
||||||
|
/* Get an instance of the I2C interface for the touchscreen chip select */
|
||||||
|
|
||||||
|
i2c = sam_i2cbus_initialize(MXT_TWI_BUS);
|
||||||
|
if (!i2c)
|
||||||
{
|
{
|
||||||
/* Configure the maXTouch CHG interrupt pin */
|
ierr("ERROR: Failed to initialize I2C%d\n", MXT_TWI_BUS);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
(void)sam_configpio(PIO_CHG_MXT);
|
/* Configure maXTouch CHG interrupts */
|
||||||
|
|
||||||
/* Get an instance of the I2C interface for the touchscreen chip select */
|
sam_pioirq(PIO_CHG_MXT);
|
||||||
|
(void)irq_attach(IRQ_CHG_MXT, mxt_interrupt, NULL);
|
||||||
|
|
||||||
i2c = sam_i2cbus_initialize(MXT_TWI_BUS);
|
/* Initialize and register the I2C touchscreen device */
|
||||||
if (!i2c)
|
|
||||||
{
|
|
||||||
ierr("ERROR: Failed to initialize I2C%d\n", MXT_TWI_BUS);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Configure maXTouch CHG interrupts */
|
ret = mxt_register(i2c, &g_mxtinfo.lower, CONFIG_SAMA5D4EK_MXT_DEVMINOR);
|
||||||
|
if (ret < 0)
|
||||||
sam_pioirq(PIO_CHG_MXT);
|
{
|
||||||
(void)irq_attach(IRQ_CHG_MXT, mxt_interrupt, NULL);
|
ierr("ERROR: Failed to register touchscreen device\n");
|
||||||
|
irq_detach(IRQ_CHG_MXT);
|
||||||
/* Initialize and register the I2C touchscreen device */
|
/* sam_i2cbus_uninitialize(i2c); */
|
||||||
|
return -ENODEV;
|
||||||
ret = mxt_register(i2c, &g_mxtinfo.lower, CONFIG_SAMA5D4EK_MXT_DEVMINOR);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
ierr("ERROR: Failed to register touchscreen device\n");
|
|
||||||
irq_detach(IRQ_CHG_MXT);
|
|
||||||
/* sam_i2cbus_uninitialize(i2c); */
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now we are initialized */
|
|
||||||
|
|
||||||
initialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -237,52 +237,38 @@ static int mxt_interrupt(int irq, FAR void *context, FAR void *arg)
|
|||||||
int sam_tsc_setup(int minor)
|
int sam_tsc_setup(int minor)
|
||||||
{
|
{
|
||||||
FAR struct i2c_master_s *i2c;
|
FAR struct i2c_master_s *i2c;
|
||||||
static bool initialized = false;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
iinfo("minor %d\n", minor);
|
iinfo("minor %d\n", minor);
|
||||||
DEBUGASSERT(minor == 0);
|
DEBUGASSERT(minor == 0);
|
||||||
|
|
||||||
/* Have we already initialized? Since we never uninitialize we must prevent
|
/* Configure the maXTouch CHG interrupt pin */
|
||||||
* multiple initializations. This is necessary, for example, when the
|
|
||||||
* touchscreen example is used as a built-in application in NSH and can be
|
|
||||||
* called numerous time. It will attempt to initialize each time.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!initialized)
|
(void)sam_configgpio(GPIO_MXT_CHG);
|
||||||
|
|
||||||
|
/* Get an instance of the I2C interface for the touchscreen chip select */
|
||||||
|
|
||||||
|
i2c = sam_i2cbus_initialize(MXT_TWI_BUS);
|
||||||
|
if (!i2c)
|
||||||
{
|
{
|
||||||
/* Configure the maXTouch CHG interrupt pin */
|
ierr("ERROR: Failed to initialize I2C%d\n", MXT_TWI_BUS);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
(void)sam_configgpio(GPIO_MXT_CHG);
|
/* Configure maXTouch CHG interrupts */
|
||||||
|
|
||||||
/* Get an instance of the I2C interface for the touchscreen chip select */
|
sam_gpioirq(GPIO_MXT_CHG);
|
||||||
|
(void)irq_attach(IRQ_MXT_CHG, mxt_interrupt, NULL);
|
||||||
|
|
||||||
i2c = sam_i2cbus_initialize(MXT_TWI_BUS);
|
/* Initialize and register the I2C touchscreen device */
|
||||||
if (!i2c)
|
|
||||||
{
|
|
||||||
ierr("ERROR: Failed to initialize I2C%d\n", MXT_TWI_BUS);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Configure maXTouch CHG interrupts */
|
ret = mxt_register(i2c, &g_mxtinfo.lower, CONFIG_SAMV71XULT_MXT_DEVMINOR);
|
||||||
|
if (ret < 0)
|
||||||
sam_gpioirq(GPIO_MXT_CHG);
|
{
|
||||||
(void)irq_attach(IRQ_MXT_CHG, mxt_interrupt, NULL);
|
ierr("ERROR: Failed to register touchscreen device\n");
|
||||||
|
irq_detach(IRQ_MXT_CHG);
|
||||||
/* Initialize and register the I2C touchscreen device */
|
/* sam_i2cbus_uninitialize(i2c); */
|
||||||
|
return -ENODEV;
|
||||||
ret = mxt_register(i2c, &g_mxtinfo.lower, CONFIG_SAMV71XULT_MXT_DEVMINOR);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
ierr("ERROR: Failed to register touchscreen device\n");
|
|
||||||
irq_detach(IRQ_MXT_CHG);
|
|
||||||
/* sam_i2cbus_uninitialize(i2c); */
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now we are initialized */
|
|
||||||
|
|
||||||
initialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -258,46 +258,32 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
|
|||||||
int stm32_tsc_setup(int minor)
|
int stm32_tsc_setup(int minor)
|
||||||
{
|
{
|
||||||
FAR struct spi_dev_s *dev;
|
FAR struct spi_dev_s *dev;
|
||||||
static bool initialized = false;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
iinfo("minor %d\n", minor);
|
iinfo("minor %d\n", minor);
|
||||||
DEBUGASSERT(minor == 0);
|
DEBUGASSERT(minor == 0);
|
||||||
|
|
||||||
/* Have we already initialized? Since we never uninitialize we must prevent
|
/* Configure the XPT2046 interrupt pin as an input */
|
||||||
* multiple initializations. This is necessary, for example, when the
|
|
||||||
* touchscreen example is used as a built-in application in NSH and can be
|
|
||||||
* called numerous time. It will attempt to initialize each time.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!initialized)
|
(void)stm32_configgpio(GPIO_LCDTP_IRQ);
|
||||||
|
|
||||||
|
/* Get an instance of the SPI interface for the touchscreen chip select */
|
||||||
|
|
||||||
|
dev = stm32_spibus_initialize(TSC_DEVNUM);
|
||||||
|
if (!dev)
|
||||||
{
|
{
|
||||||
/* Configure the XPT2046 interrupt pin as an input */
|
ierr("ERROR: Failed to initialize SPI%d\n", TSC_DEVNUM);
|
||||||
|
return -ENODEV;
|
||||||
|
}
|
||||||
|
|
||||||
(void)stm32_configgpio(GPIO_LCDTP_IRQ);
|
/* Initialize and register the SPI touchscreen device */
|
||||||
|
|
||||||
/* Get an instance of the SPI interface for the touchscreen chip select */
|
ret = ads7843e_register(dev, &g_tscinfo.config, CONFIG_ADS7843E_DEVMINOR);
|
||||||
|
if (ret < 0)
|
||||||
dev = stm32_spibus_initialize(TSC_DEVNUM);
|
{
|
||||||
if (!dev)
|
ierr("ERROR: Failed to register touchscreen device\n");
|
||||||
{
|
/* up_spiuninitialize(dev); */
|
||||||
ierr("ERROR: Failed to initialize SPI%d\n", TSC_DEVNUM);
|
return -ENODEV;
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize and register the SPI touchscreen device */
|
|
||||||
|
|
||||||
ret = ads7843e_register(dev, &g_tscinfo.config, CONFIG_ADS7843E_DEVMINOR);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
ierr("ERROR: Failed to register touchscreen device\n");
|
|
||||||
/* up_spiuninitialize(dev); */
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Now we are initialized */
|
|
||||||
|
|
||||||
initialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
Loading…
Reference in New Issue
Block a user