Arduino Universal Inputs
A collection of libraries for managing/processing input devices on Arduino.
|
Represents a joystick or potentiometer. More...
#include <IJoystick.h>
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... | |
![]() | |
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... | |
Represents a joystick or potentiometer.
IJoystick::IJoystick | ( | inputid_t | id | ) |
Creates a new joystick.
id | Joystick ID |
|
inline |
Gets the deadband width at the centre point.
inputanalog_t IJoystick::getCentredValue | ( | ) | const |
Gets the value centered at zero at the centre point and clamped if within the deadbands.
|
inline |
Gets the centre point raw value.
|
inline |
Gets the deadband width at the high end point.
|
inline |
Gets the high end point raw value.
|
inline |
Gets the deadband width at the low end point.
|
inline |
Gets the low end point raw value.
|
protectedpure virtual |
|
inline |
Gets last read raw value.
|
inline |
Returns the threshold value.
inputanalog_t IJoystick::getValue | ( | ) | const |
Gets the transformed value.
This is the value of IJoystick::getCentredValue with the transformation set by IJoystick::setTransformation applied.
|
virtual |
Polls this input device for change.
Implements IInputDevice.
bool IJoystick::setDeadbands | ( | inputanalog_t | low, |
inputanalog_t | centre, | ||
inputanalog_t | high | ||
) |
Sets the low, centre and high deadband widths.
low | Low deadband width (raw value) |
centre | Centre deadband width (raw value) |
high | High deadband width (raw value) |
bool IJoystick::setDeadbands | ( | inputanalog_t | low, |
inputanalog_t | high | ||
) |
Sets the low and high deadband widths.
low | Low deadband width (raw value) |
high | High deadband width (raw value) |
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.
low | Low end point (raw value) |
centre | Centre point (raw value) |
high | High end point (raw value) |
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.
low | Low end point (raw value) |
high | High end point (raw value) |
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.
threshold | Threshold value |
void IJoystick::setTransformation | ( | IValueTransform * | transform | ) |
Sets the transformation to use between the centred value and outout value.
transform | Pointer to the transformation |
|
inlinevirtual |