Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: N5110 PinDetect PowerControl mbed
InputManager Class Reference
Used to manage user input from buttons and thumb joystick. More...
#include <InputManager.h>
Public Member Functions | |
| InputManager (PinName pinA, PinName pinB, PinName pinC, PinName joyH, PinName joyV, PinName joyBtn) | |
| Creates a new InputManager object. | |
| ~InputManager () | |
| Deconstructor. | |
| void | addBtnPressInterrupt (Input::Button button, void(*func)(void)) |
| Adds a button interrupt which is invoked when the button is pressed. | |
| int | read (Input::Button button) |
| Reads the current value of a button. | |
Detailed Description
Used to manage user input from buttons and thumb joystick.
Definition at line 17 of file InputManager.h.
Constructor & Destructor Documentation
| InputManager | ( | PinName | pinA, |
| PinName | pinB, | ||
| PinName | pinC, | ||
| PinName | joyH, | ||
| PinName | joyV, | ||
| PinName | joyBtn | ||
| ) |
Creates a new InputManager object.
- Parameters:
-
pinA Pin connected to button A pinB Pin connected to button B pinc Pin connected to button C x Pin connected to the horizontal potentiometer of the joystick y Pin connected to the vertical potentiometer of the joystick button Pin connected to the button of the thumb joystick
Definition at line 8 of file InputManager.cpp.
| ~InputManager | ( | ) |
Deconstructor.
Frees allocated memory related to the buttons and the joystick
Definition at line 25 of file InputManager.cpp.
Member Function Documentation
| void addBtnPressInterrupt | ( | Input::Button | button, |
| void(*)(void) | func | ||
| ) |
Adds a button interrupt which is invoked when the button is pressed.
Button needs to be released for the interrupt to occur again.
- Parameters:
-
button Name of the button. func Callback function.
Definition at line 33 of file InputManager.cpp.
| int read | ( | Input::Button | button ) |
Reads the current value of a button.
- Parameters:
-
button The button we want to read.
- Returns:
- Returns 1 if button is pressed, 0 otherwise.
Definition at line 58 of file InputManager.cpp.
Generated on Tue Jul 12 2022 21:59:48 by
1.7.2