summaryrefslogtreecommitdiff
path: root/apps/examples/nxhello
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-10-08 08:33:00 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-10-08 08:33:00 -0600
commitfdb1d0a4df496e7a3232a950d5c72231363cf67a (patch)
tree5d18c1b4f9241f17396ec663ff4425bf21e6b57a /apps/examples/nxhello
parent1753a0251a941fa4d1a5b95aec631209e9957670 (diff)
downloadpx4-nuttx-fdb1d0a4df496e7a3232a950d5c72231363cf67a.tar.gz
px4-nuttx-fdb1d0a4df496e7a3232a950d5c72231363cf67a.tar.bz2
px4-nuttx-fdb1d0a4df496e7a3232a950d5c72231363cf67a.zip
Remove non-portable references to syslog from apps/examples
Diffstat (limited to 'apps/examples/nxhello')
-rw-r--r--apps/examples/nxhello/nxhello.h20
-rw-r--r--apps/examples/nxhello/nxhello_bkgd.c10
-rw-r--r--apps/examples/nxhello/nxhello_main.c40
3 files changed, 25 insertions, 45 deletions
diff --git a/apps/examples/nxhello/nxhello.h b/apps/examples/nxhello/nxhello.h
index 39e63ee0d..010294149 100644
--- a/apps/examples/nxhello/nxhello.h
+++ b/apps/examples/nxhello/nxhello.h
@@ -96,26 +96,6 @@
# endif
#endif
-/* Debug ********************************************************************/
-
-#ifdef CONFIG_CPP_HAVE_VARARGS
-# ifdef CONFIG_DEBUG
-# define message(...) lowsyslog(__VA_ARGS__)
-# define msgflush()
-# else
-# define message(...) printf(__VA_ARGS__)
-# define msgflush() fflush(stdout)
-# endif
-#else
-# ifdef CONFIG_DEBUG
-# define message lowsyslog
-# define msgflush()
-# else
-# define message printf
-# define msgflush() fflush(stdout)
-# endif
-#endif
-
/****************************************************************************
* Public Types
****************************************************************************/
diff --git a/apps/examples/nxhello/nxhello_bkgd.c b/apps/examples/nxhello/nxhello_bkgd.c
index 08be6d3a9..64d66b9cb 100644
--- a/apps/examples/nxhello/nxhello_bkgd.c
+++ b/apps/examples/nxhello/nxhello_bkgd.c
@@ -186,8 +186,8 @@ static void nxhello_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size,
static void nxhello_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos,
uint8_t buttons, FAR void *arg)
{
- message("nxhello_mousein: hwnd=%p pos=(%d,%d) button=%02x\n",
- hwnd, pos->x, pos->y, buttons);
+ printf("nxhello_mousein: hwnd=%p pos=(%d,%d) button=%02x\n",
+ hwnd, pos->x, pos->y, buttons);
}
#endif
@@ -205,7 +205,7 @@ static void nxhello_kbdin(NXWINDOW hwnd, uint8_t nch, FAR const uint8_t *ch,
* expected.
*/
- message("nxhello_kbdin: Unexpected keyboard callback\n");
+ printf("nxhello_kbdin: Unexpected keyboard callback\n");
}
#endif
@@ -371,7 +371,7 @@ void nxhello_hello(NXWINDOW hwnd)
*/
nxhello_center(&pos, fontset);
- message("nxhello_hello: Position (%d,%d)\n", pos.x, pos.y);
+ printf("nxhello_hello: Position (%d,%d)\n", pos.x, pos.y);
/* Now we can say "hello" in the center of the display. */
@@ -420,7 +420,7 @@ void nxhello_hello(NXWINDOW hwnd)
ret = nx_bitmap((NXWINDOW)hwnd, &dest, src, &pos, fstride);
if (ret < 0)
{
- message("nxhello_write: nx_bitmapwindow failed: %d\n", errno);
+ printf("nxhello_write: nx_bitmapwindow failed: %d\n", errno);
}
/* Skip to the right the width of the font */
diff --git a/apps/examples/nxhello/nxhello_main.c b/apps/examples/nxhello/nxhello_main.c
index 96b6577ef..6c8f7b966 100644
--- a/apps/examples/nxhello/nxhello_main.c
+++ b/apps/examples/nxhello/nxhello_main.c
@@ -125,12 +125,12 @@ static inline int nxhello_initialize(void)
#if defined(CONFIG_EXAMPLES_NXHELLO_EXTERNINIT)
/* Use external graphics driver initialization */
- message("nxhello_initialize: Initializing external graphics device\n");
+ printf("nxhello_initialize: Initializing external graphics device\n");
dev = up_nxdrvinit(CONFIG_EXAMPLES_NXHELLO_DEVNO);
if (!dev)
{
- message("nxhello_initialize: up_nxdrvinit failed, devno=%d\n",
- CONFIG_EXAMPLES_NXHELLO_DEVNO);
+ printf("nxhello_initialize: up_nxdrvinit failed, devno=%d\n",
+ CONFIG_EXAMPLES_NXHELLO_DEVNO);
g_nxhello.code = NXEXIT_EXTINITIALIZE;
return ERROR;
}
@@ -140,11 +140,11 @@ static inline int nxhello_initialize(void)
/* Initialize the LCD device */
- message("nxhello_initialize: Initializing LCD\n");
+ printf("nxhello_initialize: Initializing LCD\n");
ret = up_lcdinitialize();
if (ret < 0)
{
- message("nxhello_initialize: up_lcdinitialize failed: %d\n", -ret);
+ printf("nxhello_initialize: up_lcdinitialize failed: %d\n", -ret);
g_nxhello.code = NXEXIT_LCDINITIALIZE;
return ERROR;
}
@@ -154,7 +154,7 @@ static inline int nxhello_initialize(void)
dev = up_lcdgetdev(CONFIG_EXAMPLES_NXHELLO_DEVNO);
if (!dev)
{
- message("nxhello_initialize: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXHELLO_DEVNO);
+ printf("nxhello_initialize: up_lcdgetdev failed, devno=%d\n", CONFIG_EXAMPLES_NXHELLO_DEVNO);
g_nxhello.code = NXEXIT_LCDGETDEV;
return ERROR;
}
@@ -167,11 +167,11 @@ static inline int nxhello_initialize(void)
/* Initialize the frame buffer device */
- message("nxhello_initialize: Initializing framebuffer\n");
+ printf("nxhello_initialize: Initializing framebuffer\n");
ret = up_fbinitialize();
if (ret < 0)
{
- message("nxhello_initialize: up_fbinitialize failed: %d\n", -ret);
+ printf("nxhello_initialize: up_fbinitialize failed: %d\n", -ret);
g_nxhello.code = NXEXIT_FBINITIALIZE;
return ERROR;
}
@@ -179,7 +179,7 @@ static inline int nxhello_initialize(void)
dev = up_fbgetvplane(CONFIG_EXAMPLES_NXHELLO_VPLANE);
if (!dev)
{
- message("nxhello_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXHELLO_VPLANE);
+ printf("nxhello_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXHELLO_VPLANE);
g_nxhello.code = NXEXIT_FBGETVPLANE;
return ERROR;
}
@@ -187,11 +187,11 @@ static inline int nxhello_initialize(void)
/* Then open NX */
- message("nxhello_initialize: Open NX\n");
+ printf("nxhello_initialize: Open NX\n");
g_nxhello.hnx = nx_open(dev);
if (!g_nxhello.hnx)
{
- message("nxhello_initialize: nx_open failed: %d\n", errno);
+ printf("nxhello_initialize: nx_open failed: %d\n", errno);
g_nxhello.code = NXEXIT_NXOPEN;
return ERROR;
}
@@ -218,10 +218,10 @@ int nxhello_main(int argc, char *argv[])
/* Initialize NX */
ret = nxhello_initialize();
- message("nxhello_main: NX handle=%p\n", g_nxhello.hnx);
+ printf("nxhello_main: NX handle=%p\n", g_nxhello.hnx);
if (!g_nxhello.hnx || ret < 0)
{
- message("nxhello_main: Failed to get NX handle: %d\n", errno);
+ printf("nxhello_main: Failed to get NX handle: %d\n", errno);
g_nxhello.code = NXEXIT_NXOPEN;
goto errout;
}
@@ -231,21 +231,21 @@ int nxhello_main(int argc, char *argv[])
g_nxhello.hfont = nxf_getfonthandle(CONFIG_EXAMPLES_NXHELLO_FONTID);
if (!g_nxhello.hfont)
{
- message("nxhello_main: Failed to get font handle: %d\n", errno);
+ printf("nxhello_main: Failed to get font handle: %d\n", errno);
g_nxhello.code = NXEXIT_FONTOPEN;
goto errout;
}
/* Set the background to the configured background color */
- message("nxhello_main: Set background color=%d\n",
- CONFIG_EXAMPLES_NXHELLO_BGCOLOR);
+ printf("nxhello_main: Set background color=%d\n",
+ CONFIG_EXAMPLES_NXHELLO_BGCOLOR);
color = CONFIG_EXAMPLES_NXHELLO_BGCOLOR;
ret = nx_setbgcolor(g_nxhello.hnx, &color);
if (ret < 0)
{
- message("nxhello_main: nx_setbgcolor failed: %d\n", errno);
+ printf("nxhello_main: nx_setbgcolor failed: %d\n", errno);
g_nxhello.code = NXEXIT_NXSETBGCOLOR;
goto errout_with_nx;
}
@@ -255,7 +255,7 @@ int nxhello_main(int argc, char *argv[])
ret = nx_requestbkgd(g_nxhello.hnx, &g_nxhellocb, NULL);
if (ret < 0)
{
- message("nxhello_main: nx_setbgcolor failed: %d\n", errno);
+ printf("nxhello_main: nx_setbgcolor failed: %d\n", errno);
g_nxhello.code = NXEXIT_NXREQUESTBKGD;
goto errout_with_nx;
}
@@ -268,7 +268,7 @@ int nxhello_main(int argc, char *argv[])
{
(void)sem_wait(&g_nxhello.sem);
}
- message("nxhello_main: Screen resolution (%d,%d)\n", g_nxhello.xres, g_nxhello.yres);
+ printf("nxhello_main: Screen resolution (%d,%d)\n", g_nxhello.xres, g_nxhello.yres);
/* Now, say hello and exit, sleeping a little before each. */
@@ -283,7 +283,7 @@ int nxhello_main(int argc, char *argv[])
/* Close NX */
errout_with_nx:
- message("nxhello_main: Close NX\n");
+ printf("nxhello_main: Close NX\n");
nx_close(g_nxhello.hnx);
errout:
return g_nxhello.code;