diff --git a/examples/buttons/Kconfig b/examples/buttons/Kconfig index adf92905f..96910293c 100644 --- a/examples/buttons/Kconfig +++ b/examples/buttons/Kconfig @@ -41,40 +41,40 @@ config EXAMPLES_BUTTONS_NAMES if EXAMPLES_BUTTONS_NAMES config EXAMPLES_BUTTONS_QTD -int "Quantity of Buttons in the Board" -default 8 + int "Number of Buttons in the Board" + default 8 config EXAMPLES_BUTTONS_NAME0 -string "Button 0 Name" -default "BUTTON0" + string "Button 0 Name" + default "BUTTON0" config EXAMPLES_BUTTONS_NAME1 -string "Button 1 Name" -default "BUTTON1" + string "Button 1 Name" + default "BUTTON1" config EXAMPLES_BUTTONS_NAME2 -string "Button 2 Name" -default "BUTTON2" + string "Button 2 Name" + default "BUTTON2" config EXAMPLES_BUTTONS_NAME3 -string "Button 3 Name" -default "BUTTON3" + string "Button 3 Name" + default "BUTTON3" config EXAMPLES_BUTTONS_NAME4 -string "Button 4 Name" -default "BUTTON4" + string "Button 4 Name" + default "BUTTON4" config EXAMPLES_BUTTONS_NAME5 -string "Button 5 Name" -default "BUTTON5" + string "Button 5 Name" + default "BUTTON5" config EXAMPLES_BUTTONS_NAME6 -string "Button 6 Name" -default "BUTTON6" + string "Button 6 Name" + default "BUTTON6" config EXAMPLES_BUTTONS_NAME7 -string "Button 7 Name" -default "BUTTON7" + string "Button 7 Name" + default "BUTTON7" endif # EXAMPLES_BUTTONS_NAMES endif # EXAMPLES_BUTTONS diff --git a/examples/buttons/buttons_main.c b/examples/buttons/buttons_main.c index d8538b833..de50afd0a 100644 --- a/examples/buttons/buttons_main.c +++ b/examples/buttons/buttons_main.c @@ -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 * * 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; /****************************************************************************