diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-11-28 19:59:27 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-11-28 19:59:27 -0600 |
commit | 663f9b2ce8e2fea08d10ae0f95a1b63fe437413b (patch) | |
tree | c8ccc1986515bdad782c696c422654ea64c604e5 /nuttx/include | |
parent | 4cada4a9ac8f3d0e90a2a5952e895fafdd520a40 (diff) | |
download | nuttx-663f9b2ce8e2fea08d10ae0f95a1b63fe437413b.tar.gz nuttx-663f9b2ce8e2fea08d10ae0f95a1b63fe437413b.tar.bz2 nuttx-663f9b2ce8e2fea08d10ae0f95a1b63fe437413b.zip |
Add an analog joystick driver. Initial checkin is only a little more of a clone of the discrete joystick driver and is as-of-yet untested
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/nuttx/input/ajoystick.h | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/nuttx/include/nuttx/input/ajoystick.h b/nuttx/include/nuttx/input/ajoystick.h index 35ebd7210..3537f15f1 100644 --- a/nuttx/include/nuttx/input/ajoystick.h +++ b/nuttx/include/nuttx/input/ajoystick.h @@ -108,7 +108,7 @@ * seek() methods. The remaining driver methods behave as follows: * * 1) The read() method will always return a single value of size - * struct ajoy_sample_s represent the current joystick positiona and the + * struct ajoy_sample_s represent the current joystick positional and the * state of all joystick buttons. read() never blocks. * 2) The poll() method can be used to notify a client if there is a change * in any of the joystick button inputs. This feature, of course, @@ -185,6 +185,17 @@ struct ajoy_notify_s uint8_t an_signo; /* Signal number to use in the notification */ }; +/* This structure is returned by read() and provides the sample state of the + * analog joystick. + */ + +struct ajoy_sample_s +{ + int16_t as_x; /* X/horizontal position */ + int16_t as_y; /* Y/vertical position */ + ajoy_buttonset_t as_buttons; /* State of all buttons */ +}; + /* This is the type of the analog joystick interrupt handler used with * the struct ajoy_lowerhalf_s enable() method. */ @@ -198,7 +209,8 @@ typedef CODE void (*ajoy_handler_t) * 1) A common upper half driver that provides the common user interface to * the joystick, * 2) Platform-specific lower half drivers that provide the interface - * between the common upper half and the platform analog inputs. + * between the common upper half and the platform analog and discrete + * inputs. * * This structure defines the interface between an instance of the lower * half driver and the common upper half driver. Such an instance is @@ -210,17 +222,22 @@ struct ajoy_lowerhalf_s { /* Return the set of buttons supported on the analog joystick device */ - CODE ajoy_buttonset_t (*dl_supported)(FAR const struct ajoy_lowerhalf_s *lower); + CODE ajoy_buttonset_t (*al_supported)(FAR const struct ajoy_lowerhalf_s *lower); + + /* Return the current state of all analog joystick position and button data */ + + CODE int (*al_sample)(FAR const struct ajoy_lowerhalf_s *lower, + FAR struct ajoy_sample_s *sample); - /* Return the current state of all analog joystick buttons */ + /* Return the current state of button data (only) */ - CODE ajoy_buttonset_t (*dl_sample)(FAR const struct ajoy_lowerhalf_s *lower); + CODE ajoy_buttonset_t (*al_buttons)(FAR const struct ajoy_lowerhalf_s *lower); - /* Enable interrupts on the selecte set of joystick buttons. And empty + /* Enable interrupts on the selected set of joystick buttons. And empty * set will disable all interrupts. */ - CODE void (*dl_enable)(FAR const struct ajoy_lowerhalf_s *lower, + CODE void (*al_enable)(FAR const struct ajoy_lowerhalf_s *lower, ajoy_buttonset_t press, ajoy_buttonset_t release, ajoy_handler_t handler, FAR void *arg); }; @@ -245,9 +262,9 @@ extern "C" * Name: ajoy_register * * Description: - * Bind the lower half analog joystick driver to an instance of the - * upper half analog joystick driver and register the composite character - * driver as the specific device. + * Bind the lower half analog joystick driver to an instance of the upper + * half analog joystick driver and register the composite character + * driver as the specified device. * * Input Parameters: * devname - The name of the analog joystick device to be registers. |