IO is an event based input manager which permit to select which composents are manged on your system
Dependencies: C12832 FXOS8700Q LM75B MMA7660
Diff: FrdmK64f_Input.hpp
- Revision:
- 2:c871dc21467b
- Parent:
- 1:7be9a82f3ab8
- Child:
- 3:1ab88130bb9d
diff -r 7be9a82f3ab8 -r c871dc21467b FrdmK64f_Input.hpp --- a/FrdmK64f_Input.hpp Tue Feb 23 18:38:27 2016 +0000 +++ b/FrdmK64f_Input.hpp Tue Feb 23 18:56:50 2016 +0000 @@ -19,13 +19,13 @@ // Buttons InterruptIn _buttonLeft; InterruptIn _buttonRight; - bool _buttonEnable[2]; + bool _binaryInputEnable[2]; public: FrdmK64f_Input(void) : _buttonLeft(SW3), _buttonRight(SW2) { - memset(_buttonEnable, 1, sizeof(_buttonEnable)); + memset(_binaryInputEnable, 1, sizeof(_binaryInputEnable)); _buttonLeft.rise(this, &FrdmK64f_Input::onButtonLeftRise); _buttonLeft.fall(this, &FrdmK64f_Input::onButtonLeftFall); @@ -34,14 +34,14 @@ } using Parent::setEnable; - void setEnable(FrdmK64f_Input::IDBinaryInput inp, bool act) { _buttonEnable[inp] = act; } + void setEnable(FrdmK64f_Input::IDBinaryInput inp, bool act) { _binaryInputEnable[inp] = act; } // Not interresting section (do not use those methods) // Callbacks for joystick - void onButtonLeftRise(void) { if (_buttonEnable[ButtonLeft]) Parent::_events.push(Event(Event::FrdmK64f, Event::BinaryInput, ButtonLeft, Event::Rise)); } - void onButtonLeftFall(void) { if (_buttonEnable[ButtonLeft]) Parent::_events.push(Event(Event::FrdmK64f, Event::BinaryInput, ButtonLeft, Event::Fall)); } - void onButtonRightRise(void) { if (_buttonEnable[ButtonRight]) Parent::_events.push(Event(Event::FrdmK64f, Event::BinaryInput, ButtonRight, Event::Rise)); } - void onButtonRightFall(void) { if (_buttonEnable[ButtonRight]) Parent::_events.push(Event(Event::FrdmK64f, Event::BinaryInput, ButtonRight, Event::Fall)); } + void onButtonLeftRise(void) { if (_binaryInputEnable[ButtonLeft]) Parent::_events.push(Event(Event::FrdmK64f, Event::BinaryInput, ButtonLeft, Event::Rise)); } + void onButtonLeftFall(void) { if (_binaryInputEnable[ButtonLeft]) Parent::_events.push(Event(Event::FrdmK64f, Event::BinaryInput, ButtonLeft, Event::Fall)); } + void onButtonRightRise(void) { if (_binaryInputEnable[ButtonRight]) Parent::_events.push(Event(Event::FrdmK64f, Event::BinaryInput, ButtonRight, Event::Rise)); } + void onButtonRightFall(void) { if (_binaryInputEnable[ButtonRight]) Parent::_events.push(Event(Event::FrdmK64f, Event::BinaryInput, ButtonRight, Event::Fall)); } // Callback for others sensors virtual void chechAnalog(void) { Parent::chechAnalog(); }