summaryrefslogtreecommitdiff
path: root/apps/examples/nxtext/nxtext_main.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-07-08 18:21:04 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-07-08 18:21:04 +0000
commit8ab28535bd5b776e1a5b1a6b3e8ae078986acf6d (patch)
treeac7e11f8cc08e69421ddf241e33c0075d176da69 /apps/examples/nxtext/nxtext_main.c
parenta4e513bfbe4c06a36fb2ee4d0bc53de015a5fe2e (diff)
downloadnuttx-8ab28535bd5b776e1a5b1a6b3e8ae078986acf6d.tar.gz
nuttx-8ab28535bd5b776e1a5b1a6b3e8ae078986acf6d.tar.bz2
nuttx-8ab28535bd5b776e1a5b1a6b3e8ae078986acf6d.zip
Changes for clean NXTEXT compile
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3755 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/examples/nxtext/nxtext_main.c')
-rw-r--r--apps/examples/nxtext/nxtext_main.c60
1 files changed, 15 insertions, 45 deletions
diff --git a/apps/examples/nxtext/nxtext_main.c b/apps/examples/nxtext/nxtext_main.c
index 9581ddb12..ce598c1a6 100644
--- a/apps/examples/nxtext/nxtext_main.c
+++ b/apps/examples/nxtext/nxtext_main.c
@@ -62,8 +62,6 @@
#include <nuttx/arch.h>
#include <nuttx/nx.h>
#include <nuttx/nxglib.h>
-#include <nuttx/nxtk.h>
-#include <nuttx/nxfonts.h>
#include "nxtext_internal.h"
@@ -84,6 +82,8 @@
# define CONFIG_EXAMPLES_NXTEXT_DEVNO 0
#endif
+#define BGMSG_LINES 4
+
/****************************************************************************
* Private Types
****************************************************************************/
@@ -96,16 +96,14 @@
* Private Data
****************************************************************************/
-static int g_exitcode = NXEXIT_SUCCESS;
-
#ifdef CONFIG_NX_KBD
static const uint8_t g_pumsg[] = "Pop-Up!";
-static const char *g_bkgdmsg[4] =
+static const char *g_bgmsg[BGMSG_LINES] =
{
"Now is the time ",
"for all good men ",
"To come to the aid ",
- "of their party "
+ "of their party. "
};
#endif
@@ -128,43 +126,12 @@ bool g_connected = false;
#endif
sem_t g_semevent = {0};
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: nxtext_openwindow
- ****************************************************************************/
-
-static inline NXEGWINDOW nxtext_openwindow(FAR const struct nx_callback_s *cb,
- FAR struct nxtext_state_s *state)
-{
- NXEGWINDOW hwnd;
-
- hwnd = nx_openwindow(g_hnx, cb, (FAR void *)state);
- if (!hwnd)
- {
- message("user_start: nx_openwindow failed: %d\n", errno);
- g_exitcode = NXEXIT_NXOPENWINDOW;
- }
- return hwnd;
-}
+int g_exitcode = NXEXIT_SUCCESS;
/****************************************************************************
- * Name: nxtext_closewindow
+ * Private Functions
****************************************************************************/
-static inline int nxtext_closewindow(NXEGWINDOW hwnd, FAR struct nxtext_state_s *state)
-{
- int ret = nx_closewindow(hwnd);
- if (ret < 0)
- {
- message("user_start: nx_closewindow failed: %d\n", errno);
- g_exitcode = NXEXIT_NXCLOSEWINDOW;
- }
- return ret;
-}
-
/****************************************************************************
* Name: nxtext_suinitialize
****************************************************************************/
@@ -359,7 +326,7 @@ static int nxtext_initialize(void)
int user_start(int argc, char *argv[])
{
FAR struct nxtext_state_s *bgstate;
- NXEGWINDOW hwnd;
+ NXWINDOW hwnd = NULL;
nxgl_mxpixel_t color;
int popcnt;
int bkgndx;
@@ -435,7 +402,7 @@ int user_start(int argc, char *argv[])
/* Destroy the pop-up window and restart the sequence */
message("user_start: Close pop-up\n");
- (void)nxtext_closewindow(hwnd, &g_pustate);
+ (void)nxpu_close(hwnd);
popcnt = 0;
}
else if (popcnt >= 3)
@@ -461,8 +428,11 @@ int user_start(int argc, char *argv[])
* text to go the background by calling the kbdin method directly.
*/
- nxbg_puts(g_hnx, strlen(g_bkgdmsg[bkgndx]), g_bkgdmsg[bkgndx], g_bkgdstate);
-#endif
+ nxbg_write(g_hnx, (FAR const uint8_t *)g_bgmsg[bkgndx], strlen(g_bgmsg[bkgndx]));
+ if (++bkgndx >= BGMSG_LINES)
+ {
+ bkgndx = 0;
+ }
}
/* Close the pop-up window */
@@ -471,10 +441,10 @@ errout_with_hwnd:
if (popcnt >= 3)
{
message("user_start: Close pop-up\n");
- (void)nxtext_closewindow(hwnd, &g_pustate);
+ (void)nxpu_close(hwnd);
}
-errout_with_bkgd:
+//errout_with_bkgd:
(void)nx_releasebkgd(g_hnx);
errout_with_nx: