summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/examples/Makefile2
-rw-r--r--apps/examples/nxtext/nxtext_bkgd.c51
-rw-r--r--apps/examples/nxtext/nxtext_internal.h46
-rw-r--r--apps/examples/nxtext/nxtext_main.c60
-rw-r--r--apps/examples/nxtext/nxtext_popup.c61
-rw-r--r--apps/examples/nxtext/nxtext_putc.c16
-rw-r--r--nuttx/configs/stm3210e-eval/nx/defconfig2
-rw-r--r--nuttx/configs/stm3210e-eval/nxtext/defconfig30
-rwxr-xr-xnuttx/configs/stm3210e-eval/src/up_lcd.c4
9 files changed, 128 insertions, 144 deletions
diff --git a/apps/examples/Makefile b/apps/examples/Makefile
index 95769ed0c..b19dff483 100644
--- a/apps/examples/Makefile
+++ b/apps/examples/Makefile
@@ -38,7 +38,7 @@
# Sub-directories
SUBDIRS = buttons dhcpd ftpc hello helloxx hidkbd igmp mm mount nettest \
- nsh null nx nxffs nxflat ostest pashello pipe poll rgmp romfs \
+ nsh null nx nxffs nxflat nxtext ostest pashello pipe poll rgmp romfs \
sendmail serloop thttpd udp uip usbserial usbstorage wget wlan
all: nothing
diff --git a/apps/examples/nxtext/nxtext_bkgd.c b/apps/examples/nxtext/nxtext_bkgd.c
index 16965d7ae..0ec326b49 100644
--- a/apps/examples/nxtext/nxtext_bkgd.c
+++ b/apps/examples/nxtext/nxtext_bkgd.c
@@ -43,12 +43,13 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <semaphore.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/nx.h>
-#include <nuttx/nxtk.h>
+#include <nuttx/nxfonts.h>
#include "nxtext_internal.h"
@@ -64,35 +65,35 @@
* Private Function Prototypes
****************************************************************************/
-static void nxbg_redraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
+static void nxbg_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
bool morem, FAR void *arg);
-static void nxbg_position(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size,
+static void nxbg_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size,
FAR const struct nxgl_point_s *pos,
FAR const struct nxgl_rect_s *bounds,
FAR void *arg);
#ifdef CONFIG_NX_MOUSE
-static void nxbg_mousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos,
+static void nxbg_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos,
uint8_t buttons, FAR void *arg);
#endif
#ifdef CONFIG_NX_KBD
static void nxbg_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch,
- FAR void *arg)
+ FAR void *arg);
#endif
/****************************************************************************
* Private Data
****************************************************************************/
-static struct nxtext_state_s g_bgstate;
-static struct nxtext_bitmap_s g_bgbm[CONFIG_EXAMPLES_NXTEXT_BMCACHE];
-static struct nxtext_glyph_s g_bgglyph[CONFIG_EXAMPLES_NXTEXT_GLCACHE];
+static struct nxtext_state_s g_bgstate;
+static struct nxtext_bitmap_s g_bgbm[CONFIG_EXAMPLES_NXTEXT_BMCACHE];
+static struct nxtext_glyph_s g_bgglyph[CONFIG_EXAMPLES_NXTEXT_GLCACHE];
/****************************************************************************
* Public Data
****************************************************************************/
-const struct nx_callback_s g_bkgdcb =
+const struct nx_callback_s g_bgcb =
{
nxbg_redraw, /* redraw */
nxbg_position /* position */
@@ -112,14 +113,14 @@ const struct nx_callback_s g_bkgdcb =
* Name: nxbg_fillwindow
****************************************************************************/
-static inline void nxbg_fillwindow(NXEGWINDOW hwnd,
+static inline void nxbg_fillwindow(NXWINDOW hwnd,
FAR const struct nxgl_rect_s *rect,
FAR struct nxtext_state_s *st)
{
int ret;
int i;
- ret = nx_fill(hwnd, rect, st->color);
+ ret = nx_fill(hwnd, rect, st->wcolor);
if (ret < 0)
{
message("nxbg_fillwindow: nx_fill failed: %d\n", errno);
@@ -142,7 +143,7 @@ static inline void nxbg_fillwindow(NXEGWINDOW hwnd,
* Name: nxbg_redraw
****************************************************************************/
-static void nxbg_redraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
+static void nxbg_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
bool more, FAR void *arg)
{
FAR struct nxtext_state_s *st = (FAR struct nxtext_state_s *)arg;
@@ -157,7 +158,7 @@ static void nxbg_redraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
* Name: nxbg_position
****************************************************************************/
-static void nxbg_position(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size,
+static void nxbg_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size,
FAR const struct nxgl_point_s *pos,
FAR const struct nxgl_rect_s *bounds,
FAR void *arg)
@@ -195,10 +196,9 @@ static void nxbg_position(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size,
****************************************************************************/
#ifdef CONFIG_NX_MOUSE
-static void nxbg_mousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos,
+static void nxbg_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos,
uint8_t buttons, FAR void *arg)
{
- FAR struct nxtext_state_s *st = (FAR struct nxtext_state_s *)arg;
message("nxbg_mousein: hwnd=%p pos=(%d,%d) button=%02x\n",
hwnd, pos->x, pos->y, buttons);
}
@@ -212,9 +212,8 @@ static void nxbg_mousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos,
static void nxbg_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch,
FAR void *arg)
{
- FAR struct nxtext_state_s *st = (FAR struct nxtext_state_s *)arg;
message("nxbg_kbdin: hwnd=%p nch=%d\n", hwnd, nch);
- nxbg_puts(hwnd, st, nch, ch);
+ nxbg_write(hwnd, ch, nch);
}
#endif
@@ -301,7 +300,7 @@ FAR struct nxtext_state_s *nxbg_getstate(void)
/* Initialize the color (used for redrawing the window) */
- memset(&g_gbstate, 0, sizeof(struct nxtext_state_s));
+ memset(&g_bgstate, 0, sizeof(struct nxtext_state_s));
g_bgstate.wcolor[0] = CONFIG_EXAMPLES_NXTEXT_BGCOLOR;
g_bgstate.fcolor[0] = CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR;
@@ -323,23 +322,23 @@ FAR struct nxtext_state_s *nxbg_getstate(void)
/* Set the first display position */
- nxtext_home(st);
+ nxtext_home(&g_bgstate);
return &g_bgstate;
}
/****************************************************************************
- * Name: nxbg_puts
+ * Name: nxbg_write
****************************************************************************/
-void nxbg_puts(NXWINDOW hwnd, FAR const uint8_t *ch)
+void nxbg_write(NXWINDOW hwnd, FAR const uint8_t *buffer, size_t buflen)
{
int lineheight = (g_bgstate.fheight + 2);
- while (*ch)
+ while (buflen-- > 0)
{
/* Will another character fit on this line? */
- if (g_bgstate.pos.x + b_bgstate.spwidth > bg_state.size.w)
+ if (g_bgstate.pos.x + g_bgstate.fwidth > g_bgstate.wsize.w)
{
/* No.. move to the next line */
@@ -347,9 +346,9 @@ void nxbg_puts(NXWINDOW hwnd, FAR const uint8_t *ch)
/* If we were about to output a newline character, then don't */
- if (*ch == '\n')
+ if (*buffer == '\n')
{
- ch++;
+ buffer++;
continue;
}
}
@@ -363,7 +362,7 @@ void nxbg_puts(NXWINDOW hwnd, FAR const uint8_t *ch)
/* Finally, we can output the character */
- nxtext_putc(hwnd, &g_bgstate, *ch++);
+ nxtext_putc(hwnd, &g_bgstate, (uint8_t)*buffer++);
}
}
diff --git a/apps/examples/nxtext/nxtext_internal.h b/apps/examples/nxtext/nxtext_internal.h
index 17747657f..c1fc76b48 100644
--- a/apps/examples/nxtext/nxtext_internal.h
+++ b/apps/examples/nxtext/nxtext_internal.h
@@ -148,9 +148,6 @@
# endif
#endif
-#define NXEGWINDOW NXWINDOW
-#define NXTK_MAXKBDCHARS 16
-
/* Debug ********************************************************************/
#ifdef CONFIG_CPP_HAVE_VARARGS
@@ -178,9 +175,7 @@
enum exitcode_e
{
NXEXIT_SUCCESS = 0,
- NXEXIT_SIGPROCMASK,
NXEXIT_SCHEDSETPARAM,
- NXEXIT_EVENTNOTIFY,
NXEXIT_TASKCREATE,
NXEXIT_PTHREADCREATE,
NXEXIT_EXTINITIALIZE,
@@ -189,15 +184,12 @@ enum exitcode_e
NXEXIT_LCDINITIALIZE,
NXEXIT_LCDGETDEV,
NXEXIT_NXOPEN,
- NXEXIT_NXREQUESTBKGD
- NXEXIT_NXOPENTOOLBAR,
+ NXEXIT_NXREQUESTBKGD,
NXEXIT_NXCONNECT,
NXEXIT_NXSETBGCOLOR,
NXEXIT_NXOPENWINDOW,
NXEXIT_NXSETSIZE,
NXEXIT_NXSETPOSITION,
- NXEXIT_NXLOWER,
- NXEXIT_NXRAISE,
NXEXIT_NXCLOSEWINDOW,
NXEXIT_LOSTSERVERCONN
};
@@ -228,28 +220,28 @@ struct nxtext_state_s
/* The following describe the window */
nxgl_mxpixel_t wcolor[CONFIG_NX_NPLANES]; /* Window color */
- struct nxgl_size_s wsize, /* Window size */
+ struct nxgl_size_s wsize; /* Window size */
/* These characterize the font in use */
nxgl_mxpixel_t fcolor[CONFIG_NX_NPLANES]; /* Font color */
- uint8_t fheight; /* Max height of a font in pixels */
- uint8_t fwidth; /* Max width of a font in pixels */
- uint8_t spwidth; /* The width of a space */
+ uint8_t fheight; /* Max height of a font in pixels */
+ uint8_t fwidth; /* Max width of a font in pixels */
+ uint8_t spwidth; /* The width of a space */
/* This is the next display position */
- struct nxgl_point_s pos; /* Next display position */
+ struct nxgl_point_s pos; /* Next display position */
/* These describe all text already added to the display */
- uint8_t maxchars; /* Size of the mb array */
- uint8_t maxglyphs; /* Size of the glyph array */
- uint8_t nchars; /* Number of chars already displayed */
- uint8_t nglyphs; /* Number of glyphs cached */
+ uint16_t maxchars; /* Size of the mb array */
+ uint8_t maxglyphs; /* Size of the glyph array */
+ uint8_t nchars; /* Number of chars already displayed */
+ uint8_t nglyphs; /* Number of glyphs cached */
- FAR struct nxtext_bitmap_s *bm;
- FAR struct nxtext_glyph_s *glyph;
+ FAR struct nxtext_bitmap_s *bm; /* List of characters on the display */
+ FAR struct nxtext_glyph_s *glyph; /* Cache of rendered fonts in use */
};
/****************************************************************************
@@ -262,7 +254,7 @@ extern NXHANDLE g_hnx;
/* NX callback vtables */
-extern const struct nx_callback_s g_bkgdcb;
+extern const struct nx_callback_s g_bgcb;
/* The screen resolution */
@@ -275,6 +267,8 @@ extern bool g_connected;
#endif
extern sem_t g_semevent;
+extern int g_exitcode;
+
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
@@ -289,13 +283,13 @@ extern FAR void *nxtext_listener(FAR void *arg);
/* Background window interfaces */
-extern FAR struct nxtext_state_s *nxgb_getstate(void);
-extern void nxbg_puts(NXWINDOW hwnd, FAR struct nxtext_state_s *st,
- uint8_t nch, FAR const uint8_t *ch)
+extern FAR struct nxtext_state_s *nxbg_getstate(void);
+extern void nxbg_write(NXWINDOW hwnd, FAR const uint8_t *buffer, size_t buflen);
/* Pop-up window interfaces */
-extern NXEGWINDOW nxpu_open(void);
+extern NXWINDOW nxpu_open(void);
+extern int nxpu_close(NXWINDOW hwnd);
/* Generic text helpers */
@@ -304,6 +298,6 @@ extern void nxtext_newline(FAR struct nxtext_state_s *st);
extern void nxtext_putc(NXWINDOW hwnd, FAR struct nxtext_state_s *st,
uint8_t ch);
extern void nxtext_fillchar(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
- FAR const struct nxtext_bitmap_s *bm)
+ FAR const struct nxtext_bitmap_s *bm);
#endif /* __EXAMPLES_NXTEXT_NXTEXT_INTERNAL_H */
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:
diff --git a/apps/examples/nxtext/nxtext_popup.c b/apps/examples/nxtext/nxtext_popup.c
index d219ce770..b59a84500 100644
--- a/apps/examples/nxtext/nxtext_popup.c
+++ b/apps/examples/nxtext/nxtext_popup.c
@@ -43,12 +43,13 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <semaphore.h>
#include <debug.h>
#include <errno.h>
#include <nuttx/nx.h>
-#include <nuttx/nxtk.h>
+#include <nuttx/nxfonts.h>
#include "nxtext_internal.h"
@@ -67,20 +68,20 @@
* Private Function Prototypes
****************************************************************************/
-static void nxpu_redraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
+static void nxpu_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
bool morem, FAR void *arg);
-static void nxpu_position(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size,
+static void nxpu_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size,
FAR const struct nxgl_point_s *pos,
FAR const struct nxgl_rect_s *bounds,
FAR void *arg);
#ifdef CONFIG_NX_MOUSE
-static void nxpu_mousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos,
+static void nxpu_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos,
uint8_t buttons, FAR void *arg);
#endif
#ifdef CONFIG_NX_KBD
static void nxpu_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch,
- FAR void *arg)
+ FAR void *arg);
#endif
/****************************************************************************
@@ -117,7 +118,7 @@ static struct nxtext_glyph_s g_puglyph[NGLYPH_CACHE];
* Name: nxpu_setsize
****************************************************************************/
-static inline int nxpu_setsize(NXEGWINDOW hwnd, FAR struct nxgl_size_s *size)
+static inline int nxpu_setsize(NXWINDOW hwnd, FAR struct nxgl_size_s *size)
{
int ret = nx_setsize(hwnd, size);
if (ret < 0)
@@ -132,7 +133,7 @@ static inline int nxpu_setsize(NXEGWINDOW hwnd, FAR struct nxgl_size_s *size)
* Name: nxpu_setposition
****************************************************************************/
-static inline int nxpu_setposition(NXEGWINDOW hwnd, FAR struct nxgl_point_s *pos)
+static inline int nxpu_setposition(NXWINDOW hwnd, FAR struct nxgl_point_s *pos)
{
int ret = nx_setposition(hwnd, pos);
if (ret < 0)
@@ -147,14 +148,14 @@ static inline int nxpu_setposition(NXEGWINDOW hwnd, FAR struct nxgl_point_s *pos
* Name: nxpu_fillwindow
****************************************************************************/
-static inline void nxpu_fillwindow(NXEGWINDOW hwnd,
+static inline void nxpu_fillwindow(NXWINDOW hwnd,
FAR const struct nxgl_rect_s *rect,
FAR struct nxtext_state_s *st)
{
int ret;
int i;
- ret = nx_fill(hwnd, rect, st->color);
+ ret = nx_fill(hwnd, rect, st->wcolor);
if (ret < 0)
{
message("nxpu_fillwindow: nx_fill failed: %d\n", errno);
@@ -175,7 +176,7 @@ static inline void nxpu_fillwindow(NXEGWINDOW hwnd,
* Name: nxpu_redraw
****************************************************************************/
-static void nxpu_redraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
+static void nxpu_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
bool more, FAR void *arg)
{
FAR struct nxtext_state_s *st = (FAR struct nxtext_state_s *)arg;
@@ -190,7 +191,7 @@ static void nxpu_redraw(NXEGWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
* Name: nxpu_position
****************************************************************************/
-static void nxpu_position(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size,
+static void nxpu_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size,
FAR const struct nxgl_point_s *pos,
FAR const struct nxgl_rect_s *bounds,
FAR void *arg)
@@ -214,10 +215,9 @@ static void nxpu_position(NXEGWINDOW hwnd, FAR const struct nxgl_size_s *size,
****************************************************************************/
#ifdef CONFIG_NX_MOUSE
-static void nxpu_mousein(NXEGWINDOW hwnd, FAR const struct nxgl_point_s *pos,
+static void nxpu_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos,
uint8_t buttons, FAR void *arg)
{
- FAR struct nxtext_state_s *st = (FAR struct nxtext_state_s *)arg;
message("nxpu_mousein: hwnd=%p pos=(%d,%d) button=%02x\n",
hwnd, pos->x, pos->y, buttons);
}
@@ -263,7 +263,7 @@ static inline void nxpu_initstate(void)
/* Initialize the color (used for redrawing the window) */
- memset(&g_gbstate, 0, sizeof(struct nxtext_state_s));
+ memset(&g_pustate, 0, sizeof(struct nxtext_state_s));
g_pustate.wcolor[0] = CONFIG_EXAMPLES_NXTEXT_PUCOLOR;
g_pustate.fcolor[0] = CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR;
@@ -286,7 +286,7 @@ static inline void nxpu_initstate(void)
/* Set the first display position */
- nxtext_home(st);
+ nxtext_home(&g_pustate);
#endif
}
@@ -298,25 +298,26 @@ static inline void nxpu_initstate(void)
* Name: nxpu_open
****************************************************************************/
-NXEGWINDOW nxpu_open(void)
+NXWINDOW nxpu_open(void)
{
- NXEGWINDOW hwnd;
+ NXWINDOW hwnd;
struct nxgl_size_s size;
struct nxgl_point_s pt;
+ int ret;
/* Create a pop-up window */
message("user_start: Create pop-up\n");
nxpu_initstate();
- hwnd = nx_openwindow(g_hnx, cb, (FAR void *)state);
+ hwnd = nx_openwindow(g_hnx, &g_pucb, (FAR void *)&g_pustate);
message("user_start: hwnd=%p\n", hwnd);
if (!hwnd)
{
message("user_start: nx_openwindow failed: %d\n", errno);
g_exitcode = NXEXIT_NXOPENWINDOW;
- goto errout_with_bkgd;
+ goto errout_with_state;
}
/* Set the size of the pop-up window */
@@ -325,7 +326,7 @@ NXEGWINDOW nxpu_open(void)
size.h = g_yres / 4;
message("user_start: Set pop-up size to (%d,%d)\n", size.w, size.h);
- ret = nxpu_setsize(hwnd, &g_pustate.size);
+ ret = nxpu_setsize(hwnd, &size);
if (ret < 0)
{
goto errout_with_hwnd;
@@ -344,5 +345,25 @@ NXEGWINDOW nxpu_open(void)
}
return hwnd;
+
+errout_with_hwnd:
+ (void)nx_closewindow(hwnd);
+
+errout_with_state:
+ return NULL;
}
+/****************************************************************************
+ * Name: nxpu_close
+ ****************************************************************************/
+
+int nxpu_close(NXWINDOW hwnd)
+{
+ int ret = nx_closewindow(hwnd);
+ if (ret < 0)
+ {
+ message("nxpu_close: nx_closewindow failed: %d\n", errno);
+ g_exitcode = NXEXIT_NXCLOSEWINDOW;
+ }
+ return ret;
+}
diff --git a/apps/examples/nxtext/nxtext_putc.c b/apps/examples/nxtext/nxtext_putc.c
index d2035f223..09551c32f 100644
--- a/apps/examples/nxtext/nxtext_putc.c
+++ b/apps/examples/nxtext/nxtext_putc.c
@@ -120,7 +120,7 @@ nxtext_renderglyph(FAR struct nxtext_state_s *st,
/* Make sure that there is room for another glyph */
message("nxtext_renderglyph: ch=%02x\n", ch);
- if (st->nglyphs < NXTK_MAXKBDCHARS)
+ if (st->nglyphs < st->nglyphs)
{
/* Allocate the glyph */
@@ -193,8 +193,8 @@ nxtext_renderglyph(FAR struct nxtext_state_s *st,
/* Then render the glyph into the allocated memory */
ret = RENDERER((FAR nxgl_mxpixel_t*)glyph->bitmap,
- glyph->fheight, glyph->width, glyph->stride,
- bm, st->fcolor);
+ glyph->height, glyph->width, glyph->stride,
+ bm, st->fcolor[0]);
if (ret < 0)
{
/* Actually, the RENDERER never returns a failure */
@@ -227,7 +227,7 @@ nxtext_addspace(FAR struct nxtext_state_s *st, uint8_t ch)
/* Make sure that there is room for another glyph */
- if (st->nglyphs < NXTK_MAXKBDCHARS)
+ if (st->nglyphs < st->nglyphs)
{
/* Allocate the NULL glyph */
@@ -313,7 +313,7 @@ nxtext_addchar(FAR struct nxtext_state_s *st, uint8_t ch)
/* Is there space for another character on the display? */
- if (st->nchars < NXTK_MAXKBDCHARS)
+ if (st->nchars < st->nchars)
{
/* Yes, setup the bitmap */
@@ -369,7 +369,7 @@ void nxtext_home(FAR struct nxtext_state_s *st)
{
/* The first character is one space from the left */
- st->pox.x = st->spwidth;
+ st->pos.x = st->spwidth;
/* And two lines from the top */
@@ -388,7 +388,7 @@ void nxtext_newline(FAR struct nxtext_state_s *st)
{
/* Carriage return: The first character is one space from the left */
- st->pox.x = st->spwidth;
+ st->pos.x = st->spwidth;
/* Linefeed: Done the max font height + 2 */
@@ -442,7 +442,7 @@ void nxtext_putc(NXWINDOW hwnd, FAR struct nxtext_state_s *st, uint8_t ch)
void nxtext_fillchar(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
FAR const struct nxtext_bitmap_s *bm)
{
- FAR void *src = (FAR void *)bm->glyph->bitmap;
+ FAR const void *src = (FAR const void *)bm->glyph->bitmap;
struct nxgl_rect_s intersection;
int ret;
diff --git a/nuttx/configs/stm3210e-eval/nx/defconfig b/nuttx/configs/stm3210e-eval/nx/defconfig
index 63e362f32..84d407c21 100644
--- a/nuttx/configs/stm3210e-eval/nx/defconfig
+++ b/nuttx/configs/stm3210e-eval/nx/defconfig
@@ -366,7 +366,7 @@ CONFIG_SIG_SIGWORK=4
# CONFIG_SYMTAB_ORDEREDBYNAME. Select if the system symbol table
# is ordered by symbol name
#
-CONFIG_NXFLAT=y
+CONFIG_NXFLAT=n
CONFIG_NXFLAT_DUMPBUFFER=n
CONFIG_SYMTAB_ORDEREDBYNAME=y
diff --git a/nuttx/configs/stm3210e-eval/nxtext/defconfig b/nuttx/configs/stm3210e-eval/nxtext/defconfig
index f18d11448..d9e0a6371 100644
--- a/nuttx/configs/stm3210e-eval/nxtext/defconfig
+++ b/nuttx/configs/stm3210e-eval/nxtext/defconfig
@@ -335,11 +335,11 @@ CONFIG_SCHED_INSTRUMENTATION=n
CONFIG_TASK_NAME_SIZE=0
CONFIG_START_YEAR=2011
CONFIG_START_MONTH=7
-CONFIG_START_DAY=5
+CONFIG_START_DAY=8
CONFIG_GREGORIAN_TIME=n
CONFIG_JULIAN_TIME=n
CONFIG_DEV_CONSOLE=y
-CONFIG_DEV_LOWCONSOLE=n
+CONFIG_DEV_LOWCONSOLE=y
CONFIG_MUTEX_TYPES=n
CONFIG_PRIORITY_INHERITANCE=n
CONFIG_SEM_PREALLOCHOLDERS=0
@@ -366,7 +366,7 @@ CONFIG_SIG_SIGWORK=4
# CONFIG_SYMTAB_ORDEREDBYNAME. Select if the system symbol table
# is ordered by symbol name
#
-CONFIG_NXFLAT=y
+CONFIG_NXFLAT=n
CONFIG_NXFLAT_DUMPBUFFER=n
CONFIG_SYMTAB_ORDEREDBYNAME=y
@@ -978,20 +978,20 @@ CONFIG_EXAMPLES_NX_EXTERNINIT=n
# CONFIG_EXAMPLES_NXTEXT_NOTIFYSIGNO -- The signal number to use with
# nx_eventnotify(). Default: 4
-CONFIG_EXAMPLES_NXTEST_VPLANE=0
-CONFIG_EXAMPLES_NXTEST_DEVNO=0
-CONFIG_EXAMPLES_NXTEST_BGCOLOR=0x0011
-CONFIG_EXAMPLES_NXTEST_BGFONTCOLOR=0xffdf
-CONFIG_EXAMPLES_NXTEST_PUCOLOR=0xfd20
-CONFIG_EXAMPLES_NXTEST_PUFONTCOLOR=0x001f
-CONFIG_EXAMPLES_NXTEST_BPP=16
-CONFIG_EXAMPLES_NXTEST_EXTERNINIT=n
+CONFIG_EXAMPLES_NXTEXT_VPLANE=0
+CONFIG_EXAMPLES_NXTEXT_DEVNO=0
+CONFIG_EXAMPLES_NXTEXT_BGCOLOR=0x0011
+CONFIG_EXAMPLES_NXTEXT_BGFONTCOLOR=0xffdf
+CONFIG_EXAMPLES_NXTEXT_PUCOLOR=0xfd20
+CONFIG_EXAMPLES_NXTEXT_PUFONTCOLOR=0x001f
+CONFIG_EXAMPLES_NXTEXT_BPP=16
+CONFIG_EXAMPLES_NXTEXT_EXTERNINIT=n
CONFIG_EXAMPLES_NXTEXT_BMCACHE=512
CONFIG_EXAMPLES_NXTEXT_GLCACHE=128
-CONFIG_EXAMPLES_NXTEST_STACKSIZE=2048
-CONFIG_EXAMPLES_NXTEST_CLIENTPRIO=80
-CONFIG_EXAMPLES_NXTEST_SERVERPRIO=120
-CONFIG_EXAMPLES_NXTEST_NOTIFYSIGNO=4
+CONFIG_EXAMPLES_NXTEXT_STACKSIZE=2048
+CONFIG_EXAMPLES_NXTEXT_CLIENTPRIO=80
+CONFIG_EXAMPLES_NXTEXT_SERVERPRIO=120
+CONFIG_EXAMPLES_NXTEXT_NOTIFYSIGNO=4
#
# Stack and heap information
diff --git a/nuttx/configs/stm3210e-eval/src/up_lcd.c b/nuttx/configs/stm3210e-eval/src/up_lcd.c
index b759aa031..588890e50 100755
--- a/nuttx/configs/stm3210e-eval/src/up_lcd.c
+++ b/nuttx/configs/stm3210e-eval/src/up_lcd.c
@@ -520,7 +520,7 @@ static int stm3210e_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *bu
/* Buffer must be provided and aligned to a 16-bit address boundary */
- gvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
+ lcddbg("row: %d col: %d npixels: %d\n", row, col, npixels);
DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
/* Write the run to GRAM. */
@@ -588,7 +588,7 @@ static int stm3210e_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer,
/* Buffer must be provided and aligned to a 16-bit address boundary */
- gvdbg("row: %d col: %d npixels: %d\n", row, col, npixels);
+ lcddbg("row: %d col: %d npixels: %d\n", row, col, npixels);
DEBUGASSERT(buffer && ((uintptr_t)buffer & 1) == 0);
/* Set up to read the run. */