diff --git a/ChangeLog b/ChangeLog index 13f84f038a..373c808343 100644 --- a/ChangeLog +++ b/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/configs/avr32dev1/include/board.h b/configs/avr32dev1/include/board.h index 008c5ffe34..ef64c65f8f 100644 --- a/configs/avr32dev1/include/board.h +++ b/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/configs/avr32dev1/src/up_buttons.c b/configs/avr32dev1/src/up_buttons.c index 5b488d72ee..40c09b4f32 100644 --- a/configs/avr32dev1/src/up_buttons.c +++ b/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/configs/cloudctrl/include/board.h b/configs/cloudctrl/include/board.h index b5ae3d4f55..aa47ad1d22 100644 --- a/configs/cloudctrl/include/board.h +++ b/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/configs/cloudctrl/src/up_buttons.c b/configs/cloudctrl/src/up_buttons.c index 81535f1263..dbad073882 100644 --- a/configs/cloudctrl/src/up_buttons.c +++ b/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/configs/demo9s12ne64/include/board.h b/configs/demo9s12ne64/include/board.h index 501b2f8e09..9a7d704f75 100644 --- a/configs/demo9s12ne64/include/board.h +++ b/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/configs/demo9s12ne64/src/up_buttons.c b/configs/demo9s12ne64/src/up_buttons.c index b895f45a36..bc0d6697b2 100644 --- a/configs/demo9s12ne64/src/up_buttons.c +++ b/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/configs/ea3131/include/board.h b/configs/ea3131/include/board.h index 2154af545b..ea8ee92f4a 100644 --- a/configs/ea3131/include/board.h +++ b/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/configs/ea3131/src/up_buttons.c b/configs/ea3131/src/up_buttons.c index 8dd468a9e6..f5e71b4dcb 100644 --- a/configs/ea3131/src/up_buttons.c +++ b/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/configs/ea3152/include/board.h b/configs/ea3152/include/board.h index 848c4137c0..cf468a18ed 100644 --- a/configs/ea3152/include/board.h +++ b/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/configs/ea3152/src/up_buttons.c b/configs/ea3152/src/up_buttons.c index d56bfd7662..3a9dcf5446 100644 --- a/configs/ea3152/src/up_buttons.c +++ b/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/configs/ez80f910200zco/include/board.h b/configs/ez80f910200zco/include/board.h index 84767437f9..a5fca8d4b8 100644 --- a/configs/ez80f910200zco/include/board.h +++ b/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/configs/ez80f910200zco/src/ez80_buttons.c b/configs/ez80f910200zco/src/ez80_buttons.c index babf13b7e1..5528a41eb6 100644 --- a/configs/ez80f910200zco/src/ez80_buttons.c +++ b/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/configs/fire-stm32v2/include/board.h b/configs/fire-stm32v2/include/board.h index efdf07ec55..1166f0d832 100644 --- a/configs/fire-stm32v2/include/board.h +++ b/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/configs/fire-stm32v2/src/up_buttons.c b/configs/fire-stm32v2/src/up_buttons.c index 738d65d5f6..e9ebdc18e5 100644 --- a/configs/fire-stm32v2/src/up_buttons.c +++ b/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/configs/hymini-stm32v/include/board.h b/configs/hymini-stm32v/include/board.h index 7751946e79..0e7427f6c9 100644 --- a/configs/hymini-stm32v/include/board.h +++ b/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/configs/hymini-stm32v/src/up_buttons.c b/configs/hymini-stm32v/src/up_buttons.c index 05a7c76308..2ab22227b1 100644 --- a/configs/hymini-stm32v/src/up_buttons.c +++ b/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/configs/kwikstik-k40/src/up_buttons.c b/configs/kwikstik-k40/src/up_buttons.c index a30a480bcb..0358cda339 100644 --- a/configs/kwikstik-k40/src/up_buttons.c +++ b/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/configs/lincoln60/src/up_buttons.c b/configs/lincoln60/src/up_buttons.c index 706d858f49..53c9db4e91 100644 --- a/configs/lincoln60/src/up_buttons.c +++ b/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/configs/lm4f120-launchpad/include/board.h b/configs/lm4f120-launchpad/include/board.h index 0bdc3fc89d..7ac08d948f 100644 --- a/configs/lm4f120-launchpad/include/board.h +++ b/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/configs/lpc4330-xplorer/src/up_buttons.c b/configs/lpc4330-xplorer/src/up_buttons.c index d99ee23561..a3f4c4975d 100644 --- a/configs/lpc4330-xplorer/src/up_buttons.c +++ b/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/configs/mikroe-stm32f4/include/board.h b/configs/mikroe-stm32f4/include/board.h index 7728f70618..dfd5f302af 100644 --- a/configs/mikroe-stm32f4/include/board.h +++ b/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/configs/ne64badge/include/board.h b/configs/ne64badge/include/board.h index ba4ce3631b..aff704e2bb 100644 --- a/configs/ne64badge/include/board.h +++ b/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/configs/ne64badge/src/up_buttons.c b/configs/ne64badge/src/up_buttons.c index 70c57f2cce..e0daadda00 100644 --- a/configs/ne64badge/src/up_buttons.c +++ b/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/configs/olimex-lpc1766stk/include/board.h b/configs/olimex-lpc1766stk/include/board.h index 172ce6cc09..ab2070a869 100644 --- a/configs/olimex-lpc1766stk/include/board.h +++ b/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/configs/olimex-lpc1766stk/src/up_buttons.c b/configs/olimex-lpc1766stk/src/up_buttons.c index c50d9c8ae4..eaaee6c194 100644 --- a/configs/olimex-lpc1766stk/src/up_buttons.c +++ b/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/configs/olimex-stm32-p207/src/up_boot.c b/configs/olimex-stm32-p207/src/up_boot.c index 6f37eb0909..29658ae54e 100644 --- a/configs/olimex-stm32-p207/src/up_boot.c +++ b/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/configs/olimex-stm32-p207/src/up_buttons.c b/configs/olimex-stm32-p207/src/up_buttons.c index 87e24f364c..789d5da28c 100644 --- a/configs/olimex-stm32-p207/src/up_buttons.c +++ b/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/configs/olimex-strp711/include/board.h b/configs/olimex-strp711/include/board.h index 1a68ec7413..ce83de2fe0 100644 --- a/configs/olimex-strp711/include/board.h +++ b/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/configs/olimex-strp711/src/up_buttons.c b/configs/olimex-strp711/src/up_buttons.c index e8737954cc..8047b83614 100644 --- a/configs/olimex-strp711/src/up_buttons.c +++ b/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/configs/open1788/include/board.h b/configs/open1788/include/board.h index ac5feb64c0..fd1d76d4df 100644 --- a/configs/open1788/include/board.h +++ b/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/configs/open1788/src/lpc17_buttons.c b/configs/open1788/src/lpc17_buttons.c index e74fce1b73..5982dfb6ab 100644 --- a/configs/open1788/src/lpc17_buttons.c +++ b/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/configs/pcduino-a10/include/board.h b/configs/pcduino-a10/include/board.h index b5b0f3b715..09f5820a76 100644 --- a/configs/pcduino-a10/include/board.h +++ b/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/configs/pcduino-a10/src/a1x_buttons.c b/configs/pcduino-a10/src/a1x_buttons.c index 2347568541..f537e40600 100644 --- a/configs/pcduino-a10/src/a1x_buttons.c +++ b/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/configs/sam3u-ek/include/board.h b/configs/sam3u-ek/include/board.h index d5a10c4b17..5b638f290c 100644 --- a/configs/sam3u-ek/include/board.h +++ b/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/configs/sam3u-ek/src/up_buttons.c b/configs/sam3u-ek/src/up_buttons.c index c04eb0b377..81b3d7ccbc 100644 --- a/configs/sam3u-ek/src/up_buttons.c +++ b/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/configs/sam4l-xplained/include/board.h b/configs/sam4l-xplained/include/board.h index c314e4cfef..9241120669 100644 --- a/configs/sam4l-xplained/include/board.h +++ b/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/configs/sam4l-xplained/src/sam_buttons.c b/configs/sam4l-xplained/src/sam_buttons.c index 4c4b8cb831..cbf237ef07 100644 --- a/configs/sam4l-xplained/src/sam_buttons.c +++ b/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/configs/sam4s-xplained/include/board.h b/configs/sam4s-xplained/include/board.h index 1ff60650ec..e4133a6fd3 100644 --- a/configs/sam4s-xplained/include/board.h +++ b/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/configs/sam4s-xplained/src/sam_buttons.c b/configs/sam4s-xplained/src/sam_buttons.c index fe5c0b7768..2db8979cf9 100644 --- a/configs/sam4s-xplained/src/sam_buttons.c +++ b/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/configs/sama5d3x-ek/include/board.h b/configs/sama5d3x-ek/include/board.h index 2bf1e1ebb3..5e6c20746a 100644 --- a/configs/sama5d3x-ek/include/board.h +++ b/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/configs/sama5d3x-ek/src/sam_buttons.c b/configs/sama5d3x-ek/src/sam_buttons.c index 4377a2f5d3..fe74f3fb72 100644 --- a/configs/sama5d3x-ek/src/sam_buttons.c +++ b/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/configs/shenzhou/include/board.h b/configs/shenzhou/include/board.h index 3e10a32e77..818e99ca64 100644 --- a/configs/shenzhou/include/board.h +++ b/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/configs/shenzhou/src/up_buttons.c b/configs/shenzhou/src/up_buttons.c index 5a8515ca5c..c9d2e4f1f7 100644 --- a/configs/shenzhou/src/up_buttons.c +++ b/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/configs/skp16c26/src/up_buttons.c b/configs/skp16c26/src/up_buttons.c index a483aaeaa4..219c690ddc 100644 --- a/configs/skp16c26/src/up_buttons.c +++ b/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/configs/spark/include/board.h b/configs/spark/include/board.h index 2421f69a87..153c2a67aa 100644 --- a/configs/spark/include/board.h +++ b/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/configs/spark/src/up_boot.c b/configs/spark/src/up_boot.c index 3fb9a6ef19..774b3c03e3 100644 --- a/configs/spark/src/up_boot.c +++ b/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/configs/spark/src/up_buttons.c b/configs/spark/src/up_buttons.c index 33791417ac..ddba1e89e6 100644 --- a/configs/spark/src/up_buttons.c +++ b/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/configs/stm3210e-eval/include/board.h b/configs/stm3210e-eval/include/board.h index 1f0898441c..82653e07bd 100644 --- a/configs/stm3210e-eval/include/board.h +++ b/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/configs/stm3210e-eval/src/up_buttons.c b/configs/stm3210e-eval/src/up_buttons.c index 4f884649c3..569b380102 100644 --- a/configs/stm3210e-eval/src/up_buttons.c +++ b/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/configs/stm3210e-eval/src/up_pmbuttons.c b/configs/stm3210e-eval/src/up_pmbuttons.c index cc6f3cae0e..ec01c1e904 100644 --- a/configs/stm3210e-eval/src/up_pmbuttons.c +++ b/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/configs/stm3220g-eval/include/board.h b/configs/stm3220g-eval/include/board.h index c8dccf390a..d5bddbe013 100644 --- a/configs/stm3220g-eval/include/board.h +++ b/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/configs/stm3220g-eval/src/up_buttons.c b/configs/stm3220g-eval/src/up_buttons.c index 4847aaa7c0..e8f19d3f65 100644 --- a/configs/stm3220g-eval/src/up_buttons.c +++ b/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/configs/stm3240g-eval/include/board.h b/configs/stm3240g-eval/include/board.h index f9c8a437cd..0369d23f97 100644 --- a/configs/stm3240g-eval/include/board.h +++ b/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/configs/stm3240g-eval/src/up_buttons.c b/configs/stm3240g-eval/src/up_buttons.c index 522b8e4d9a..e8c9712dea 100644 --- a/configs/stm3240g-eval/src/up_buttons.c +++ b/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/configs/stm32f100rc_generic/include/board.h b/configs/stm32f100rc_generic/include/board.h index b5bc69259f..59c4b31cc5 100644 --- a/configs/stm32f100rc_generic/include/board.h +++ b/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/configs/stm32f100rc_generic/src/up_buttons.c b/configs/stm32f100rc_generic/src/up_buttons.c index 7200d9ce86..2442e38b4b 100644 --- a/configs/stm32f100rc_generic/src/up_buttons.c +++ b/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/configs/stm32f3discovery/include/board.h b/configs/stm32f3discovery/include/board.h index ff1a049f53..bc0b9be864 100644 --- a/configs/stm32f3discovery/include/board.h +++ b/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/configs/stm32f3discovery/src/up_buttons.c b/configs/stm32f3discovery/src/up_buttons.c index 08e8c8a1fa..305b3251e3 100644 --- a/configs/stm32f3discovery/src/up_buttons.c +++ b/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/configs/stm32f429i-disco/include/board.h b/configs/stm32f429i-disco/include/board.h index 49fb18d877..bd6e0f5213 100644 --- a/configs/stm32f429i-disco/include/board.h +++ b/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/configs/stm32f429i-disco/src/up_buttons.c b/configs/stm32f429i-disco/src/up_buttons.c index b1c2ef96cb..6d1b6b8385 100644 --- a/configs/stm32f429i-disco/src/up_buttons.c +++ b/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/configs/stm32f4discovery/include/board.h b/configs/stm32f4discovery/include/board.h index de829f19e2..dadde0fca5 100644 --- a/configs/stm32f4discovery/include/board.h +++ b/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/configs/stm32f4discovery/src/up_buttons.c b/configs/stm32f4discovery/src/up_buttons.c index ae13669307..a3f9bd6486 100644 --- a/configs/stm32f4discovery/src/up_buttons.c +++ b/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/configs/stm32f4discovery/src/up_pmbuttons.c b/configs/stm32f4discovery/src/up_pmbuttons.c index 4bc241fce4..5a7d2443e7 100644 --- a/configs/stm32f4discovery/src/up_pmbuttons.c +++ b/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/configs/stm32ldiscovery/include/board.h b/configs/stm32ldiscovery/include/board.h index eca2ef0147..6eea3aca0c 100644 --- a/configs/stm32ldiscovery/include/board.h +++ b/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/configs/stm32ldiscovery/src/stm32_buttons.c b/configs/stm32ldiscovery/src/stm32_buttons.c index 7ab7debdaf..83833c5e1b 100644 --- a/configs/stm32ldiscovery/src/stm32_buttons.c +++ b/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/configs/stm32vldiscovery/include/board.h b/configs/stm32vldiscovery/include/board.h index ebc04f9851..76f25bffe1 100644 --- a/configs/stm32vldiscovery/include/board.h +++ b/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/configs/stm32vldiscovery/src/stm32_buttons.c b/configs/stm32vldiscovery/src/stm32_buttons.c index c614fdca0a..d214ae323b 100644 --- a/configs/stm32vldiscovery/src/stm32_buttons.c +++ b/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/configs/sure-pic32mx/include/board.h b/configs/sure-pic32mx/include/board.h index 3b4d7f7989..f22c471233 100644 --- a/configs/sure-pic32mx/include/board.h +++ b/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/configs/sure-pic32mx/src/pic32mx_buttons.c b/configs/sure-pic32mx/src/pic32mx_buttons.c index ce9acd875e..cfcdbede9e 100644 --- a/configs/sure-pic32mx/src/pic32mx_buttons.c +++ b/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/configs/twr-k60n512/include/board.h b/configs/twr-k60n512/include/board.h index ca060c654d..6c2aa21012 100644 --- a/configs/twr-k60n512/include/board.h +++ b/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/configs/twr-k60n512/src/up_buttons.c b/configs/twr-k60n512/src/up_buttons.c index 5b449dbe89..c836efee37 100644 --- a/configs/twr-k60n512/src/up_buttons.c +++ b/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/configs/ubw32/include/board.h b/configs/ubw32/include/board.h index 63869cc5f2..347e02a3e1 100644 --- a/configs/ubw32/include/board.h +++ b/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/configs/ubw32/src/up_buttons.c b/configs/ubw32/src/up_buttons.c index 4fef567053..5b6bc95644 100644 --- a/configs/ubw32/src/up_buttons.c +++ b/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/configs/us7032evb1/include/board.h b/configs/us7032evb1/include/board.h index 3ca3476dad..2fd709246e 100644 --- a/configs/us7032evb1/include/board.h +++ b/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/configs/viewtool-stm32f107/include/board.h b/configs/viewtool-stm32f107/include/board.h index 361ada569c..9d15e9486c 100644 --- a/configs/viewtool-stm32f107/include/board.h +++ b/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/configs/viewtool-stm32f107/src/stm32_buttons.c b/configs/viewtool-stm32f107/src/stm32_buttons.c index 71e0faa621..0c2b623ea9 100644 --- a/configs/viewtool-stm32f107/src/stm32_buttons.c +++ b/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/configs/viewtool-stm32f107/src/stm32_highpri.c b/configs/viewtool-stm32f107/src/stm32_highpri.c index 78a006285d..de4cc881b2 100644 --- a/configs/viewtool-stm32f107/src/stm32_highpri.c +++ b/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/configs/vsn/include/board.h b/configs/vsn/include/board.h index 85cd96bd7b..766b6197d6 100644 --- a/configs/vsn/include/board.h +++ b/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/configs/vsn/src/buttons.c b/configs/vsn/src/buttons.c index c0a0f72975..a252606bfe 100644 --- a/configs/vsn/src/buttons.c +++ b/configs/vsn/src/buttons.c @@ -34,20 +34,23 @@ * ****************************************************************************/ -/** \file - * \author Uros Platise - * \brief VSN Button - */ +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include + +#include "vsn.h" #ifdef CONFIG_ARCH_BUTTONS -#include -#include -#include -#include "vsn.h" - /**************************************************************************** - * 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/configs/zkit-arm-1769/src/up_buttons.c b/configs/zkit-arm-1769/src/up_buttons.c index 8dfb5f9ce1..d4c5dfd35b 100644 --- a/configs/zkit-arm-1769/src/up_buttons.c +++ b/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/include/nuttx/arch.h b/include/nuttx/arch.h index 6522c6208e..c5011b4774 100644 --- a/include/nuttx/arch.h +++ b/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 * ****************************************************************************/