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:
Gregory Nutt 2018-01-17 10:14:03 -06:00
parent 301bf1ee77
commit 43390c78ea
6 changed files with 114 additions and 190 deletions

View File

@ -355,20 +355,11 @@ static FAR struct spi_dev_s *sam_tsc_spiinitialize(void)
int sam_tsc_setup(int minor)
{
FAR struct spi_dev_s *dev;
static bool initialized = false;
int ret;
iinfo("minor %d\n", minor);
DEBUGASSERT(minor == 0);
/* Have we already initialized? Since we never uninitialize we must prevent
* 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)
{
/* Configure and enable the XPT2046 interrupt pin as an input */
(void)sam_configgpio(GPIO_TSC_IRQ);
@ -396,11 +387,6 @@ int sam_tsc_setup(int minor)
return -ENODEV;
}
/* Now we are initialized */
initialized = true;
}
return OK;
}

View File

@ -272,19 +272,12 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
int open1788_tsc_setup(int minor)
{
static bool initialized = false;
FAR struct spi_dev_s *dev;
int ret;
iinfo("initialized:%d minor:%d\n", initialized, minor);
iinfo("minor:%d\n", minor);
DEBUGASSERT(minor == 0);
/* Since there is no uninitialized logic, this initialization can be
* performed only one time.
*/
if (!initialized)
{
/* Configure and enable the XPT2046 PENIRQ pin as an interrupting input. */
(void)lpc17_configgpio(GPIO_TC_PENIRQ);
@ -315,9 +308,6 @@ int open1788_tsc_setup(int minor)
return -ENODEV;
}
initialized = true;
}
return OK;
}

View File

@ -88,18 +88,11 @@
int sam_tsc_setup(int minor)
{
struct sam_adc_s *adc;
static bool initialized = false;
int ret;
iinfo("initialized:%d minor:%d\n", initialized, minor);
iinfo("minor:%d\n", minor);
DEBUGASSERT(minor == 0);
/* Since there is no uninitialized logic, this initialization can be
* performed only one time.
*/
if (!initialized)
{
/* Initialize the ADC driver */
adc = sam_adc_initialize();
@ -119,9 +112,6 @@ int sam_tsc_setup(int minor)
return -ENODEV;
}
initialized = true;
}
return OK;
}

View File

@ -238,20 +238,11 @@ static int mxt_interrupt(int irq, FAR void *context, FAR void *arg)
int sam_tsc_setup(int minor)
{
FAR struct i2c_master_s *i2c;
static bool initialized = false;
int ret;
iinfo("minor %d\n", minor);
DEBUGASSERT(minor == 0);
/* Have we already initialized? Since we never uninitialize we must prevent
* 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)
{
/* Configure the maXTouch CHG interrupt pin */
(void)sam_configpio(PIO_CHG_MXT);
@ -281,11 +272,6 @@ int sam_tsc_setup(int minor)
return -ENODEV;
}
/* Now we are initialized */
initialized = true;
}
return OK;
}

View File

@ -237,20 +237,11 @@ static int mxt_interrupt(int irq, FAR void *context, FAR void *arg)
int sam_tsc_setup(int minor)
{
FAR struct i2c_master_s *i2c;
static bool initialized = false;
int ret;
iinfo("minor %d\n", minor);
DEBUGASSERT(minor == 0);
/* Have we already initialized? Since we never uninitialize we must prevent
* 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)
{
/* Configure the maXTouch CHG interrupt pin */
(void)sam_configgpio(GPIO_MXT_CHG);
@ -280,11 +271,6 @@ int sam_tsc_setup(int minor)
return -ENODEV;
}
/* Now we are initialized */
initialized = true;
}
return OK;
}

View File

@ -258,20 +258,11 @@ static bool tsc_pendown(FAR struct ads7843e_config_s *state)
int stm32_tsc_setup(int minor)
{
FAR struct spi_dev_s *dev;
static bool initialized = false;
int ret;
iinfo("minor %d\n", minor);
DEBUGASSERT(minor == 0);
/* Have we already initialized? Since we never uninitialize we must prevent
* 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)
{
/* Configure the XPT2046 interrupt pin as an input */
(void)stm32_configgpio(GPIO_LCDTP_IRQ);
@ -295,11 +286,6 @@ int stm32_tsc_setup(int minor)
return -ENODEV;
}
/* Now we are initialized */
initialized = true;
}
return OK;
}