summaryrefslogtreecommitdiffstats
path: root/nuttx/examples/nx
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2010-04-17 14:46:13 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2010-04-17 14:46:13 +0000
commit2551749f695e0b49fe9dda59526546d4aca8b9d3 (patch)
tree9d8c28c160258d8a8c76bdd6751c85175b05795a /nuttx/examples/nx
parent86e8c8d22b1f6abd630aba920bbbaf6fcbb3b7ac (diff)
1st round of fixes for LCD build
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@2604 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/examples/nx')
-rw-r--r--nuttx/examples/nx/nx_internal.h4
-rw-r--r--nuttx/examples/nx/nx_main.c51
2 files changed, 48 insertions, 7 deletions
diff --git a/nuttx/examples/nx/nx_internal.h b/nuttx/examples/nx/nx_internal.h
index cb94e8dd7d..c86e8cf614 100644
--- a/nuttx/examples/nx/nx_internal.h
+++ b/nuttx/examples/nx/nx_internal.h
@@ -1,7 +1,7 @@
/****************************************************************************
* examples/nx/nx_internal.h
*
- * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -192,6 +192,8 @@ enum exitcode_e
NXEXIT_PTHREADCREATE,
NXEXIT_FBINITIALIZE,
NXEXIT_FBGETVPLANE,
+ NXEXIT_LCDINITIALIZE,
+ NXEXIT_LCDGETDEV,
NXEXIT_NXOPEN,
NXEXIT_NXOPENTOOLBAR,
NXEXIT_NXCONNECT,
diff --git a/nuttx/examples/nx/nx_main.c b/nuttx/examples/nx/nx_main.c
index a07bfd3c4c..0104c4291e 100644
--- a/nuttx/examples/nx/nx_main.c
+++ b/nuttx/examples/nx/nx_main.c
@@ -51,7 +51,12 @@
#include <errno.h>
#include <debug.h>
-#include <nuttx/fb.h>
+#ifdef CONFIG_NX_LCDDRIVER
+# include <nuttx/lcd.h>
+#else
+# include <nuttx/fb.h>
+#endif
+
#include <nuttx/arch.h>
#include <nuttx/nx.h>
#include <nuttx/nxtk.h>
@@ -60,9 +65,22 @@
#include "nx_internal.h"
/****************************************************************************
- * Definitions
+ * Pre-processor Definitions
****************************************************************************/
+/* Configuration ************************************************************/
+/* If not specified, assume that the hardware supports one video plane */
+
+#ifndef CONFIG_EXAMPLES_NX_VPLANE
+# define CONFIG_EXAMPLES_NX_VPLANE 0
+#endif
+
+/* If not specified, assume that the hardware supports one LCD device */
+
+#ifndef CONFIG_EXAMPLES_NX_DEVNO
+# define CONFIG_EXAMPLES_NX_DEVNO 0
+#endif
+
/****************************************************************************
* Private Types
****************************************************************************/
@@ -398,9 +416,29 @@ static inline int nxeg_raise(NXEGWINDOW hwnd)
#ifndef CONFIG_NX_MULTIUSER
static inline int nxeg_suinitialize(void)
{
- FAR struct fb_vtable_s *fb;
+ FAR NX_DRIVERTYPE *dev;
int ret;
+#ifdef CONFIG_NX_LCDDRIVER
+ /* Initialize the LCD device */
+
+ message("nxeg_initialize: Initializing LCD\n");
+ ret = up_lcdinitialize();
+ if (ret < 0)
+ {
+ message("nxeg_initialize: up_lcdinitialize failed: %d\n", -ret);
+ g_exitcode = NXEXIT_LCDINITIALIZE;
+ return ERROR;
+ }
+
+ dev = up_lcdgetdev(CONFIG_EXAMPLES_NX_DEVNO);
+ if (!dev)
+ {
+ message("nxeg_initialize: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO);
+ g_exitcode = NXEXIT_LCDGETDEV;
+ return ERROR;
+ }
+#else
/* Initialize the frame buffer device */
message("nxeg_initialize: Initializing framebuffer\n");
@@ -412,18 +450,19 @@ static inline int nxeg_suinitialize(void)
return ERROR;
}
- fb = up_fbgetvplane(CONFIG_EXAMPLES_NX_VPLANE);
- if (!fb)
+ dev = up_fbgetvplane(CONFIG_EXAMPLES_NX_VPLANE);
+ if (!dev)
{
message("nxeg_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NX_VPLANE);
g_exitcode = NXEXIT_FBGETVPLANE;
return ERROR;
}
+#endif
/* Then open NX */
message("nxeg_initialize: Open NX\n");
- g_hnx = nx_open(fb);
+ g_hnx = nx_open(dev);
if (!g_hnx)
{
message("user_start: nx_open failed: %d\n", errno);