Andreas Garmannslund / Mbed 2 deprecated SimplePlatformGame

Dependencies:   N5110 PinDetect PowerControl mbed

Embed: (wiki syntax)

« Back to documentation index

InputManager Class Reference

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:
pinAPin connected to button A
pinBPin connected to button B
pincPin connected to button C
xPin connected to the horizontal potentiometer of the joystick
yPin connected to the vertical potentiometer of the joystick
buttonPin 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:
buttonName of the button.
funcCallback function.

Definition at line 33 of file InputManager.cpp.

int read ( Input::Button  button )

Reads the current value of a button.

Parameters:
buttonThe button we want to read.
Returns:
Returns 1 if button is pressed, 0 otherwise.

Definition at line 58 of file InputManager.cpp.