Merged nuttx/apps into master
This commit is contained in:
commit
1143984ede
@ -1581,4 +1581,6 @@
|
|||||||
moved to Obsoleted/apps/system/sdcard (2016-03-29).
|
moved to Obsoleted/apps/system/sdcard (2016-03-29).
|
||||||
* apps/examples/alarm: Add a simple test of the ALARM iotcl calls
|
* apps/examples/alarm: Add a simple test of the ALARM iotcl calls
|
||||||
of the RTC driver (2016-04-03).
|
of the RTC driver (2016-04-03).
|
||||||
|
* apps/examples/nximage: No configuration option to select
|
||||||
|
greyscale.
|
||||||
|
|
||||||
|
@ -129,6 +129,13 @@ config NXWIDGETS_BPP
|
|||||||
Supported bits-per-pixel {8, 16, 24, 32}. Default: The smallest
|
Supported bits-per-pixel {8, 16, 24, 32}. Default: The smallest
|
||||||
BPP configuration supported by NX.
|
BPP configuration supported by NX.
|
||||||
|
|
||||||
|
config NXWIDGETS_GREYSCALE
|
||||||
|
bool "Greyscale (vs RGB)"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Select to use a greyscale vs RGB color image. This option is ignored if
|
||||||
|
CONFIG_NXWIDGETS_BPP > 8
|
||||||
|
|
||||||
config NXWIDGETS_SIZEOFCHAR
|
config NXWIDGETS_SIZEOFCHAR
|
||||||
int "Size of a character (1 or 2 bytes)"
|
int "Size of a character (1 or 2 bytes)"
|
||||||
range 1 2
|
range 1 2
|
||||||
@ -1284,3 +1291,4 @@ endmenu # NxWM Media Player Display Settings
|
|||||||
|
|
||||||
endif # NXWM
|
endif # NXWM
|
||||||
endmenu # NxWidgets/NxWM
|
endmenu # NxWidgets/NxWM
|
||||||
|
|
||||||
|
@ -60,6 +60,9 @@
|
|||||||
# include <nuttx/lcd/lcd.h>
|
# include <nuttx/lcd/lcd.h>
|
||||||
#else
|
#else
|
||||||
# include <nuttx/video/fb.h>
|
# include <nuttx/video/fb.h>
|
||||||
|
# ifdef CONFIG_VNCSERVER
|
||||||
|
# include <nuttx/video/vnc.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <nuttx/nx/nx.h>
|
#include <nuttx/nx/nx.h>
|
||||||
@ -425,10 +428,10 @@ static inline int nxeg_raise(NXEGWINDOW hwnd)
|
|||||||
static inline int nxeg_suinitialize(void)
|
static inline int nxeg_suinitialize(void)
|
||||||
{
|
{
|
||||||
FAR NX_DRIVERTYPE *dev;
|
FAR NX_DRIVERTYPE *dev;
|
||||||
|
int ret;
|
||||||
|
|
||||||
#if defined(CONFIG_EXAMPLES_NX_EXTERNINIT)
|
#if defined(CONFIG_EXAMPLES_NX_EXTERNINIT)
|
||||||
struct boardioc_graphics_s devinfo;
|
struct boardioc_graphics_s devinfo;
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Use external graphics driver initialization */
|
/* Use external graphics driver initialization */
|
||||||
|
|
||||||
@ -449,8 +452,6 @@ static inline int nxeg_suinitialize(void)
|
|||||||
dev = devinfo.dev;
|
dev = devinfo.dev;
|
||||||
|
|
||||||
#elif defined(CONFIG_NX_LCDDRIVER)
|
#elif defined(CONFIG_NX_LCDDRIVER)
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Initialize the LCD device */
|
/* Initialize the LCD device */
|
||||||
|
|
||||||
printf("nxeg_initialize: Initializing LCD\n");
|
printf("nxeg_initialize: Initializing LCD\n");
|
||||||
@ -476,9 +477,8 @@ static inline int nxeg_suinitialize(void)
|
|||||||
/* Turn the LCD on at 75% power */
|
/* Turn the LCD on at 75% power */
|
||||||
|
|
||||||
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
||||||
#else
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
|
#else
|
||||||
/* Initialize the frame buffer device */
|
/* Initialize the frame buffer device */
|
||||||
|
|
||||||
printf("nxeg_initialize: Initializing framebuffer\n");
|
printf("nxeg_initialize: Initializing framebuffer\n");
|
||||||
@ -515,6 +515,20 @@ static inline int nxeg_suinitialize(void)
|
|||||||
g_exitcode = NXEXIT_NXOPEN;
|
g_exitcode = NXEXIT_NXOPEN;
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_VNCSERVER
|
||||||
|
/* Setup the VNC server to support keyboard/mouse inputs */
|
||||||
|
|
||||||
|
ret = vnc_default_fbinitialize(0, g_hnx);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
printf("vnc_default_fbinitialize failed: %d\n", ret);
|
||||||
|
nx_close(g_hnx);
|
||||||
|
g_exitcode = NXEXIT_FBINITIALIZE;
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -565,6 +579,18 @@ static inline int nxeg_muinitialize(void)
|
|||||||
{
|
{
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
|
|
||||||
|
#ifdef CONFIG_VNCSERVER
|
||||||
|
/* Setup the VNC server to support keyboard/mouse inputs */
|
||||||
|
|
||||||
|
ret = vnc_default_fbinitialize(0, g_hnx);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
printf("vnc_default_fbinitialize failed: %d\n", ret);
|
||||||
|
nx_disconnect(g_hnx);
|
||||||
|
g_exitcode = NXEXIT_FBINITIALIZE;
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/* Start a separate thread to listen for server events. This is probably
|
/* Start a separate thread to listen for server events. This is probably
|
||||||
* the least efficient way to do this, but it makes this example flow more
|
* the least efficient way to do this, but it makes this example flow more
|
||||||
* smoothly.
|
* smoothly.
|
||||||
@ -600,6 +626,7 @@ static inline int nxeg_muinitialize(void)
|
|||||||
g_exitcode = NXEXIT_NXCONNECT;
|
g_exitcode = NXEXIT_NXCONNECT;
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -60,6 +60,9 @@
|
|||||||
# include <nuttx/lcd/lcd.h>
|
# include <nuttx/lcd/lcd.h>
|
||||||
#else
|
#else
|
||||||
# include <nuttx/video/fb.h>
|
# include <nuttx/video/fb.h>
|
||||||
|
# ifdef CONFIG_VNCSERVER
|
||||||
|
# include <nuttx/video/vnc.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <nuttx/nx/nx.h>
|
#include <nuttx/nx/nx.h>
|
||||||
@ -124,10 +127,10 @@ struct nxhello_data_s g_nxhello =
|
|||||||
static inline int nxhello_initialize(void)
|
static inline int nxhello_initialize(void)
|
||||||
{
|
{
|
||||||
FAR NX_DRIVERTYPE *dev;
|
FAR NX_DRIVERTYPE *dev;
|
||||||
|
int ret;
|
||||||
|
|
||||||
#if defined(CONFIG_EXAMPLES_NXHELLO_EXTERNINIT)
|
#if defined(CONFIG_EXAMPLES_NXHELLO_EXTERNINIT)
|
||||||
struct boardioc_graphics_s devinfo;
|
struct boardioc_graphics_s devinfo;
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Use external graphics driver initialization */
|
/* Use external graphics driver initialization */
|
||||||
|
|
||||||
@ -148,8 +151,6 @@ static inline int nxhello_initialize(void)
|
|||||||
dev = devinfo.dev;
|
dev = devinfo.dev;
|
||||||
|
|
||||||
#elif defined(CONFIG_NX_LCDDRIVER)
|
#elif defined(CONFIG_NX_LCDDRIVER)
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Initialize the LCD device */
|
/* Initialize the LCD device */
|
||||||
|
|
||||||
printf("nxhello_initialize: Initializing LCD\n");
|
printf("nxhello_initialize: Initializing LCD\n");
|
||||||
@ -175,9 +176,8 @@ static inline int nxhello_initialize(void)
|
|||||||
/* Turn the LCD on at 75% power */
|
/* Turn the LCD on at 75% power */
|
||||||
|
|
||||||
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
||||||
#else
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
|
#else
|
||||||
/* Initialize the frame buffer device */
|
/* Initialize the frame buffer device */
|
||||||
|
|
||||||
printf("nxhello_initialize: Initializing framebuffer\n");
|
printf("nxhello_initialize: Initializing framebuffer\n");
|
||||||
@ -212,6 +212,21 @@ static inline int nxhello_initialize(void)
|
|||||||
g_nxhello.code = NXEXIT_NXOPEN;
|
g_nxhello.code = NXEXIT_NXOPEN;
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_VNCSERVER
|
||||||
|
/* Setup the VNC server to support keyboard/mouse inputs */
|
||||||
|
|
||||||
|
ret = vnc_default_fbinitialize(0, g_nxhello.hnx);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
printf("vnc_default_fbinitialize failed: %d\n", ret);
|
||||||
|
|
||||||
|
nx_close(g_nxhello.hnx);
|
||||||
|
g_nxhello.code = NXEXIT_FBINITIALIZE;
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,72 +12,79 @@ config EXAMPLES_NXIMAGE
|
|||||||
if EXAMPLES_NXIMAGE
|
if EXAMPLES_NXIMAGE
|
||||||
|
|
||||||
config EXAMPLES_NXIMAGE_VPLANE
|
config EXAMPLES_NXIMAGE_VPLANE
|
||||||
int "Video Plane"
|
int "Video Plane"
|
||||||
default 0
|
default 0
|
||||||
---help---
|
---help---
|
||||||
The plane to select from the framebuffer driver for use in the test.
|
The plane to select from the framebuffer driver for use in the test.
|
||||||
Default: 0
|
Default: 0
|
||||||
|
|
||||||
config EXAMPLES_NXIMAGE_DEVNO
|
config EXAMPLES_NXIMAGE_DEVNO
|
||||||
int "Video Device Number"
|
int "Video Device Number"
|
||||||
default 0
|
default 0
|
||||||
---help---
|
---help---
|
||||||
The LCD device to select from the LCD driver for use in the test:
|
The LCD device to select from the LCD driver for use in the test:
|
||||||
Default: 0
|
Default: 0
|
||||||
|
|
||||||
config EXAMPLES_NXIMAGE_BPP
|
config EXAMPLES_NXIMAGE_BPP
|
||||||
int "Bits-Per-Pixel"
|
int "Bits-Per-Pixel"
|
||||||
default 32
|
default 32
|
||||||
---help---
|
---help---
|
||||||
Pixels per pixel to use. Valid options include 1, 2, 4, 8, 16, 24,
|
Pixels per pixel to use. Valid options include 1, 2, 4, 8, 16, 24,
|
||||||
and 32. Default is 32.
|
and 32. Default is 32.
|
||||||
|
|
||||||
|
config EXAMPLES_NXIMAGE_GREYSCALE
|
||||||
|
bool "Greyscale (vs RGB)"
|
||||||
|
default n
|
||||||
|
---help---
|
||||||
|
Select to use a greyscale vs RGB color image. This option is ignored if
|
||||||
|
CONFIG_EXAMPLES_NXIMAGE_BPP > 8
|
||||||
|
|
||||||
config EXAMPLES_NXIMAGE_XSCALEp5
|
config EXAMPLES_NXIMAGE_XSCALEp5
|
||||||
bool "Scale X by 50%"
|
bool "Scale X by 50%"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Reduce image scale by 50% of its original size.
|
Reduce image scale by 50% of its original size.
|
||||||
|
|
||||||
config EXAMPLES_NXIMAGE_XSCALE1p0
|
config EXAMPLES_NXIMAGE_XSCALE1p0
|
||||||
bool "Don't scale image."
|
bool "Don't scale image."
|
||||||
default y
|
default y
|
||||||
---help---
|
---help---
|
||||||
Keep original image size.
|
Keep original image size.
|
||||||
|
|
||||||
config EXAMPLES_NXIMAGE_XSCALE1p5
|
config EXAMPLES_NXIMAGE_XSCALE1p5
|
||||||
bool "Scale X by 150%"
|
bool "Scale X by 150%"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Increase image scale by 50% of its original size.
|
Increase image scale by 50% of its original size.
|
||||||
|
|
||||||
config EXAMPLES_NXIMAGE_XSCALE2p0
|
config EXAMPLES_NXIMAGE_XSCALE2p0
|
||||||
bool "Scale X by 200%"
|
bool "Scale X by 200%"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Increase image scale by 200% of its original size.
|
Increase image scale by 200% of its original size.
|
||||||
|
|
||||||
config EXAMPLES_NXIMAGE_YSCALEp5
|
config EXAMPLES_NXIMAGE_YSCALEp5
|
||||||
bool "Scale Y by 50%"
|
bool "Scale Y by 50%"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Reduce image scale by 50% of its original size.
|
Reduce image scale by 50% of its original size.
|
||||||
|
|
||||||
config EXAMPLES_NXIMAGE_YSCALE1p0
|
config EXAMPLES_NXIMAGE_YSCALE1p0
|
||||||
bool "Don't scale image."
|
bool "Don't scale image."
|
||||||
default y
|
default y
|
||||||
---help---
|
---help---
|
||||||
Keep original image size.
|
Keep original image size.
|
||||||
|
|
||||||
config EXAMPLES_NXIMAGE_YSCALE1p5
|
config EXAMPLES_NXIMAGE_YSCALE1p5
|
||||||
bool "Scale Y by 150%"
|
bool "Scale Y by 150%"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Increase image scale by 50% of its original size.
|
Increase image scale by 50% of its original size.
|
||||||
|
|
||||||
config EXAMPLES_NXIMAGE_YSCALE2p0
|
config EXAMPLES_NXIMAGE_YSCALE2p0
|
||||||
bool "Scale Y by 200%"
|
bool "Scale Y by 200%"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
Increase image scale by 200% of its original size.
|
Increase image scale by 200% of its original size.
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
@ -60,6 +60,9 @@
|
|||||||
# include <nuttx/lcd/lcd.h>
|
# include <nuttx/lcd/lcd.h>
|
||||||
#else
|
#else
|
||||||
# include <nuttx/video/fb.h>
|
# include <nuttx/video/fb.h>
|
||||||
|
# ifdef CONFIG_VNCSERVER
|
||||||
|
# include <nuttx/video/vnc.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <nuttx/nx/nx.h>
|
#include <nuttx/nx/nx.h>
|
||||||
@ -128,10 +131,10 @@ struct nximage_data_s g_nximage =
|
|||||||
static inline int nximage_initialize(void)
|
static inline int nximage_initialize(void)
|
||||||
{
|
{
|
||||||
FAR NX_DRIVERTYPE *dev;
|
FAR NX_DRIVERTYPE *dev;
|
||||||
|
int ret;
|
||||||
|
|
||||||
#if defined(CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT)
|
#if defined(CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT)
|
||||||
struct boardioc_graphics_s devinfo;
|
struct boardioc_graphics_s devinfo;
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Use external graphics driver initialization */
|
/* Use external graphics driver initialization */
|
||||||
|
|
||||||
@ -152,8 +155,6 @@ static inline int nximage_initialize(void)
|
|||||||
dev = devinfo.dev;
|
dev = devinfo.dev;
|
||||||
|
|
||||||
#elif defined(CONFIG_NX_LCDDRIVER)
|
#elif defined(CONFIG_NX_LCDDRIVER)
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Initialize the LCD device */
|
/* Initialize the LCD device */
|
||||||
|
|
||||||
printf("nximage_initialize: Initializing LCD\n");
|
printf("nximage_initialize: Initializing LCD\n");
|
||||||
@ -180,8 +181,6 @@ static inline int nximage_initialize(void)
|
|||||||
|
|
||||||
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
||||||
#else
|
#else
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Initialize the frame buffer device */
|
/* Initialize the frame buffer device */
|
||||||
|
|
||||||
printf("nximage_initialize: Initializing framebuffer\n");
|
printf("nximage_initialize: Initializing framebuffer\n");
|
||||||
@ -213,10 +212,25 @@ static inline int nximage_initialize(void)
|
|||||||
if (!g_nximage.hnx)
|
if (!g_nximage.hnx)
|
||||||
{
|
{
|
||||||
printf("nximage_initialize: nx_open failed: %d\n", errno);
|
printf("nximage_initialize: nx_open failed: %d\n", errno);
|
||||||
|
|
||||||
g_nximage.code = NXEXIT_NXOPEN;
|
g_nximage.code = NXEXIT_NXOPEN;
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_VNCSERVER
|
||||||
|
/* Setup the VNC server to support keyboard/mouse inputs */
|
||||||
|
|
||||||
|
ret = vnc_default_fbinitialize(0, g_nximage.hnx);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
printf("vnc_default_fbinitialize failed: %d\n", ret);
|
||||||
|
|
||||||
|
g_nximage.code = NXEXIT_FBINITIALIZE;
|
||||||
|
nx_close(g_nximage.hnx);
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,9 @@
|
|||||||
# include <nuttx/lcd/lcd.h>
|
# include <nuttx/lcd/lcd.h>
|
||||||
#else
|
#else
|
||||||
# include <nuttx/video/fb.h>
|
# include <nuttx/video/fb.h>
|
||||||
|
# ifdef CONFIG_VNCSERVER
|
||||||
|
# include <nuttx/video/vnc.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <nuttx/nx/nx.h>
|
#include <nuttx/nx/nx.h>
|
||||||
@ -120,10 +123,10 @@ struct nxlines_data_s g_nxlines =
|
|||||||
static inline int nxlines_initialize(void)
|
static inline int nxlines_initialize(void)
|
||||||
{
|
{
|
||||||
FAR NX_DRIVERTYPE *dev;
|
FAR NX_DRIVERTYPE *dev;
|
||||||
|
int ret;
|
||||||
|
|
||||||
#if defined(CONFIG_EXAMPLES_NXLINES_EXTERNINIT)
|
#if defined(CONFIG_EXAMPLES_NXLINES_EXTERNINIT)
|
||||||
struct boardioc_graphics_s devinfo;
|
struct boardioc_graphics_s devinfo;
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Use external graphics driver initialization */
|
/* Use external graphics driver initialization */
|
||||||
|
|
||||||
@ -144,8 +147,6 @@ static inline int nxlines_initialize(void)
|
|||||||
dev = devinfo.dev;
|
dev = devinfo.dev;
|
||||||
|
|
||||||
#elif defined(CONFIG_NX_LCDDRIVER)
|
#elif defined(CONFIG_NX_LCDDRIVER)
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Initialize the LCD device */
|
/* Initialize the LCD device */
|
||||||
|
|
||||||
printf("nxlines_initialize: Initializing LCD\n");
|
printf("nxlines_initialize: Initializing LCD\n");
|
||||||
@ -172,8 +173,6 @@ static inline int nxlines_initialize(void)
|
|||||||
|
|
||||||
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
||||||
#else
|
#else
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Initialize the frame buffer device */
|
/* Initialize the frame buffer device */
|
||||||
|
|
||||||
printf("nxlines_initialize: Initializing framebuffer\n");
|
printf("nxlines_initialize: Initializing framebuffer\n");
|
||||||
@ -211,6 +210,19 @@ static inline int nxlines_initialize(void)
|
|||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_VNCSERVER
|
||||||
|
/* Setup the VNC server to support keyboard/mouse inputs */
|
||||||
|
|
||||||
|
ret = vnc_default_fbinitialize(0, g_nxlines.hnx);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
printf("vnc_default_fbinitialize failed: %d\n", ret);
|
||||||
|
|
||||||
|
nx_close(g_nxlines.hnx);
|
||||||
|
g_nxlines.code = NXEXIT_FBINITIALIZE;
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* examples/nxterm/nxterm_main.c
|
* examples/nxterm/nxterm_main.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2012, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -55,6 +55,9 @@
|
|||||||
# include <nuttx/lcd/lcd.h>
|
# include <nuttx/lcd/lcd.h>
|
||||||
#else
|
#else
|
||||||
# include <nuttx/video/fb.h>
|
# include <nuttx/video/fb.h>
|
||||||
|
# ifdef CONFIG_VNCSERVER
|
||||||
|
# include <nuttx/video/vnc.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
@ -140,6 +143,16 @@ static int nxterm_initialize(void)
|
|||||||
{
|
{
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
|
|
||||||
|
#ifdef CONFIG_VNCSERVER
|
||||||
|
/* Setup the VNC server to support keyboard/mouse inputs */
|
||||||
|
|
||||||
|
ret = vnc_default_fbinitialize(0, g_nxterm_vars.hnx);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
printf("vnc_default_fbinitialize failed: %d\n", ret);
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/* Start a separate thread to listen for server events. This is probably
|
/* Start a separate thread to listen for server events. This is probably
|
||||||
* the least efficient way to do this, but it makes this example flow more
|
* the least efficient way to do this, but it makes this example flow more
|
||||||
* smoothly.
|
* smoothly.
|
||||||
|
@ -60,6 +60,9 @@
|
|||||||
# include <nuttx/lcd/lcd.h>
|
# include <nuttx/lcd/lcd.h>
|
||||||
#else
|
#else
|
||||||
# include <nuttx/video/fb.h>
|
# include <nuttx/video/fb.h>
|
||||||
|
# ifdef CONFIG_VNCSERVER
|
||||||
|
# include <nuttx/video/vnc.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <nuttx/nx/nx.h>
|
#include <nuttx/nx/nx.h>
|
||||||
@ -166,10 +169,10 @@ int g_exitcode = NXEXIT_SUCCESS;
|
|||||||
static inline int nxtext_suinitialize(void)
|
static inline int nxtext_suinitialize(void)
|
||||||
{
|
{
|
||||||
FAR NX_DRIVERTYPE *dev;
|
FAR NX_DRIVERTYPE *dev;
|
||||||
|
int ret;
|
||||||
|
|
||||||
#if defined(CONFIG_EXAMPLES_NXTEXT_EXTERNINIT)
|
#if defined(CONFIG_EXAMPLES_NXTEXT_EXTERNINIT)
|
||||||
struct boardioc_graphics_s devinfo;
|
struct boardioc_graphics_s devinfo;
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Use external graphics driver initialization */
|
/* Use external graphics driver initialization */
|
||||||
|
|
||||||
@ -190,8 +193,6 @@ static inline int nxtext_suinitialize(void)
|
|||||||
dev = devinfo.dev;
|
dev = devinfo.dev;
|
||||||
|
|
||||||
#elif defined(CONFIG_NX_LCDDRIVER)
|
#elif defined(CONFIG_NX_LCDDRIVER)
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* Initialize the LCD device */
|
/* Initialize the LCD device */
|
||||||
|
|
||||||
printf("nxtext_initialize: Initializing LCD\n");
|
printf("nxtext_initialize: Initializing LCD\n");
|
||||||
@ -217,9 +218,8 @@ static inline int nxtext_suinitialize(void)
|
|||||||
/* Turn the LCD on at 75% power */
|
/* Turn the LCD on at 75% power */
|
||||||
|
|
||||||
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
(void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4));
|
||||||
#else
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
|
#else
|
||||||
/* Initialize the frame buffer device */
|
/* Initialize the frame buffer device */
|
||||||
|
|
||||||
printf("nxtext_initialize: Initializing framebuffer\n");
|
printf("nxtext_initialize: Initializing framebuffer\n");
|
||||||
@ -257,6 +257,20 @@ static inline int nxtext_suinitialize(void)
|
|||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_VNCSERVER
|
||||||
|
/* Setup the VNC server to support keyboard/mouse inputs */
|
||||||
|
|
||||||
|
ret = vnc_default_fbinitialize(0, g_hnx);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
printf("vnc_default_fbinitialize failed: %d\n", ret);
|
||||||
|
|
||||||
|
nx_close(g_hnx);
|
||||||
|
g_exitcode = NXEXIT_FBINITIALIZE;
|
||||||
|
return ERROR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -305,43 +319,58 @@ static inline int nxtext_muinitialize(void)
|
|||||||
g_hnx = nx_connect();
|
g_hnx = nx_connect();
|
||||||
if (g_hnx)
|
if (g_hnx)
|
||||||
{
|
{
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
|
|
||||||
/* Start a separate thread to listen for server events. This is probably
|
#ifdef CONFIG_VNCSERVER
|
||||||
* the least efficient way to do this, but it makes this example flow more
|
/* Setup the VNC server to support keyboard/mouse inputs */
|
||||||
* smoothly.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(void)pthread_attr_init(&attr);
|
ret = vnc_default_fbinitialize(0, g_hnx);
|
||||||
param.sched_priority = CONFIG_EXAMPLES_NXTEXT_LISTENERPRIO;
|
if (ret < 0)
|
||||||
(void)pthread_attr_setschedparam(&attr, ¶m);
|
{
|
||||||
(void)pthread_attr_setstacksize(&attr, CONFIG_EXAMPLES_NXTEXT_STACKSIZE);
|
printf("vnc_default_fbinitialize failed: %d\n", ret);
|
||||||
|
|
||||||
ret = pthread_create(&thread, &attr, nxtext_listener, NULL);
|
g_exitcode = NXEXIT_FBINITIALIZE;
|
||||||
if (ret != 0)
|
return ERROR;
|
||||||
{
|
}
|
||||||
printf("nxtext_initialize: pthread_create failed: %d\n", ret);
|
#endif
|
||||||
g_exitcode = NXEXIT_PTHREADCREATE;
|
/* Start a separate thread to listen for server events. This is probably
|
||||||
return ERROR;
|
* the least efficient way to do this, but it makes this example flow more
|
||||||
}
|
* smoothly.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Don't return until we are connected to the server */
|
(void)pthread_attr_init(&attr);
|
||||||
|
param.sched_priority = CONFIG_EXAMPLES_NXTEXT_LISTENERPRIO;
|
||||||
|
(void)pthread_attr_setschedparam(&attr, ¶m);
|
||||||
|
(void)pthread_attr_setstacksize(&attr, CONFIG_EXAMPLES_NXTEXT_STACKSIZE);
|
||||||
|
|
||||||
while (!g_connected)
|
ret = pthread_create(&thread, &attr, nxtext_listener, NULL);
|
||||||
{
|
if (ret != 0)
|
||||||
/* Wait for the listener thread to wake us up when we really
|
{
|
||||||
* are connected.
|
printf("nxtext_initialize: pthread_create failed: %d\n", ret);
|
||||||
*/
|
|
||||||
|
|
||||||
(void)sem_wait(&g_semevent);
|
g_exitcode = NXEXIT_PTHREADCREATE;
|
||||||
}
|
return ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Don't return until we are connected to the server */
|
||||||
|
|
||||||
|
while (!g_connected)
|
||||||
|
{
|
||||||
|
/* Wait for the listener thread to wake us up when we really
|
||||||
|
* are connected.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(void)sem_wait(&g_semevent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("nxtext_initialize: nx_connect failed: %d\n", errno);
|
printf("nxtext_initialize: nx_connect failed: %d\n", errno);
|
||||||
|
|
||||||
g_exitcode = NXEXIT_NXCONNECT;
|
g_exitcode = NXEXIT_NXCONNECT;
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* apps/examples/screenshot/screenshot_main.c
|
* apps/examples/screenshot/screenshot_main.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
* Petteri Aimonen <jpa@kapsi.fi>
|
* Petteri Aimonen <jpa@kapsi.fi>
|
||||||
*
|
*
|
||||||
@ -38,19 +38,24 @@
|
|||||||
* Included Files
|
* Included Files
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <semaphore.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include <apps/tiff.h>
|
#include <apps/tiff.h>
|
||||||
|
|
||||||
#include <semaphore.h>
|
|
||||||
#include <nuttx/config.h>
|
|
||||||
#include <nuttx/nx/nx.h>
|
#include <nuttx/nx/nx.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_VNCSERVER
|
||||||
|
# include <nuttx/video/vnc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Pre-Processor Definitions
|
* Pre-Processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -118,15 +123,15 @@ static void replace_extension(FAR const char *filename, FAR const char *newext,
|
|||||||
int save_screenshot(FAR const char *filename)
|
int save_screenshot(FAR const char *filename)
|
||||||
{
|
{
|
||||||
struct tiff_info_s info;
|
struct tiff_info_s info;
|
||||||
FAR uint8_t *strip;
|
|
||||||
int row;
|
|
||||||
int ret;
|
|
||||||
char tempf1[64];
|
|
||||||
char tempf2[64];
|
|
||||||
NXHANDLE server;
|
|
||||||
NXWINDOW window;
|
|
||||||
struct nx_callback_s cb = {};
|
struct nx_callback_s cb = {};
|
||||||
struct nxgl_size_s size = {CONFIG_SCREENSHOT_WIDTH, CONFIG_SCREENSHOT_HEIGHT};
|
struct nxgl_size_s size = {CONFIG_SCREENSHOT_WIDTH, CONFIG_SCREENSHOT_HEIGHT};
|
||||||
|
FAR uint8_t *strip;
|
||||||
|
NXHANDLE server;
|
||||||
|
NXWINDOW window;
|
||||||
|
char tempf1[64];
|
||||||
|
char tempf2[64];
|
||||||
|
int row;
|
||||||
|
int ret;
|
||||||
|
|
||||||
replace_extension(filename, ".tm1", tempf1, sizeof(tempf1));
|
replace_extension(filename, ".tm1", tempf1, sizeof(tempf1));
|
||||||
replace_extension(filename, ".tm2", tempf2, sizeof(tempf2));
|
replace_extension(filename, ".tm2", tempf2, sizeof(tempf2));
|
||||||
@ -135,19 +140,31 @@ int save_screenshot(FAR const char *filename)
|
|||||||
|
|
||||||
server = nx_connect();
|
server = nx_connect();
|
||||||
if (!server)
|
if (!server)
|
||||||
{
|
{
|
||||||
perror("nx_connect");
|
perror("nx_connect");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_VNCSERVER
|
||||||
|
/* Setup the VNC server to support keyboard/mouse inputs */
|
||||||
|
|
||||||
|
ret = vnc_default_fbinitialize(0, server);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
printf("vnc_default_fbinitialize failed: %d\n", ret);
|
||||||
|
nx_disconnect(server);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Wait for "connected" event */
|
/* Wait for "connected" event */
|
||||||
|
|
||||||
if (nx_eventhandler(server) < 0)
|
if (nx_eventhandler(server) < 0)
|
||||||
{
|
{
|
||||||
perror("nx_eventhandler");
|
perror("nx_eventhandler");
|
||||||
nx_disconnect(server);
|
nx_disconnect(server);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Open invisible dummy window for communication */
|
/* Open invisible dummy window for communication */
|
||||||
|
|
||||||
|
@ -46,10 +46,15 @@
|
|||||||
#include "trv_graphics.h"
|
#include "trv_graphics.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifdef CONFIG_NX_MULTIUSER
|
#ifdef CONFIG_NX_MULTIUSER
|
||||||
# include <semaphore.h>
|
# include <semaphore.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_VNCSERVER
|
||||||
|
# include <nuttx/video/vnc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Data
|
* Public Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -202,6 +207,17 @@ static inline int trv_nxsu_initialize(FAR struct trv_graphics_info_s *ginfo)
|
|||||||
trv_abort("trv_nxsu_initialize: nx_open failed: %d\n", errno);
|
trv_abort("trv_nxsu_initialize: nx_open failed: %d\n", errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_VNCSERVER
|
||||||
|
/* Setup the VNC server to support keyboard/mouse inputs */
|
||||||
|
|
||||||
|
ret = vnc_default_fbinitialize(0, ginfo->hnx);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
nx_close(ginfo->hnx);
|
||||||
|
trv_abort("vnc_default_fbinitialize failed: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* And use the background window */
|
/* And use the background window */
|
||||||
|
|
||||||
trv_use_bgwindow(ginfo);
|
trv_use_bgwindow(ginfo);
|
||||||
@ -247,9 +263,7 @@ static inline int trv_nxmu_initialize(FAR struct trv_graphics_info_s *ginfo)
|
|||||||
ret = sched_setparam(0, ¶m);
|
ret = sched_setparam(0, ¶m);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
printf("nxeg_initialize: sched_setparam failed: %d\n" , ret);
|
trv_abort("nxeg_initialize: sched_setparam failed: %d\n" , ret);
|
||||||
g_exitcode = NXEXIT_SCHEDSETPARAM;
|
|
||||||
return ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start the server task */
|
/* Start the server task */
|
||||||
@ -259,9 +273,8 @@ static inline int trv_nxmu_initialize(FAR struct trv_graphics_info_s *ginfo)
|
|||||||
CONFIG_EXAMPLES_NX_STACKSIZE, trv_servertask, NULL);
|
CONFIG_EXAMPLES_NX_STACKSIZE, trv_servertask, NULL);
|
||||||
if (servrid < 0)
|
if (servrid < 0)
|
||||||
{
|
{
|
||||||
printf("nxeg_initialize: Failed to create trv_servertask task: %d\n", errno);
|
trv_abort("nxeg_initialize: Failed to create trv_servertask task: %d\n",
|
||||||
g_exitcode = NXEXIT_TASKCREATE;
|
errno);
|
||||||
return ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait a bit to let the server get started */
|
/* Wait a bit to let the server get started */
|
||||||
@ -273,42 +286,48 @@ static inline int trv_nxmu_initialize(FAR struct trv_graphics_info_s *ginfo)
|
|||||||
ginfo->hnx = nx_connect();
|
ginfo->hnx = nx_connect();
|
||||||
if (ginfo->hnx)
|
if (ginfo->hnx)
|
||||||
{
|
{
|
||||||
pthread_attr_t attr;
|
pthread_attr_t attr;
|
||||||
|
|
||||||
/* Start a separate thread to listen for server events. This is probably
|
#ifdef CONFIG_VNCSERVER
|
||||||
* the least efficient way to do this, but it makes this example flow more
|
/* Setup the VNC server to support keyboard/mouse inputs */
|
||||||
* smoothly.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(void)pthread_attr_init(&attr);
|
ret = vnc_default_fbinitialize(0, ginfo->hnx);
|
||||||
param.sched_priority = CONFIG_EXAMPLES_NX_LISTENERPRIO;
|
if (ret < 0)
|
||||||
(void)pthread_attr_setschedparam(&attr, ¶m);
|
{
|
||||||
(void)pthread_attr_setstacksize(&attr, CONFIG_EXAMPLES_NX_STACKSIZE);
|
trv_abort("vnc_default_fbinitialize failed: %d\n", ret);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ret = pthread_create(&thread, &attr, trv_nxlistener, NULL);
|
/* Start a separate thread to listen for server events. This is probably
|
||||||
if (ret != 0)
|
* the least efficient way to do this, but it makes this example flow more
|
||||||
{
|
* smoothly.
|
||||||
printf("nxeg_initialize: pthread_create failed: %d\n", ret);
|
*/
|
||||||
g_exitcode = NXEXIT_PTHREADCREATE;
|
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Don't return until we are connected to the server */
|
(void)pthread_attr_init(&attr);
|
||||||
|
param.sched_priority = CONFIG_EXAMPLES_NX_LISTENERPRIO;
|
||||||
|
(void)pthread_attr_setschedparam(&attr, ¶m);
|
||||||
|
(void)pthread_attr_setstacksize(&attr, CONFIG_EXAMPLES_NX_STACKSIZE);
|
||||||
|
|
||||||
while (!g_trv_nxrconnected)
|
ret = pthread_create(&thread, &attr, trv_nxlistener, NULL);
|
||||||
{
|
if (ret != 0)
|
||||||
/* Wait for the listener thread to wake us up when we really
|
{
|
||||||
* are connected.
|
trv_abort("nxeg_initialize: pthread_create failed: %d\n", ret);
|
||||||
*/
|
}
|
||||||
|
|
||||||
(void)sem_wait(&g_trv_nxevent);
|
/* Don't return until we are connected to the server */
|
||||||
}
|
|
||||||
|
while (!g_trv_nxrconnected)
|
||||||
|
{
|
||||||
|
/* Wait for the listener thread to wake us up when we really
|
||||||
|
* are connected.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(void)sem_wait(&g_trv_nxevent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("nxeg_initialize: nx_connect failed: %d\n", errno);
|
trv_abort("nxeg_initialize: nx_connect failed: %d\n", errno);
|
||||||
g_exitcode = NXEXIT_NXCONNECT;
|
|
||||||
return ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* And use the background window */
|
/* And use the background window */
|
||||||
|
Loading…
Reference in New Issue
Block a user