summaryrefslogtreecommitdiff
path: root/nuttx/examples/nx/nx_main.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-04-17 14:46:13 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2010-04-17 14:46:13 +0000
commit6fb154273f6cdb31738b54a3f9a513b944d20813 (patch)
tree9d8c28c160258d8a8c76bdd6751c85175b05795a /nuttx/examples/nx/nx_main.c
parent3facd1246f2a57f2b78c3e16521803c62c8394f4 (diff)
downloadpx4-nuttx-6fb154273f6cdb31738b54a3f9a513b944d20813.tar.gz
px4-nuttx-6fb154273f6cdb31738b54a3f9a513b944d20813.tar.bz2
px4-nuttx-6fb154273f6cdb31738b54a3f9a513b944d20813.zip
1st round of fixes for LCD build
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2604 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/nx/nx_main.c')
-rw-r--r--nuttx/examples/nx/nx_main.c51
1 files changed, 45 insertions, 6 deletions
diff --git a/nuttx/examples/nx/nx_main.c b/nuttx/examples/nx/nx_main.c
index a07bfd3c4..0104c4291 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);