class documentation
Handles input from the keyboard.
| Method | __del__ |
Destructor to clean up resources. |
| Method | __init__ |
Initialize the input manager for the current board. |
| Method | button |
Convert a button code to its corresponding character. |
| Method | is |
Return True if the last button was held for the specified duration. |
| Method | is |
Returns True if any key is currently pressed. |
| Method | on |
Callback invoked when a key becomes available. |
| Method | read |
Returns the key code as an integer (blocking call). |
| Method | read |
Returns the key code as integer, or -1 if no key is pressed. |
| Method | reset |
Resets the input state. |
| Method | touch |
Convert touch coordinates to a corresponding button code. |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | pin |
Undocumented |
| Property | button |
Returns the last button pressed. |
| Property | gesture |
Returns the last touch gesture. |
| Property | has |
Returns True if touch input is supported on the current board. |
| Property | point |
Returns the last touch point as (x, y). |
| Property | was |
Returns True if the last key pressed was a capital letter. |
| Method | __touch |
Handle a touch interrupt and map it to a button event. |
| Method | _key |
Map a key to a button. |
| Method | _poll |
Poll the touch controller and map touch areas to button events. |
| Method | _poll |
Poll the touch data and map it to a button event. |
| Instance Variable | _button |
Undocumented |
| Instance Variable | _character |
Undocumented |
| Instance Variable | _current |
Undocumented |
| Instance Variable | _delay |
Undocumented |
| Instance Variable | _elapsed |
Undocumented |
| Instance Variable | _elapsed |
Undocumented |
| Instance Variable | _elapsed |
Undocumented |
| Instance Variable | _key |
Undocumented |
| Instance Variable | _key |
Undocumented |
| Instance Variable | _last |
Undocumented |
| Instance Variable | _last |
Undocumented |
| Instance Variable | _last |
Undocumented |
| Instance Variable | _screen |
Undocumented |
| Instance Variable | _touch |
Undocumented |
| Instance Variable | _touch |
Undocumented |
| Instance Variable | _touch |
Undocumented |
| Instance Variable | _was |
Undocumented |
| Instance Variable | _was |
Undocumented |
Initialize the input manager for the current board.
| Parameters | |
backint | The button code used as back. Defaults to buttons.BUTTON_BACK. |
Convert a button code to its corresponding character.
| Parameters | |
button:int | Button code. |
| Returns | |
str | The corresponding character or empty string if unmapped. |
Return True if the last button was held for the specified duration.
| Parameters | |
duration:int | Number of polls the button must be held. Defaults to 3. |
| Returns | |
bool | True if the button is held for the duration. |
Callback invoked when a key becomes available.
| Parameters | |
_:None | Unused argument required by mp_sched_schedule. |
Returns the key code as an integer (blocking call).
Warning
This is a blocking call and should not be used in callback contexts.
| Returns | |
int | Key code (0-255) |
Convert touch coordinates to a corresponding button code.
| Parameters | |
x:int | X coordinate of the touch point. |
y:int | Y coordinate of the touch point. |
| Returns | |
int | The button code corresponding to the touch area. |
Handle a touch interrupt and map it to a button event.
| Parameters | |
pin:Pin | The pin that triggered the interrupt. |