mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
board_button_irq: Button IRQ logic no longer returns the xcpt_t oldhandler. There value is useless and dangerous after the recent changes to interrupt argument passing.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* configs/twr-k60n512/src/k60_buttons.c
|
||||
*
|
||||
* Copyright (C) 2011, 2014-2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011, 2014-2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
@@ -128,15 +129,13 @@ uint8_t board_buttons(void)
|
||||
* 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).
|
||||
* value.
|
||||
*
|
||||
************************************************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_IRQBUTTONS
|
||||
xcpt_t 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;
|
||||
uint32_t pinset;
|
||||
|
||||
/* Map the button id to the GPIO bit set. */
|
||||
@@ -151,7 +150,7 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* The button has already been configured as an interrupting input (by
|
||||
@@ -160,12 +159,15 @@ xcpt_t board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
* Attach the new button handler.
|
||||
*/
|
||||
|
||||
oldhandler = knetis_pinirqattach(pinset, irqhandler);
|
||||
ret = kinetis_pinirqattach(pinset, irqhandler, arg);
|
||||
if (ret >= 0)
|
||||
{
|
||||
/* Then make sure that interrupts are enabled on the pin */
|
||||
|
||||
/* Then make sure that interrupts are enabled on the pin */
|
||||
kinetis_pindmaenable(pinset);
|
||||
}
|
||||
|
||||
kinetis_pindmaenable(pinset);
|
||||
return oldhandler;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
#endif /* CONFIG_ARCH_BUTTONS */
|
||||
|
||||
Reference in New Issue
Block a user