diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-12-04 03:19:59 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-12-04 03:19:59 +0000 |
commit | 01fab0c78eeef5461a896847f05caec51d26050f (patch) | |
tree | 1a500c7a38318a2d9ee6b40655863d4726c1f2f8 /nuttx/examples/nx/nx_main.c | |
parent | 6f348a7102c32164dd7fcc9008bdbd8a810fc5b7 (diff) | |
download | px4-nuttx-01fab0c78eeef5461a896847f05caec51d26050f.tar.gz px4-nuttx-01fab0c78eeef5461a896847f05caec51d26050f.tar.bz2 px4-nuttx-01fab0c78eeef5461a896847f05caec51d26050f.zip |
Enable keypad input
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1411 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/nx/nx_main.c')
-rw-r--r-- | nuttx/examples/nx/nx_main.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/nuttx/examples/nx/nx_main.c b/nuttx/examples/nx/nx_main.c index 7e68b47bd..ed7b7a3bb 100644 --- a/nuttx/examples/nx/nx_main.c +++ b/nuttx/examples/nx/nx_main.c @@ -43,6 +43,7 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <string.h> #include <sched.h> #include <pthread.h> #include <errno.h> @@ -72,6 +73,12 @@ static int g_exitcode = NXEXIT_SUCCESS; +#ifdef CONFIG_NX_KBD +static const ubyte g_kbdmsg1[] = "NuttX is cool!"; +static const ubyte g_kbdmsg2[] = "NuttX is fun!"; +#endif + + /**************************************************************************** * Public Data ****************************************************************************/ @@ -660,6 +667,23 @@ int user_start(int argc, char *argv[]) sleep(1); #endif + /* Give keyboard input to the top window -- should be window #2 */ + +#ifdef CONFIG_NX_KBD + message("user_start: Send keyboard input: %s\n", g_kbdmsg1); + ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_kbdmsg1), g_kbdmsg1); + if (ret < 0) + { + message("user_start: nx_kbdin failed: %d\n", errno); + goto errout_with_hwnd2; + } + + /* Sleep a bit */ + + message("user_start: Sleeping\n\n"); + sleep(1); +#endif + /* Lower window 2 */ message("user_start: Lower window #2\n"); @@ -685,6 +709,23 @@ int user_start(int argc, char *argv[]) sleep(1); #endif + /* Give keyboard input to the top window -- should be window #1 */ + +#ifdef CONFIG_NX_KBD + message("user_start: Send keyboard input: %s\n", g_kbdmsg2); + ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_kbdmsg2), g_kbdmsg2); + if (ret < 0) + { + message("user_start: nx_kbdin failed: %d\n", errno); + goto errout_with_hwnd2; + } + + /* Sleep a bit */ + + message("user_start: Sleeping\n\n"); + sleep(1); +#endif + /* Raise window 2 */ message("user_start: Raise window #2\n"); |