Arduino Universal Inputs
A collection of libraries for managing/processing input devices on Arduino.
|
Handles the storage, polling and event handling for multiple input devices. More...
#include <UniversalInputManager.h>
Public Member Functions | |
UniversalInputManager () | |
Create a new input manager. | |
size_t | deviceCount () |
Returns the number of devices that have been added. More... | |
size_t | poll () |
Polls all input devices for change. More... | |
bool | setCallback (IUniversalInputCallback *callback) |
Sets the callback class for this manager. More... | |
bool | setCallback (UniversalInputCallbackFunctionHandler::UniversalInputCallbackFunction callback) |
Sets the callback function for this manager. More... | |
bool | addDevice (IInputDevice *device) |
Adds a new input device to the manager. More... | |
IInputDevice * | getDevice (inputid_t id) |
Gets an input device given its ID. More... | |
bool | deviceExists (inputid_t id) |
Determines if a given device ID exists in the manager. More... | |
bool | setButtonDefaults (bool activeLow, bool pullUp, inputtime_t debounce) |
Sets the default button configuraton for buttons created with UniversalInputManager::addNewButton. More... | |
bool | addNewButton (inputpin_t pin) |
Adds a new button with default configuration. More... | |
bool | addNewButton (inputid_t id, inputpin_t pin) |
Adds a new button with default configuration. More... | |
bool | addNewJoystick (inputpin_t pin) |
Adds a new joystick. More... | |
bool | addNewJoystick (inputid_t id, inputpin_t pin) |
Adds a new joystick. More... | |
Handles the storage, polling and event handling for multiple input devices.
bool UniversalInputManager::addDevice | ( | IInputDevice * | device | ) |
Adds a new input device to the manager.
device | Pointer to input device |
Note that the device ID must be unique, if a device with the same ID already exists this call will return false.
bool UniversalInputManager::addNewButton | ( | inputpin_t | pin | ) |
Adds a new button with default configuration.
pin | Pin button is attached to |
Note that pin number becomes device ID.
bool UniversalInputManager::addNewButton | ( | inputid_t | id, |
inputpin_t | pin | ||
) |
Adds a new button with default configuration.
id | ID of new button |
pin | Pin button is attached to |
bool UniversalInputManager::addNewJoystick | ( | inputpin_t | pin | ) |
Adds a new joystick.
pin | Pin joystick is attached to |
Note that pin number becomes device ID.
bool UniversalInputManager::addNewJoystick | ( | inputid_t | id, |
inputpin_t | pin | ||
) |
Adds a new joystick.
id | ID of new joystick |
pin | Pin joystick is attached to |
|
inline |
Returns the number of devices that have been added.
bool UniversalInputManager::deviceExists | ( | inputid_t | id | ) |
Determines if a given device ID exists in the manager.
id | ID of device |
IInputDevice * UniversalInputManager::getDevice | ( | inputid_t | id | ) |
Gets an input device given its ID.
id | Device ID |
size_t UniversalInputManager::poll | ( | ) |
Polls all input devices for change.
bool UniversalInputManager::setButtonDefaults | ( | bool | activeLow, |
bool | pullUp, | ||
inputtime_t | debounce | ||
) |
Sets the default button configuraton for buttons created with UniversalInputManager::addNewButton.
activeLow | True if active low by default |
pullUp | True of pull up by default |
debounce | Default debounce time |
bool UniversalInputManager::setCallback | ( | IUniversalInputCallback * | callback | ) |
Sets the callback class for this manager.
callback | Pointer to the callback handler |
bool UniversalInputManager::setCallback | ( | UniversalInputCallbackFunctionHandler::UniversalInputCallbackFunction | callback | ) |
Sets the callback function for this manager.
callback | Pointer to the callback function |