Button upper half driver: Add definitions needed for compilation with the poll() interface is not disabled.
This commit is contained in:
parent
e891a33c2e
commit
9c4b604074
@ -331,7 +331,7 @@ config BUTTONS
|
||||
if BUTTONS
|
||||
|
||||
config BUTTONS_LOWER
|
||||
bool "Generic Lower Half Button Dirver"
|
||||
bool "Generic Lower Half Button Driver"
|
||||
default n
|
||||
depends on ARCH_BUTTONS && ARCH_IRQBUTTONS
|
||||
---help---
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* drivers/input/button_upper.c
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -230,8 +230,8 @@ static void btn_enable(FAR struct btn_upperhalf_s *priv)
|
||||
{
|
||||
/* Yes.. OR in the poll event buttons */
|
||||
|
||||
press |= opriv->bo_pollevents.ap_press;
|
||||
release |= opriv->bo_pollevents.ap_release;
|
||||
press |= opriv->bo_pollevents.bp_press;
|
||||
release |= opriv->bo_pollevents.bp_release;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -322,8 +322,8 @@ static void btn_sample(FAR struct btn_upperhalf_s *priv)
|
||||
* newly released.
|
||||
*/
|
||||
|
||||
change = sample ^ priv->bu_sample;
|
||||
press = change & sample;
|
||||
change = sample ^ priv->bu_sample;
|
||||
press = change & sample;
|
||||
|
||||
DEBUGASSERT(lower->bl_supported);
|
||||
release = change & (lower->bl_supported(lower) & ~sample);
|
||||
@ -335,8 +335,8 @@ static void btn_sample(FAR struct btn_upperhalf_s *priv)
|
||||
#ifndef CONFIG_DISABLE_POLL
|
||||
/* Have any poll events occurred? */
|
||||
|
||||
if ((press & opriv->bo_pollevents.ap_press) != 0 ||
|
||||
(release & opriv->bo_pollevents.ap_release) != 0)
|
||||
if ((press & opriv->bo_pollevents.bp_press) != 0 ||
|
||||
(release & opriv->bo_pollevents.bp_release) != 0)
|
||||
{
|
||||
/* Yes.. Notify all waiters */
|
||||
|
||||
@ -431,8 +431,8 @@ static int btn_open(FAR struct file *filep)
|
||||
DEBUGASSERT(lower && lower->bl_supported);
|
||||
supported = lower->bl_supported(lower);
|
||||
|
||||
opriv->bo_pollevents.ap_press = supported;
|
||||
opriv->bo_pollevents.ap_release = supported;
|
||||
opriv->bo_pollevents.bp_press = supported;
|
||||
opriv->bo_pollevents.bp_release = supported;
|
||||
#endif
|
||||
|
||||
/* Attach the open structure to the device */
|
||||
@ -664,8 +664,8 @@ static int btn_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
/* Save the poll events */
|
||||
|
||||
opriv->bo_pollevents.ap_press = pollevents->ap_press;
|
||||
opriv->bo_pollevents.ap_release = pollevents->ap_release;
|
||||
opriv->bo_pollevents.bp_press = pollevents->bp_press;
|
||||
opriv->bo_pollevents.bp_release = pollevents->bp_release;
|
||||
|
||||
/* Enable/disable interrupt handling */
|
||||
|
||||
|
@ -61,6 +61,7 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#ifndef CONFIG_AJOYSTICK_NPOLLWAITERS
|
||||
@ -159,6 +160,7 @@
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* This type is a bit set that contains the state of all analog joystick
|
||||
* buttons.
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
/************************************************************************************
|
||||
* include/nuttx/input/buttons.h
|
||||
*
|
||||
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -46,6 +46,7 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Configuration ************************************************************/
|
||||
|
||||
#ifndef CONFIG_BUTTONS_NPOLLWAITERS
|
||||
@ -64,6 +65,17 @@
|
||||
|
||||
#define BTNIOC_SUPPORTED _BTNIOC(0x0001)
|
||||
|
||||
/* Command: BTNIOC_POLLEVENTS
|
||||
* Description: Specify the set of button events that can cause a poll()
|
||||
* to awaken. The default is all button depressions and all
|
||||
* button releases (all supported buttons);
|
||||
* Argument: A read-only pointer to an instance of struct ajoy_pollevents_s
|
||||
* Return: Zero (OK) on success. Minus one will be returned on failure
|
||||
* with the errno value set appropriately.
|
||||
*/
|
||||
|
||||
#define BTNIOC_POLLEVENTS _BTNIOC(0x0002)
|
||||
|
||||
/* Command: BTNIOC_REGISTER
|
||||
* Description: Register to receive a signal whenever there is a change in
|
||||
* the state of button inputs. This feature, of course, depends
|
||||
@ -73,11 +85,12 @@
|
||||
* with the errno value set appropriately.
|
||||
*/
|
||||
|
||||
#define BTNIOC_REGISTER _BTNIOC(0x0002)
|
||||
#define BTNIOC_REGISTER _BTNIOC(0x0003)
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* This type is a bit set that contains the state of all buttons as defined
|
||||
* in arch/board/board.h. This is the value that is returned when reading
|
||||
* from the button driver.
|
||||
@ -85,6 +98,17 @@
|
||||
|
||||
typedef uint8_t btn_buttonset_t;
|
||||
|
||||
/* A reference to this structure is provided with the BTNIOC_POLLEVENTS IOCTL
|
||||
* command and describes the conditions under which the client would like
|
||||
* to receive notification.
|
||||
*/
|
||||
|
||||
struct btn_pollevents_s
|
||||
{
|
||||
btn_buttonset_t bp_press; /* Set of button depressions to wake up the poll */
|
||||
btn_buttonset_t bp_release; /* Set of button releases to wake up the poll */
|
||||
};
|
||||
|
||||
/* A reference to this structure is provided with the BTNIOC_REGISTER IOCTL
|
||||
* command and describes the conditions under which the client would like
|
||||
* to receive notification.
|
||||
|
Loading…
Reference in New Issue
Block a user