examples/buttons: Eliminate 'too many initializers' warning.

This commit is contained in:
Gregory Nutt 2017-02-16 11:00:43 -06:00
parent 58b521183d
commit 9b9a321637
2 changed files with 47 additions and 33 deletions

View File

@ -41,7 +41,7 @@ config EXAMPLES_BUTTONS_NAMES
if EXAMPLES_BUTTONS_NAMES
config EXAMPLES_BUTTONS_QTD
int "Quantity of Buttons in the Board"
int "Number of Buttons in the Board"
default 8
config EXAMPLES_BUTTONS_NAME0

View File

@ -1,7 +1,7 @@
/****************************************************************************
* examples/buttons/buttons_main.c
*
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
* Copyright (C) 2016-2027 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -123,24 +123,38 @@
# error "CONFIG_EXAMPLES_BUTTONS_QTD > 8"
#endif
#ifdef CONFIG_EXAMPLES_BUTTONS_NAMES
char button_name[CONFIG_EXAMPLES_BUTTONS_QTD][16] =
{
CONFIG_EXAMPLES_BUTTONS_NAME0,
CONFIG_EXAMPLES_BUTTONS_NAME1,
CONFIG_EXAMPLES_BUTTONS_NAME2,
CONFIG_EXAMPLES_BUTTONS_NAME3,
CONFIG_EXAMPLES_BUTTONS_NAME4,
CONFIG_EXAMPLES_BUTTONS_NAME5,
CONFIG_EXAMPLES_BUTTONS_NAME6,
CONFIG_EXAMPLES_BUTTONS_NAME7,
};
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#ifdef CONFIG_EXAMPLES_BUTTONS_NAMES
static const char button_name[CONFIG_EXAMPLES_BUTTONS_QTD][16] =
{
CONFIG_EXAMPLES_BUTTONS_NAME0
#if CONFIG_EXAMPLES_BUTTONS_QTD > 1
, CONFIG_EXAMPLES_BUTTONS_NAME1
#endif
#if CONFIG_EXAMPLES_BUTTONS_QTD > 2
, CONFIG_EXAMPLES_BUTTONS_NAME2
#endif
#if CONFIG_EXAMPLES_BUTTONS_QTD > 3
, CONFIG_EXAMPLES_BUTTONS_NAME3
#endif
#if CONFIG_EXAMPLES_BUTTONS_QTD > 4
, CONFIG_EXAMPLES_BUTTONS_NAME4
#endif
#if CONFIG_EXAMPLES_BUTTONS_QTD > 5
, CONFIG_EXAMPLES_BUTTONS_NAME5
#endif
#if CONFIG_EXAMPLES_BUTTONS_QTD > 6
, CONFIG_EXAMPLES_BUTTONS_NAME6
#endif
#if CONFIG_EXAMPLES_BUTTONS_QTD > 7
, CONFIG_EXAMPLES_BUTTONS_NAME7
#endif
};
#endif
static bool g_button_daemon_started;
/****************************************************************************