Keyboard Input
A keyboard input block allows to read a registered set of keys from the keyboard. This set of registered keys are available on the output of this block. To give an example
KeyboardInput<3> keyboard{{'a','b','c'}, {"start", "stop", "home"}};
The three keys 'a', 'b', 'c' are registered and will be available on the output. The output itself is an array with three fields each of type bool
. As soon as you press 'a', the corresponding signal will be set to true
. You have to manually reset the signal to false
with
keyboard.reset(0);
For each registered key, the keyboard input block automatically creates a instance of hal::KeyboardDigIn
. This is a digital input of the HAL and can be used as such. For instance, it could be used as a critical input to the safety system, see KeyboardTest.cpp. When used as a HAL input, it is not necessary to reset manually. It will be reset automatically when read by the HAL.