Rename up_buttoninit to board_button_intialize

This commit is contained in:
Gregory Nutt
2014-01-24 13:50:23 -06:00
parent ff35d0f11a
commit e5bfdcf36c
80 changed files with 390 additions and 1457 deletions
+7 -60
View File
@@ -1,8 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/avr32dev1/include/board.h * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -34,8 +33,8 @@
* *
************************************************************************************/ ************************************************************************************/
#ifndef __ARCH_BOARD_BOARD_H #ifndef __CONFIGS_AVR32DEV1_INCLUDE_BOARD_H
#define __ARCH_BOARD_BOARD_H #define __CONFIGS_AVR32DEV1_INCLUDE_BOARD_H
/************************************************************************************ /************************************************************************************
* Included Files * Included Files
@@ -174,7 +173,8 @@
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
#define EXTERN extern "C" #define EXTERN extern "C"
extern "C" { extern "C"
{
#else #else
#define EXTERN extern #define EXTERN extern
#endif #endif
@@ -192,60 +192,7 @@ extern "C" {
* *
************************************************************************************/ ************************************************************************************/
EXTERN void avr32_boardinitialize(void); 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 */
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
@@ -253,5 +200,5 @@ EXTERN xcpt_t up_irqbutton(int id, xcpt_t irqhandler);
#endif #endif
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* __ARCH_BOARD_BOARD_H */ #endif /* __CONFIGS_AVR32DEV1_INCLUDE_BOARD_H */
+16 -14
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/sam3u-ek/src/up_leds.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <arch/irq.h>
@@ -87,12 +88,12 @@ static xcpt_t up_irqbuttonx(int irq, xcpt_t irqhandler)
if (irqhandler) if (irqhandler)
{ {
gpio_irqenable(irq); gpio_irqenable(irq);
} }
else else
{ {
gpio_irqdisable(irq); gpio_irqdisable(irq);
} }
/* Return the old button handler (so that it can be restored) */ /* 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: * Description:
* up_buttoninit() must be called to initialize button resources. After * board_button_initialize() must be called to initialize button resources.
* that, up_buttons() may be called to collect the current state of all * After that, up_buttons() may be called to collect the current state of
* buttons or up_irqbutton() may be called to register button interrupt * all buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
(void)at32uc3_configgpio(PINMUX_GPIO_BUTTON1); (void)at32uc3_configgpio(PINMUX_GPIO_BUTTON1);
(void)at32uc3_configgpio(PINMUX_GPIO_BUTTON2); (void)at32uc3_configgpio(PINMUX_GPIO_BUTTON2);
@@ -125,10 +126,11 @@ void up_buttoninit(void)
* Name: up_buttons * Name: up_buttons
* *
* Description: * Description:
* After up_buttoninit() has been called, up_buttons() may be called to * After board_button_initialize() has been called, up_buttons() may be
* collect the state of all buttons. up_buttons() returns an 8-bit bit set * called to collect the state of all buttons. up_buttons() returns an
* with each bit associated with a button. See the BUTTON* definitions * 8-bit bit set with each bit associated with a button. See the BUTTON*
* above for the meaning of each bit in the returned value. * definitions in the board.h header file for the meaning of each bit in
* the returned value.
* *
****************************************************************************/ ****************************************************************************/
+17 -48
View File
@@ -322,37 +322,6 @@ extern "C" {
void stm32_boardinitialize(void); 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 * 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 #ifndef CONFIG_ARCH_LEDS
EXTERN void stm32_ledinit(void); void stm32_ledinit(void);
EXTERN void stm32_setled(int led, bool ledon); void stm32_setled(int led, bool ledon);
EXTERN void stm32_setleds(uint8_t ledset); void stm32_setleds(uint8_t ledset);
#endif #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 * Relay control functions
@@ -393,17 +362,17 @@ EXTERN void stm32_lcdclear(uint16_t color);
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_ARCH_RELAYS #ifdef CONFIG_ARCH_RELAYS
EXTERN void up_relaysinit(void); void up_relaysinit(void);
EXTERN void relays_setstat(int relays, bool stat); void relays_setstat(int relays, bool stat);
EXTERN bool relays_getstat(int relays); bool relays_getstat(int relays);
EXTERN void relays_setstats(uint32_t relays_stat); void relays_setstats(uint32_t relays_stat);
EXTERN uint32_t relays_getstats(void); uint32_t relays_getstats(void);
EXTERN void relays_onoff(int relays, uint32_t mdelay); void relays_onoff(int relays, uint32_t mdelay);
EXTERN void relays_onoffs(uint32_t relays_stat, uint32_t mdelay); void relays_onoffs(uint32_t relays_stat, uint32_t mdelay);
EXTERN void relays_resetmode(int relays); void relays_resetmode(int relays);
EXTERN void relays_powermode(int relays); void relays_powermode(int relays);
EXTERN void relays_resetmodes(uint32_t relays_stat); void relays_resetmodes(uint32_t relays_stat);
EXTERN void relays_powermodes(uint32_t relays_stat); void relays_powermodes(uint32_t relays_stat);
#endif #endif
/************************************************************************************ /************************************************************************************
@@ -414,8 +383,8 @@ EXTERN void relays_powermodes(uint32_t relays_stat);
* *
************************************************************************************/ ************************************************************************************/
EXTERN const char *stm32_getchipid(void); const char *stm32_getchipid(void);
EXTERN const char *stm32_getchipid_string(void); const char *stm32_getchipid_string(void);
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
+23 -19
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/cloudctrl/src/up_buttons.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* Darcy Gong <darcy.gong@gmail.com> * Darcy Gong <darcy.gong@gmail.com>
* *
@@ -42,7 +42,9 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "cloudctrl-internal.h" #include "cloudctrl-internal.h"
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
@@ -72,17 +74,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] =
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * Description:
* up_buttoninit() must be called to initialize button resources. After * board_button_initialize() must be called to initialize button resources.
* that, up_buttons() may be called to collect the current state of all * After that, up_buttons() may be called to collect the current state of
* buttons or up_irqbutton() may be called to register button interrupt * all buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
int i; int i;
@@ -130,28 +132,30 @@ uint8_t up_buttons(void)
return ret; return ret;
} }
/************************************************************************************ /****************************************************************************
* Button support. * Button support.
* *
* Description: * Description:
* up_buttoninit() must be called to initialize button resources. After * board_button_initialize() must be called to initialize button resources.
* that, up_buttons() may be called to collect the current state of all * After that, up_buttons() may be called to collect the current state of
* buttons or up_irqbutton() may be called to register button interrupt * all buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
* After up_buttoninit() has been called, up_buttons() may be called to * After board_button_initialize() has been called, up_buttons() may be
* collect the state of all buttons. up_buttons() returns an 8-bit bit set * called to collect the state of all buttons. up_buttons() returns an
* with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * 8-bit bit set with each bit associated with a button. See the
* definitions in board.h for the meaning of each bit. * 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 * 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 * 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 enumeration value that uniquely identifies a button resource. See
* BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration * the
* value. The previous interrupt handler address is returned (so that it may * BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of
* restored, if so desired). * enumeration value. The previous interrupt handler address is returned
* (so that it may restored, if so desired).
* *
************************************************************************************/ ****************************************************************************/
#ifdef CONFIG_ARCH_IRQBUTTONS #ifdef CONFIG_ARCH_IRQBUTTONS
xcpt_t up_irqbutton(int id, xcpt_t irqhandler) xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+1 -16
View File
@@ -117,22 +117,7 @@ extern "C" {
* *
************************************************************************************/ ************************************************************************************/
EXTERN void hcs12_boardinitialize(void); 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
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
+5 -3
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/demo9s12ne64/src/up_leds.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,9 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "demo9s12ne64.h" #include "demo9s12ne64.h"
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
@@ -63,10 +65,10 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
} }
+4 -19
View File
@@ -2,7 +2,7 @@
* configs/ea3131/include/board.h * configs/ea3131/include/board.h
* include/arch/board/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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -122,7 +122,8 @@
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
#define EXTERN extern "C" #define EXTERN extern "C"
extern "C" { extern "C"
{
#else #else
#define EXTERN extern #define EXTERN extern
#endif #endif
@@ -140,23 +141,7 @@ extern "C" {
* *
************************************************************************************/ ************************************************************************************/
EXTERN void lpc31_boardinitialize(void); 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
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
+5 -3
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/ea3131/src/up_leds.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,9 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "ea3131_internal.h" #include "ea3131_internal.h"
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
@@ -63,10 +65,10 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
} }
+1 -17
View File
@@ -140,23 +140,7 @@ extern "C" {
* *
************************************************************************************/ ************************************************************************************/
EXTERN void lpc31_boardinitialize(void); 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
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
+5 -3
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/ea3152/src/up_leds.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,9 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "ea3152_internal.h" #include "ea3152_internal.h"
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
@@ -63,10 +65,10 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
} }
-5
View File
@@ -80,11 +80,6 @@ extern "C" {
#define EXTERN extern #define EXTERN extern
#endif #endif
#ifdef CONFIG_ARCH_BUTTONS
EXTERN void up_buttoninit(void);
EXTERN uint8_t up_buttons(void);
#endif
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
} }
+2 -2
View File
@@ -113,11 +113,11 @@ void up_pb2interrupt(void)
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
void up_buttoninit(void) void board_button_initialize(void)
{ {
uint8_t regval; uint8_t regval;
+5 -36
View File
@@ -383,38 +383,7 @@ extern "C" {
* *
************************************************************************************/ ************************************************************************************/
EXTERN void stm32_boardinitialize(void); 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 * 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 #ifndef CONFIG_ARCH_LEDS
EXTERN void stm32_ledinit(void); void stm32_ledinit(void);
EXTERN void stm32_setled(int led, bool ledon); void stm32_setled(int led, bool ledon);
EXTERN void stm32_setleds(uint8_t ledset); void stm32_setleds(uint8_t ledset);
#endif #endif
/************************************************************************************ /************************************************************************************
@@ -444,7 +413,7 @@ EXTERN void stm32_setleds(uint8_t ledset);
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_STM32_FSMC #ifdef CONFIG_STM32_FSMC
EXTERN void fire_lcdclear(uint16_t color); void fire_lcdclear(uint16_t color);
#endif #endif
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
+21 -18
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/fire-stm32v2/src/up_buttons.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,9 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "fire-internal.h" #include "fire-internal.h"
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
@@ -63,17 +65,17 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * Description:
* up_buttoninit() must be called to initialize button resources. After * board_button_initialize() must be called to initialize button resources.
* that, up_buttons() may be called to collect the current state of all * After that, up_buttons() may be called to collect the current state of
* buttons or up_irqbutton() may be called to register button interrupt * all buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
/* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are /* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are
* configured for some pins but NOT used in this file * configured for some pins but NOT used in this file
@@ -106,28 +108,29 @@ uint8_t up_buttons(void)
return ret; return ret;
} }
/************************************************************************************ /*****************************************************************************
* Button support. * Button support.
* *
* Description: * Description:
* up_buttoninit() must be called to initialize button resources. After * board_button_initialize() must be called to initialize button resources.
* that, up_buttons() may be called to collect the current state of all * 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 * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
* After up_buttoninit() has been called, up_buttons() may be called to * After board_button_initialize() has been called, up_buttons() may be
* collect the state of all buttons. up_buttons() returns an 8-bit bit set * called to collect the state of all buttons. up_buttons() returns an
* with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * 8-bit bit set with each bit associated with a button. See the
* definitions in board.h for the meaning of each bit. * 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 * 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 * 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 enumeration value that uniquely identifies a button resource. See
* BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration * the BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of
* value. The previous interrupt handler address is returned (so that it may * enumeration values. The previous interrupt handler address is returned
* restored, if so desired). * (so that it may restored, if so desired).
* *
************************************************************************************/ ****************************************************************************/
#ifdef CONFIG_ARCH_IRQBUTTONS #ifdef CONFIG_ARCH_IRQBUTTONS
xcpt_t up_irqbutton(int id, xcpt_t irqhandler) xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+1 -32
View File
@@ -202,38 +202,7 @@ extern "C" {
* *
************************************************************************************/ ************************************************************************************/
EXTERN void stm32_boardinitialize(void); 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
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
+22 -19
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/hymini-stm32v/src/up_buttons.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,9 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "hymini_stm32v-internal.h" #include "hymini_stm32v-internal.h"
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
@@ -55,17 +57,17 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * Description:
* up_buttoninit() must be called to initialize button resources. After * board_button_initialize() must be called to initialize button resources.
* that, up_buttons() may be called to collect the current state of all * After that, up_buttons() may be called to collect the current state of
* buttons or up_irqbutton() may be called to register button interrupt * all buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
stm32_configgpio(GPIO_BTN_KEYA); stm32_configgpio(GPIO_BTN_KEYA);
stm32_configgpio(GPIO_BTN_KEYB); stm32_configgpio(GPIO_BTN_KEYB);
@@ -100,28 +102,29 @@ uint8_t up_buttons(void)
return ret; return ret;
} }
/************************************************************************************ /****************************************************************************
* Button support. * Button support.
* *
* Description: * Description:
* up_buttoninit() must be called to initialize button resources. After * board_button_initialize() must be called to initialize button resources.
* that, up_buttons() may be called to collect the current state of all * After that, up_buttons() may be called to collect the current state of
* buttons or up_irqbutton() may be called to register button interrupt * all buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
* After up_buttoninit() has been called, up_buttons() may be called to * After board_button_initialize() has been called, up_buttons() may be
* collect the state of all buttons. up_buttons() returns an 8-bit bit set * called to collect the state of all buttons. up_buttons() returns an
* with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * 8-bit bit set with each bit associated with a button. See the
* definitions in board.h for the meaning of each bit. * 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 * 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 * 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 enumeration value that uniquely identifies a button resource. See
* BUTTON_* definitions in board.h for the meaning of enumeration * the BUTTON_* definitions in board.h for the meaning of enumeration
* value. The previous interrupt handler address is returned (so that it may * value. The previous interrupt handler address is returned (so that it
* restored, if so desired). * may be restored, if so desired).
* *
************************************************************************************/ ****************************************************************************/
#ifdef CONFIG_ARCH_IRQBUTTONS #ifdef CONFIG_ARCH_IRQBUTTONS
xcpt_t up_irqbutton(int id, xcpt_t irqhandler) xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+22 -19
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/kwikstik-k40/src/up_buttons.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,9 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "kwikstik-internal.h" #include "kwikstik-internal.h"
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
@@ -63,17 +65,17 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * Description:
* up_buttoninit() must be called to initialize button resources. After * board_button_initialize() must be called to initialize button resources.
* that, up_buttons() may be called to collect the current state of all * After that, up_buttons() may be called to collect the current state of
* buttons or up_irqbutton() may be called to register button interrupt * all buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
/* The KwikStik-K40 board has no standard GPIO contact buttons */ /* The KwikStik-K40 board has no standard GPIO contact buttons */
} }
@@ -89,28 +91,29 @@ uint8_t up_buttons(void)
return 0; return 0;
} }
/************************************************************************************ /****************************************************************************
* Button support. * Button support.
* *
* Description: * Description:
* up_buttoninit() must be called to initialize button resources. After * board_button_initialize() must be called to initialize button resources.
* that, up_buttons() may be called to collect the current state of all * After that, up_buttons() may be called to collect the current state of
* buttons or up_irqbutton() may be called to register button interrupt * all buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
* After up_buttoninit() has been called, up_buttons() may be called to * After board_button_initialize() has been called, up_buttons() may be
* collect the state of all buttons. up_buttons() returns an 8-bit bit set * called to collect the state of all buttons. up_buttons() returns an
* with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT * 8-bit bit set with each bit associated with a button. See the
* definitions in board.h for the meaning of each bit. * 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 * 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 * 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 enumeration value that uniquely identifies a button resource.
* BUTTON_* and JOYSTICK_* definitions in board.h for the meaning of enumeration * See the BUTTON_* and JOYSTICK_* definitions in board.h for the meaning
* value. The previous interrupt handler address is returned (so that it may * of enumeration value. The previous interrupt handler address is
* restored, if so desired). * returned (so that it may be restored, if so desired).
* *
************************************************************************************/ ****************************************************************************/
#ifdef CONFIG_ARCH_IRQBUTTONS #ifdef CONFIG_ARCH_IRQBUTTONS
xcpt_t up_irqbutton(int id, xcpt_t irqhandler) xcpt_t up_irqbutton(int id, xcpt_t irqhandler)
+5 -5
View File
@@ -94,17 +94,17 @@ static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] =
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
int i; int i;
@@ -120,7 +120,7 @@ void up_buttoninit(void)
* Name: up_buttons * Name: up_buttons
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons. * buttons.
* *
@@ -160,7 +160,7 @@ uint8_t up_buttons(void)
* Button support. * Button support.
* *
* Description: * 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. * that, up_irqbutton() may be called to register button interrupt handlers.
* *
* up_irqbutton() may be called to register an interrupt handler that will * up_irqbutton() may be called to register an interrupt handler that will
+4 -60
View File
@@ -1,8 +1,7 @@
/************************************************************************************ /************************************************************************************
* configs/lm4f120-launchpad/include/board.h * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -34,8 +33,8 @@
* *
************************************************************************************/ ************************************************************************************/
#ifndef __ARCH_BOARD_BOARD_H #ifndef __CONFIGS_LM4F120_LAUNCHPAD_INCLUDE_BOARD_H
#define __ARCH_BOARD_BOARD_H #define __CONFIGS_LM4F120_LAUNCHPAD_INCLUDE_BOARD_H
/************************************************************************************ /************************************************************************************
* Included Files * Included Files
@@ -219,60 +218,5 @@ void lm4f_setled(int led, bool ledon);
void lm4f_setleds(uint8_t ledset); void lm4f_setleds(uint8_t ledset);
#endif #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 /* __ASSEMBLY__ */
#endif /* __ARCH_BOARD_BOARD_H */ #endif /* __CONFIGS_LM4F120_LAUNCHPAD_INCLUDE_BOARD_H */
+5 -5
View File
@@ -93,17 +93,17 @@ static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] =
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
int i; int i;
@@ -119,7 +119,7 @@ void up_buttoninit(void)
* Name: up_buttons * Name: up_buttons
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons. * buttons.
* *
@@ -159,7 +159,7 @@ uint8_t up_buttons(void)
* Button support. * Button support.
* *
* Description: * 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. * that, up_irqbutton() may be called to register button interrupt handlers.
* *
* up_irqbutton() may be called to register an interrupt handler that will * up_irqbutton() may be called to register an interrupt handler that will
-31
View File
@@ -297,37 +297,6 @@ void stm32_setled(int led, bool ledon);
void stm32_setleds(uint8_t ledset); void stm32_setleds(uint8_t ledset);
#endif #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 #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
} }
+1 -16
View File
@@ -125,22 +125,7 @@ extern "C" {
* *
************************************************************************************/ ************************************************************************************/
EXTERN void hcs12_boardinitialize(void); 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
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
+7 -5
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/ne64badge/src/up_buttons.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,9 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "ne64badge_internal.h" #include "ne64badge_internal.h"
#ifdef CONFIG_ARCH_BUTTONS #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 */ /* Configure all button GPIO lines */
btn_dumpgpio("up_buttoninit() Entry)"); btn_dumpgpio("board_button_initialize() Entry)");
hcs12_configgpio(NE64BADGE_BUTTON1); hcs12_configgpio(NE64BADGE_BUTTON1);
hcs12_configgpio(NE64BADGE_BUTTON2); hcs12_configgpio(NE64BADGE_BUTTON2);
btn_dumpgpio("up_buttoninit() Exit"); btn_dumpgpio("board_button_initialize() Exit");
} }
/**************************************************************************** /****************************************************************************
-55
View File
@@ -398,61 +398,6 @@ EXTERN void lpc17_setled(int led, bool ledon);
EXTERN void lpc17_setleds(uint8_t ledset); EXTERN void lpc17_setleds(uint8_t ledset);
#endif #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 #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
} }
+5 -5
View File
@@ -97,17 +97,17 @@ static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] =
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
int i; int i;
@@ -123,7 +123,7 @@ void up_buttoninit(void)
* Name: up_buttons * Name: up_buttons
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons. * buttons.
* *
@@ -163,7 +163,7 @@ uint8_t up_buttons(void)
* Button support. * Button support.
* *
* Description: * 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. * that, up_irqbutton() may be called to register button interrupt handlers.
* *
* up_irqbutton() may be called to register an interrupt handler that will * up_irqbutton() may be called to register an interrupt handler that will
+1 -1
View File
@@ -90,7 +90,7 @@ void stm32_boardinitialize(void)
/* Configure on-board BUTTONs if BUTTON support has been selected. */ /* Configure on-board BUTTONs if BUTTON support has been selected. */
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
up_buttoninit(); board_button_initialize();
#endif #endif
} }
+8 -5
View File
@@ -40,7 +40,10 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "olimex-stm32-p207.h" #include "olimex-stm32-p207.h"
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
@@ -77,17 +80,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] =
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
int i; int i;
@@ -153,12 +156,12 @@ uint8_t up_buttons(void)
* Button support. * Button support.
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * 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 * 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 * with each bit associated with a button. See the BUTTON_*_BIT
* definitions in board.h for the meaning of each bit. * definitions in board.h for the meaning of each bit.
-5
View File
@@ -171,11 +171,6 @@ extern "C" {
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_ARCH_BUTTONS
EXTERN void up_buttoninit(void);
EXTERN uint8_t up_buttons(void);
#endif
#undef EXTERN #undef EXTERN
#ifdef __cplusplus #ifdef __cplusplus
} }
+2 -2
View File
@@ -72,11 +72,11 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
void up_buttoninit(void) void board_button_initialize(void)
{ {
uint16_t reg16; uint16_t reg16;
-55
View File
@@ -483,61 +483,6 @@ EXTERN void lpc17_setled(int led, bool ledon);
EXTERN void lpc17_setleds(uint8_t ledset); EXTERN void lpc17_setleds(uint8_t ledset);
#endif #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 #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
} }
+5 -5
View File
@@ -115,17 +115,17 @@ static uint8_t g_buttonirq[BOARD_NUM_BUTTONS] =
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
int i; int i;
@@ -141,7 +141,7 @@ void up_buttoninit(void)
* Name: up_buttons * Name: up_buttons
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons. * buttons.
* *
@@ -181,7 +181,7 @@ uint8_t up_buttons(void)
* Button support. * Button support.
* *
* Description: * 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. * that, up_irqbutton() may be called to register button interrupt handlers.
* *
* up_irqbutton() may be called to register an interrupt handler that will * up_irqbutton() may be called to register an interrupt handler that will
-42
View File
@@ -201,48 +201,6 @@ void a1x_setled(int led, bool ledon);
void a1x_setleds(uint8_t ledset); void a1x_setleds(uint8_t ledset);
#endif #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 #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
} }
+6 -5
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/pcduino-a10/src/a1x_buttons.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,7 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <arch/irq.h>
@@ -71,17 +72,17 @@ static xcpt_t g_irqbutton[BOARD_NBUTTONS];
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
# warning Missing logic # warning Missing logic
} }
@@ -90,7 +91,7 @@ void up_buttoninit(void)
* Name: up_buttons * Name: up_buttons
* *
* Description: * 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 * 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 * with each bit associated with a button. See the BUTTON* definitions
* above for the meaning of each bit in the returned value. * above for the meaning of each bit in the returned value.
-42
View File
@@ -185,48 +185,6 @@ extern "C" {
void sam_boardinitialize(void); 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 #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
} }
+6 -5
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/sam3u-ek/src/up_leds.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,7 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <arch/irq.h>
@@ -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: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
(void)sam_configgpio(GPIO_BUTTON1); (void)sam_configgpio(GPIO_BUTTON1);
(void)sam_configgpio(GPIO_BUTTON2); (void)sam_configgpio(GPIO_BUTTON2);
@@ -131,7 +132,7 @@ void up_buttoninit(void)
* Name: up_buttons * Name: up_buttons
* *
* Description: * 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 * 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 * associated with a button. See the BUTTON* definitions above for the meaning of
* each bit in the returned value. * each bit in the returned value.
-42
View File
@@ -332,48 +332,6 @@ void sam_setled(int led, bool ledon);
void sam_setleds(uint8_t ledset); void sam_setleds(uint8_t ledset);
#endif #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 #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
} }
+6 -5
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/sam4l-xplained/src/sam_buttons.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,7 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <arch/irq.h>
@@ -72,17 +73,17 @@ static xcpt_t g_irqsw0;
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
(void)sam_configgpio(GPIO_SW0); (void)sam_configgpio(GPIO_SW0);
} }
@@ -91,7 +92,7 @@ void up_buttoninit(void)
* Name: up_buttons * Name: up_buttons
* *
* Description: * 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 * 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 * associated with a button. See the BUTTON* definitions above for the meaning of
* each bit in the returned value. * each bit in the returned value.
-42
View File
@@ -272,48 +272,6 @@ void sam_setled(int led, bool ledon);
void sam_setleds(uint8_t ledset); void sam_setleds(uint8_t ledset);
#endif #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 #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
} }
+6 -5
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/sam4s-xplained/src/sam_buttons.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,7 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <arch/irq.h>
@@ -70,17 +71,17 @@ static xcpt_t g_irqbp2;
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
(void)sam_configgpio(GPIO_BP2); (void)sam_configgpio(GPIO_BP2);
} }
@@ -89,7 +90,7 @@ void up_buttoninit(void)
* Name: up_buttons * Name: up_buttons
* *
* Description: * 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 * 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 * associated with a button. See the BUTTON* definitions above for the meaning of
* each bit in the returned value. * each bit in the returned value.
-42
View File
@@ -364,48 +364,6 @@ void sam_setled(int led, bool ledon);
void sam_setleds(uint8_t ledset); void sam_setleds(uint8_t ledset);
#endif #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 #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
} }
+5 -4
View File
@@ -56,6 +56,7 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <arch/irq.h> #include <arch/irq.h>
@@ -87,17 +88,17 @@ static xcpt_t g_irquser1;
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
(void)sam_configpio(PIO_USER1); (void)sam_configpio(PIO_USER1);
} }
@@ -106,7 +107,7 @@ void up_buttoninit(void)
* Name: up_buttons * Name: up_buttons
* *
* Description: * 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 * 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 * with each bit associated with a button. See the BUTTON* definitions
* above for the meaning of each bit in the returned value. * above for the meaning of each bit in the returned value.
+17 -48
View File
@@ -368,37 +368,6 @@ extern "C" {
void stm32_boardinitialize(void); 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 * 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 #ifndef CONFIG_ARCH_LEDS
EXTERN void stm32_ledinit(void); void stm32_ledinit(void);
EXTERN void stm32_setled(int led, bool ledon); void stm32_setled(int led, bool ledon);
EXTERN void stm32_setleds(uint8_t ledset); void stm32_setleds(uint8_t ledset);
#endif #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 * Relay control functions
@@ -439,17 +408,17 @@ EXTERN void stm32_lcdclear(uint16_t color);
************************************************************************************/ ************************************************************************************/
#ifdef CONFIG_ARCH_RELAYS #ifdef CONFIG_ARCH_RELAYS
EXTERN void up_relaysinit(void); void up_relaysinit(void);
EXTERN void relays_setstat(int relays, bool stat); void relays_setstat(int relays, bool stat);
EXTERN bool relays_getstat(int relays); bool relays_getstat(int relays);
EXTERN void relays_setstats(uint32_t relays_stat); void relays_setstats(uint32_t relays_stat);
EXTERN uint32_t relays_getstats(void); uint32_t relays_getstats(void);
EXTERN void relays_onoff(int relays, uint32_t mdelay); void relays_onoff(int relays, uint32_t mdelay);
EXTERN void relays_onoffs(uint32_t relays_stat, uint32_t mdelay); void relays_onoffs(uint32_t relays_stat, uint32_t mdelay);
EXTERN void relays_resetmode(int relays); void relays_resetmode(int relays);
EXTERN void relays_powermode(int relays); void relays_powermode(int relays);
EXTERN void relays_resetmodes(uint32_t relays_stat); void relays_resetmodes(uint32_t relays_stat);
EXTERN void relays_powermodes(uint32_t relays_stat); void relays_powermodes(uint32_t relays_stat);
#endif #endif
/************************************************************************************ /************************************************************************************
@@ -460,8 +429,8 @@ EXTERN void relays_powermodes(uint32_t relays_stat);
* *
************************************************************************************/ ************************************************************************************/
EXTERN const char *stm32_getchipid(void); const char *stm32_getchipid(void);
EXTERN const char *stm32_getchipid_string(void); const char *stm32_getchipid_string(void);
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
+8 -6
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/shenzhou/src/up_buttons.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,9 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "shenzhou-internal.h" #include "shenzhou-internal.h"
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
@@ -71,17 +73,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] =
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
int i; int i;
@@ -133,12 +135,12 @@ uint8_t up_buttons(void)
* Button support. * Button support.
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * 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 * 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 * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
* definitions in board.h for the meaning of each bit. * definitions in board.h for the meaning of each bit.
+2 -2
View File
@@ -69,11 +69,11 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
****************************************************************************/ ****************************************************************************/
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
void up_buttoninit(void) void board_button_initialize(void)
{ {
uint8_t regval; uint8_t regval;
-30
View File
@@ -221,36 +221,6 @@ extern "C"
/************************************************************************************ /************************************************************************************
* Public Function Prototypes * 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 * Name: up_ledinit, up_setled, and up_setleds
+1 -1
View File
@@ -78,7 +78,7 @@ void stm32_boardinitialize(void)
#endif #endif
#ifdef CONFIG_ARCH_HAVE_BUTTONS #ifdef CONFIG_ARCH_HAVE_BUTTONS
up_buttoninit(); board_button_initialize();
#endif #endif
/* Configure SPI chip selects if 1) SP2 is not disabled, and 2) the weak function /* Configure SPI chip selects if 1) SP2 is not disabled, and 2) the weak function
+8 -6
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/spark/src/up_buttons.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,9 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "spark.h" #include "spark.h"
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
@@ -63,17 +65,17 @@
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
/* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are /* Configure the GPIO pins as inputs. NOTE that EXTI interrupts are
* configured for all pins. * configured for all pins.
@@ -97,12 +99,12 @@ uint8_t up_buttons(void)
* Button support. * Button support.
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * 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 * 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 * with each bit associated with a button. See the BUTTON_*_BIT
* definitions in board.h for the meaning of each bit. * definitions in board.h for the meaning of each bit.
-31
View File
@@ -232,37 +232,6 @@ extern "C" {
EXTERN void stm32_boardinitialize(void); 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 * Name: stm3210e_lcdclear
* *
+8 -6
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* configs/stm3210e-eval/src/up_buttons.c * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,9 @@
#include <stdint.h> #include <stdint.h>
#include <nuttx/arch.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "stm3210e-internal.h" #include "stm3210e-internal.h"
#ifdef CONFIG_ARCH_BUTTONS #ifdef CONFIG_ARCH_BUTTONS
@@ -72,17 +74,17 @@ static const uint16_t g_buttons[NUM_BUTTONS] =
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
* Name: up_buttoninit * Name: board_button_initialize
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * handlers.
* *
****************************************************************************/ ****************************************************************************/
void up_buttoninit(void) void board_button_initialize(void)
{ {
int i; int i;
@@ -134,12 +136,12 @@ uint8_t up_buttons(void)
* Button support. * Button support.
* *
* Description: * 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 * that, up_buttons() may be called to collect the current state of all
* buttons or up_irqbutton() may be called to register button interrupt * buttons or up_irqbutton() may be called to register button interrupt
* handlers. * 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 * 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 * with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
* definitions in board.h for the meaning of each bit. * definitions in board.h for the meaning of each bit.
+1 -1
View File
@@ -298,7 +298,7 @@ void up_pmbuttons(void)
{ {
/* Initialize the button GPIOs */ /* Initialize the button GPIOs */
up_buttoninit(); board_button_initialize();
#ifdef CONFIG_ARCH_IRQBUTTONS #ifdef CONFIG_ARCH_IRQBUTTONS
int i; int i;

Some files were not shown because too many files have changed in this diff Show More