module documentation

Infrared - Send and learn infrared remote signals.

Class InfraredAnimationDisplay Fit the built-in desktop animation into the 48px status artwork area.
Class InfraredStatus Draw 48px bear frames from SD at 5 fps, keeping only one frame in RAM.
Function run Run the infrared app.
Function start Start the infrared app.
Function stop Stop the infrared app and clean up resources.
Constant FIELD_BUTTON Undocumented
Constant FIELD_NAME Undocumented
Constant RECEIVE_TIMEOUT_MS Undocumented
Constant STATE_BUTTON_MENU Undocumented
Constant STATE_KEYBOARD Undocumented
Constant STATE_LEARN_MENU Undocumented
Constant STATE_LISTENING Undocumented
Constant STATE_MAIN_MENU Undocumented
Constant STATE_NO_SIGNAL Undocumented
Constant STATE_PIN_CHOICE Undocumented
Constant STATE_RECEIVE_ERROR Undocumented
Constant STATE_REMOTE_FILES Undocumented
Constant STATE_REMOTE_KEYS Undocumented
Constant STATE_SAVED Undocumented
Constant STATE_SETTINGS_MENU Undocumented
Constant STATE_TOGGLE Undocumented
Function _clean_remote_name Normalize a user-provided remote filename.
Function _close_keyboard Close the Learn keyboard and return to its menu.
Function _close_receiver Release receive IRQ/timer resources on every exit path.
Function _create_menu Create a styled menu for the current view.
Function _display_value Limit a Learn field value to one menu line.
Function _draw_receive_status Draw the current receive-state title, details, and hint footer.
Function _keyboard_save_callback Record that the Learn keyboard saved a value.
Function _load_settings Load the saved transmitter settings.
Function _open_external_toggle Open the toggle that enables external transmission.
Function _open_keyboard Open the keyboard for a Learn field.
Function _open_pin_choice Open the transmitter pin choice list.
Function _rebuild_infrared Rebuild the Infrared facade for the current pin settings.
Function _receive_signal Start reception and return so animation and input remain responsive.
Function _relative_remote_path Convert a library path to a root-relative remote path.
Function _remote_file_path Return the storage path for the current learned remote.
Function _run_external_toggle Handle one frame of external toggle input.
Function _run_keyboard Process one frame of Learn keyboard input.
Function _run_pin_choice Handle one frame of pin choice input.
Function _run_receive Handle one frame of receive input and advance the receive state.
Function _save_keyboard_value Apply the value saved from the Learn keyboard.
Function _save_settings Persist the transmitter settings.
Function _send_signal Transmit the selected signal from the loaded remote.
Function _set_receive_state Switch to a receive state and start the matching bear animation.
Function _show_button_menu Show standard and custom signal-name choices.
Function _show_key_menu Load a remote and show its signal names.
Function _show_learn_menu Show the fields and action for learning a remote.
Function _show_main_menu Show the top-level infrared menu.
Function _show_remote_menu List available infrared remote files.
Function _show_settings_menu Show the transmitter settings menu.
Constant _BUTTON_OPTIONS Undocumented
Constant _PIN_OPTIONS Undocumented
Constant _SETTINGS_PATH Undocumented
Variable _button_menu Undocumented
Variable _button_name Undocumented
Variable _infrared Undocumented
Variable _key_menu Undocumented
Variable _key_names Undocumented
Variable _keyboard_field Undocumented
Variable _keyboard_result Undocumented
Variable _keyboard_save_requested Undocumented
Variable _learn_menu Undocumented
Variable _menu Undocumented
Variable _pin_choice Undocumented
Variable _receive_error Undocumented
Variable _receive_started Undocumented
Variable _receiver Undocumented
Variable _remote Undocumented
Variable _remote_menu Undocumented
Variable _remote_name Undocumented
Variable _remote_paths Undocumented
Variable _settings_menu Undocumented
Variable _status Undocumented
Variable _toggle Undocumented
Variable _tx_pin Undocumented
Variable _use_external Undocumented
def run(view_manager):

Run the infrared app.

Parameters
view_manager:ViewManagerThe view manager providing buttons and input state.
def start(view_manager) -> bool:

Start the infrared app.

Parameters
view_manager:ViewManagerThe view manager providing storage and drawing.
Returns
boolTrue after the app is initialized.
def stop(view_manager):

Stop the infrared app and clean up resources.

Parameters
view_manager:ViewManagerThe view manager providing keyboard state.
FIELD_BUTTON =

Undocumented

Value
const(0)
FIELD_NAME =

Undocumented

Value
const(1)
RECEIVE_TIMEOUT_MS =

Undocumented

Value
const(10000)
STATE_BUTTON_MENU =

Undocumented

Value
const(4)
STATE_KEYBOARD =

Undocumented

Value
const(5)
STATE_LEARN_MENU =

Undocumented

Value
const(3)
STATE_LISTENING =

Undocumented

Value
const(6)
STATE_MAIN_MENU =

Undocumented

Value
const(0)
STATE_NO_SIGNAL =

Undocumented

Value
const(8)
STATE_PIN_CHOICE =

Undocumented

Value
const(12)
STATE_RECEIVE_ERROR =

Undocumented

Value
const(9)
STATE_REMOTE_FILES =

Undocumented

Value
const(1)
STATE_REMOTE_KEYS =

Undocumented

Value
const(2)
STATE_SAVED =

Undocumented

Value
const(7)
STATE_SETTINGS_MENU =

Undocumented

Value
const(10)
STATE_TOGGLE =

Undocumented

Value
const(11)
def _clean_remote_name(value):

Normalize a user-provided remote filename.

Parameters
value:strThe remote name entered on the keyboard.
Returns
strThe sanitized name, or an empty string if unusable.
def _close_keyboard(view_manager):

Close the Learn keyboard and return to its menu.

Parameters
view_manager:ViewManagerThe view manager providing keyboard and input state.
def _close_receiver():

Release receive IRQ/timer resources on every exit path.

def _create_menu(view_manager, title):

Create a styled menu for the current view.

Parameters
view_manager:ViewManagerThe view manager providing colors and size.
title:strThe menu title.
Returns
MenuThe styled menu bound to the current view.
def _display_value(value):

Limit a Learn field value to one menu line.

Parameters
value:strThe field value to display.
Returns
strThe value truncated to 18 characters.
def _draw_receive_status(view_manager, now):

Draw the current receive-state title, details, and hint footer.

Parameters
view_manager:ViewManagerThe view manager the bear animation draws through.
now:intCurrent ticks_ms() used for the 5 fps tick.
def _keyboard_save_callback(result):

Record that the Learn keyboard saved a value.

Parameters
result:strThe value the user committed on the keyboard.
def _load_settings(view_manager):

Load the saved transmitter settings.

Parameters
view_manager:ViewManagerThe view manager providing storage.
def _open_external_toggle(view_manager):

Open the toggle that enables external transmission.

Parameters
view_manager:ViewManagerThe view manager for drawing and colors.
def _open_keyboard(view_manager, field):

Open the keyboard for a Learn field.

Parameters
view_manager:ViewManagerThe view manager providing the keyboard.
field:intThe field to edit (FIELD_BUTTON or FIELD_NAME).
def _open_pin_choice(view_manager):

Open the transmitter pin choice list.

Parameters
view_manager:ViewManagerThe view manager for drawing and colors.
def _rebuild_infrared(view_manager):

Rebuild the Infrared facade for the current pin settings.

Parameters
view_manager:ViewManagerThe view manager providing storage.
def _receive_signal(view_manager):

Start reception and return so animation and input remain responsive.

Parameters
view_manager:ViewManagerThe view manager for alerts, drawing, and logging.
def _relative_remote_path(path):

Convert a library path to a root-relative remote path.

Parameters
path:strThe remote path from the infrared library.
Returns
strThe path without the "infrared/" prefix.
def _remote_file_path():

Return the storage path for the current learned remote.

Returns
strThe "learned/<remote name>.ir" storage path.
def _run_external_toggle(view_manager):

Handle one frame of external toggle input.

Parameters
view_manager:ViewManagerThe view manager providing buttons.
def _run_keyboard(view_manager):

Process one frame of Learn keyboard input.

Parameters
view_manager:ViewManagerThe view manager providing keyboard and input state.
def _run_pin_choice(view_manager):

Handle one frame of pin choice input.

Parameters
view_manager:ViewManagerThe view manager providing buttons.
def _run_receive(view_manager):

Handle one frame of receive input and advance the receive state.

Parameters
view_manager:ViewManagerThe view manager for buttons, alerts, drawing, and logging.
def _save_keyboard_value(view_manager):

Apply the value saved from the Learn keyboard.

Parameters
view_manager:ViewManagerThe view manager providing the keyboard result and alerts.
def _save_settings(view_manager):

Persist the transmitter settings.

Parameters
view_manager:ViewManagerThe view manager providing storage.
def _send_signal(view_manager):

Transmit the selected signal from the loaded remote.

Parameters
view_manager:ViewManagerThe view manager for alerts and drawing.
def _set_receive_state(view_manager, state, now, error=''):

Switch to a receive state and start the matching bear animation.

Parameters
view_manager:ViewManagerThe view manager the bear animation draws through.
state:intThe receive state to enter (STATE_LISTENING, STATE_SAVED, ...).
now:intCurrent ticks_ms() used to time the animation.
error:strError message shown in the STATE_RECEIVE_ERROR state. Defaults to "".
def _show_button_menu(view_manager):

Show standard and custom signal-name choices.

Parameters
view_manager:ViewManagerThe view manager for drawing and input.
def _show_key_menu(view_manager, path):

Load a remote and show its signal names.

Parameters
view_manager:ViewManagerThe view manager for drawing and alerts.
path:strThe root-relative .ir file path to load.
def _show_learn_menu(view_manager):

Show the fields and action for learning a remote.

Parameters
view_manager:ViewManagerThe view manager for drawing and input.
def _show_main_menu(view_manager):

Show the top-level infrared menu.

Parameters
view_manager:ViewManagerThe view manager for drawing and input.
def _show_remote_menu(view_manager):

List available infrared remote files.

Parameters
view_manager:ViewManagerThe view manager for drawing and storage access.
def _show_settings_menu(view_manager):

Show the transmitter settings menu.

Parameters
view_manager:ViewManagerThe view manager for drawing and input.
_BUTTON_OPTIONS: tuple[str, ...] =

Undocumented

Value
('Power',
 'Volume Up',
 'Volume Down',
 'Channel Up',
 'Channel Down',
 'Mute',
 'Play',
...
_PIN_OPTIONS: tuple[int, ...] =

Undocumented

Value
(1, 2, 5, 8, 28)
_SETTINGS_PATH: str =

Undocumented

Value
'picoware/settings/ir.json'
_button_menu =

Undocumented

_button_name: str =

Undocumented

_infrared =

Undocumented

_key_menu =

Undocumented

_key_names: list =

Undocumented

_keyboard_field: int =

Undocumented

_keyboard_result: str =

Undocumented

_keyboard_save_requested: bool =

Undocumented

_learn_menu =

Undocumented

_menu =

Undocumented

_pin_choice =

Undocumented

_receive_error: str =

Undocumented

_receive_started: int =

Undocumented

_receiver =

Undocumented

_remote =

Undocumented

_remote_menu =

Undocumented

_remote_name: str =

Undocumented

_remote_paths: list =

Undocumented

_settings_menu =

Undocumented

_status =

Undocumented

_toggle =

Undocumented

_tx_pin =

Undocumented

_use_external: bool =

Undocumented