brian.uicontrol.Btns
BTNS class objects
Static singleton providing access to the physical buttons and knob on the device via the global button state listener.
BTNS is not instantiable — it is a pre-existing module-level object. Button attributes like is_pressed and turned_to reflect the live hardware state.
Button class objects
is_pressed
True if the button is currently pressed by the user.
wait_for_press
Waits for next button press event. This function is blocking.
Arguments:
timeout_ms: Maximum number of milliseconds to wait. If the timeout is not provided or is None, the function will wait indefinitely.
Returns:
True if the desired button event was caught; False if the timeout ran out.
wait_for_release
Waits for next button release event. This function is blocking.
Arguments:
timeout_ms: Maximum number of milliseconds to wait. If the timeout is not provided or is None, the function will wait indefinitely.
Returns:
True if the desired button event was caught; False if the timeout ran out.
wait_for_press_and_release
Waits for next button press and release event. This function is blocking.
Arguments:
timeout_ms: Maximum number of milliseconds to wait. If the timeout is not provided or is None, the function will wait indefinitely.
Returns:
True if the desired button event was caught; False if the timeout ran out.
Knob class objects
turned_to
Absolute turn indent count (offset-corrected). Can be reset via `reset_absolute_rotation()`.
wait_for_directional_turn
Waits for next directional turn of the knob. This function is blocking.
Arguments:
clockwise: Whether to wait for clockwise or counterclockwise turn.timeout_ms: Maximum number of milliseconds to wait. If the timeout is not provided or is None, the function will wait indefinitely.
Returns:
True if the desired button event was caught; False if the timeout ran out.
wait_for_any_turn
Waits for next any turn of the knob. This function is blocking.
Arguments:
timeout_ms: Maximum number of milliseconds to wait. If the timeout is not provided or is None, the function will wait indefinitely.
Returns:
True if the desired button event was caught; False if the timeout ran out.
reset_absolute_rotation
Resets turned_to back to zero (or the provided value).
Arguments:
new_turned_to: Value thatturned_toshould return immediately after this call. Defaults to 0.