stm32_gpiosetevent: GPIO IRQ logic no longer returns the xcpt_t oldhandler. This value is useless and dangerous after the recent changes to interrupt argument passing.
This commit is contained in:
parent
4f5e0e3519
commit
f4bad1a280
@ -72,22 +72,21 @@ extern "C"
|
|||||||
* Description:
|
* Description:
|
||||||
* Sets/clears GPIO based event and interrupt triggers.
|
* Sets/clears GPIO based event and interrupt triggers.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* - pinset: gpio pin configuration
|
* - pinset: gpio pin configuration
|
||||||
* - rising/falling edge: enables
|
* - rising/falling edge: enables
|
||||||
* - event: generate event when set
|
* - event: generate event when set
|
||||||
* - func: when non-NULL, generate interrupt
|
* - func: when non-NULL, generate interrupt
|
||||||
* - arg: Argument passed to the interrupt callback
|
* - arg: Argument passed to the interrupt callback
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returned Value:
|
||||||
* The previous value of the interrupt handler function pointer. This value may,
|
* Zero (OK) on success; a negated errno value on failure indicating the
|
||||||
* for example, be used to restore the previous handler when multiple handlers are
|
* nature of the failure.
|
||||||
* used.
|
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
int stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||||
bool event, xcpt_t func, void *arg);
|
bool event, xcpt_t func, void *arg);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Name: stm32_exti_alarm
|
* Name: stm32_exti_alarm
|
||||||
@ -95,13 +94,13 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
|||||||
* Description:
|
* Description:
|
||||||
* Sets/clears EXTI alarm interrupt.
|
* Sets/clears EXTI alarm interrupt.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* - rising/falling edge: enables interrupt on rising/falling edges
|
* - rising/falling edge: enables interrupt on rising/falling edges
|
||||||
* - event: generate event when set
|
* - event: generate event when set
|
||||||
* - func: when non-NULL, generate interrupt
|
* - func: when non-NULL, generate interrupt
|
||||||
* - arg: Argument passed to the interrupt callback
|
* - arg: Argument passed to the interrupt callback
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returned Value:
|
||||||
* Zero (OK) on success; a negated errno value on failure indicating the
|
* Zero (OK) on success; a negated errno value on failure indicating the
|
||||||
* nature of the failure.
|
* nature of the failure.
|
||||||
*
|
*
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/stm32/stm32_exti_gpio.c
|
* arch/arm/src/stm32/stm32_exti_gpio.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009, 2011-2012, 2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2009, 2011-2012, 2015, 2017 Gregory Nutt. All rights reserved.
|
||||||
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
* Copyright (C) 2011 Uros Platise. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
* Uros Platise <uros.platise@isotel.eu>
|
* Uros Platise <uros.platise@isotel.eu>
|
||||||
@ -250,7 +250,7 @@ static int stm32_exti1510_isr(int irq, void *context, void *arg)
|
|||||||
* Description:
|
* Description:
|
||||||
* Sets/clears GPIO based event and interrupt triggers.
|
* Sets/clears GPIO based event and interrupt triggers.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* - pinset: GPIO pin configuration
|
* - pinset: GPIO pin configuration
|
||||||
* - risingedge: Enables interrupt on rising edges
|
* - risingedge: Enables interrupt on rising edges
|
||||||
* - fallingedge: Enables interrupt on falling edges
|
* - fallingedge: Enables interrupt on falling edges
|
||||||
@ -258,22 +258,20 @@ static int stm32_exti1510_isr(int irq, void *context, void *arg)
|
|||||||
* - func: When non-NULL, generate interrupt
|
* - func: When non-NULL, generate interrupt
|
||||||
* - arg: Argument passed to the interrupt callback
|
* - arg: Argument passed to the interrupt callback
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returned Value:
|
||||||
* The previous value of the interrupt handler function pointer. This
|
* Zero (OK) on success; a negated errno value on failure indicating the
|
||||||
* value may, for example, be used to restore the previous handler when
|
* nature of the failure.
|
||||||
* multiple handlers are used.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
int stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||||
bool event, xcpt_t func, void *arg)
|
bool event, xcpt_t func, void *arg)
|
||||||
{
|
{
|
||||||
FAR struct gpio_callback_s *shared_cbs;
|
FAR struct gpio_callback_s *shared_cbs;
|
||||||
uint32_t pin = pinset & GPIO_PIN_MASK;
|
uint32_t pin = pinset & GPIO_PIN_MASK;
|
||||||
uint32_t exti = STM32_EXTI_BIT(pin);
|
uint32_t exti = STM32_EXTI_BIT(pin);
|
||||||
int irq;
|
int irq;
|
||||||
xcpt_t handler;
|
xcpt_t handler;
|
||||||
xcpt_t oldhandler = NULL;
|
|
||||||
int nshared;
|
int nshared;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -324,7 +322,6 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
|||||||
|
|
||||||
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
|
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
|
||||||
|
|
||||||
oldhandler = g_gpio_callbacks[pin].callback;
|
|
||||||
g_gpio_callbacks[pin].callback = func;
|
g_gpio_callbacks[pin].callback = func;
|
||||||
g_gpio_callbacks[pin].arg = arg;
|
g_gpio_callbacks[pin].arg = arg;
|
||||||
|
|
||||||
@ -384,7 +381,5 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
|||||||
func ? 0 : exti,
|
func ? 0 : exti,
|
||||||
func ? exti : 0);
|
func ? exti : 0);
|
||||||
|
|
||||||
/* Return the old IRQ handler */
|
return OK;
|
||||||
|
|
||||||
return oldhandler;
|
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,7 @@ EXTERN const uint32_t g_gpiobase[STM32_NGPIO_PORTS];
|
|||||||
* function, it must be unconfigured with stm32_unconfiggpio() with
|
* function, it must be unconfigured with stm32_unconfiggpio() with
|
||||||
* the same cfgset first before it can be set to non-alternative function.
|
* the same cfgset first before it can be set to non-alternative function.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returned Value:
|
||||||
* OK on success
|
* OK on success
|
||||||
* ERROR on invalid port, or when pin is locked as ALT function.
|
* ERROR on invalid port, or when pin is locked as ALT function.
|
||||||
*
|
*
|
||||||
@ -453,7 +453,7 @@ int stm32_configgpio(uint32_t cfgset);
|
|||||||
* operate in PWM mode could produce excessive on-board currents and trigger
|
* operate in PWM mode could produce excessive on-board currents and trigger
|
||||||
* over-current/alarm function.
|
* over-current/alarm function.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returned Value:
|
||||||
* OK on success
|
* OK on success
|
||||||
* ERROR on invalid port
|
* ERROR on invalid port
|
||||||
*
|
*
|
||||||
@ -487,22 +487,21 @@ bool stm32_gpioread(uint32_t pinset);
|
|||||||
* Description:
|
* Description:
|
||||||
* Sets/clears GPIO based event and interrupt triggers.
|
* Sets/clears GPIO based event and interrupt triggers.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* - pinset: gpio pin configuration
|
* - pinset: gpio pin configuration
|
||||||
* - rising/falling edge: enables
|
* - rising/falling edge: enables
|
||||||
* - event: generate event when set
|
* - event: generate event when set
|
||||||
* - func: when non-NULL, generate interrupt
|
* - func: when non-NULL, generate interrupt
|
||||||
* - arg: Argument passed to the interrupt callback
|
* - arg: Argument passed to the interrupt callback
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returned Value:
|
||||||
* The previous value of the interrupt handler function pointer. This value may,
|
* Zero (OK) on success; a negated errno value on failure indicating the
|
||||||
* for example, be used to restore the previous handler when multiple handlers are
|
* nature of the failure.
|
||||||
* used.
|
|
||||||
*
|
*
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
int stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||||
bool event, xcpt_t func, void *arg);
|
bool event, xcpt_t func, void *arg);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Function: stm32_dumpgpio
|
* Function: stm32_dumpgpio
|
||||||
|
@ -668,16 +668,16 @@ static void stm32_configwaitints(struct stm32_dev_s *priv, uint32_t waitmask,
|
|||||||
|
|
||||||
/* Arm the SDIO_D Ready and install Isr */
|
/* Arm the SDIO_D Ready and install Isr */
|
||||||
|
|
||||||
stm32_gpiosetevent(pinset, true, false, false,
|
(void)stm32_gpiosetevent(pinset, true, false, false,
|
||||||
stm32_rdyinterrupt, priv);
|
stm32_rdyinterrupt, priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disarm SDIO_D ready */
|
/* Disarm SDIO_D ready */
|
||||||
|
|
||||||
if ((wkupevent & SDIOWAIT_WRCOMPLETE) != 0)
|
if ((wkupevent & SDIOWAIT_WRCOMPLETE) != 0)
|
||||||
{
|
{
|
||||||
stm32_gpiosetevent(GPIO_SDIO_D0, false, false, false,
|
(void)stm32_gpiosetevent(GPIO_SDIO_D0, false, false, false,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
stm32_configgpio(GPIO_SDIO_D0);
|
stm32_configgpio(GPIO_SDIO_D0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -72,7 +72,7 @@ extern "C"
|
|||||||
* Description:
|
* Description:
|
||||||
* Sets/clears GPIO based event and interrupt triggers.
|
* Sets/clears GPIO based event and interrupt triggers.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* - pinset: GPIO pin configuration
|
* - pinset: GPIO pin configuration
|
||||||
* - risingedge: Enables interrupt on rising edges
|
* - risingedge: Enables interrupt on rising edges
|
||||||
* - fallingedge: Enables interrupt on falling edges
|
* - fallingedge: Enables interrupt on falling edges
|
||||||
@ -80,15 +80,14 @@ extern "C"
|
|||||||
* - func: When non-NULL, generate interrupt
|
* - func: When non-NULL, generate interrupt
|
||||||
* - arg: Argument passed to the interrupt callback
|
* - arg: Argument passed to the interrupt callback
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returned Value:
|
||||||
* The previous value of the interrupt handler function pointer. This
|
* Zero (OK) on success; a negated errno value on failure indicating the
|
||||||
* value may, for example, be used to restore the previous handler when
|
* nature of the failure.
|
||||||
* multiple handlers are used.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
int stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||||
bool event, xcpt_t func, void *arg);
|
bool event, xcpt_t func, void *arg);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: stm32_exti_alarm
|
* Name: stm32_exti_alarm
|
||||||
@ -96,14 +95,14 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
|||||||
* Description:
|
* Description:
|
||||||
* Sets/clears EXTI alarm interrupt.
|
* Sets/clears EXTI alarm interrupt.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* - risingedge: Enables interrupt on rising edges
|
* - risingedge: Enables interrupt on rising edges
|
||||||
* - fallingedge: Enables interrupt on falling edges
|
* - fallingedge: Enables interrupt on falling edges
|
||||||
* - event: Generate event when set
|
* - event: Generate event when set
|
||||||
* - func: When non-NULL, generate interrupt
|
* - func: When non-NULL, generate interrupt
|
||||||
* - arg: Argument passed to the interrupt callback
|
* - arg: Argument passed to the interrupt callback
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returned Value:
|
||||||
* Zero (OK) on success; a negated errno value on failure indicating the
|
* Zero (OK) on success; a negated errno value on failure indicating the
|
||||||
* nature of the failure.
|
* nature of the failure.
|
||||||
*
|
*
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* arch/arm/src/stm32f7/stm32_exti_gpio.c
|
* arch/arm/src/stm32f7/stm32_exti_gpio.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2015, 2017 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* Based on EXTI GPIO logic from the Cortex-M3/4 which includes contributions
|
* Based on EXTI GPIO logic from the Cortex-M3/4 which includes contributions
|
||||||
@ -262,7 +262,7 @@ static int stm32_exti1510_isr(int irq, void *context, void *arg)
|
|||||||
* Description:
|
* Description:
|
||||||
* Sets/clears GPIO based event and interrupt triggers.
|
* Sets/clears GPIO based event and interrupt triggers.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* - pinset: GPIO pin configuration
|
* - pinset: GPIO pin configuration
|
||||||
* - risingedge: Enables interrupt on rising edges
|
* - risingedge: Enables interrupt on rising edges
|
||||||
* - fallingedge: Enables interrupt on falling edges
|
* - fallingedge: Enables interrupt on falling edges
|
||||||
@ -270,22 +270,20 @@ static int stm32_exti1510_isr(int irq, void *context, void *arg)
|
|||||||
* - func: When non-NULL, generate interrupt
|
* - func: When non-NULL, generate interrupt
|
||||||
* - arg: Argument passed to the interrupt callback
|
* - arg: Argument passed to the interrupt callback
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returned Value:
|
||||||
* The previous value of the interrupt handler function pointer. This
|
* Zero (OK) on success; a negated errno value on failure indicating the
|
||||||
* value may, for example, be used to restore the previous handler when
|
* nature of the failure.
|
||||||
* multiple handlers are used.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
int stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||||
bool event, xcpt_t func, void *arg)
|
bool event, xcpt_t func, void *arg)
|
||||||
{
|
{
|
||||||
struct gpio_callback_s *shared_cbs;
|
struct gpio_callback_s *shared_cbs;
|
||||||
uint32_t pin = pinset & GPIO_PIN_MASK;
|
uint32_t pin = pinset & GPIO_PIN_MASK;
|
||||||
uint32_t exti = STM32_EXTI_BIT(pin);
|
uint32_t exti = STM32_EXTI_BIT(pin);
|
||||||
int irq;
|
int irq;
|
||||||
xcpt_t handler;
|
xcpt_t handler;
|
||||||
xcpt_t oldhandler = NULL;
|
|
||||||
int nshared;
|
int nshared;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -336,7 +334,6 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
|||||||
|
|
||||||
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
|
/* Get the previous GPIO IRQ handler; Save the new IRQ handler. */
|
||||||
|
|
||||||
oldhandler = g_gpio_callbacks[pin].callback;
|
|
||||||
g_gpio_callbacks[pin].callback = func;
|
g_gpio_callbacks[pin].callback = func;
|
||||||
g_gpio_callbacks[pin].arg = arg;
|
g_gpio_callbacks[pin].arg = arg;
|
||||||
|
|
||||||
@ -396,9 +393,7 @@ xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
|||||||
func ? 0 : exti,
|
func ? 0 : exti,
|
||||||
func ? exti : 0);
|
func ? exti : 0);
|
||||||
|
|
||||||
/* Return the old IRQ handler */
|
return OK;
|
||||||
|
|
||||||
return oldhandler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_STM32F7_STM32F74XX || CONFIG_STM32F7_STM32F75XX */
|
#endif /* CONFIG_STM32F7_STM32F74XX || CONFIG_STM32F7_STM32F75XX */
|
||||||
|
@ -266,7 +266,7 @@ EXTERN const uint32_t g_gpiobase[STM32F7_NGPIO];
|
|||||||
* function, it must be unconfigured with stm32_unconfiggpio() with
|
* function, it must be unconfigured with stm32_unconfiggpio() with
|
||||||
* the same cfgset first before it can be set to non-alternative function.
|
* the same cfgset first before it can be set to non-alternative function.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returned Value:
|
||||||
* OK on success
|
* OK on success
|
||||||
* ERROR on invalid port, or when pin is locked as ALT function.
|
* ERROR on invalid port, or when pin is locked as ALT function.
|
||||||
*
|
*
|
||||||
@ -287,7 +287,7 @@ int stm32_configgpio(uint32_t cfgset);
|
|||||||
* operate in PWM mode could produce excessive on-board currents and trigger
|
* operate in PWM mode could produce excessive on-board currents and trigger
|
||||||
* over-current/alarm function.
|
* over-current/alarm function.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returned Value:
|
||||||
* OK on success
|
* OK on success
|
||||||
* ERROR on invalid port
|
* ERROR on invalid port
|
||||||
*
|
*
|
||||||
@ -321,7 +321,7 @@ bool stm32_gpioread(uint32_t pinset);
|
|||||||
* Description:
|
* Description:
|
||||||
* Sets/clears GPIO based event and interrupt triggers.
|
* Sets/clears GPIO based event and interrupt triggers.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Input Parameters:
|
||||||
* - pinset: GPIO pin configuration
|
* - pinset: GPIO pin configuration
|
||||||
* - risingedge: Enables interrupt on rising edges
|
* - risingedge: Enables interrupt on rising edges
|
||||||
* - fallingedge: Enables interrupt on falling edges
|
* - fallingedge: Enables interrupt on falling edges
|
||||||
@ -329,15 +329,14 @@ bool stm32_gpioread(uint32_t pinset);
|
|||||||
* - func: When non-NULL, generate interrupt
|
* - func: When non-NULL, generate interrupt
|
||||||
* - arg: Argument passed to the interrupt callback
|
* - arg: Argument passed to the interrupt callback
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returned Value:
|
||||||
* The previous value of the interrupt handler function pointer. This
|
* Zero (OK) on success; a negated errno value on failure indicating the
|
||||||
* value may, for example, be used to restore the previous handler when
|
* nature of the failure.
|
||||||
* multiple handlers are used.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
xcpt_t stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
int stm32_gpiosetevent(uint32_t pinset, bool risingedge, bool fallingedge,
|
||||||
bool event, xcpt_t func, void *arg);
|
bool event, xcpt_t func, void *arg);
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Function: stm32_dumpgpio
|
* Function: stm32_dumpgpio
|
||||||
|
@ -846,16 +846,16 @@ static void stm32_configwaitints(struct stm32_dev_s *priv, uint32_t waitmask,
|
|||||||
|
|
||||||
/* Arm the SDMMC_D Ready and install Isr */
|
/* Arm the SDMMC_D Ready and install Isr */
|
||||||
|
|
||||||
stm32_gpiosetevent(pinset, true, false, false,
|
(void)stm32_gpiosetevent(pinset, true, false, false,
|
||||||
priv->wrchandler, priv);
|
priv->wrchandler, priv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disarm SDMMC_D ready */
|
/* Disarm SDMMC_D ready */
|
||||||
|
|
||||||
if ((wkupevent & SDIOWAIT_WRCOMPLETE) != 0)
|
if ((wkupevent & SDIOWAIT_WRCOMPLETE) != 0)
|
||||||
{
|
{
|
||||||
stm32_gpiosetevent(priv->d0_gpio, false, false, false,
|
(void)stm32_gpiosetevent(priv->d0_gpio, false, false, false,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
stm32_configgpio(priv->d0_gpio);
|
stm32_configgpio(priv->d0_gpio);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -159,18 +160,17 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler,
|
||||||
irqhandler, arg);
|
arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -135,8 +136,8 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler;
|
|
||||||
uint16_t gpio;
|
uint16_t gpio;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (id == BUTTON_KEY1)
|
if (id == BUTTON_KEY1)
|
||||||
{
|
{
|
||||||
@ -148,13 +149,10 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return NULL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
oldhandler = stm32_gpiosetevent(gpio, true, true, true, irqhandler, arg);
|
return stm32_gpiosetevent(gpio, true, true, true, irqhandler, arg);
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -134,8 +135,8 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
|
||||||
uint32_t pinset = GPIO_BTN_KEYA;
|
uint32_t pinset = GPIO_BTN_KEYA;
|
||||||
|
int ret = -EINVAL;
|
||||||
|
|
||||||
if (id == 1)
|
if (id == 1)
|
||||||
{
|
{
|
||||||
@ -144,12 +145,10 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
|||||||
|
|
||||||
if (id < 2)
|
if (id < 2)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(pinset, true, true, true,
|
ret = stm32_gpiosetevent(pinset, true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/irq.h>
|
#include <nuttx/irq.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -106,16 +107,14 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
if (id == BUTTON_USER)
|
if (id == BUTTON_USER)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true,
|
ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -43,6 +43,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
#include <arch/board/board.h>
|
#include <arch/board/board.h>
|
||||||
@ -52,22 +53,6 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Function Prototypes
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -127,16 +112,15 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
if (id == BUTTON_USER)
|
if (id == BUTTON_USER)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true,
|
ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler,
|
||||||
irqhandler, arg);
|
arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -49,18 +50,6 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -124,16 +113,14 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
if (id == BUTTON_USER)
|
if (id == BUTTON_USER)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true,
|
ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -49,18 +50,6 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -124,16 +113,14 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
if (id == BUTTON_USER)
|
if (id == BUTTON_USER)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true,
|
ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -50,7 +51,7 @@
|
|||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Pin configuration for each Olimex-STM32-H405 button. This array is
|
/* Pin configuration for each Olimex-STM32-H405 button. This array is
|
||||||
@ -134,18 +135,17 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler =
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler,
|
||||||
stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -49,18 +50,10 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* Pin configuration for each Olimex-STM32-H405 button. This array is indexed by
|
/* Pin configuration for each Olimex-STM32-H405 button. This array is indexed by
|
||||||
* the BUTTON_* definitions in board.h
|
* the BUTTON_* definitions in board.h
|
||||||
*/
|
*/
|
||||||
@ -142,18 +135,16 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -50,7 +51,7 @@
|
|||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Pin configuration for each Olimex-STM32-H405 button. This array is indexed by
|
/* Pin configuration for each Olimex-STM32-H405 button. This array is indexed by
|
||||||
@ -134,18 +135,17 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler,
|
||||||
irqhandler, arg);
|
arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -49,18 +50,10 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* Pin configuration for each STM32F4 Discovery button. This array is indexed by
|
/* Pin configuration for each STM32F4 Discovery button. This array is indexed by
|
||||||
* the BUTTON_* definitions in board.h
|
* the BUTTON_* definitions in board.h
|
||||||
*/
|
*/
|
||||||
@ -178,18 +171,16 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -52,7 +53,7 @@
|
|||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Functions
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Pin configuration for each STM32F4 Discovery button. This array is indexed by
|
/* Pin configuration for each STM32F4 Discovery button. This array is indexed by
|
||||||
@ -172,18 +173,16 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -50,21 +51,10 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Data
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Button support.
|
* Button support.
|
||||||
*
|
*
|
||||||
@ -133,18 +123,17 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id == IRQBUTTON)
|
if (id == IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(BUTTON_BOOT0n, true, true, true,
|
ret = stm32_gpiosetevent(BUTTON_BOOT0n, true, true, true, irqhandler,
|
||||||
irqhandler, arg);
|
arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -49,13 +50,10 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Pin configuration for each Shenzhou button. This array is indexed by
|
/* Pin configuration for each Shenzhou button. This array is indexed by
|
||||||
* the BUTTON_* definitions in board.h
|
* the BUTTON_* definitions in board.h
|
||||||
*/
|
*/
|
||||||
@ -65,10 +63,6 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
|||||||
GPIO_BTN_USERKEY2, GPIO_BTN_USERKEY, GPIO_BTN_TAMPER, GPIO_BTN_WAKEUP
|
GPIO_BTN_USERKEY2, GPIO_BTN_USERKEY, GPIO_BTN_TAMPER, GPIO_BTN_WAKEUP
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -157,18 +151,16 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -109,17 +110,16 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id == BUTTON_USER)
|
if (id == BUTTON_USER)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(GPIO_BTN, true, true, true, irqhandler, arg);
|
ret = stm32_gpiosetevent(GPIO_BTN, true, true, true, irqhandler, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -162,18 +163,16 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -49,18 +50,10 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
|
/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
|
||||||
* the BUTTON_* and JOYSTICK_* definitions in board.h
|
* the BUTTON_* and JOYSTICK_* definitions in board.h
|
||||||
*/
|
*/
|
||||||
@ -158,18 +151,16 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -158,18 +159,16 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -153,18 +154,17 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler,
|
||||||
irqhandler, arg);
|
arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -49,18 +50,10 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* Pin configuration for each STM32F3Discovery button. This array is indexed by
|
/* Pin configuration for each STM32F3Discovery button. This array is indexed by
|
||||||
* the BUTTON_* definitions in board.h
|
* the BUTTON_* definitions in board.h
|
||||||
*/
|
*/
|
||||||
@ -153,18 +146,16 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -49,18 +50,10 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* Pin configuration for each STM32F4 Discovery button. This array is indexed by
|
/* Pin configuration for each STM32F4 Discovery button. This array is indexed by
|
||||||
* the BUTTON_* definitions in board.h
|
* the BUTTON_* definitions in board.h
|
||||||
*/
|
*/
|
||||||
@ -153,18 +146,16 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -49,18 +50,10 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* Pin configuration for each STM32F4 Discovery button. This array is indexed by
|
/* Pin configuration for each STM32F4 Discovery button. This array is indexed by
|
||||||
* the BUTTON_* definitions in board.h
|
* the BUTTON_* definitions in board.h
|
||||||
*/
|
*/
|
||||||
@ -153,18 +146,16 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -49,18 +50,10 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/* Pin configuration for each STM32F3Discovery button. This array is indexed by
|
/* Pin configuration for each STM32F3Discovery button. This array is indexed by
|
||||||
* the BUTTON_* definitions in board.h
|
* the BUTTON_* definitions in board.h
|
||||||
*/
|
*/
|
||||||
@ -153,18 +146,16 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -108,15 +109,14 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(GPIO_BTN_0, true, true, true, irqhandler, arg);
|
ret = stm32_gpiosetevent(GPIO_BTN_0, true, true, true, irqhandler, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
#include <nuttx/board.h>
|
#include <nuttx/board.h>
|
||||||
@ -49,13 +50,10 @@
|
|||||||
|
|
||||||
#ifdef CONFIG_ARCH_BUTTONS
|
#ifdef CONFIG_ARCH_BUTTONS
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Private Data
|
* Private Data
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
|
/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
|
||||||
* the BUTTON_* and JOYSTICK_* definitions in board.h
|
* the BUTTON_* and JOYSTICK_* definitions in board.h
|
||||||
*/
|
*/
|
||||||
@ -65,10 +63,6 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
|||||||
GPIO_SW2, GPIO_SW3, GPIO_SW4
|
GPIO_SW2, GPIO_SW3, GPIO_SW4
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Private Functions
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -153,18 +147,16 @@ uint8_t board_buttons(void)
|
|||||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||||
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||||
{
|
{
|
||||||
xcpt_t oldhandler = NULL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
/* The following should be atomic */
|
/* The following should be atomic */
|
||||||
|
|
||||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||||
{
|
{
|
||||||
oldhandler = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||||
irqhandler, arg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UNUSED(oldhandler);
|
return ret;
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_ARCH_BUTTONS */
|
#endif /* CONFIG_ARCH_BUTTONS */
|
||||||
|
@ -585,11 +585,10 @@ struct cc1101_dev_s *cc1101_init(struct spi_dev_s *spi, uint8_t isrpin,
|
|||||||
|
|
||||||
cc1101_setgdo(dev, dev->isrpin, CC1101_GDO_SYNC);
|
cc1101_setgdo(dev, dev->isrpin, CC1101_GDO_SYNC);
|
||||||
|
|
||||||
/* Bind to external interrupt line */
|
/* Configure to receive interrupts on the external GPIO interrupt line.
|
||||||
|
*
|
||||||
/* depends on STM32: TODO: Make that config within pinset and
|
* REVISIT: There is no MCU-independent way to do this in this
|
||||||
* provide general gpio interface
|
* context.
|
||||||
* stm32_gpiosetevent(pinset, false, true, true, cc1101_eventcb);
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return dev;
|
return dev;
|
||||||
@ -599,8 +598,11 @@ int cc1101_deinit(struct cc1101_dev_s *dev)
|
|||||||
{
|
{
|
||||||
ASSERT(dev);
|
ASSERT(dev);
|
||||||
|
|
||||||
/* Release interrupt */
|
/* Release the external GPIO interrupt
|
||||||
/* stm32_gpiosetevent(pinset, false, false, false, NULL); */
|
*
|
||||||
|
* REVISIT: There is no MCU-independent way to do this in this
|
||||||
|
* context.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Power down chip */
|
/* Power down chip */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user