Skip to content

manage_devices

frog.hardware.manage_devices ¤

This module contains code for interfacing with different hardware devices.

Classes¤

Functions¤

get_device_instance(base_type, name=None) ¤

Get the instance of the device of type base_type with an optional name.

If there is no device matching these parameters, None is returned.

Source code in frog/hardware/manage_devices.py
19
20
21
22
23
24
25
26
27
28
29
def get_device_instance(base_type: type[_T], name: str | None = None) -> _T | None:
    """Get the instance of the device of type base_type with an optional name.

    If there is no device matching these parameters, None is returned.
    """
    key = DeviceInstanceRef(base_type.get_device_base_type_info().name, name)

    try:
        return cast(_T, _devices[key])
    except KeyError:
        return None