examples/touchscreen: Add a configuration option to indicate that there is or is not an architecture-specific initialization function
This commit is contained in:
parent
b9cf7acb1a
commit
08d269634a
@ -884,4 +884,5 @@
|
||||
three smaller files (2014-4-11).
|
||||
* apps/netutils/ntpclient/ntpclient.c: Corrections to the NTP client
|
||||
from Manuel Stuehn (2014-4-12).
|
||||
|
||||
* apps/examples/touchscreen: Add a configuration option to indicate if
|
||||
architecture-specific initialized is required, yes or no (2014-4-14).
|
||||
|
@ -43,4 +43,25 @@ config EXAMPLES_TOUCHSCREEN_MOUSE
|
||||
The touchscreen test can also be configured to work with a mouse
|
||||
driver by setting this option.
|
||||
|
||||
config EXAMPLES_TOUCHSCREEN_ARCHINIT
|
||||
bool "Architecture-specific initialization"
|
||||
default y
|
||||
---help---
|
||||
By default, the touchscreen example will call arch_tcinitialize() to
|
||||
register the touchscreen device before it attempts to open it.
|
||||
Similarly, it will call arch_tcuninitialize() to unregister the
|
||||
touchscreen device when it is finished.
|
||||
|
||||
This works well for the typical touchscreen controller but there are
|
||||
other devices that cannot be initialized and uninitialized in this
|
||||
fashion. Consider a USB mouse, fo example. The USB mouse will be
|
||||
registered when the mouse is connected and unregistered when the
|
||||
mouse is disconnected.
|
||||
|
||||
So, in cases like this, there are two options: (1) provide dummy
|
||||
arch_tcinitialize() and arch_tcuninitialize() just to satisfy the
|
||||
linking requirements or, (2) select this option. if this option is
|
||||
de-selected, then the arch_tcinitialize() and arch_tcuninitialize() will
|
||||
never be called.
|
||||
|
||||
endif
|
||||
|
@ -118,6 +118,7 @@ int tc_main(int argc, char *argv[])
|
||||
message("tc_main: nsamples: %d\n", CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT
|
||||
/* Initialization of the touchscreen hardware is performed by logic
|
||||
* external to this test.
|
||||
*/
|
||||
@ -130,6 +131,7 @@ int tc_main(int argc, char *argv[])
|
||||
errval = 1;
|
||||
goto errout;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Open the touchscreen device for reading */
|
||||
|
||||
@ -249,8 +251,12 @@ int tc_main(int argc, char *argv[])
|
||||
|
||||
errout_with_dev:
|
||||
close(fd);
|
||||
|
||||
errout_with_tc:
|
||||
#ifdef CONFIG_EXAMPLES_TOUCHSCREEN_ARCHINIT
|
||||
arch_tcuninitialize();
|
||||
#endif
|
||||
|
||||
errout:
|
||||
message("Terminating!\n");
|
||||
msgflush();
|
||||
|
Loading…
Reference in New Issue
Block a user