mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 01:42:58 +08:00
Finish framebuffer support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2672 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -116,6 +116,17 @@ examples/nx
|
||||
include 2, 4, 8, 16, 24, and 32. Default is 32.
|
||||
CONFIG_EXAMPLES_NX_RAWWINDOWS -- Use raw windows; Default is to
|
||||
use pretty, framed NXTK windows with toolbars.
|
||||
CONFIG_EXAMPLES_NX_EXTERNINIT - The driver for the graphics device on
|
||||
this platform requires some unusual initialization. This is the
|
||||
for, for example, SPI LCD/OLED devices. If this configuration is
|
||||
selected, then the platform code must provide an LCD initialization
|
||||
function with a prototype like:
|
||||
|
||||
#ifdef CONFIG_NX_LCDDRIVER
|
||||
FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno);
|
||||
#else
|
||||
FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno);
|
||||
#endif
|
||||
|
||||
This test can be performed with either the single-user version of
|
||||
NX or with the multiple user version of NX selected with CONFIG_NX_MULTIUSER.
|
||||
|
||||
@@ -190,6 +190,7 @@ enum exitcode_e
|
||||
NXEXIT_EVENTNOTIFY,
|
||||
NXEXIT_TASKCREATE,
|
||||
NXEXIT_PTHREADCREATE,
|
||||
NXEXIT_EXTINITIALIZE,
|
||||
NXEXIT_FBINITIALIZE,
|
||||
NXEXIT_FBGETVPLANE,
|
||||
NXEXIT_LCDINITIALIZE,
|
||||
@@ -284,6 +285,10 @@ extern nxgl_mxpixel_t g_tbcolor[CONFIG_NX_NPLANES];
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_NX_EXTERNINIT
|
||||
extern FAR NX_DRIVERTYPE *up_nxdrvinit(unsigned int devno);
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NX) && defined(CONFIG_NX_MULTIUSER)
|
||||
extern int nx_servertask(int argc, char *argv[]);
|
||||
extern FAR void *nx_listenerthread(FAR void *arg);
|
||||
|
||||
+13
-1
@@ -419,7 +419,19 @@ static inline int nxeg_suinitialize(void)
|
||||
FAR NX_DRIVERTYPE *dev;
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_NX_LCDDRIVER
|
||||
#if defined(CONFIG_EXAMPLES_NX_EXTERNINIT)
|
||||
/* Use external graphics driver initialization */
|
||||
|
||||
message("nxeg_initialize: Initializing external graphics device\n");
|
||||
dev = up_nxdrvinit(CONFIG_EXAMPLES_NX_DEVNO);
|
||||
if (!dev)
|
||||
{
|
||||
message("nxeg_initialize: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO);
|
||||
g_exitcode = NXEXIT_EXTINITIALIZE;
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_NX_LCDDRIVER)
|
||||
/* Initialize the LCD device */
|
||||
|
||||
message("nxeg_initialize: Initializing LCD\n");
|
||||
|
||||
+48
-4
@@ -48,6 +48,13 @@
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/nx.h>
|
||||
|
||||
#ifdef CONFIG_NX_LCDDRIVER
|
||||
# include <nuttx/lcd.h>
|
||||
#else
|
||||
# include <nuttx/fb.h>
|
||||
#endif
|
||||
|
||||
#include "nx_internal.h"
|
||||
|
||||
#ifdef CONFIG_NX_MULTIUSER
|
||||
@@ -78,9 +85,45 @@
|
||||
|
||||
int nx_servertask(int argc, char *argv[])
|
||||
{
|
||||
FAR struct fb_vtable_s *fb;
|
||||
FAR NX_DRIVERTYPE *dev;
|
||||
int ret;
|
||||
|
||||
#if defined(CONFIG_EXAMPLES_NX_EXTERNINIT)
|
||||
/* Use external graphics driver initialization */
|
||||
|
||||
message("nxeg_initialize: Initializing external graphics device\n");
|
||||
dev = up_nxdrvinit(CONFIG_EXAMPLES_NX_DEVNO);
|
||||
if (!dev)
|
||||
{
|
||||
message("nxeg_initialize: up_nxdrvinit failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO);
|
||||
g_exitcode = NXEXIT_EXTINITIALIZE;
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
#elif defined(CONFIG_NX_LCDDRIVER)
|
||||
/* Initialize the LCD device */
|
||||
|
||||
message("nx_servertask: Initializing LCD\n");
|
||||
ret = up_lcdinitialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
message("nx_servertask: up_lcdinitialize failed: %d\n", -ret);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Get the device instance */
|
||||
|
||||
dev = up_lcdgetdev(CONFIG_EXAMPLES_NX_DEVNO);
|
||||
if (!dev)
|
||||
{
|
||||
message("nx_servertask: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NX_DEVNO);
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Turn the LCD on at 75% power */
|
||||
|
||||
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
||||
#else
|
||||
/* Initialize the frame buffer device */
|
||||
|
||||
message("nx_servertask: Initializing framebuffer\n");
|
||||
@@ -91,16 +134,17 @@ int nx_servertask(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
fb = up_fbgetvplane(CONFIG_EXAMPLES_NX_VPLANE);
|
||||
if (!fb)
|
||||
dev = up_fbgetvplane(CONFIG_EXAMPLES_NX_VPLANE);
|
||||
if (!dev)
|
||||
{
|
||||
message("nx_servertask: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NX_VPLANE);
|
||||
return 2;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Then start the server */
|
||||
|
||||
ret = nx_run(fb);
|
||||
ret = nx_run(dev);
|
||||
message("nx_servertask: nx_run returned: %d\n", errno);
|
||||
return 3;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user