summaryrefslogtreecommitdiffstats
path: root/apps/examples
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-03-27 22:33:15 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-03-27 22:33:15 +0000
commit73faea1991a0426baf15b136df46e0052598ef1e (patch)
tree111caacdbfa612f833be4c211ac0cfd537ccadcc /apps/examples
parent79750dcd7469e7b41929602a53104fcf3b6131d5 (diff)
Updaes for NX Console
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4531 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'apps/examples')
-rw-r--r--apps/examples/nxconsole/nxcon_internal.h20
-rw-r--r--apps/examples/nxconsole/nxcon_main.c6
-rw-r--r--apps/examples/nxconsole/nxcon_wndo.c9
3 files changed, 29 insertions, 6 deletions
diff --git a/apps/examples/nxconsole/nxcon_internal.h b/apps/examples/nxconsole/nxcon_internal.h
index a4bcd851b7..5aaabfe97e 100644
--- a/apps/examples/nxconsole/nxcon_internal.h
+++ b/apps/examples/nxconsole/nxcon_internal.h
@@ -71,8 +71,26 @@
# define CONFIG_EXAMPLES_NXCON_VPLANE 0
#endif
+/* Pixel depth. If non provided, pick the smallest enabled pixel depth */
+
#ifndef CONFIG_EXAMPLES_NXCON_BPP
-# define CONFIG_EXAMPLES_NXCON_BPP 32
+# if !defined(CONFIG_NX_DISABLE_1BPP)
+# define CONFIG_EXAMPLES_NXCON_BPP 1
+# elif !defined(CONFIG_NX_DISABLE_2BPP)
+# define CONFIG_EXAMPLES_NXCON_BPP 2
+# elif !defined(CONFIG_NX_DISABLE_4BPP)
+# define CONFIG_EXAMPLES_NXCON_BPP 4
+# elif !defined(CONFIG_NX_DISABLE_8BPP)
+# define CONFIG_EXAMPLES_NXCON_BPP 8
+# elif !defined(CONFIG_NX_DISABLE_16BPP)
+# define CONFIG_EXAMPLES_NXCON_BPP 16
+//#elif !defined(CONFIG_NX_DISABLE_24BPP)
+//# define CONFIG_NXCONSOLE_BPP 24
+# elif !defined(CONFIG_NX_DISABLE_32BPP)
+# define CONFIG_EXAMPLES_NXCON_BPP 32
+# else
+# error "No pixel depth provided"
+# endif
#endif
/* Background color */
diff --git a/apps/examples/nxconsole/nxcon_main.c b/apps/examples/nxconsole/nxcon_main.c
index cc83aac169..96f6567046 100644
--- a/apps/examples/nxconsole/nxcon_main.c
+++ b/apps/examples/nxconsole/nxcon_main.c
@@ -356,7 +356,7 @@ int MAIN_NAME(int argc, char **argv)
/* Create a window */
message(MAIN_NAME_STRING ": Create window\n");
- g_nxcon_vars.hwnd = nxtk_openwindow(&g_nxcon_vars.hnx, &g_nxconcb, NULL);
+ g_nxcon_vars.hwnd = nxtk_openwindow(g_nxcon_vars.hnx, &g_nxconcb, NULL);
if (!g_nxcon_vars.hwnd)
{
message(MAIN_NAME_STRING ": nxtk_openwindow failed: %d\n", errno);
@@ -432,10 +432,10 @@ int MAIN_NAME(int argc, char **argv)
/* Open the driver */
- fd = open(CONFIG_EXAMPLES_NXCON_DEVNAME, O_RDONLY);
+ fd = open(CONFIG_EXAMPLES_NXCON_DEVNAME, O_WRONLY);
if (fd < 0)
{
- message(MAIN_NAME_STRING ": open %d read-only failed: %d\n",
+ message(MAIN_NAME_STRING ": open %s read-only failed: %d\n",
CONFIG_EXAMPLES_NXCON_DEVNAME, errno);
goto errout_with_driver;
}
diff --git a/apps/examples/nxconsole/nxcon_wndo.c b/apps/examples/nxconsole/nxcon_wndo.c
index b052af0d2b..6fadda866e 100644
--- a/apps/examples/nxconsole/nxcon_wndo.c
+++ b/apps/examples/nxconsole/nxcon_wndo.c
@@ -119,9 +119,14 @@ static void nxwndo_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
hwnd, rect->pt1.x, rect->pt1.y, rect->pt2.x, rect->pt2.y,
more ? "true" : "false");
- /* Inform the NX console of the redraw request */
+ /* Don't attempt to redraw if the driver has not yet been opened */
- nxcon_redraw(g_nxcon_vars.hdrvr, rect, more);
+ if (g_nxcon_vars.hdrvr)
+ {
+ /* Inform the NX console of the redraw request */
+
+ nxcon_redraw(g_nxcon_vars.hdrvr, rect, more);
+ }
}
/****************************************************************************