PiFaceCAD input driver¶
This driver works with PiFace Control and Display Raspberry Pi shields.
Sample config.json section:
"input":
[{
"driver":"pfcad"
}]
Note
Generally, you won’t need to edit config.json
if you’re using this shield because it’ll be done automatically by config.sh
.
-
class
input.drivers.pfcad.
InputDevice
[source]¶ A driver for PiFace Control and Display Raspberry Pi shields. It has 5 buttons, one single-axis joystick with a pushbutton, a 16x2 HD44780 screen and an IR receiver (not used yet).
-
__init__
()[source]¶ Initialises the
InputDevice
object and startspifacecad.SwitchEventListener
. Also, registers callbacks topress_key
method.
-
start
()[source]¶ Starts listening on the input device. Initialises the IO expander and runs either interrupt-driven or polling loop.
-
process_data
(data)[source]¶ Checks data received from IO expander and classifies changes as either “button up” or “button down” events. On “button up”, calls send_key with the corresponding button name from
self.mapping
.
-
send_key
(keycode)[source]¶ A hook to be overridden by
InputListener
. Otherwise, prints out key names as soon as they’re pressed so is useful for debugging.
-
__weakref__
¶ list of weak references to the object (if defined)
-