spike.button
Hub button mock API
Classes
|
Hub button mocking class. |
- class spike.button.Button(side)
Hub button mocking class.
Class is accessed simultaneously by the user side thread and the ground truth update thread. It is therefore protected by a mutex
- __init__(side)
Contructor
- Parameters:
side (string) – button side (left or right)
- wait_until_pressed()
Wait until the button is pressed
- wait_until_released()
Wait until the button is released
- was_pressed()
Tests to see whether the button has been pressed since the last time this method called. Once this method returns “true,” the button must be released and pressed again before it will return “true” again.
- Returns:
True if the button was pressed, false otherwise
- Return type:
boolean
- is_pressed()
Tests whether the button is pressed.
- Returns:
True if the button is pressed, otherwise false
- Return type:
boolean
- c_reset()
Reset function
Warning
This function is not part of the spike API. It is provided to update the component from scenario data and shall not be used by the end-user.
- c_read(is_pressed)
Button status setting function
Warning
This function is not part of the spike API. It is provided to update the component from scenario data and shall not be used by the end-user.
- Parameters:
is_pressed (boolean) – True if button is pressed, false otherwise