mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
committed by
Abdelatif Guettouche
parent
1b47aa1cb2
commit
a61b8a13c6
@@ -32,6 +32,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* The Olimex board has four buttons, BUT1-4. Each is grounded and so should
|
||||
* have a weak pull-up so that it will be sensed as "1" when open and "0"
|
||||
* when closed.
|
||||
|
||||
@@ -60,10 +60,10 @@
|
||||
* low-power wake up signal.
|
||||
* Also, only SW3 can be a non-maskable interrupt.
|
||||
*
|
||||
* Switch GPIO Function
|
||||
* --------- ---------------------------------------------------------------
|
||||
* SW2 PTC6/SPI0_SOUT/PD0_EXTRG/I2S0_RX_BCLK/FB_AD9/I2S0_MCLK/LLWU_P10
|
||||
* SW3 PTA4/FTM0_CH1/NMI_b/LLWU_P3
|
||||
* Switch GPIO Function
|
||||
* -------- ---------------------------------------------------------------
|
||||
* SW2 PTC6/SPI0_SOUT/PD0_EXTRG/I2S0_RX_BCLK/FB_AD9/I2S0_MCLK/LLWU_P10
|
||||
* SW3 PTA4/FTM0_CH1/NMI_b/LLWU_P3
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -64,10 +64,10 @@
|
||||
* low-power wake up signal.
|
||||
* Also, only SW3 can be a non-maskable interrupt.
|
||||
*
|
||||
* Switch GPIO Function
|
||||
* --------- ---------------------------------------------------------------
|
||||
* SW2 PTD11/LLWU_P25/SPI2_PCS0/SDHC0_CLKIN/LPUART0_CTS/FB_A19
|
||||
* SW3 PTA10/LLWU_P22/FTM2_CH0/MII0_RXD2/FTM2_QD_PHA/TPM2_CH0/TRACE_D0
|
||||
* Switch GPIO Function
|
||||
* -------- ---------------------------------------------------------------
|
||||
* SW2 PTD11/LLWU_P25/SPI2_PCS0/SDHC0_CLKIN/LPUART0_CTS/FB_A19
|
||||
* SW3 PTA10/LLWU_P22/FTM2_CH0/MII0_RXD2/FTM2_QD_PHA/TPM2_CH0/TRACE_D0
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
@@ -59,8 +59,8 @@
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of
|
||||
* all buttons or board_button_irq() may be called to register button
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -88,8 +88,8 @@ uint32_t board_buttons(void)
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of
|
||||
* all buttons or board_button_irq() may be called to register button
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* The TWR-K60N512 has user buttons (plus a reset button):
|
||||
*
|
||||
* 1. SW1 (IRQ0) PTA19
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
|
||||
* the BUTTON_* and JOYSTICK_* definitions in board.h
|
||||
*/
|
||||
@@ -158,8 +159,8 @@ uint32_t board_buttons(void)
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* After that, board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
* will be called when a button is depressed or released. The ID value is
|
||||
|
||||
@@ -73,8 +73,8 @@
|
||||
* JOY_D -- Connected to P2[19]
|
||||
* JOY_CTR -- Connected to P0[14]
|
||||
*
|
||||
* The switches are all connected to ground and should be pulled up and sensed
|
||||
* with a value of '0' when closed.
|
||||
* The switches are all connected to ground and should be pulled up and
|
||||
* sensed with a value of '0' when closed.
|
||||
*/
|
||||
|
||||
/* Pin configuration for each LPC4088 Developer's Kit button. This array is
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
|
||||
* the BUTTON_* and JOYSTICK_* definitions in board.h
|
||||
*/
|
||||
@@ -96,8 +97,8 @@ static uint8_t g_buttonirq[NUM_BUTTONS] =
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of
|
||||
* all buttons or board_button_irq() may be called to register button
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -161,8 +162,8 @@ uint32_t board_buttons(void)
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* After that, board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
* will be called when a button is depressed or released. The ID value is
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* The Open1788 supports several buttons. All will read "1" when open and "0"
|
||||
* when closed
|
||||
/* The Open1788 supports several buttons. All will read "1" when open and
|
||||
* "0" when closed
|
||||
*
|
||||
* USER1 -- Connected to P4[26]
|
||||
* USER2 -- Connected to P2[22]
|
||||
@@ -73,8 +73,8 @@
|
||||
* JOY_D -- Connected to P2[19]
|
||||
* JOY_CTR -- Connected to P0[14]
|
||||
*
|
||||
* The switches are all connected to ground and should be pulled up and sensed
|
||||
* with a value of '0' when closed.
|
||||
* The switches are all connected to ground and should be pulled up and
|
||||
* sensed with a value of '0' when closed.
|
||||
*/
|
||||
|
||||
/* Pin configuration for each Open1788 button. This array is indexed by
|
||||
@@ -108,8 +108,8 @@ static const uint8_t g_buttonirq[NUM_BUTTONS] =
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of
|
||||
* all buttons or board_button_irq() may be called to register button
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each zkit-arm-1769 button.
|
||||
* This array is indexed by NUM_BUTTONS in board.h
|
||||
*/
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
* Alan Carvalho de Assis acassis@gmail.com [nuttx] <nuttx@googlegroups.com>
|
||||
* Alan Carvalho de Assis acassis@gmail.com
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
||||
@@ -158,8 +158,8 @@ uint32_t board_buttons(void)
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* After that, board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
* will be called when a button is depressed or released.
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each LPC4357-EVB button. This array is indexed by
|
||||
* the BUTTON_* definitions in board.h
|
||||
*/
|
||||
@@ -164,8 +165,8 @@ uint32_t board_buttons(void)
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* After that, board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
* will be called when a button is depressed or released.
|
||||
|
||||
@@ -67,13 +67,13 @@
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static int board_button_irqx(gpio_pinset_t pinset, int irq, xcpt_t irqhandler,
|
||||
void *arg)
|
||||
static int board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
xcpt_t irqhandler, void *arg)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
/* Disable interrupts until we are done. This guarantees that the following
|
||||
* operations are atomic.
|
||||
/* Disable interrupts until we are done. This guarantees that the
|
||||
* following operations are atomic.
|
||||
*/
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
@@ -67,13 +67,13 @@
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_SAM34_GPIOA_IRQ) && defined(CONFIG_ARCH_IRQBUTTONS)
|
||||
static int board_button_irqx(gpio_pinset_t pinset, int irq, xcpt_t irqhandler,
|
||||
void *arg)
|
||||
static int board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
xcpt_t irqhandler, void *arg)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
/* Disable interrupts until we are done. This guarantees that the following
|
||||
* operations are atomic.
|
||||
/* Disable interrupts until we are done. This guarantees that the
|
||||
* following operations are atomic.
|
||||
*/
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* There are five push button switches on the SAMA5D3X-EK base board:
|
||||
*
|
||||
* 1. One Reset, board reset (BP1)
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* A single button, PB_USER1 (PB2), is available on the SAMA5D4-EK:
|
||||
*
|
||||
* ------------------------------ ------------------- ----------------------
|
||||
|
||||
@@ -63,8 +63,8 @@
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of
|
||||
* all buttons or board_button_irq() may be called to register button
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -63,8 +63,8 @@
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of
|
||||
* all buttons or board_button_irq() may be called to register button
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -85,8 +85,8 @@ static int board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
/* Disable interrupts until we are done. This guarantees that the following
|
||||
* operations are atomic.
|
||||
/* Disable interrupts until we are done. This guarantees that the
|
||||
* following operations are atomic.
|
||||
*/
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
@@ -84,13 +84,13 @@
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef HAVE_IRQBUTTONS
|
||||
static int board_button_irqx(gpio_pinset_t pinset, int irq, xcpt_t irqhandler,
|
||||
void *arg)
|
||||
static int board_button_irqx(gpio_pinset_t pinset, int irq,
|
||||
xcpt_t irqhandler, void *arg)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
/* Disable interrupts until we are done. This guarantees that the following
|
||||
* operations are atomic.
|
||||
/* Disable interrupts until we are done. This guarantees that the
|
||||
* following operations are atomic.
|
||||
*/
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
@@ -61,10 +61,10 @@
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -106,20 +106,20 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() 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
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each cloudctrl button. This array is indexed by
|
||||
* the BUTTON_* definitions in board.h
|
||||
*/
|
||||
@@ -80,9 +81,9 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of
|
||||
* all buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -115,22 +116,22 @@ uint32_t board_buttons(void)
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed for most keys. The exception
|
||||
* is the WAKEUP button.
|
||||
*/
|
||||
/* A LOW value means that the key is pressed for most keys.
|
||||
* The exception is the WAKEUP button.
|
||||
*/
|
||||
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
if (i == BUTTON_WAKEUP)
|
||||
{
|
||||
released = !released;
|
||||
}
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
if (i == BUTTON_WAKEUP)
|
||||
{
|
||||
released = !released;
|
||||
}
|
||||
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -141,9 +142,9 @@ uint32_t board_buttons(void)
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of
|
||||
* all buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
@@ -151,8 +152,8 @@ uint32_t board_buttons(void)
|
||||
* BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning
|
||||
* of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that will
|
||||
* be called when a button is depressed or released. The ID value is a
|
||||
* board_button_irq() 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.
|
||||
|
||||
@@ -71,9 +71,9 @@
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of
|
||||
* all buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -96,7 +96,9 @@ uint32_t board_buttons(void)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
|
||||
/* Check that state of each key. A LOW value means that the key is pressed, */
|
||||
/* Check that state of each key.
|
||||
* A LOW value means that the key is pressed.
|
||||
*/
|
||||
|
||||
if (!stm32_gpioread(GPIO_BTN_KEY1))
|
||||
{
|
||||
@@ -116,9 +118,9 @@ uint32_t board_buttons(void)
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
@@ -126,8 +128,8 @@ uint32_t board_buttons(void)
|
||||
* BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning
|
||||
* of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that will
|
||||
* be called when a button is depressed or released. The ID value is a
|
||||
* board_button_irq() 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 values.
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32/hymini-stm32v/src/stm32_buttons.c
|
||||
*
|
||||
* Copyright (C) 2009, 2011, 2014-2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009, 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
|
||||
@@ -61,9 +62,9 @@
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of
|
||||
* all buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -81,14 +82,14 @@ uint32_t board_button_initialize(void)
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
uint32_t ret = 0;
|
||||
bool pinValue;
|
||||
bool value;
|
||||
|
||||
/* Check that state of each key */
|
||||
|
||||
/* Pin is pulled up */
|
||||
|
||||
pinValue = stm32_gpioread(GPIO_BTN_KEYA);
|
||||
if (!pinValue)
|
||||
value = stm32_gpioread(GPIO_BTN_KEYA);
|
||||
if (!value)
|
||||
{
|
||||
/* Button pressed */
|
||||
|
||||
@@ -97,8 +98,8 @@ uint32_t board_buttons(void)
|
||||
|
||||
/* Pin is pulled down */
|
||||
|
||||
pinValue = stm32_gpioread(GPIO_BTN_KEYB);
|
||||
if (pinValue)
|
||||
value = stm32_gpioread(GPIO_BTN_KEYB);
|
||||
if (value)
|
||||
{
|
||||
/* Button pressed */
|
||||
|
||||
@@ -113,9 +114,9 @@ uint32_t board_buttons(void)
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of
|
||||
* all buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
@@ -123,8 +124,8 @@ uint32_t board_buttons(void)
|
||||
* BUTTON_*_BIT and JOYSTICK_*_BIT definitions in board.h for the meaning
|
||||
* of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that will
|
||||
* be called when a button is depressed or released. The ID value is a
|
||||
* board_button_irq() 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.
|
||||
|
||||
@@ -98,7 +98,8 @@ uint32_t board_buttons(void)
|
||||
* board_button_irq() 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.
|
||||
* See the BUTTON_* definitions in board.h for the meaning of enumeration
|
||||
* value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -98,7 +98,8 @@ uint32_t board_buttons(void)
|
||||
* board_button_irq() 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.
|
||||
* See the BUTTON_* definitions in board.h for the meaning of enumeration
|
||||
* value.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -93,20 +93,20 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() 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
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -118,7 +118,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id == BUTTON_USER)
|
||||
{
|
||||
ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -94,8 +94,8 @@ uint32_t board_buttons(void)
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of
|
||||
* all buttons or board_button_irq() may be called to register button
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
|
||||
@@ -95,20 +95,20 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() 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
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -120,7 +120,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id == BUTTON_USER)
|
||||
{
|
||||
ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -123,8 +123,8 @@ uint32_t board_buttons(void)
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
* will be called when a button is depressed or released. The ID value is
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each Olimex-STM32-H405 button. This array is indexed by
|
||||
* the BUTTON_* definitions in board.h
|
||||
/* Pin configuration for each Olimex-STM32-H405 button. This array is indexed
|
||||
* by the BUTTON_* definitions in board.h
|
||||
*/
|
||||
|
||||
static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
@@ -71,10 +71,10 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -116,20 +116,20 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() 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
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -143,7 +143,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each Olimex-STM32-H405 button. This array is indexed by
|
||||
* the BUTTON_* definitions in board.h
|
||||
/* Pin configuration for each Olimex-STM32-H405 button. This array is indexed
|
||||
* by the BUTTON_* definitions in board.h
|
||||
*/
|
||||
|
||||
static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
@@ -123,8 +123,8 @@ uint32_t board_buttons(void)
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() may be called to register an interrupt handler that
|
||||
* will be called when a button is depressed or released. The ID value is
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each STM32F4 Discovery button. This array is indexed by
|
||||
* the BUTTON_* definitions in board.h
|
||||
/* Pin configuration for each STM32F4 Discovery button. This array is indexed
|
||||
* by the BUTTON_* definitions in board.h
|
||||
*/
|
||||
|
||||
static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
@@ -77,10 +77,10 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -152,20 +152,20 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() 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
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -179,7 +179,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -56,8 +56,8 @@
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each STM32F4 Discovery button. This array is indexed by
|
||||
* the BUTTON_* definitions in board.h
|
||||
/* Pin configuration for each STM32F4 Discovery button. This array is indexed
|
||||
* by the BUTTON_* definitions in board.h
|
||||
*/
|
||||
|
||||
static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
@@ -79,10 +79,10 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -154,20 +154,20 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() 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
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -181,7 +181,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -56,14 +56,14 @@
|
||||
# undef CONFIG_STM32_SPI2
|
||||
#endif
|
||||
|
||||
/* LEDs *****************************************************************************
|
||||
/* LEDs *********************************************************************
|
||||
*
|
||||
* GPIO Function MPU Board
|
||||
* Pin # Name
|
||||
* -- ----- -------------------------------- ----------------------------
|
||||
* GPIO Function MPU Board
|
||||
* Pin # Name
|
||||
* -- ----- -------------------------------- ----------------------------
|
||||
*
|
||||
* PA[05] PA5/SPI1_SCK/ADC5 21 D13(SCK1/LED1)
|
||||
* PA[01] PA1/USART2_RTS/ADC1/TIM2_CH2 15 D3(LED2)
|
||||
* PA[05] PA5/SPI1_SCK/ADC5 21 D13(SCK1/LED1)
|
||||
* PA[01] PA1/USART2_RTS/ADC1/TIM2_CH2 15 D3(LED2)
|
||||
*/
|
||||
|
||||
#define GPIO_LED1 (GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz | \
|
||||
@@ -73,28 +73,28 @@
|
||||
GPIO_PORTA | GPIO_PIN1 | GPIO_OUTPUT_CLEAR)
|
||||
#define GPIO_LED_YELLOW GPIO_LED2
|
||||
|
||||
/* BUTTON ***************************************************************************
|
||||
/* BUTTON *******************************************************************
|
||||
*
|
||||
* GPIO Function MPU Board
|
||||
* Pin # Name
|
||||
* -- ----- -------------------------------- ----------------------------
|
||||
* GPIO Function MPU Board
|
||||
* Pin # Name
|
||||
* -- ----- -------------------------------- ----------------------------
|
||||
*
|
||||
* PC[09] PC9/TIM3_CH4 40 BOOT0
|
||||
* PC[09] PC9/TIM3_CH4 40 BOOT0
|
||||
*
|
||||
*/
|
||||
|
||||
#define BUTTON_BOOT0n (GPIO_INPUT | GPIO_CNF_INFLOAT | GPIO_PORTC | GPIO_PIN9 | \
|
||||
#define BUTTON_BOOT0N (GPIO_INPUT | GPIO_CNF_INFLOAT | GPIO_PORTC | GPIO_PIN9 | \
|
||||
GPIO_EXTI)
|
||||
#define IRQBUTTON BUTTON_BOOT0_BIT
|
||||
|
||||
/* USBs *****************************************************************************
|
||||
/* USBs *********************************************************************
|
||||
*
|
||||
* GPIO Function MPU Board
|
||||
* Pin # Name
|
||||
* -- ----- -------------------------------- ----------------------------
|
||||
* GPIO Function MPU Board
|
||||
* Pin # Name
|
||||
* -- ----- -------------------------------- ----------------------------
|
||||
*
|
||||
* PC[11] PC11/USART3_RX 52 USB_P
|
||||
* PC[12] PC12/USART3_CK 53 DISC
|
||||
* PC[11] PC11/USART3_RX 52 USB_P
|
||||
* PC[12] PC12/USART3_CK 53 DISC
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -102,14 +102,14 @@
|
||||
#define GPIO_USB_PULLUPn (GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz | \
|
||||
GPIO_PORTC | GPIO_PIN12 | GPIO_OUTPUT_SET)
|
||||
|
||||
/* SPI ***************************************************************************
|
||||
/* SPI **********************************************************************
|
||||
*
|
||||
* GPIO Function MPU Board
|
||||
* Pin # Name
|
||||
* -- ----- -------------------------------- ----------------------------
|
||||
* GPIO Function MPU Board
|
||||
* Pin # Name
|
||||
* -- ----- -------------------------------- ----------------------------
|
||||
*
|
||||
* PC[09] PA4/SPI1_NSS/USART2_CK/ADC4 20 D10(#SS1)
|
||||
* PD[02] PD2/TIM3_ETR 54 D25(MMC_CS)
|
||||
* PC[09] PA4/SPI1_NSS/USART2_CK/ADC4 20 D10(#SS1)
|
||||
* PD[02] PD2/TIM3_ETR 54 D25(MMC_CS)
|
||||
*/
|
||||
|
||||
#define GPIO_SPI1_SSn (GPIO_OUTPUT | GPIO_CNF_OUTPP | GPIO_MODE_50MHz | \
|
||||
@@ -131,7 +131,7 @@
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
* Public Functions Prototype
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
@@ -164,8 +164,8 @@ void stm32_usbinitialize(void);
|
||||
* Called to setup set a call back for USB power state changes.
|
||||
*
|
||||
* Input Parameters:
|
||||
* pwr_changed_handler: An interrupt handler that will be called on VBUS power
|
||||
* state changes.
|
||||
* pwr_changed_handler: An interrupt handler that will be called on VBUS
|
||||
* power state changes.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
@@ -79,15 +79,15 @@
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state of
|
||||
* all buttons or board_button_irq() may be called to register button
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
uint32_t board_button_initialize(void)
|
||||
{
|
||||
stm32_configgpio(BUTTON_BOOT0n);
|
||||
stm32_configgpio(BUTTON_BOOT0N);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ uint32_t board_button_initialize(void)
|
||||
|
||||
uint32_t board_buttons(void)
|
||||
{
|
||||
return stm32_gpioread(BUTTON_BOOT0n) ? 0 : BUTTON_BOOT0_MASK;
|
||||
return stm32_gpioread(BUTTON_BOOT0N) ? 0 : BUTTON_BOOT0_MASK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -130,8 +130,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id == IRQBUTTON)
|
||||
{
|
||||
ret = stm32_gpiosetevent(BUTTON_BOOT0n, true, true, true, irqhandler,
|
||||
arg);
|
||||
ret = stm32_gpiosetevent(BUTTON_BOOT0N, true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -71,10 +71,10 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -107,22 +107,22 @@ uint32_t board_buttons(void)
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed for most keys. The exception
|
||||
* is the WAKEUP button.
|
||||
*/
|
||||
/* A LOW value means that the key is pressed for most keys.
|
||||
* The exception is the WAKEUP button.
|
||||
*/
|
||||
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
if (i == BUTTON_WAKEUP)
|
||||
{
|
||||
released = !released;
|
||||
}
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
if (i == BUTTON_WAKEUP)
|
||||
{
|
||||
released = !released;
|
||||
}
|
||||
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -132,21 +132,22 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-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.
|
||||
*
|
||||
* board_button_irq() 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.
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -159,7 +160,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32/stm3210e-eval/src/stm32_buttons.c
|
||||
*
|
||||
* Copyright (C) 2009, 2011, 2014-2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009, 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
|
||||
@@ -54,6 +55,7 @@
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each STM3210E-EVAL button. This array is indexed by
|
||||
* the BUTTON_* and JOYSTICK_* definitions in board.h
|
||||
*/
|
||||
@@ -84,10 +86,10 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -120,22 +122,22 @@ uint32_t board_buttons(void)
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed for most keys. The exception
|
||||
* is the WAKEUP button.
|
||||
*/
|
||||
/* A LOW value means that the key is pressed for most keys.
|
||||
* The exception is the WAKEUP button.
|
||||
*/
|
||||
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
if (i == BUTTON_WAKEUP)
|
||||
{
|
||||
released = !released;
|
||||
}
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
if (i == BUTTON_WAKEUP)
|
||||
{
|
||||
released = !released;
|
||||
}
|
||||
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -145,21 +147,22 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-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.
|
||||
*
|
||||
* board_button_irq() 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.
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -172,7 +175,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -71,10 +71,10 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -107,22 +107,22 @@ uint32_t board_buttons(void)
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed for most keys. The exception
|
||||
* is the WAKEUP button.
|
||||
*/
|
||||
/* A LOW value means that the key is pressed for most keys.
|
||||
* The exception is the WAKEUP button.
|
||||
*/
|
||||
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
if (i == BUTTON_WAKEUP)
|
||||
{
|
||||
released = !released;
|
||||
}
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
if (i == BUTTON_WAKEUP)
|
||||
{
|
||||
released = !released;
|
||||
}
|
||||
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -132,20 +132,20 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() 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
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -159,7 +159,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -79,10 +79,10 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -115,22 +115,22 @@ uint32_t board_buttons(void)
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed for most keys. The exception
|
||||
* is the WAKEUP button.
|
||||
*/
|
||||
/* A LOW value means that the key is pressed for most keys.
|
||||
* The exception is the WAKEUP button.
|
||||
*/
|
||||
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
if (i == BUTTON_WAKEUP)
|
||||
{
|
||||
released = !released;
|
||||
}
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
if (i == BUTTON_WAKEUP)
|
||||
{
|
||||
released = !released;
|
||||
}
|
||||
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -140,20 +140,20 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() 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
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -167,7 +167,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32/stm32butterfly2/src/stm32_buttons.c
|
||||
*
|
||||
* Copyright (C) 2016 Michał Łyszczek. All rights reserved.
|
||||
@@ -32,13 +32,13 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* Public Includes
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "stm32_gpio.h"
|
||||
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
#define GPIO_JOY_L (GPIO_INPUT | GPIO_CNF_INFLOAT | GPIO_MODE_INPUT |\
|
||||
GPIO_PORTC | GPIO_PIN11)
|
||||
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* Private Declarations
|
||||
****************************************************************************/
|
||||
|
||||
@@ -64,11 +64,11 @@ static const uint32_t buttons[NUM_BUTTONS] =
|
||||
GPIO_JOY_O, GPIO_JOY_U, GPIO_JOY_D, GPIO_JOY_R, GPIO_JOY_L
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
@@ -87,7 +87,7 @@ uint32_t board_button_initialize(void)
|
||||
return NUM_BUTTONS;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
/****************************************************************************
|
||||
* Name: board_buttons
|
||||
*
|
||||
* Description:
|
||||
|
||||
@@ -116,17 +116,16 @@ uint32_t board_buttons(void)
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed.
|
||||
*/
|
||||
/* A LOW value means that the key is pressed. */
|
||||
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each STM32F3Discovery button. This array is indexed by
|
||||
* the BUTTON_* definitions in board.h
|
||||
/* Pin configuration for each STM32F3Discovery button. This array is indexed
|
||||
* by the BUTTON_* definitions in board.h
|
||||
*/
|
||||
|
||||
static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
@@ -71,10 +71,10 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -107,17 +107,16 @@ uint32_t board_buttons(void)
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed.
|
||||
*/
|
||||
/* A LOW value means that the key is pressed. */
|
||||
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -127,20 +126,20 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() 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
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -154,7 +153,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32/stm32f429i-disco/src/stm32_buttons.c
|
||||
*
|
||||
* Copyright (C) 2011-2012, 2014-2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 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
|
||||
@@ -54,8 +55,8 @@
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each STM32F4 Discovery button. This array is indexed by
|
||||
* the BUTTON_* definitions in board.h
|
||||
/* Pin configuration for each STM32F4 Discovery button. This array is indexed
|
||||
* by the BUTTON_* definitions in board.h
|
||||
*/
|
||||
|
||||
static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
@@ -71,10 +72,10 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -107,17 +108,16 @@ uint32_t board_buttons(void)
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed.
|
||||
*/
|
||||
/* A LOW value means that the key is pressed. */
|
||||
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -127,20 +127,20 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() 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
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -154,7 +154,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/****************************************************************************
|
||||
* boards/arm/stm32/stm32f4discovery/src/stm32_buttons.c
|
||||
*
|
||||
* Copyright (C) 2011-2012, 2014-2015, 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 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
|
||||
@@ -55,8 +56,8 @@
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each STM32F4 Discovery button. This array is indexed by
|
||||
* the BUTTON_* definitions in board.h
|
||||
/* Pin configuration for each STM32F4 Discovery button. This array is indexed
|
||||
* by the BUTTON_* definitions in board.h
|
||||
*/
|
||||
|
||||
static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
@@ -72,10 +73,10 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -108,17 +109,16 @@ uint32_t board_buttons(void)
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed.
|
||||
*/
|
||||
/* A LOW value means that the key is pressed. */
|
||||
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -128,20 +128,20 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() 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
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -155,7 +155,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -55,8 +55,8 @@
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/* Pin configuration for each STM32F3Discovery button. This array is indexed by
|
||||
* the BUTTON_* definitions in board.h
|
||||
/* Pin configuration for each STM32F3Discovery button. This array is indexed
|
||||
* by the BUTTON_* definitions in board.h
|
||||
*/
|
||||
|
||||
static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
@@ -72,10 +72,10 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -108,17 +108,16 @@ uint32_t board_buttons(void)
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed.
|
||||
*/
|
||||
/* A LOW value means that the key is pressed. */
|
||||
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
/* Accumulate the set of depressed (not released) keys */
|
||||
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
if (!released)
|
||||
{
|
||||
ret |= (1 << i);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -128,20 +127,20 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() 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
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -155,7 +154,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -59,10 +59,10 @@
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -89,21 +89,22 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-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.
|
||||
*
|
||||
* board_button_irq() 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.
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -114,7 +115,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id == 0)
|
||||
{
|
||||
ret = stm32_gpiosetevent(GPIO_BTN_0, true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(GPIO_BTN_0, true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -71,10 +71,10 @@ static const uint32_t g_buttons[NUM_BUTTONS] =
|
||||
* Name: board_button_initialize
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -107,8 +107,8 @@ uint32_t board_buttons(void)
|
||||
|
||||
for (i = 0; i < NUM_BUTTONS; i++)
|
||||
{
|
||||
/* A LOW value means that the key is pressed for most keys. The exception
|
||||
* is the WAKEUP button.
|
||||
/* A LOW value means that the key is pressed for most keys. The
|
||||
* exception is the WAKEUP button.
|
||||
*/
|
||||
|
||||
bool released = stm32_gpioread(g_buttons[i]);
|
||||
@@ -128,21 +128,22 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT and JOYSTICK_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-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.
|
||||
*
|
||||
* board_button_irq() 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.
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
@@ -155,7 +156,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id >= MIN_IRQBUTTON && id <= MAX_IRQBUTTON)
|
||||
{
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(g_buttons[id], true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -95,20 +95,20 @@ uint32_t board_buttons(void)
|
||||
* Button support.
|
||||
*
|
||||
* Description:
|
||||
* board_button_initialize() must be called to initialize button resources. After
|
||||
* that, board_buttons() may be called to collect the current state of all
|
||||
* buttons or board_button_irq() may be called to register button interrupt
|
||||
* handlers.
|
||||
* board_button_initialize() must be called to initialize button resources.
|
||||
* After that, board_buttons() may be called to collect the current state
|
||||
* of all buttons or board_button_irq() may be called to register button
|
||||
* interrupt handlers.
|
||||
*
|
||||
* After board_button_initialize() has been called, board_buttons() may be called to
|
||||
* collect the state of all buttons. board_buttons() returns an 32-bit bit set
|
||||
* with each bit associated with a button. See the BUTTON_*_BIT
|
||||
* definitions in board.h for the meaning of each bit.
|
||||
* After board_button_initialize() has been called, board_buttons() may be
|
||||
* called to collect the state of all buttons. board_buttons() returns an
|
||||
* 32-bit bit set with each bit associated with a button. See the
|
||||
* BUTTON_*_BIT definitions in board.h for the meaning of each bit.
|
||||
*
|
||||
* board_button_irq() 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
|
||||
* board_button_irq() 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
@@ -120,7 +120,8 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg)
|
||||
|
||||
if (id == BUTTON_USER)
|
||||
{
|
||||
ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true, irqhandler, arg);
|
||||
ret = stm32_gpiosetevent(GPIO_BTN_USER, true, true, true,
|
||||
irqhandler, arg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user