Arduino Universal Inputs
A collection of libraries for managing/processing input devices on Arduino.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Protected Member Functions | List of all members
IJoystick Class Referenceabstract

Represents a joystick or potentiometer. More...

#include <IJoystick.h>

Inheritance diagram for IJoystick:
Inheritance graph
[legend]
Collaboration diagram for IJoystick:
Collaboration graph
[legend]

Public Member Functions

 IJoystick (inputid_t id)
 Creates a new joystick. More...
 
inputtype_t type () const
 Retrieves the type of this device. More...
 
bool poll ()
 Polls this input device for change. More...
 
inputanalog_t getRawValue () const
 Gets last read raw value. More...
 
inputanalog_t getCentredValue () const
 Gets the value centered at zero at the centre point and clamped if within the deadbands. More...
 
inputanalog_t getValue () const
 Gets the transformed value. More...
 
void setTransformation (IValueTransform *transform)
 Sets the transformation to use between the centred value and outout value. More...
 
bool setThreshold (inputanalog_t threshold)
 Sets the minimum change in raw value that will fire an event. More...
 
inputanalog_t getThreshold () const
 Returns the threshold value. More...
 
bool setPoints (inputanalog_t low, inputanalog_t centre, inputanalog_t high)
 Sets the low, centre and high points. More...
 
bool setPoints (inputanalog_t low, inputanalog_t high)
 Sets the low and high end points. More...
 
bool setDeadbands (inputanalog_t low, inputanalog_t centre, inputanalog_t high)
 Sets the low, centre and high deadband widths. More...
 
bool setDeadbands (inputanalog_t low, inputanalog_t high)
 Sets the low and high deadband widths. More...
 
inputanalog_t getLowPoint () const
 Gets the low end point raw value. More...
 
inputanalog_t getCentrePoint () const
 Gets the centre point raw value. More...
 
inputanalog_t getHighPoint () const
 Gets the high end point raw value. More...
 
inputanalog_t getLowDeadband () const
 Gets the deadband width at the low end point. More...
 
inputanalog_t getCentreDeadband () const
 Gets the deadband width at the centre point. More...
 
inputanalog_t getHighDeadband () const
 Gets the deadband width at the high end point. More...
 
- Public Member Functions inherited from IInputDevice
 IInputDevice (inputid_t id)
 Creates a new input device. More...
 
inputid_t getID () const
 Retrieves the ID of this device. More...
 

Protected Member Functions

virtual inputanalog_t getPhysicalValue () const =0
 Gets the raw value form the joystick. More...
 

Detailed Description

Represents a joystick or potentiometer.

Constructor & Destructor Documentation

IJoystick::IJoystick ( inputid_t  id)

Creates a new joystick.

Parameters
idJoystick ID

Member Function Documentation

inputanalog_t IJoystick::getCentreDeadband ( ) const
inline

Gets the deadband width at the centre point.

Returns
Centre deadband width
inputanalog_t IJoystick::getCentredValue ( ) const

Gets the value centered at zero at the centre point and clamped if within the deadbands.

Returns
Centered value
See Also
IJoystick::getRawValue
IJoystick::getValue
inputanalog_t IJoystick::getCentrePoint ( ) const
inline

Gets the centre point raw value.

Returns
Centre point
inputanalog_t IJoystick::getHighDeadband ( ) const
inline

Gets the deadband width at the high end point.

Returns
High deadband width
inputanalog_t IJoystick::getHighPoint ( ) const
inline

Gets the high end point raw value.

Returns
High end point
inputanalog_t IJoystick::getLowDeadband ( ) const
inline

Gets the deadband width at the low end point.

Returns
Low deadband width
inputanalog_t IJoystick::getLowPoint ( ) const
inline

Gets the low end point raw value.

Returns
Low end point
virtual inputanalog_t IJoystick::getPhysicalValue ( ) const
protectedpure virtual

Gets the raw value form the joystick.

Returns
Raw value

Implemented in ArduinoJoystick.

inputanalog_t IJoystick::getRawValue ( ) const
inline

Gets last read raw value.

Returns
Raw value
inputanalog_t IJoystick::getThreshold ( ) const
inline

Returns the threshold value.

Returns
Threshold
inputanalog_t IJoystick::getValue ( ) const

Gets the transformed value.

Returns
Output value
See Also
IJoystick::getCenteredValue
IJoystick::setTransformation

This is the value of IJoystick::getCentredValue with the transformation set by IJoystick::setTransformation applied.

bool IJoystick::poll ( )
virtual

Polls this input device for change.

Returns
True if any state change occurred.

Implements IInputDevice.

bool IJoystick::setDeadbands ( inputanalog_t  low,
inputanalog_t  centre,
inputanalog_t  high 
)

Sets the low, centre and high deadband widths.

Parameters
lowLow deadband width (raw value)
centreCentre deadband width (raw value)
highHigh deadband width (raw value)
Returns
True of all widths are valid and were set
See Also
IJoystick::setDeadbands(inputanalog_t, inputanalog_t)
bool IJoystick::setDeadbands ( inputanalog_t  low,
inputanalog_t  high 
)

Sets the low and high deadband widths.

Parameters
lowLow deadband width (raw value)
highHigh deadband width (raw value)
Returns
True of all widths are valid and were set
See Also
IJoystick::setDeadbands(inputanalog_t, inputanalog_t, inputanalog_t)

For use with potentiometers without a "centre" position.

bool IJoystick::setPoints ( inputanalog_t  low,
inputanalog_t  centre,
inputanalog_t  high 
)

Sets the low, centre and high points.

Parameters
lowLow end point (raw value)
centreCentre point (raw value)
highHigh end point (raw value)
Returns
True if value are valid and were set
See Also
IJoystick::setPoints(inputanalog_t, inputanalog_t)

low <= centre <= high must hold for values to be valid.

bool IJoystick::setPoints ( inputanalog_t  low,
inputanalog_t  high 
)

Sets the low and high end points.

Parameters
lowLow end point (raw value)
highHigh end point (raw value)
Returns
True if value are valid and were set
See Also
IJoystick::setPoints(inputanalog_t, inputanalog_t, inputanalog_t)

For use with potentiometers without a "centre" position.

low <= high must hold for values to be valid.

bool IJoystick::setThreshold ( inputanalog_t  threshold)

Sets the minimum change in raw value that will fire an event.

Parameters
thresholdThreshold value
Returns
True of the value is valid and was set
void IJoystick::setTransformation ( IValueTransform transform)

Sets the transformation to use between the centred value and outout value.

Parameters
transformPointer to the transformation
inputtype_t IJoystick::type ( ) const
inlinevirtual

Retrieves the type of this device.

Returns
Device type

Implements IInputDevice.


The documentation for this class was generated from the following files: