From ea439de0bb25f37ffc4004b6532bf53810511c3d Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 24 Jan 2014 13:50:23 -0600 Subject: Rename up_buttoninit to board_button_intialize --- apps/examples/buttons/buttons_main.c | 9 +-- nuttx/ChangeLog | 4 ++ nuttx/configs/avr32dev1/include/board.h | 67 +++------------------- nuttx/configs/avr32dev1/src/up_buttons.c | 30 +++++----- nuttx/configs/cloudctrl/include/board.h | 65 ++++++--------------- nuttx/configs/cloudctrl/src/up_buttons.c | 42 ++++++++------ nuttx/configs/demo9s12ne64/include/board.h | 17 +----- nuttx/configs/demo9s12ne64/src/up_buttons.c | 8 ++- nuttx/configs/ea3131/include/board.h | 23 ++------ nuttx/configs/ea3131/src/up_buttons.c | 8 ++- nuttx/configs/ea3152/include/board.h | 18 +----- nuttx/configs/ea3152/src/up_buttons.c | 8 ++- nuttx/configs/ez80f910200zco/include/board.h | 5 -- nuttx/configs/ez80f910200zco/src/ez80_buttons.c | 4 +- nuttx/configs/fire-stm32v2/include/board.h | 41 ++----------- nuttx/configs/fire-stm32v2/src/up_buttons.c | 39 +++++++------ nuttx/configs/hymini-stm32v/include/board.h | 33 +---------- nuttx/configs/hymini-stm32v/src/up_buttons.c | 41 +++++++------ nuttx/configs/kwikstik-k40/src/up_buttons.c | 41 +++++++------ nuttx/configs/lincoln60/src/up_buttons.c | 10 ++-- nuttx/configs/lm4f120-launchpad/include/board.h | 64 ++------------------- nuttx/configs/lpc4330-xplorer/src/up_buttons.c | 10 ++-- nuttx/configs/mikroe-stm32f4/include/board.h | 31 ---------- nuttx/configs/ne64badge/include/board.h | 17 +----- nuttx/configs/ne64badge/src/up_buttons.c | 12 ++-- nuttx/configs/olimex-lpc1766stk/include/board.h | 55 ------------------ nuttx/configs/olimex-lpc1766stk/src/up_buttons.c | 10 ++-- nuttx/configs/olimex-stm32-p207/src/up_boot.c | 2 +- nuttx/configs/olimex-stm32-p207/src/up_buttons.c | 13 +++-- nuttx/configs/olimex-strp711/include/board.h | 5 -- nuttx/configs/olimex-strp711/src/up_buttons.c | 4 +- nuttx/configs/open1788/include/board.h | 55 ------------------ nuttx/configs/open1788/src/lpc17_buttons.c | 10 ++-- nuttx/configs/pcduino-a10/include/board.h | 42 -------------- nuttx/configs/pcduino-a10/src/a1x_buttons.c | 11 ++-- nuttx/configs/sam3u-ek/include/board.h | 42 -------------- nuttx/configs/sam3u-ek/src/up_buttons.c | 11 ++-- nuttx/configs/sam4l-xplained/include/board.h | 42 -------------- nuttx/configs/sam4l-xplained/src/sam_buttons.c | 11 ++-- nuttx/configs/sam4s-xplained/include/board.h | 42 -------------- nuttx/configs/sam4s-xplained/src/sam_buttons.c | 11 ++-- nuttx/configs/sama5d3x-ek/include/board.h | 42 -------------- nuttx/configs/sama5d3x-ek/src/sam_buttons.c | 9 +-- nuttx/configs/shenzhou/include/board.h | 65 ++++++--------------- nuttx/configs/shenzhou/src/up_buttons.c | 14 +++-- nuttx/configs/skp16c26/src/up_buttons.c | 4 +- nuttx/configs/spark/include/board.h | 30 ---------- nuttx/configs/spark/src/up_boot.c | 2 +- nuttx/configs/spark/src/up_buttons.c | 14 +++-- nuttx/configs/stm3210e-eval/include/board.h | 31 ---------- nuttx/configs/stm3210e-eval/src/up_buttons.c | 14 +++-- nuttx/configs/stm3210e-eval/src/up_pmbuttons.c | 2 +- nuttx/configs/stm3220g-eval/include/board.h | 31 ---------- nuttx/configs/stm3220g-eval/src/up_buttons.c | 14 +++-- nuttx/configs/stm3240g-eval/include/board.h | 41 ++----------- nuttx/configs/stm3240g-eval/src/up_buttons.c | 14 +++-- nuttx/configs/stm32f100rc_generic/include/board.h | 31 ---------- nuttx/configs/stm32f100rc_generic/src/up_buttons.c | 14 +++-- nuttx/configs/stm32f3discovery/include/board.h | 31 ---------- nuttx/configs/stm32f3discovery/src/up_buttons.c | 12 ++-- nuttx/configs/stm32f429i-disco/include/board.h | 31 ---------- nuttx/configs/stm32f429i-disco/src/up_buttons.c | 14 +++-- nuttx/configs/stm32f4discovery/include/board.h | 31 ---------- nuttx/configs/stm32f4discovery/src/up_buttons.c | 14 +++-- nuttx/configs/stm32f4discovery/src/up_pmbuttons.c | 2 +- nuttx/configs/stm32ldiscovery/include/board.h | 31 ---------- nuttx/configs/stm32ldiscovery/src/stm32_buttons.c | 14 +++-- nuttx/configs/stm32vldiscovery/include/board.h | 31 ---------- nuttx/configs/stm32vldiscovery/src/stm32_buttons.c | 14 +++-- nuttx/configs/sure-pic32mx/include/board.h | 36 ------------ nuttx/configs/sure-pic32mx/src/pic32mx_buttons.c | 10 ++-- nuttx/configs/twr-k60n512/include/board.h | 31 ---------- nuttx/configs/twr-k60n512/src/up_buttons.c | 16 +++--- nuttx/configs/ubw32/include/board.h | 36 ------------ nuttx/configs/ubw32/src/up_buttons.c | 10 ++-- nuttx/configs/us7032evb1/include/board.h | 5 -- nuttx/configs/viewtool-stm32f107/include/board.h | 42 -------------- .../configs/viewtool-stm32f107/src/stm32_buttons.c | 13 +++-- .../configs/viewtool-stm32f107/src/stm32_highpri.c | 7 +-- nuttx/configs/vsn/include/board.h | 9 --- nuttx/configs/vsn/src/buttons.c | 19 +++--- nuttx/configs/zkit-arm-1769/src/up_buttons.c | 10 ++-- nuttx/include/nuttx/arch.h | 26 ++++----- 83 files changed, 409 insertions(+), 1471 deletions(-) diff --git a/apps/examples/buttons/buttons_main.c b/apps/examples/buttons/buttons_main.c index 655080def..fba88d026 100644 --- a/apps/examples/buttons/buttons_main.c +++ b/apps/examples/buttons/buttons_main.c @@ -1,7 +1,7 @@ /**************************************************************************** * examples/buttons/buttons_main.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -45,15 +45,16 @@ ****************************************************************************/ #include -#include #include #include #include #include +#include + /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /* Configuration ************************************************************/ @@ -414,7 +415,7 @@ int buttons_main(int argc, char *argv[]) /* Initialize the button GPIOs */ - up_buttoninit(); + board_button_initialize(); /* Register to recieve button interrupts */ diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 13f84f038..373c80834 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -6509,3 +6509,7 @@ distribution from ARM mean that we need to be explicit about branch sizes; one or more of the wide branch opcodes results in bad table branching. From Mike Smith (2014-1-23). + * Many files: renamed up_buttoninit() to board_button_initialize to + better conform to the naming standard. Now ONLY prototypes in + include/nuttx/arch.h (2014-1024). + diff --git a/nuttx/configs/avr32dev1/include/board.h b/nuttx/configs/avr32dev1/include/board.h index 008c5ffe3..ef64c65f8 100644 --- a/nuttx/configs/avr32dev1/include/board.h +++ b/nuttx/configs/avr32dev1/include/board.h @@ -1,8 +1,7 @@ /************************************************************************************ * configs/avr32dev1/include/board.h - * include/arch/board/board.h * - * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -34,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_BOARD_BOARD_H -#define __ARCH_BOARD_BOARD_H +#ifndef __CONFIGS_AVR32DEV1_INCLUDE_BOARD_H +#define __CONFIGS_AVR32DEV1_INCLUDE_BOARD_H /************************************************************************************ * Included Files @@ -174,7 +173,8 @@ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif @@ -192,60 +192,7 @@ extern "C" { * ************************************************************************************/ -EXTERN void avr32_boardinitialize(void); - -/************************************************************************************ - * Name: up_buttoninit - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * NOTE: Nothing in the "base" NuttX code calls up_buttoninit(). If you want button - * support in an application, your application startup code must call up_buttoninit() - * prior to calling any of the other button interfaces. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); - -/************************************************************************************ - * Name: up_buttons - * - * Description: - * After up_buttoninit() has been called, up_buttons() may be called to collect - * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit - * associated with a button. See the BUTTON* definitions above for the meaning of - * each bit in the returned value. - * - ************************************************************************************/ - -EXTERN uint8_t up_buttons(void); - -/************************************************************************************ - * Name: up_irqbutton - * - * Description: - * This function may be called to register an interrupt handler that will be - * called when a button is depressed or released. The ID value is one of the - * BUTTON* definitions provided above. The previous interrupt handler address is - * returned (so that it may restored, if so desired). - * - * Configuration Notes: - * Configuration CONFIG_AVR32_GPIOIRQ must be selected to enable the overall GPIO - * IRQ feature and CONFIG_AVR32_GPIOIRQSETA and/or CONFIG_AVR32_GPIOIRQSETB must - * be enabled to select GPIOs to support interrupts on. For button support, bits - * 2 and 3 must be set in CONFIG_AVR32_GPIOIRQSETB (PB2 and PB3). - * - ************************************************************************************/ - -#ifdef CONFIG_AVR32_GPIOIRQ -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif /* CONFIG_ARCH_BUTTONS */ +void avr32_boardinitialize(void); #undef EXTERN #if defined(__cplusplus) @@ -253,5 +200,5 @@ EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); #endif #endif /* __ASSEMBLY__ */ -#endif /* __ARCH_BOARD_BOARD_H */ +#endif /* __CONFIGS_AVR32DEV1_INCLUDE_BOARD_H */ diff --git a/nuttx/configs/avr32dev1/src/up_buttons.c b/nuttx/configs/avr32dev1/src/up_buttons.c index 5b488d72e..40c09b4f3 100644 --- a/nuttx/configs/avr32dev1/src/up_buttons.c +++ b/nuttx/configs/avr32dev1/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/sam3u-ek/src/up_leds.c * - * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ #include #include +#include #include #include @@ -87,12 +88,12 @@ static xcpt_t up_irqbuttonx(int irq, xcpt_t irqhandler) if (irqhandler) { - gpio_irqenable(irq); - } + gpio_irqenable(irq); + } else { - gpio_irqdisable(irq); - } + gpio_irqdisable(irq); + } /* Return the old button handler (so that it can be restored) */ @@ -105,17 +106,17 @@ static xcpt_t up_irqbuttonx(int irq, xcpt_t irqhandler) ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt + * board_button_initialize() must be called to initialize button resources. + * After that, up_buttons() may be called to collect the current state of + * all buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { (void)at32uc3_configgpio(PINMUX_GPIO_BUTTON1); (void)at32uc3_configgpio(PINMUX_GPIO_BUTTON2); @@ -125,10 +126,11 @@ void up_buttoninit(void) * Name: up_buttons * * Description: - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON* definitions - * above for the meaning of each bit in the returned value. + * After board_button_initialize() has been called, up_buttons() may be + * called to collect the state of all buttons. up_buttons() returns an + * 8-bit bit set with each bit associated with a button. See the BUTTON* + * definitions in the board.h header file for the meaning of each bit in + * the returned value. * ****************************************************************************/ diff --git a/nuttx/configs/cloudctrl/include/board.h b/nuttx/configs/cloudctrl/include/board.h index b5ae3d4f5..aa47ad1d2 100644 --- a/nuttx/configs/cloudctrl/include/board.h +++ b/nuttx/configs/cloudctrl/include/board.h @@ -322,37 +322,6 @@ extern "C" { void stm32_boardinitialize(void); -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif - /************************************************************************************ * Name: stm32_ledinit, stm32_setled, and stm32_setleds * @@ -364,9 +333,9 @@ EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); ************************************************************************************/ #ifndef CONFIG_ARCH_LEDS -EXTERN void stm32_ledinit(void); -EXTERN void stm32_setled(int led, bool ledon); -EXTERN void stm32_setleds(uint8_t ledset); +void stm32_ledinit(void); +void stm32_setled(int led, bool ledon); +void stm32_setleds(uint8_t ledset); #endif /************************************************************************************ @@ -380,7 +349,7 @@ EXTERN void stm32_setleds(uint8_t ledset); * ************************************************************************************/ -EXTERN void stm32_lcdclear(uint16_t color); +void stm32_lcdclear(uint16_t color); /************************************************************************************ * Relay control functions @@ -393,17 +362,17 @@ EXTERN void stm32_lcdclear(uint16_t color); ************************************************************************************/ #ifdef CONFIG_ARCH_RELAYS -EXTERN void up_relaysinit(void); -EXTERN void relays_setstat(int relays, bool stat); -EXTERN bool relays_getstat(int relays); -EXTERN void relays_setstats(uint32_t relays_stat); -EXTERN uint32_t relays_getstats(void); -EXTERN void relays_onoff(int relays, uint32_t mdelay); -EXTERN void relays_onoffs(uint32_t relays_stat, uint32_t mdelay); -EXTERN void relays_resetmode(int relays); -EXTERN void relays_powermode(int relays); -EXTERN void relays_resetmodes(uint32_t relays_stat); -EXTERN void relays_powermodes(uint32_t relays_stat); +void up_relaysinit(void); +void relays_setstat(int relays, bool stat); +bool relays_getstat(int relays); +void relays_setstats(uint32_t relays_stat); +uint32_t relays_getstats(void); +void relays_onoff(int relays, uint32_t mdelay); +void relays_onoffs(uint32_t relays_stat, uint32_t mdelay); +void relays_resetmode(int relays); +void relays_powermode(int relays); +void relays_resetmodes(uint32_t relays_stat); +void relays_powermodes(uint32_t relays_stat); #endif /************************************************************************************ @@ -414,8 +383,8 @@ EXTERN void relays_powermodes(uint32_t relays_stat); * ************************************************************************************/ -EXTERN const char *stm32_getchipid(void); -EXTERN const char *stm32_getchipid_string(void); +const char *stm32_getchipid(void); +const char *stm32_getchipid_string(void); #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/configs/cloudctrl/src/up_buttons.c b/nuttx/configs/cloudctrl/src/up_buttons.c index 81535f126..dbad07388 100644 --- a/nuttx/configs/cloudctrl/src/up_buttons.c +++ b/nuttx/configs/cloudctrl/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/cloudctrl/src/up_buttons.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * Darcy Gong * @@ -42,7 +42,9 @@ #include +#include #include + #include "cloudctrl-internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -72,17 +74,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt + * board_button_initialize() must be called to initialize button resources. + * After that, up_buttons() may be called to collect the current state of + * all buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -130,28 +132,30 @@ uint8_t up_buttons(void) return ret; } -/************************************************************************************ +/**************************************************************************** * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt + * board_button_initialize() must be called to initialize button resources. + * After that, up_buttons() may be called to collect the current state of + * all buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. + * After board_button_initialize() has been called, up_buttons() may be + * called to collect the state of all buttons. up_buttons() returns an + * 8-bit bit set with each bit associated with a button. See the + * BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning + * of each bit. * * up_irqbutton() may be called to register an interrupt handler that will * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). + * button enumeration value that uniquely identifies a button resource. See + * the + * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of + * enumeration value. The previous interrupt handler address is returned + * (so that it may restored, if so desired). * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS xcpt_t up_irqbutton(int id, xcpt_t irqhandler) diff --git a/nuttx/configs/demo9s12ne64/include/board.h b/nuttx/configs/demo9s12ne64/include/board.h index 501b2f8e0..9a7d704f7 100644 --- a/nuttx/configs/demo9s12ne64/include/board.h +++ b/nuttx/configs/demo9s12ne64/include/board.h @@ -117,22 +117,7 @@ extern "C" { * ************************************************************************************/ -EXTERN void hcs12_boardinitialize(void); - -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the state of all buttons. up_buttons() - * returns an bit set with bits corresponding to the state of each button. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#endif +void hcs12_boardinitialize(void); #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/configs/demo9s12ne64/src/up_buttons.c b/nuttx/configs/demo9s12ne64/src/up_buttons.c index b895f45a3..bc0d6697b 100644 --- a/nuttx/configs/demo9s12ne64/src/up_buttons.c +++ b/nuttx/configs/demo9s12ne64/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/demo9s12ne64/src/up_leds.c * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "demo9s12ne64.h" #ifdef CONFIG_ARCH_BUTTONS @@ -63,10 +65,10 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { } diff --git a/nuttx/configs/ea3131/include/board.h b/nuttx/configs/ea3131/include/board.h index 2154af545..ea8ee92f4 100644 --- a/nuttx/configs/ea3131/include/board.h +++ b/nuttx/configs/ea3131/include/board.h @@ -2,7 +2,7 @@ * configs/ea3131/include/board.h * include/arch/board/board.h * - * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -122,7 +122,8 @@ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif @@ -140,23 +141,7 @@ extern "C" { * ************************************************************************************/ -EXTERN void lpc31_boardinitialize(void); - -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the state of all buttons. up_buttons() - * returns an 8-bit bit set with each bit associated with a button. See the - * BUTTON_* definitions above for the meaning of each bit. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#endif +void lpc31_boardinitialize(void); #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/configs/ea3131/src/up_buttons.c b/nuttx/configs/ea3131/src/up_buttons.c index 8dd468a9e..f5e71b4dc 100644 --- a/nuttx/configs/ea3131/src/up_buttons.c +++ b/nuttx/configs/ea3131/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/ea3131/src/up_leds.c * - * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "ea3131_internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -63,10 +65,10 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { } diff --git a/nuttx/configs/ea3152/include/board.h b/nuttx/configs/ea3152/include/board.h index 848c4137c..cf468a18e 100644 --- a/nuttx/configs/ea3152/include/board.h +++ b/nuttx/configs/ea3152/include/board.h @@ -140,23 +140,7 @@ extern "C" { * ************************************************************************************/ -EXTERN void lpc31_boardinitialize(void); - -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the state of all buttons. up_buttons() - * returns an 8-bit bit set with each bit associated with a button. See the - * BUTTON_* definitions above for the meaning of each bit. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#endif +void lpc31_boardinitialize(void); #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/configs/ea3152/src/up_buttons.c b/nuttx/configs/ea3152/src/up_buttons.c index d56bfd766..3a9dcf544 100644 --- a/nuttx/configs/ea3152/src/up_buttons.c +++ b/nuttx/configs/ea3152/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/ea3152/src/up_leds.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "ea3152_internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -63,10 +65,10 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { } diff --git a/nuttx/configs/ez80f910200zco/include/board.h b/nuttx/configs/ez80f910200zco/include/board.h index 84767437f..a5fca8d4b 100644 --- a/nuttx/configs/ez80f910200zco/include/board.h +++ b/nuttx/configs/ez80f910200zco/include/board.h @@ -80,11 +80,6 @@ extern "C" { #define EXTERN extern #endif -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#endif - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/ez80f910200zco/src/ez80_buttons.c b/nuttx/configs/ez80f910200zco/src/ez80_buttons.c index babf13b7e..5528a41eb 100644 --- a/nuttx/configs/ez80f910200zco/src/ez80_buttons.c +++ b/nuttx/configs/ez80f910200zco/src/ez80_buttons.c @@ -113,11 +113,11 @@ void up_pb2interrupt(void) ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize ****************************************************************************/ #ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void) +void board_button_initialize(void) { uint8_t regval; diff --git a/nuttx/configs/fire-stm32v2/include/board.h b/nuttx/configs/fire-stm32v2/include/board.h index efdf07ec5..1166f0d83 100644 --- a/nuttx/configs/fire-stm32v2/include/board.h +++ b/nuttx/configs/fire-stm32v2/include/board.h @@ -383,38 +383,7 @@ extern "C" { * ************************************************************************************/ -EXTERN void stm32_boardinitialize(void); - -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif +void stm32_boardinitialize(void); /************************************************************************************ * Name: stm32_ledinit, stm32_setled, and stm32_setleds @@ -427,9 +396,9 @@ EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); ************************************************************************************/ #ifndef CONFIG_ARCH_LEDS -EXTERN void stm32_ledinit(void); -EXTERN void stm32_setled(int led, bool ledon); -EXTERN void stm32_setleds(uint8_t ledset); +void stm32_ledinit(void); +void stm32_setled(int led, bool ledon); +void stm32_setleds(uint8_t ledset); #endif /************************************************************************************ @@ -444,7 +413,7 @@ EXTERN void stm32_setleds(uint8_t ledset); ************************************************************************************/ #ifdef CONFIG_STM32_FSMC -EXTERN void fire_lcdclear(uint16_t color); +void fire_lcdclear(uint16_t color); #endif #endif /* __ASSEMBLY__ */ diff --git a/nuttx/configs/fire-stm32v2/src/up_buttons.c b/nuttx/configs/fire-stm32v2/src/up_buttons.c index 738d65d5f..e9ebdc18e 100644 --- a/nuttx/configs/fire-stm32v2/src/up_buttons.c +++ b/nuttx/configs/fire-stm32v2/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/fire-stm32v2/src/up_buttons.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "fire-internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -63,17 +65,17 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt + * board_button_initialize() must be called to initialize button resources. + * After that, up_buttons() may be called to collect the current state of + * all buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { /* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are * configured for some pins but NOT used in this file @@ -106,28 +108,29 @@ uint8_t up_buttons(void) return ret; } -/************************************************************************************ +/***************************************************************************** * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all + * board_button_initialize() must be called to initialize button resources. + * After that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. + * After board_button_initialize() has been called, up_buttons() may be + * called to collect the state of all buttons. up_buttons() returns an + * 8-bit bit set with each bit associated with a button. See the + * BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning + * of each bit. * * up_irqbutton() may be called to register an interrupt handler that will * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). + * button enumeration value that uniquely identifies a button resource. See + * the BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of + * enumeration values. The previous interrupt handler address is returned + * (so that it may restored, if so desired). * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS xcpt_t up_irqbutton(int id, xcpt_t irqhandler) diff --git a/nuttx/configs/hymini-stm32v/include/board.h b/nuttx/configs/hymini-stm32v/include/board.h index 7751946e7..0e7427f6c 100644 --- a/nuttx/configs/hymini-stm32v/include/board.h +++ b/nuttx/configs/hymini-stm32v/include/board.h @@ -202,38 +202,7 @@ extern "C" { * ************************************************************************************/ -EXTERN void stm32_boardinitialize(void); - -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif +void stm32_boardinitialize(void); #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/configs/hymini-stm32v/src/up_buttons.c b/nuttx/configs/hymini-stm32v/src/up_buttons.c index 05a7c7630..2ab22227b 100644 --- a/nuttx/configs/hymini-stm32v/src/up_buttons.c +++ b/nuttx/configs/hymini-stm32v/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/hymini-stm32v/src/up_buttons.c * - * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "hymini_stm32v-internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -55,17 +57,17 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt + * board_button_initialize() must be called to initialize button resources. + * After that, up_buttons() may be called to collect the current state of + * all buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { stm32_configgpio(GPIO_BTN_KEYA); stm32_configgpio(GPIO_BTN_KEYB); @@ -100,28 +102,29 @@ uint8_t up_buttons(void) return ret; } -/************************************************************************************ +/**************************************************************************** * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt + * board_button_initialize() must be called to initialize button resources. + * After that, up_buttons() may be called to collect the current state of + * all buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. + * After board_button_initialize() has been called, up_buttons() may be + * called to collect the state of all buttons. up_buttons() returns an + * 8-bit bit set with each bit associated with a button. See the + * BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning + * of each bit. * * up_irqbutton() may be called to register an interrupt handler that will * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). + * button enumeration value that uniquely identifies a button resource. See + * the BUTTON_* definitions in board.h for the meaning of enumeration + * value. The previous interrupt handler address is returned (so that it + * may be restored, if so desired). * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS xcpt_t up_irqbutton(int id, xcpt_t irqhandler) diff --git a/nuttx/configs/kwikstik-k40/src/up_buttons.c b/nuttx/configs/kwikstik-k40/src/up_buttons.c index a30a480bc..0358cda33 100644 --- a/nuttx/configs/kwikstik-k40/src/up_buttons.c +++ b/nuttx/configs/kwikstik-k40/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/kwikstik-k40/src/up_buttons.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "kwikstik-internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -63,17 +65,17 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt + * board_button_initialize() must be called to initialize button resources. + * After that, up_buttons() may be called to collect the current state of + * all buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { /* The KwikStik-K40 board has no standard GPIO contact buttons */ } @@ -89,28 +91,29 @@ uint8_t up_buttons(void) return 0; } -/************************************************************************************ +/**************************************************************************** * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt + * board_button_initialize() must be called to initialize button resources. + * After that, up_buttons() may be called to collect the current state of + * all buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. + * After board_button_initialize() has been called, up_buttons() may be + * called to collect the state of all buttons. up_buttons() returns an + * 8-bit bit set with each bit associated with a button. See the + * BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning + * of each bit. * * up_irqbutton() may be called to register an interrupt handler that will * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). + * button enumeration value that uniquely identifies a button resource. + * See the BUTTON_* and JOYSTICK_* definitions in board.h for the meaning + * of enumeration value. The previous interrupt handler address is + * returned (so that it may be restored, if so desired). * - ************************************************************************************/ + ****************************************************************************/ #ifdef CONFIG_ARCH_IRQBUTTONS xcpt_t up_irqbutton(int id, xcpt_t irqhandler) diff --git a/nuttx/configs/lincoln60/src/up_buttons.c b/nuttx/configs/lincoln60/src/up_buttons.c index 706d858f4..53c9db4e9 100644 --- a/nuttx/configs/lincoln60/src/up_buttons.c +++ b/nuttx/configs/lincoln60/src/up_buttons.c @@ -94,17 +94,17 @@ static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -120,7 +120,7 @@ void up_buttoninit(void) * Name: up_buttons * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons. * @@ -160,7 +160,7 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_irqbutton() may be called to register button interrupt handlers. * * up_irqbutton() may be called to register an interrupt handler that will diff --git a/nuttx/configs/lm4f120-launchpad/include/board.h b/nuttx/configs/lm4f120-launchpad/include/board.h index 0bdc3fc89..7ac08d948 100644 --- a/nuttx/configs/lm4f120-launchpad/include/board.h +++ b/nuttx/configs/lm4f120-launchpad/include/board.h @@ -1,8 +1,7 @@ /************************************************************************************ * configs/lm4f120-launchpad/include/board.h - * include/arch/board/board.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -34,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_BOARD_BOARD_H -#define __ARCH_BOARD_BOARD_H +#ifndef __CONFIGS_LM4F120_LAUNCHPAD_INCLUDE_BOARD_H +#define __CONFIGS_LM4F120_LAUNCHPAD_INCLUDE_BOARD_H /************************************************************************************ * Included Files @@ -219,60 +218,5 @@ void lm4f_setled(int led, bool ledon); void lm4f_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Name: up_buttoninit - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the current state of all buttons or - * up_irqbutton() may be called to register button interrupt handlers. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); - -/************************************************************************************ - * Name: up_buttons - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the current state of all buttons. - * - * After up_buttoninit() has been called, up_buttons() may be called to collect - * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit - * associated with a button. See the BOARD_BUTTON_*_BIT and BOARD_JOYSTICK_*_BIT - * definitions above for the meaning of each bit. - * - ************************************************************************************/ - -uint8_t up_buttons(void); - -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_irqbutton() may be called to register button interrupt handlers. - * - * up_irqbutton() may be called to register an interrupt handler that will be called - * when a button is depressed or released. The ID value is a button enumeration - * value that uniquely identifies a button resource. See the BOARD_BUTTON_* and - * BOARD_JOYSTICK_* definitions in above for the meaning of enumeration values - * The previous interrupt handler address is returned (so that it may restored, if - * so desired). - * - * Note that up_irqbutton() also enables button interrupts. Button interrupts - * will remain enabled after the interrupt handler is attached. Interrupts may - * be disabled (and detached) by calling up_irqbutton with irqhandler equal to - * NULL. - * - ************************************************************************************/ - -#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ) -xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif /* CONFIG_ARCH_BUTTONS */ - #endif /* __ASSEMBLY__ */ -#endif /* __ARCH_BOARD_BOARD_H */ +#endif /* __CONFIGS_LM4F120_LAUNCHPAD_INCLUDE_BOARD_H */ diff --git a/nuttx/configs/lpc4330-xplorer/src/up_buttons.c b/nuttx/configs/lpc4330-xplorer/src/up_buttons.c index d99ee2356..a3f4c4975 100644 --- a/nuttx/configs/lpc4330-xplorer/src/up_buttons.c +++ b/nuttx/configs/lpc4330-xplorer/src/up_buttons.c @@ -93,17 +93,17 @@ static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -119,7 +119,7 @@ void up_buttoninit(void) * Name: up_buttons * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons. * @@ -159,7 +159,7 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_irqbutton() may be called to register button interrupt handlers. * * up_irqbutton() may be called to register an interrupt handler that will diff --git a/nuttx/configs/mikroe-stm32f4/include/board.h b/nuttx/configs/mikroe-stm32f4/include/board.h index 7728f7061..dfd5f302a 100644 --- a/nuttx/configs/mikroe-stm32f4/include/board.h +++ b/nuttx/configs/mikroe-stm32f4/include/board.h @@ -297,37 +297,6 @@ void stm32_setled(int led, bool ledon); void stm32_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); -uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/ne64badge/include/board.h b/nuttx/configs/ne64badge/include/board.h index ba4ce3631..aff704e2b 100644 --- a/nuttx/configs/ne64badge/include/board.h +++ b/nuttx/configs/ne64badge/include/board.h @@ -125,22 +125,7 @@ extern "C" { * ************************************************************************************/ -EXTERN void hcs12_boardinitialize(void); - -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the state of all buttons. up_buttons() - * returns an bit set with bits corresponding to the state of each button. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#endif +void hcs12_boardinitialize(void); #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/configs/ne64badge/src/up_buttons.c b/nuttx/configs/ne64badge/src/up_buttons.c index 70c57f2cc..e0daadda0 100644 --- a/nuttx/configs/ne64badge/src/up_buttons.c +++ b/nuttx/configs/ne64badge/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/ne64badge/src/up_buttons.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "ne64badge_internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -91,19 +93,19 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { /* Configure all button GPIO lines */ - btn_dumpgpio("up_buttoninit() Entry)"); + btn_dumpgpio("board_button_initialize() Entry)"); hcs12_configgpio(NE64BADGE_BUTTON1); hcs12_configgpio(NE64BADGE_BUTTON2); - btn_dumpgpio("up_buttoninit() Exit"); + btn_dumpgpio("board_button_initialize() Exit"); } /**************************************************************************** diff --git a/nuttx/configs/olimex-lpc1766stk/include/board.h b/nuttx/configs/olimex-lpc1766stk/include/board.h index 172ce6cc0..ab2070a86 100644 --- a/nuttx/configs/olimex-lpc1766stk/include/board.h +++ b/nuttx/configs/olimex-lpc1766stk/include/board.h @@ -398,61 +398,6 @@ EXTERN void lpc17_setled(int led, bool ledon); EXTERN void lpc17_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Name: up_buttoninit - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the current state of all buttons or - * up_irqbutton() may be called to register button interrupt handlers. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); - -/************************************************************************************ - * Name: up_buttons - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the current state of all buttons. - * - * After up_buttoninit() has been called, up_buttons() may be called to collect - * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit - * associated with a button. See the BOARD_BUTTON_*_BIT and BOARD_JOYSTICK_*_BIT - * definitions above for the meaning of each bit. - * - ************************************************************************************/ - -EXTERN uint8_t up_buttons(void); - -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_irqbutton() may be called to register button interrupt handlers. - * - * up_irqbutton() may be called to register an interrupt handler that will be called - * when a button is depressed or released. The ID value is a button enumeration - * value that uniquely identifies a button resource. See the BOARD_BUTTON_* and - * BOARD_JOYSTICK_* definitions in above for the meaning of enumeration values - * The previous interrupt handler address is returned (so that it may restored, if - * so desired). - * - * Note that up_irqbutton() also enables button interrupts. Button interrupts - * will remain enabled after the interrupt handler is attached. Interrupts may - * be disabled (and detached) by calling up_irqbutton with irqhandler equal to - * NULL. - * - ************************************************************************************/ - -#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ) -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif /* CONFIG_ARCH_BUTTONS */ - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c b/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c index c50d9c8ae..eaaee6c19 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c +++ b/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c @@ -97,17 +97,17 @@ static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -123,7 +123,7 @@ void up_buttoninit(void) * Name: up_buttons * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons. * @@ -163,7 +163,7 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_irqbutton() may be called to register button interrupt handlers. * * up_irqbutton() may be called to register an interrupt handler that will diff --git a/nuttx/configs/olimex-stm32-p207/src/up_boot.c b/nuttx/configs/olimex-stm32-p207/src/up_boot.c index 6f37eb090..29658ae54 100644 --- a/nuttx/configs/olimex-stm32-p207/src/up_boot.c +++ b/nuttx/configs/olimex-stm32-p207/src/up_boot.c @@ -90,7 +90,7 @@ void stm32_boardinitialize(void) /* Configure on-board BUTTONs if BUTTON support has been selected. */ #ifdef CONFIG_ARCH_BUTTONS - up_buttoninit(); + board_button_initialize(); #endif } diff --git a/nuttx/configs/olimex-stm32-p207/src/up_buttons.c b/nuttx/configs/olimex-stm32-p207/src/up_buttons.c index 87e24f364..789d5da28 100644 --- a/nuttx/configs/olimex-stm32-p207/src/up_buttons.c +++ b/nuttx/configs/olimex-stm32-p207/src/up_buttons.c @@ -40,7 +40,10 @@ #include #include + +#include #include + #include "olimex-stm32-p207.h" #ifdef CONFIG_ARCH_BUTTONS @@ -77,17 +80,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -153,12 +156,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/configs/olimex-strp711/include/board.h b/nuttx/configs/olimex-strp711/include/board.h index 1a68ec741..ce83de2fe 100644 --- a/nuttx/configs/olimex-strp711/include/board.h +++ b/nuttx/configs/olimex-strp711/include/board.h @@ -171,11 +171,6 @@ extern "C" { * Public Functions ****************************************************************************/ -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#endif - #undef EXTERN #ifdef __cplusplus } diff --git a/nuttx/configs/olimex-strp711/src/up_buttons.c b/nuttx/configs/olimex-strp711/src/up_buttons.c index e8737954c..8047b8361 100644 --- a/nuttx/configs/olimex-strp711/src/up_buttons.c +++ b/nuttx/configs/olimex-strp711/src/up_buttons.c @@ -72,11 +72,11 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize ****************************************************************************/ #ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void) +void board_button_initialize(void) { uint16_t reg16; diff --git a/nuttx/configs/open1788/include/board.h b/nuttx/configs/open1788/include/board.h index ac5feb64c..fd1d76d4d 100644 --- a/nuttx/configs/open1788/include/board.h +++ b/nuttx/configs/open1788/include/board.h @@ -483,61 +483,6 @@ EXTERN void lpc17_setled(int led, bool ledon); EXTERN void lpc17_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Name: up_buttoninit - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the current state of all buttons or - * up_irqbutton() may be called to register button interrupt handlers. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); - -/************************************************************************************ - * Name: up_buttons - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the current state of all buttons. - * - * After up_buttoninit() has been called, up_buttons() may be called to collect - * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit - * associated with a button. See the BOARD_BUTTON_*_BIT and BOARD_JOYSTICK_*_BIT - * definitions above for the meaning of each bit. - * - ************************************************************************************/ - -EXTERN uint8_t up_buttons(void); - -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_irqbutton() may be called to register button interrupt handlers. - * - * up_irqbutton() may be called to register an interrupt handler that will be called - * when a button is depressed or released. The ID value is a button enumeration - * value that uniquely identifies a button resource. See the BOARD_BUTTON_* and - * BOARD_JOYSTICK_* definitions in above for the meaning of enumeration values - * The previous interrupt handler address is returned (so that it may restored, if - * so desired). - * - * Note that up_irqbutton() also enables button interrupts. Button interrupts - * will remain enabled after the interrupt handler is attached. Interrupts may - * be disabled (and detached) by calling up_irqbutton with irqhandler equal to - * NULL. - * - ************************************************************************************/ - -#if defined(CONFIG_ARCH_IRQBUTTONS) && defined(CONFIG_GPIO_IRQ) -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif /* CONFIG_ARCH_BUTTONS */ - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/open1788/src/lpc17_buttons.c b/nuttx/configs/open1788/src/lpc17_buttons.c index e74fce1b7..5982dfb6a 100644 --- a/nuttx/configs/open1788/src/lpc17_buttons.c +++ b/nuttx/configs/open1788/src/lpc17_buttons.c @@ -115,17 +115,17 @@ static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -141,7 +141,7 @@ void up_buttoninit(void) * Name: up_buttons * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons. * @@ -181,7 +181,7 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_irqbutton() may be called to register button interrupt handlers. * * up_irqbutton() may be called to register an interrupt handler that will diff --git a/nuttx/configs/pcduino-a10/include/board.h b/nuttx/configs/pcduino-a10/include/board.h index b5b0f3b71..09f5820a7 100644 --- a/nuttx/configs/pcduino-a10/include/board.h +++ b/nuttx/configs/pcduino-a10/include/board.h @@ -201,48 +201,6 @@ void a1x_setled(int led, bool ledon); void a1x_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Name: up_buttoninit - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the current state of all buttons or - * up_irqbutton() may be called to register button interrupt handlers. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); - -/************************************************************************************ - * Name: up_buttons - * - * Description: - * After up_buttoninit() has been called, up_buttons() may be called to collect - * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit - * associated with a button. See the BUTTON* definitions above for the meaning of - * each bit in the returned value. - * - ************************************************************************************/ - -uint8_t up_buttons(void); - -/************************************************************************************ - * Name: up_irqbutton - * - * Description: - * This function may be called to register an interrupt handler that will be - * called when a button is depressed or released. The ID value is one of the - * BUTTON* definitions provided above. The previous interrupt handler address is - * returned (so that it may restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_A1X_PIO_IRQ -xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif /* CONFIG_ARCH_BUTTONS */ - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/pcduino-a10/src/a1x_buttons.c b/nuttx/configs/pcduino-a10/src/a1x_buttons.c index 234756854..f537e4060 100644 --- a/nuttx/configs/pcduino-a10/src/a1x_buttons.c +++ b/nuttx/configs/pcduino-a10/src/a1x_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/pcduino-a10/src/a1x_buttons.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,6 +41,7 @@ #include +#include #include #include @@ -71,17 +72,17 @@ static xcpt_t g_irqbutton[BOARD_NBUTTONS]; ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { # warning Missing logic } @@ -90,7 +91,7 @@ void up_buttoninit(void) * Name: up_buttons * * Description: - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON* definitions * above for the meaning of each bit in the returned value. diff --git a/nuttx/configs/sam3u-ek/include/board.h b/nuttx/configs/sam3u-ek/include/board.h index d5a10c4b1..5b638f290 100644 --- a/nuttx/configs/sam3u-ek/include/board.h +++ b/nuttx/configs/sam3u-ek/include/board.h @@ -185,48 +185,6 @@ extern "C" { void sam_boardinitialize(void); -/************************************************************************************ - * Name: up_buttoninit - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the current state of all buttons or - * up_irqbutton() may be called to register button interrupt handlers. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); - -/************************************************************************************ - * Name: up_buttons - * - * Description: - * After up_buttoninit() has been called, up_buttons() may be called to collect - * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit - * associated with a button. See the BUTTON* definitions above for the meaning of - * each bit in the returned value. - * - ************************************************************************************/ - -uint8_t up_buttons(void); - -/************************************************************************************ - * Name: up_irqbutton - * - * Description: - * This function may be called to register an interrupt handler that will be - * called when a button is depressed or released. The ID value is one of the - * BUTTON* definitions provided above. The previous interrupt handler address is - * returned (so that it may restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_GPIOA_IRQ -xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif /* CONFIG_ARCH_BUTTONS */ - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/sam3u-ek/src/up_buttons.c b/nuttx/configs/sam3u-ek/src/up_buttons.c index c04eb0b37..81b3d7ccb 100644 --- a/nuttx/configs/sam3u-ek/src/up_buttons.c +++ b/nuttx/configs/sam3u-ek/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/sam3u-ek/src/up_leds.c * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,6 +41,7 @@ #include +#include #include #include @@ -111,17 +112,17 @@ static xcpt_t up_irqbuttonx(int irq, xcpt_t irqhandler, xcpt_t *store) ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { (void)sam_configgpio(GPIO_BUTTON1); (void)sam_configgpio(GPIO_BUTTON2); @@ -131,7 +132,7 @@ void up_buttoninit(void) * Name: up_buttons * * Description: - * After up_buttoninit() has been called, up_buttons() may be called to collect + * After board_button_initialize() has been called, up_buttons() may be called to collect * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit * associated with a button. See the BUTTON* definitions above for the meaning of * each bit in the returned value. diff --git a/nuttx/configs/sam4l-xplained/include/board.h b/nuttx/configs/sam4l-xplained/include/board.h index c314e4cfe..924112066 100644 --- a/nuttx/configs/sam4l-xplained/include/board.h +++ b/nuttx/configs/sam4l-xplained/include/board.h @@ -332,48 +332,6 @@ void sam_setled(int led, bool ledon); void sam_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Name: up_buttoninit - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the current state of all buttons or - * up_irqbutton() may be called to register button interrupt handlers. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); - -/************************************************************************************ - * Name: up_buttons - * - * Description: - * After up_buttoninit() has been called, up_buttons() may be called to collect - * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit - * associated with a button. See the BUTTON* definitions above for the meaning of - * each bit in the returned value. - * - ************************************************************************************/ - -uint8_t up_buttons(void); - -/************************************************************************************ - * Name: up_irqbutton - * - * Description: - * This function may be called to register an interrupt handler that will be - * called when a button is depressed or released. The ID value is one of the - * BUTTON* definitions provided above. The previous interrupt handler address is - * returned (so that it may restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_GPIOA_IRQ -xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif /* CONFIG_ARCH_BUTTONS */ - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/sam4l-xplained/src/sam_buttons.c b/nuttx/configs/sam4l-xplained/src/sam_buttons.c index 4c4b8cb83..cbf237ef0 100644 --- a/nuttx/configs/sam4l-xplained/src/sam_buttons.c +++ b/nuttx/configs/sam4l-xplained/src/sam_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/sam4l-xplained/src/sam_buttons.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,6 +41,7 @@ #include +#include #include #include @@ -72,17 +73,17 @@ static xcpt_t g_irqsw0; ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { (void)sam_configgpio(GPIO_SW0); } @@ -91,7 +92,7 @@ void up_buttoninit(void) * Name: up_buttons * * Description: - * After up_buttoninit() has been called, up_buttons() may be called to collect + * After board_button_initialize() has been called, up_buttons() may be called to collect * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit * associated with a button. See the BUTTON* definitions above for the meaning of * each bit in the returned value. diff --git a/nuttx/configs/sam4s-xplained/include/board.h b/nuttx/configs/sam4s-xplained/include/board.h index 1ff60650e..e4133a6fd 100644 --- a/nuttx/configs/sam4s-xplained/include/board.h +++ b/nuttx/configs/sam4s-xplained/include/board.h @@ -272,48 +272,6 @@ void sam_setled(int led, bool ledon); void sam_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Name: up_buttoninit - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the current state of all buttons or - * up_irqbutton() may be called to register button interrupt handlers. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); - -/************************************************************************************ - * Name: up_buttons - * - * Description: - * After up_buttoninit() has been called, up_buttons() may be called to collect - * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit - * associated with a button. See the BUTTON* definitions above for the meaning of - * each bit in the returned value. - * - ************************************************************************************/ - -uint8_t up_buttons(void); - -/************************************************************************************ - * Name: up_irqbutton - * - * Description: - * This function may be called to register an interrupt handler that will be - * called when a button is depressed or released. The ID value is one of the - * BUTTON* definitions provided above. The previous interrupt handler address is - * returned (so that it may restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_GPIOA_IRQ -xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif /* CONFIG_ARCH_BUTTONS */ - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/sam4s-xplained/src/sam_buttons.c b/nuttx/configs/sam4s-xplained/src/sam_buttons.c index fe5c0b776..2db8979cf 100644 --- a/nuttx/configs/sam4s-xplained/src/sam_buttons.c +++ b/nuttx/configs/sam4s-xplained/src/sam_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/sam4s-xplained/src/sam_buttons.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,6 +41,7 @@ #include +#include #include #include @@ -70,17 +71,17 @@ static xcpt_t g_irqbp2; ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { (void)sam_configgpio(GPIO_BP2); } @@ -89,7 +90,7 @@ void up_buttoninit(void) * Name: up_buttons * * Description: - * After up_buttoninit() has been called, up_buttons() may be called to collect + * After board_button_initialize() has been called, up_buttons() may be called to collect * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit * associated with a button. See the BUTTON* definitions above for the meaning of * each bit in the returned value. diff --git a/nuttx/configs/sama5d3x-ek/include/board.h b/nuttx/configs/sama5d3x-ek/include/board.h index 2bf1e1ebb..5e6c20746 100644 --- a/nuttx/configs/sama5d3x-ek/include/board.h +++ b/nuttx/configs/sama5d3x-ek/include/board.h @@ -364,48 +364,6 @@ void sam_setled(int led, bool ledon); void sam_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Name: up_buttoninit - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the current state of all buttons or - * up_irqbutton() may be called to register button interrupt handlers. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); - -/************************************************************************************ - * Name: up_buttons - * - * Description: - * After up_buttoninit() has been called, up_buttons() may be called to collect - * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit - * associated with a button. See the BUTTON* definitions above for the meaning of - * each bit in the returned value. - * - ************************************************************************************/ - -uint8_t up_buttons(void); - -/************************************************************************************ - * Name: up_irqbutton - * - * Description: - * This function may be called to register an interrupt handler that will be - * called when a button is depressed or released. The ID value is one of the - * BUTTON* definitions provided above. The previous interrupt handler address is - * returned (so that it may restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_SAMA5_PIOE_IRQ -xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif /* CONFIG_ARCH_BUTTONS */ - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/sama5d3x-ek/src/sam_buttons.c b/nuttx/configs/sama5d3x-ek/src/sam_buttons.c index 4377a2f5d..fe74f3fb7 100644 --- a/nuttx/configs/sama5d3x-ek/src/sam_buttons.c +++ b/nuttx/configs/sama5d3x-ek/src/sam_buttons.c @@ -56,6 +56,7 @@ #include +#include #include #include @@ -87,17 +88,17 @@ static xcpt_t g_irquser1; ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { (void)sam_configpio(PIO_USER1); } @@ -106,7 +107,7 @@ void up_buttoninit(void) * Name: up_buttons * * Description: - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON* definitions * above for the meaning of each bit in the returned value. diff --git a/nuttx/configs/shenzhou/include/board.h b/nuttx/configs/shenzhou/include/board.h index 3e10a32e7..818e99ca6 100644 --- a/nuttx/configs/shenzhou/include/board.h +++ b/nuttx/configs/shenzhou/include/board.h @@ -368,37 +368,6 @@ extern "C" { void stm32_boardinitialize(void); -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif - /************************************************************************************ * Name: stm32_ledinit, stm32_setled, and stm32_setleds * @@ -410,9 +379,9 @@ EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); ************************************************************************************/ #ifndef CONFIG_ARCH_LEDS -EXTERN void stm32_ledinit(void); -EXTERN void stm32_setled(int led, bool ledon); -EXTERN void stm32_setleds(uint8_t ledset); +void stm32_ledinit(void); +void stm32_setled(int led, bool ledon); +void stm32_setleds(uint8_t ledset); #endif /************************************************************************************ @@ -426,7 +395,7 @@ EXTERN void stm32_setleds(uint8_t ledset); * ************************************************************************************/ -EXTERN void stm32_lcdclear(uint16_t color); +void stm32_lcdclear(uint16_t color); /************************************************************************************ * Relay control functions @@ -439,17 +408,17 @@ EXTERN void stm32_lcdclear(uint16_t color); ************************************************************************************/ #ifdef CONFIG_ARCH_RELAYS -EXTERN void up_relaysinit(void); -EXTERN void relays_setstat(int relays, bool stat); -EXTERN bool relays_getstat(int relays); -EXTERN void relays_setstats(uint32_t relays_stat); -EXTERN uint32_t relays_getstats(void); -EXTERN void relays_onoff(int relays, uint32_t mdelay); -EXTERN void relays_onoffs(uint32_t relays_stat, uint32_t mdelay); -EXTERN void relays_resetmode(int relays); -EXTERN void relays_powermode(int relays); -EXTERN void relays_resetmodes(uint32_t relays_stat); -EXTERN void relays_powermodes(uint32_t relays_stat); +void up_relaysinit(void); +void relays_setstat(int relays, bool stat); +bool relays_getstat(int relays); +void relays_setstats(uint32_t relays_stat); +uint32_t relays_getstats(void); +void relays_onoff(int relays, uint32_t mdelay); +void relays_onoffs(uint32_t relays_stat, uint32_t mdelay); +void relays_resetmode(int relays); +void relays_powermode(int relays); +void relays_resetmodes(uint32_t relays_stat); +void relays_powermodes(uint32_t relays_stat); #endif /************************************************************************************ @@ -460,8 +429,8 @@ EXTERN void relays_powermodes(uint32_t relays_stat); * ************************************************************************************/ -EXTERN const char *stm32_getchipid(void); -EXTERN const char *stm32_getchipid_string(void); +const char *stm32_getchipid(void); +const char *stm32_getchipid_string(void); #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/configs/shenzhou/src/up_buttons.c b/nuttx/configs/shenzhou/src/up_buttons.c index 5a8515ca5..c9d2e4f1f 100644 --- a/nuttx/configs/shenzhou/src/up_buttons.c +++ b/nuttx/configs/shenzhou/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/shenzhou/src/up_buttons.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "shenzhou-internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -71,17 +73,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -133,12 +135,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/configs/skp16c26/src/up_buttons.c b/nuttx/configs/skp16c26/src/up_buttons.c index a483aaeaa..219c690dd 100644 --- a/nuttx/configs/skp16c26/src/up_buttons.c +++ b/nuttx/configs/skp16c26/src/up_buttons.c @@ -69,11 +69,11 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize ****************************************************************************/ #ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void) +void board_button_initialize(void) { uint8_t regval; diff --git a/nuttx/configs/spark/include/board.h b/nuttx/configs/spark/include/board.h index 2421f69a8..153c2a67a 100644 --- a/nuttx/configs/spark/include/board.h +++ b/nuttx/configs/spark/include/board.h @@ -221,36 +221,6 @@ extern "C" /************************************************************************************ * Public Function Prototypes ************************************************************************************/ -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); -uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif /************************************************************************************ * Name: up_ledinit, up_setled, and up_setleds diff --git a/nuttx/configs/spark/src/up_boot.c b/nuttx/configs/spark/src/up_boot.c index 3fb9a6ef1..774b3c03e 100644 --- a/nuttx/configs/spark/src/up_boot.c +++ b/nuttx/configs/spark/src/up_boot.c @@ -78,7 +78,7 @@ void stm32_boardinitialize(void) #endif #ifdef CONFIG_ARCH_HAVE_BUTTONS - up_buttoninit(); + board_button_initialize(); #endif /* Configure SPI chip selects if 1) SP2 is not disabled, and 2) the weak function diff --git a/nuttx/configs/spark/src/up_buttons.c b/nuttx/configs/spark/src/up_buttons.c index 33791417a..ddba1e89e 100644 --- a/nuttx/configs/spark/src/up_buttons.c +++ b/nuttx/configs/spark/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/spark/src/up_buttons.c * - * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "spark.h" #ifdef CONFIG_ARCH_BUTTONS @@ -63,17 +65,17 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { /* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are * configured for all pins. @@ -97,12 +99,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/configs/stm3210e-eval/include/board.h b/nuttx/configs/stm3210e-eval/include/board.h index 1f0898441..82653e07b 100644 --- a/nuttx/configs/stm3210e-eval/include/board.h +++ b/nuttx/configs/stm3210e-eval/include/board.h @@ -232,37 +232,6 @@ extern "C" { EXTERN void stm32_boardinitialize(void); -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif - /************************************************************************************ * Name: stm3210e_lcdclear * diff --git a/nuttx/configs/stm3210e-eval/src/up_buttons.c b/nuttx/configs/stm3210e-eval/src/up_buttons.c index 4f884649c..569b38010 100644 --- a/nuttx/configs/stm3210e-eval/src/up_buttons.c +++ b/nuttx/configs/stm3210e-eval/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/stm3210e-eval/src/up_buttons.c * - * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "stm3210e-internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -72,17 +74,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -134,12 +136,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c b/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c index cc6f3cae0..ec01c1e90 100644 --- a/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c +++ b/nuttx/configs/stm3210e-eval/src/up_pmbuttons.c @@ -298,7 +298,7 @@ void up_pmbuttons(void) { /* Initialize the button GPIOs */ - up_buttoninit(); + board_button_initialize(); #ifdef CONFIG_ARCH_IRQBUTTONS int i; diff --git a/nuttx/configs/stm3220g-eval/include/board.h b/nuttx/configs/stm3220g-eval/include/board.h index c8dccf390..d5bddbe01 100644 --- a/nuttx/configs/stm3220g-eval/include/board.h +++ b/nuttx/configs/stm3220g-eval/include/board.h @@ -481,37 +481,6 @@ EXTERN void stm32_setled(int led, bool ledon); EXTERN void stm32_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif - /************************************************************************************ * Name: stm3220g_lcdclear * diff --git a/nuttx/configs/stm3220g-eval/src/up_buttons.c b/nuttx/configs/stm3220g-eval/src/up_buttons.c index 4847aaa7c..e8f19d3f6 100644 --- a/nuttx/configs/stm3220g-eval/src/up_buttons.c +++ b/nuttx/configs/stm3220g-eval/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/stm3220g-eval/src/up_buttons.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "stm3220g-internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -72,17 +74,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -134,12 +136,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/configs/stm3240g-eval/include/board.h b/nuttx/configs/stm3240g-eval/include/board.h index f9c8a437c..0369d23f9 100644 --- a/nuttx/configs/stm3240g-eval/include/board.h +++ b/nuttx/configs/stm3240g-eval/include/board.h @@ -480,7 +480,7 @@ extern "C" { * ************************************************************************************/ -EXTERN void stm32_boardinitialize(void); +void stm32_boardinitialize(void); /************************************************************************************ * Name: stm32_ledinit, stm32_setled, and stm32_setleds @@ -493,40 +493,9 @@ EXTERN void stm32_boardinitialize(void); ************************************************************************************/ #ifndef CONFIG_ARCH_LEDS -EXTERN void stm32_ledinit(void); -EXTERN void stm32_setled(int led, bool ledon); -EXTERN void stm32_setleds(uint8_t ledset); -#endif - -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif +void stm32_ledinit(void); +void stm32_setled(int led, bool ledon); +void stm32_setleds(uint8_t ledset); #endif /************************************************************************************ @@ -541,7 +510,7 @@ EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); ************************************************************************************/ #ifdef CONFIG_STM32_FSMC -EXTERN void stm3240g_lcdclear(uint16_t color); +void stm3240g_lcdclear(uint16_t color); #endif #undef EXTERN diff --git a/nuttx/configs/stm3240g-eval/src/up_buttons.c b/nuttx/configs/stm3240g-eval/src/up_buttons.c index 522b8e4d9..e8c9712de 100644 --- a/nuttx/configs/stm3240g-eval/src/up_buttons.c +++ b/nuttx/configs/stm3240g-eval/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/stm3240g-eval/src/up_buttons.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "stm3240g-internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -72,17 +74,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -134,12 +136,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/configs/stm32f100rc_generic/include/board.h b/nuttx/configs/stm32f100rc_generic/include/board.h index b5bc69259..59c4b31cc 100644 --- a/nuttx/configs/stm32f100rc_generic/include/board.h +++ b/nuttx/configs/stm32f100rc_generic/include/board.h @@ -183,37 +183,6 @@ EXTERN void stm32_setled(int led, bool ledon); EXTERN void stm32_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/stm32f100rc_generic/src/up_buttons.c b/nuttx/configs/stm32f100rc_generic/src/up_buttons.c index 7200d9ce8..2442e38b4 100644 --- a/nuttx/configs/stm32f100rc_generic/src/up_buttons.c +++ b/nuttx/configs/stm32f100rc_generic/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/stm32f100rc_generic/src/up_buttons.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * Freddie Chopin * @@ -42,7 +42,9 @@ #include +#include #include + #include "stm32f100rc_internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -52,17 +54,17 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { stm32_configgpio(GPIO_BTN_0); /* Configure the GPIO pins as inputs. */ } @@ -84,12 +86,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/configs/stm32f3discovery/include/board.h b/nuttx/configs/stm32f3discovery/include/board.h index ff1a049f5..bc0b9be86 100644 --- a/nuttx/configs/stm32f3discovery/include/board.h +++ b/nuttx/configs/stm32f3discovery/include/board.h @@ -302,37 +302,6 @@ EXTERN void stm32_setled(int led, bool ledon); EXTERN void stm32_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/stm32f3discovery/src/up_buttons.c b/nuttx/configs/stm32f3discovery/src/up_buttons.c index 08e8c8a1f..305b3251e 100644 --- a/nuttx/configs/stm32f3discovery/src/up_buttons.c +++ b/nuttx/configs/stm32f3discovery/src/up_buttons.c @@ -41,7 +41,9 @@ #include +#include #include + #include "stm32f3discovery-internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -72,17 +74,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -129,12 +131,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/configs/stm32f429i-disco/include/board.h b/nuttx/configs/stm32f429i-disco/include/board.h index 49fb18d87..bd6e0f521 100644 --- a/nuttx/configs/stm32f429i-disco/include/board.h +++ b/nuttx/configs/stm32f429i-disco/include/board.h @@ -293,37 +293,6 @@ void stm32_setled(int led, bool ledon); void stm32_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); -uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/stm32f429i-disco/src/up_buttons.c b/nuttx/configs/stm32f429i-disco/src/up_buttons.c index b1c2ef96c..6d1b6b838 100644 --- a/nuttx/configs/stm32f429i-disco/src/up_buttons.c +++ b/nuttx/configs/stm32f429i-disco/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/stm32f429i-disco/src/up_buttons.c * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2-14 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "stm32f429i-disco-internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -72,17 +74,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -129,12 +131,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/configs/stm32f4discovery/include/board.h b/nuttx/configs/stm32f4discovery/include/board.h index de829f19e..dadde0fca 100644 --- a/nuttx/configs/stm32f4discovery/include/board.h +++ b/nuttx/configs/stm32f4discovery/include/board.h @@ -283,37 +283,6 @@ void stm32_setled(int led, bool ledon); void stm32_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); -uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/stm32f4discovery/src/up_buttons.c b/nuttx/configs/stm32f4discovery/src/up_buttons.c index ae1366930..a3f9bd648 100644 --- a/nuttx/configs/stm32f4discovery/src/up_buttons.c +++ b/nuttx/configs/stm32f4discovery/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/stm32f4discovery/src/up_buttons.c * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "stm32f4discovery-internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -72,17 +74,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -129,12 +131,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/configs/stm32f4discovery/src/up_pmbuttons.c b/nuttx/configs/stm32f4discovery/src/up_pmbuttons.c index 4bc241fce..5a7d2443e 100644 --- a/nuttx/configs/stm32f4discovery/src/up_pmbuttons.c +++ b/nuttx/configs/stm32f4discovery/src/up_pmbuttons.c @@ -132,7 +132,7 @@ void up_pmbuttons(void) { /* Initialize the button GPIOs */ - up_buttoninit(); + board_button_initialize(); #ifdef CONFIG_ARCH_IRQBUTTONS xcpt_t oldhandler = up_irqbutton(0, button_handler); diff --git a/nuttx/configs/stm32ldiscovery/include/board.h b/nuttx/configs/stm32ldiscovery/include/board.h index eca2ef014..6eea3aca0 100644 --- a/nuttx/configs/stm32ldiscovery/include/board.h +++ b/nuttx/configs/stm32ldiscovery/include/board.h @@ -320,37 +320,6 @@ void stm32_setled(int led, bool ledon); void stm32_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); -uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif - /**************************************************************************** * Name: stm32_slcd_initialize * diff --git a/nuttx/configs/stm32ldiscovery/src/stm32_buttons.c b/nuttx/configs/stm32ldiscovery/src/stm32_buttons.c index 7ab7debda..83833c5e1 100644 --- a/nuttx/configs/stm32ldiscovery/src/stm32_buttons.c +++ b/nuttx/configs/stm32ldiscovery/src/stm32_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/stm32ldiscovery/src/up_buttons.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "stm32ldiscovery.h" #ifdef CONFIG_ARCH_BUTTONS @@ -72,17 +74,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -129,12 +131,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/configs/stm32vldiscovery/include/board.h b/nuttx/configs/stm32vldiscovery/include/board.h index ebc04f985..76f25bffe 100644 --- a/nuttx/configs/stm32vldiscovery/include/board.h +++ b/nuttx/configs/stm32vldiscovery/include/board.h @@ -184,37 +184,6 @@ void stm32_setled(int led, bool ledon); void stm32_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); -uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/stm32vldiscovery/src/stm32_buttons.c b/nuttx/configs/stm32vldiscovery/src/stm32_buttons.c index c614fdca0..d214ae323 100644 --- a/nuttx/configs/stm32vldiscovery/src/stm32_buttons.c +++ b/nuttx/configs/stm32vldiscovery/src/stm32_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/stm32vldiscovery/src/stm32_buttons.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * Freddie Chopin * @@ -42,7 +42,9 @@ #include +#include #include + #include "stm32vldiscovery.h" #ifdef CONFIG_ARCH_BUTTONS @@ -52,17 +54,17 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { stm32_configgpio(GPIO_BTN_0); /* Configure the GPIO pins as inputs. */ } @@ -84,12 +86,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/configs/sure-pic32mx/include/board.h b/nuttx/configs/sure-pic32mx/include/board.h index 3b4d7f798..f22c47123 100644 --- a/nuttx/configs/sure-pic32mx/include/board.h +++ b/nuttx/configs/sure-pic32mx/include/board.h @@ -169,42 +169,6 @@ extern "C" { #define EXTERN extern #endif -/**************************************************************************** - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. - * See the BUTTON_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it - * may restored, if so desired). - * - * When an interrupt occurs, it is due to a change on the GPIO input pin - * associated with the button. In that case, all attached change - * notification handlers will be called. Each handler must maintain state - * and determine if the unlying GPIO button input value changed. - * - ****************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif - #undef EXTERN #ifdef __cplusplus } diff --git a/nuttx/configs/sure-pic32mx/src/pic32mx_buttons.c b/nuttx/configs/sure-pic32mx/src/pic32mx_buttons.c index ce9acd875..cfcdbede9 100644 --- a/nuttx/configs/sure-pic32mx/src/pic32mx_buttons.c +++ b/nuttx/configs/sure-pic32mx/src/pic32mx_buttons.c @@ -125,17 +125,17 @@ static const uint8_t g_buttoncn[NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -177,12 +177,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/configs/twr-k60n512/include/board.h b/nuttx/configs/twr-k60n512/include/board.h index ca060c654..6c2aa2101 100644 --- a/nuttx/configs/twr-k60n512/include/board.h +++ b/nuttx/configs/twr-k60n512/include/board.h @@ -398,37 +398,6 @@ extern "C" { EXTERN void kinetis_boardinitialize(void); -/************************************************************************************ - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. See the - * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it may - * restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/twr-k60n512/src/up_buttons.c b/nuttx/configs/twr-k60n512/src/up_buttons.c index 5b449dbe8..c836efee3 100644 --- a/nuttx/configs/twr-k60n512/src/up_buttons.c +++ b/nuttx/configs/twr-k60n512/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/twr-k60n512/src/up_buttons.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,7 +41,9 @@ #include +#include #include + #include "twrk60-internal.h" #ifdef CONFIG_ARCH_BUTTONS @@ -68,17 +70,17 @@ ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { /* Configure the two buttons as inputs */ @@ -111,12 +113,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. @@ -152,7 +154,7 @@ xcpt_t up_irqbutton(int id, xcpt_t irqhandler) } /* The button has already been configured as an interrupting input (by - * up_buttoninit() above). + * board_button_initialize() above). * * Attach the new button handler. */ diff --git a/nuttx/configs/ubw32/include/board.h b/nuttx/configs/ubw32/include/board.h index 63869cc5f..347e02a3e 100644 --- a/nuttx/configs/ubw32/include/board.h +++ b/nuttx/configs/ubw32/include/board.h @@ -199,42 +199,6 @@ EXTERN void pic32mx_setled(int led, bool ledon); EXTERN void pic32mx_setleds(uint8_t ledset); #endif -/**************************************************************************** - * Button support. - * - * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. - * - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. See the BUTTON_*_BIT - * definitions in board.h for the meaning of each bit. - * - * up_irqbutton() may be called to register an interrupt handler that will - * be called when a button is depressed or released. The ID value is a - * button enumeration value that uniquely identifies a button resource. - * See the BUTTON_* definitions in board.h for the meaning of enumeration - * value. The previous interrupt handler address is returned (so that it - * may restored, if so desired). - * - * When an interrupt occurs, it is due to a change on the GPIO input pin - * associated with the button. In that case, all attached change - * notification handlers will be called. Each handler must maintain state - * and determine if the unlying GPIO button input value changed. - * - ****************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#ifdef CONFIG_ARCH_IRQBUTTONS -EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif -#endif - #undef EXTERN #ifdef __cplusplus } diff --git a/nuttx/configs/ubw32/src/up_buttons.c b/nuttx/configs/ubw32/src/up_buttons.c index 4fef56705..5b6bc9564 100644 --- a/nuttx/configs/ubw32/src/up_buttons.c +++ b/nuttx/configs/ubw32/src/up_buttons.c @@ -104,17 +104,17 @@ static const uint8_t g_buttoncn[NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -152,12 +152,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT definitions in * board.h for the meaning of each bit. diff --git a/nuttx/configs/us7032evb1/include/board.h b/nuttx/configs/us7032evb1/include/board.h index 3ca3476da..2fd709246 100644 --- a/nuttx/configs/us7032evb1/include/board.h +++ b/nuttx/configs/us7032evb1/include/board.h @@ -86,11 +86,6 @@ extern "C" { * Public Functions ****************************************************************************/ -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#endif - #undef EXTERN #ifdef __cplusplus } diff --git a/nuttx/configs/viewtool-stm32f107/include/board.h b/nuttx/configs/viewtool-stm32f107/include/board.h index 361ada569..9d15e9486 100644 --- a/nuttx/configs/viewtool-stm32f107/include/board.h +++ b/nuttx/configs/viewtool-stm32f107/include/board.h @@ -174,48 +174,6 @@ void up_setled(int led, bool ledon); void up_setleds(uint8_t ledset); #endif -/************************************************************************************ - * Name: up_buttoninit - * - * Description: - * up_buttoninit() must be called to initialize button resources. After that, - * up_buttons() may be called to collect the current state of all buttons or - * up_irqbutton() may be called to register button interrupt handlers. - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); - -/************************************************************************************ - * Name: up_buttons - * - * Description: - * After up_buttoninit() has been called, up_buttons() may be called to collect - * the state of all buttons. up_buttons() returns an 8-bit bit set with each bit - * associated with a button. See the BUTTON* definitions above for the meaning of - * each bit in the returned value. - * - ************************************************************************************/ - -uint8_t up_buttons(void); - -/************************************************************************************ - * Name: up_irqbutton - * - * Description: - * This function may be called to register an interrupt handler that will be - * called when a button is depressed or released. The ID value is one of the - * BUTTON* definitions provided above. The previous interrupt handler address is - * returned (so that it may restored, if so desired). - * - ************************************************************************************/ - -#ifdef CONFIG_ARCH_IRQBUTTONS -xcpt_t up_irqbutton(int id, xcpt_t irqhandler); -#endif /* CONFIG_ARCH_IRQBUTTONS */ -#endif /* CONFIG_ARCH_BUTTONS */ - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/viewtool-stm32f107/src/stm32_buttons.c b/nuttx/configs/viewtool-stm32f107/src/stm32_buttons.c index 71e0faa62..0c2b623ea 100644 --- a/nuttx/configs/viewtool-stm32f107/src/stm32_buttons.c +++ b/nuttx/configs/viewtool-stm32f107/src/stm32_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/viewtool-stm32f107/src/stm32_buttons.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,6 +41,7 @@ #include +#include #include #include "viewtool_stm32f107.h" @@ -72,17 +73,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] = ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -130,12 +131,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/configs/viewtool-stm32f107/src/stm32_highpri.c b/nuttx/configs/viewtool-stm32f107/src/stm32_highpri.c index 78a006285..de4cc881b 100644 --- a/nuttx/configs/viewtool-stm32f107/src/stm32_highpri.c +++ b/nuttx/configs/viewtool-stm32f107/src/stm32_highpri.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/viewtool-stm32f107/src/stm32_highpri.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -157,10 +157,7 @@ void tim6_handler(void) * Name: highpri_main * * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt - * handlers. + * Main entry point in into the high priority interrupt test. * ****************************************************************************/ diff --git a/nuttx/configs/vsn/include/board.h b/nuttx/configs/vsn/include/board.h index 85cd96bd7..766b6197d 100644 --- a/nuttx/configs/vsn/include/board.h +++ b/nuttx/configs/vsn/include/board.h @@ -225,15 +225,6 @@ EXTERN void stm32_boardinitialize(void); EXTERN void stm32_board_clockconfig(void); #endif -/************************************************************************************ - * Button support. (TODO: button is not yet supported) - ************************************************************************************/ - -#ifdef CONFIG_ARCH_BUTTONS -EXTERN void up_buttoninit(void); -EXTERN uint8_t up_buttons(void); -#endif - #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/vsn/src/buttons.c b/nuttx/configs/vsn/src/buttons.c index c0a0f7297..a252606bf 100644 --- a/nuttx/configs/vsn/src/buttons.c +++ b/nuttx/configs/vsn/src/buttons.c @@ -34,20 +34,23 @@ * ****************************************************************************/ -/** \file - * \author Uros Platise - * \brief VSN Button - */ - -#ifdef CONFIG_ARCH_BUTTONS +/**************************************************************************** + * Included Files + ****************************************************************************/ #include + #include + +#include #include + #include "vsn.h" +#ifdef CONFIG_ARCH_BUTTONS + /**************************************************************************** - * Definitions + * Pre-processor Definitions ****************************************************************************/ /**************************************************************************** @@ -73,7 +76,7 @@ void buttons_callback(void) * Public Functions ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { stm32_configgpio(GPIO_PUSHBUTTON); } diff --git a/nuttx/configs/zkit-arm-1769/src/up_buttons.c b/nuttx/configs/zkit-arm-1769/src/up_buttons.c index 8dfb5f9ce..d4c5dfd35 100644 --- a/nuttx/configs/zkit-arm-1769/src/up_buttons.c +++ b/nuttx/configs/zkit-arm-1769/src/up_buttons.c @@ -83,17 +83,17 @@ static xcpt_t g_oldhandler; ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * ****************************************************************************/ -void up_buttoninit(void) +void board_button_initialize(void) { int i; @@ -138,12 +138,12 @@ uint8_t up_buttons(void) * Button support. * * Description: - * up_buttoninit() must be called to initialize button resources. After + * board_button_initialize() must be called to initialize button resources. After * that, up_buttons() may be called to collect the current state of all * buttons or up_irqbutton() may be called to register button interrupt * handlers. * - * After up_buttoninit() has been called, up_buttons() may be called to + * After board_button_initialize() has been called, up_buttons() may be called to * collect the state of all buttons. up_buttons() returns an 8-bit bit set * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * definitions in board.h for the meaning of each bit. diff --git a/nuttx/include/nuttx/arch.h b/nuttx/include/nuttx/arch.h index 6522c6208..c5011b477 100644 --- a/nuttx/include/nuttx/arch.h +++ b/nuttx/include/nuttx/arch.h @@ -1015,12 +1015,12 @@ ssize_t up_check_stack_remain(void); ****************************************************************************/ /**************************************************************************** - * Name: up_buttoninit + * Name: board_button_initialize * * Description: - * up_buttoninit() must be called to initialize button resources. After - * that, up_buttons() may be called to collect the current state of all - * buttons or up_irqbutton() may be called to register button interrupt + * board_button_initialize() must be called to initialize button resources. + * After that, up_buttons() may be called to collect the current state of + * all buttons or up_irqbutton() may be called to register button interrupt * handlers. * * NOTE: This interface may or may not be supported by board-specific @@ -1030,23 +1030,23 @@ ssize_t up_check_stack_remain(void); ****************************************************************************/ #ifdef CONFIG_ARCH_BUTTONS -void up_buttoninit(void); +void board_button_initialize(void); #endif /**************************************************************************** * Name: up_buttons * * Description: - * After up_buttoninit() has been called, up_buttons() may be called to - * collect the state of all buttons. up_buttons() returns an 8-bit bit set - * with each bit associated with a button. A bit set to "1" means that the - * button is depressed; a bit set to "0" means that the button is released. - * The correspondence of the each button bit and physical buttons is board- - * specific. + * After board_button_initialize() has been called, up_buttons() may be + * called to collect the state of all buttons. up_buttons() returns an + * 8-bit bit set with each bit associated with a button. A bit set to + * "1" means that the button is depressed; a bit set to "0" means that + * the button is released. The correspondence of the each button bit + * and physical buttons is board-specific. * * NOTE: This interface may or may not be supported by board-specific - * logic. If the board supports button interfaces, then CONFIG_ARCH_BUTTONS - * will be defined + * logic. If the board supports button interfaces, then + * CONFIG_ARCH_BUTTONS will be defined * ****************************************************************************/ -- cgit v1.2.3