Rename examples/buttons to examples/archbuttons

This commit is contained in:
Alan Carvalho de Assis 2016-10-11 14:21:08 -06:00 committed by Gregory Nutt
parent e5cc2bb63e
commit f29c444363
6 changed files with 89 additions and 84 deletions

View File

@ -87,6 +87,36 @@ examples/alarm
CONFIG_EXAMPLES_ALARM_DEVPATH - RTC device path (/dev/rtc0)
ONFIG_EXAMPLES_ALARM_SIGNO - Alarm signal
examples/archbuttons
^^^^^^^^^^^^^^^^^^^^
This is a simple configuration that may be used to test the board-
specific button interfaces. Configuration options:
CONFIG_ARCH_BUTTONS - Must be defined for button support
CONFIG_EXAMPLES_BUTTONS_MIN - Lowest button number (MIN=0)
CONFIG_EXAMPLES_BUTTONS_MAX - Highest button number (MAX=7)
CONFIG_ARCH_IRQBUTTONS - Must be defined for interrupting button support
CONFIG_EXAMPLES_IRQBUTTONS_MIN - Lowest interrupting button number (MIN=0)
CONFIG_EXAMPLES_IRQBUTTONS_MAX - Highest interrupting button number (MAX=7)
Name strings for buttons:
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,
Additional architecture-/board- specific configuration settings may also
be required.
NOTE: This test exercises internal button driver interfaces. As such, it
relies on internal OS interfaces that are not normally available to a
user-space program. As a result, this example cannot be used if a
NuttX is built as a protected, supervisor kernel (CONFIG_BUILD_PROTECTED
or CONFIG_BUILD_KERNEL).
examples/bastest
^^^^^^^^^^^^^^^^
This directory contains a small program that will mount a ROMFS file system
@ -147,32 +177,7 @@ examples/bridge
examples/buttons
^^^^^^^^^^^^^^^^
This is a simple configuration that may be used to test the board-
specific button interfaces. Configuration options:
CONFIG_ARCH_BUTTONS - Must be defined for button support
CONFIG_EXAMPLES_BUTTONS_MIN - Lowest button number (MIN=0)
CONFIG_EXAMPLES_BUTTONS_MAX - Highest button number (MAX=7)
CONFIG_ARCH_IRQBUTTONS - Must be defined for interrupting button support
CONFIG_EXAMPLES_IRQBUTTONS_MIN - Lowest interrupting button number (MIN=0)
CONFIG_EXAMPLES_IRQBUTTONS_MAX - Highest interrupting button number (MAX=7)
Name strings for buttons:
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,
Additional architecture-/board- specific configuration settings may also
be required.
NOTE: This test exercises internal button driver interfaces. As such, it
relies on internal OS interfaces that are not normally available to a
user-space program. As a result, this example cannot be used if a
NuttX is built as a protected, supervisor kernel (CONFIG_BUILD_PROTECTED
or CONFIG_BUILD_KERNEL).
To be provided
examples/can
^^^^^^^^^^^^

View File

@ -3,19 +3,19 @@
# see the file kconfig-language.txt in the NuttX tools repository.
#
config EXAMPLES_BUTTONS
bool "Buttons example"
config EXAMPLES_ARCHBUTTONS
bool "Arch Buttons example"
default n
depends on ARCH_BUTTONS && BUILD_FLAT
---help---
Enable the buttons example. May require ARCH_BUTTONS on some boards.
if EXAMPLES_BUTTONS
config EXAMPLES_BUTTONS_MIN
if EXAMPLES_ARCHBUTTONS
config EXAMPLES_ARCHBUTTONS_MIN
int "Lowest Button Number"
default 0
config EXAMPLES_BUTTONS_MAX
config EXAMPLES_ARCHBUTTONS_MAX
int "Highest Button Number"
default 7
@ -28,35 +28,35 @@ config EXAMPLES_IRQBUTTONS_MAX
int "Highest Interrupting Button Number"
default 7
config EXAMPLES_BUTTONS_NAME0
config EXAMPLES_ARCHBUTTONS_NAME0
string "Button 0 Name"
default "Button 0"
config EXAMPLES_BUTTONS_NAME1
config EXAMPLES_ARCHBUTTONS_NAME1
string "Button 1 Name"
default "Button 1"
config EXAMPLES_BUTTONS_NAME2
config EXAMPLES_ARCHBUTTONS_NAME2
string "Button 2 Name"
default "Button 2"
config EXAMPLES_BUTTONS_NAME3
config EXAMPLES_ARCHBUTTONS_NAME3
string "Button 3 Name"
default "Button 3"
config EXAMPLES_BUTTONS_NAME4
config EXAMPLES_ARCHBUTTONS_NAME4
string "Button 4 Name"
default "Button 4"
config EXAMPLES_BUTTONS_NAME5
config EXAMPLES_ARCHBUTTONS_NAME5
string "Button 5 Name"
default "Button 5"
config EXAMPLES_BUTTONS_NAME6
config EXAMPLES_ARCHBUTTONS_NAME6
string "Button 6 Name"
default "Button 6"
config EXAMPLES_BUTTONS_NAME7
config EXAMPLES_ARCHBUTTONS_NAME7
string "Button 7 Name"
default "Button 7"

View File

@ -1,5 +1,5 @@
############################################################################
# apps/examples/buttons/Make.defs
# apps/examples/archbuttons/Make.defs
# Adds selected applications to apps/ build
#
# Copyright (C) 2015 Gregory Nutt. All rights reserved.
@ -34,6 +34,6 @@
#
############################################################################
ifeq ($(CONFIG_EXAMPLES_BUTTONS),y)
CONFIGURED_APPS += examples/buttons
ifeq ($(CONFIG_EXAMPLES_ARCHBUTTONS),y)
CONFIGURED_APPS += examples/archbuttons
endif

View File

@ -39,14 +39,14 @@
ASRCS =
CSRCS =
MAINSRC = buttons_main.c
MAINSRC = archbuttons_main.c
CONFIG_XYZ_PROGNAME ?= buttons$(EXEEXT)
CONFIG_XYZ_PROGNAME ?= archbuttons$(EXEEXT)
PROGNAME = $(CONFIG_XYZ_PROGNAME)
# Buttons built-in application info
APPNAME = buttons
APPNAME = archbuttons
PRIORITY = SCHED_PRIORITY_DEFAULT
STACKSIZE = 2048

View File

@ -1,5 +1,5 @@
/****************************************************************************
* examples/buttons/buttons_main.c
* examples/archbuttons/archbuttons_main.c
*
* Copyright (C) 2011, 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
@ -64,53 +64,53 @@
# error "CONFIG_ARCH_BUTTONS is not defined in the configuration"
#endif
#ifndef CONFIG_EXAMPLES_BUTTONS_NAME0
# define CONFIG_EXAMPLES_BUTTONS_NAME0 "BUTTON0"
#ifndef CONFIG_EXAMPLES_ARCHBUTTONS_NAME0
# define CONFIG_EXAMPLES_ARCHBUTTONS_NAME0 "BUTTON0"
#endif
#ifndef CONFIG_EXAMPLES_BUTTONS_NAME1
# define CONFIG_EXAMPLES_BUTTONS_NAME1 "BUTTON1"
#ifndef CONFIG_EXAMPLES_ARCHBUTTONS_NAME1
# define CONFIG_EXAMPLES_ARCHBUTTONS_NAME1 "BUTTON1"
#endif
#ifndef CONFIG_EXAMPLES_BUTTONS_NAME2
# define CONFIG_EXAMPLES_BUTTONS_NAME2 "BUTTON2"
#ifndef CONFIG_EXAMPLES_ARCHBUTTONS_NAME2
# define CONFIG_EXAMPLES_ARCHBUTTONS_NAME2 "BUTTON2"
#endif
#ifndef CONFIG_EXAMPLES_BUTTONS_NAME3
# define CONFIG_EXAMPLES_BUTTONS_NAME3 "BUTTON3"
#ifndef CONFIG_EXAMPLES_ARCHBUTTONS_NAME3
# define CONFIG_EXAMPLES_ARCHBUTTONS_NAME3 "BUTTON3"
#endif
#ifndef CONFIG_EXAMPLES_BUTTONS_NAME4
# define CONFIG_EXAMPLES_BUTTONS_NAME4 "BUTTON4"
#ifndef CONFIG_EXAMPLES_ARCHBUTTONS_NAME4
# define CONFIG_EXAMPLES_ARCHBUTTONS_NAME4 "BUTTON4"
#endif
#ifndef CONFIG_EXAMPLES_BUTTONS_NAME5
# define CONFIG_EXAMPLES_BUTTONS_NAME5 "BUTTON5"
#ifndef CONFIG_EXAMPLES_ARCHBUTTONS_NAME5
# define CONFIG_EXAMPLES_ARCHBUTTONS_NAME5 "BUTTON5"
#endif
#ifndef CONFIG_EXAMPLES_BUTTONS_NAME6
# define CONFIG_EXAMPLES_BUTTONS_NAME6 "BUTTON6"
#ifndef CONFIG_EXAMPLES_ARCHBUTTONS_NAME6
# define CONFIG_EXAMPLES_ARCHBUTTONS_NAME6 "BUTTON6"
#endif
#ifndef CONFIG_EXAMPLES_BUTTONS_NAME7
# define CONFIG_EXAMPLES_BUTTONS_NAME7 "BUTTON7"
#ifndef CONFIG_EXAMPLES_ARCHBUTTONS_NAME7
# define CONFIG_EXAMPLES_ARCHBUTTONS_NAME7 "BUTTON7"
#endif
#define BUTTON_MIN 0
#define BUTTON_MAX 7
#ifndef CONFIG_EXAMPLES_BUTTONS_MIN
# define CONFIG_EXAMPLES_BUTTONS_MIN BUTTON_MIN
#ifndef CONFIG_EXAMPLES_ARCHBUTTONS_MIN
# define CONFIG_EXAMPLES_ARCHBUTTONS_MIN BUTTON_MIN
#endif
#ifndef CONFIG_EXAMPLES_BUTTONS_MAX
# define CONFIG_EXAMPLES_BUTTONS_MAX BUTTON_MAX
#ifndef CONFIG_EXAMPLES_ARCHBUTTONS_MAX
# define CONFIG_EXAMPLES_ARCHBUTTONS_MAX BUTTON_MAX
#endif
#if CONFIG_EXAMPLES_BUTTONS_MIN > CONFIG_EXAMPLES_BUTTONS_MAX
# error "CONFIG_EXAMPLES_BUTTONS_MIN > CONFIG_EXAMPLES_BUTTONS_MAX"
#if CONFIG_EXAMPLES_ARCHBUTTONS_MIN > CONFIG_EXAMPLES_ARCHBUTTONS_MAX
# error "CONFIG_EXAMPLES_ARCHBUTTONS_MIN > CONFIG_EXAMPLES_ARCHBUTTONS_MAX"
#endif
#if CONFIG_EXAMPLES_BUTTONS_MAX > 7
# error "CONFIG_EXAMPLES_BUTTONS_MAX > 7"
#if CONFIG_EXAMPLES_ARCHBUTTONS_MAX > 7
# error "CONFIG_EXAMPLES_ARCHBUTTONS_MAX > 7"
#endif
#ifndef CONFIG_EXAMPLES_IRQBUTTONS_MIN
# define CONFIG_EXAMPLES_IRQBUTTONS_MIN CONFIG_EXAMPLES_BUTTONS_MIN
# define CONFIG_EXAMPLES_IRQBUTTONS_MIN CONFIG_EXAMPLES_ARCHBUTTONS_MIN
#endif
#ifndef CONFIG_EXAMPLES_IRQBUTTONS_MAX
# define CONFIG_EXAMPLES_IRQBUTTONS_MAX CONFIG_EXAMPLES_BUTTONS_MAX
# define CONFIG_EXAMPLES_IRQBUTTONS_MAX CONFIG_EXAMPLES_ARCHBUTTONS_MAX
#endif
#if CONFIG_EXAMPLES_IRQBUTTONS_MIN > CONFIG_EXAMPLES_IRQBUTTONS_MAX
@ -127,8 +127,8 @@
# define MAX(a,b) (a > b ? a : b)
#endif
#define MIN_BUTTON MIN(CONFIG_EXAMPLES_BUTTONS_MIN, CONFIG_EXAMPLES_IRQBUTTONS_MIN)
#define MAX_BUTTON MAX(CONFIG_EXAMPLES_BUTTONS_MAX, CONFIG_EXAMPLES_IRQBUTTONS_MAX)
#define MIN_BUTTON MIN(CONFIG_EXAMPLES_ARCHBUTTONS_MIN, CONFIG_EXAMPLES_IRQBUTTONS_MIN)
#define MAX_BUTTON MAX(CONFIG_EXAMPLES_ARCHBUTTONS_MAX, CONFIG_EXAMPLES_IRQBUTTONS_MAX)
#define NUM_BUTTONS (MAX_BUTTON - MIN_BUTTON + 1)
#define BUTTON_INDEX(b) ((b)-MIN_BUTTON)
@ -190,7 +190,7 @@ static const struct button_info_s g_buttoninfo[NUM_BUTTONS] =
{
#if MIN_BUTTON < 1
{
CONFIG_EXAMPLES_BUTTONS_NAME0,
CONFIG_EXAMPLES_ARCHBUTTONS_NAME0,
#ifdef CONFIG_ARCH_IRQBUTTONS
button0_handler
#endif
@ -198,7 +198,7 @@ static const struct button_info_s g_buttoninfo[NUM_BUTTONS] =
#endif
#if MIN_BUTTON < 2 && MAX_BUTTON > 0
{
CONFIG_EXAMPLES_BUTTONS_NAME1,
CONFIG_EXAMPLES_ARCHBUTTONS_NAME1,
#ifdef CONFIG_ARCH_IRQBUTTONS
button1_handler
#endif
@ -206,7 +206,7 @@ static const struct button_info_s g_buttoninfo[NUM_BUTTONS] =
#endif
#if MIN_BUTTON < 3 && MAX_BUTTON > 1
{
CONFIG_EXAMPLES_BUTTONS_NAME2,
CONFIG_EXAMPLES_ARCHBUTTONS_NAME2,
#ifdef CONFIG_ARCH_IRQBUTTONS
button2_handler
#endif
@ -214,7 +214,7 @@ static const struct button_info_s g_buttoninfo[NUM_BUTTONS] =
#endif
#if MIN_BUTTON < 4 && MAX_BUTTON > 2
{
CONFIG_EXAMPLES_BUTTONS_NAME3,
CONFIG_EXAMPLES_ARCHBUTTONS_NAME3,
#ifdef CONFIG_ARCH_IRQBUTTONS
button3_handler
#endif
@ -222,7 +222,7 @@ static const struct button_info_s g_buttoninfo[NUM_BUTTONS] =
#endif
#if MIN_BUTTON < 5 && MAX_BUTTON > 3
{
CONFIG_EXAMPLES_BUTTONS_NAME4,
CONFIG_EXAMPLES_ARCHBUTTONS_NAME4,
#ifdef CONFIG_ARCH_IRQBUTTONS
button4_handler
#endif
@ -230,7 +230,7 @@ static const struct button_info_s g_buttoninfo[NUM_BUTTONS] =
#endif
#if MIN_BUTTON < 6 && MAX_BUTTON > 4
{
CONFIG_EXAMPLES_BUTTONS_NAME5,
CONFIG_EXAMPLES_ARCHBUTTONS_NAME5,
#ifdef CONFIG_ARCH_IRQBUTTONS
button5_handler
#endif
@ -238,7 +238,7 @@ static const struct button_info_s g_buttoninfo[NUM_BUTTONS] =
#endif
#if MIN_BUTTON < 7 && MAX_BUTTON > 5
{
CONFIG_EXAMPLES_BUTTONS_NAME6,
CONFIG_EXAMPLES_ARCHBUTTONS_NAME6,
#ifdef CONFIG_ARCH_IRQBUTTONS
button6_handler
#endif
@ -246,7 +246,7 @@ static const struct button_info_s g_buttoninfo[NUM_BUTTONS] =
#endif
#if MAX_BUTTON > 6
{
CONFIG_EXAMPLES_BUTTONS_NAME7,
CONFIG_EXAMPLES_ARCHBUTTONS_NAME7,
#ifdef CONFIG_ARCH_IRQBUTTONS
button7_handler
#endif
@ -390,13 +390,13 @@ static int button7_handler(int irq, FAR void *context)
****************************************************************************/
/****************************************************************************
* buttons_main
* archbuttons_main
****************************************************************************/
#ifdef CONFIG_BUILD_KERNEL
int main(int argc, FAR char *argv[])
#else
int buttons_main(int argc, char *argv[])
int archbuttons_main(int argc, char *argv[])
#endif
{
uint8_t newset;