squishy.core.device.SquishyHardwareDevice

Todo

Flesh this out

class squishy.core.device.SquishyHardwareDevice(dev: USBDevice, serial: str, timeout: int = 2500, **kwargs)

Squishy Hardware Device

This class represents and abstracted Squishy hardware device, exposing a common and stable API for applets to interact with the hardware on.

Parameters:
  • dev (usb1.USBDevice) – The USB device handle for the hardware platform.

  • serial (str) – The serial number of the device.

Variables:
  • serial (str) – The serial number of the device.

  • rev (int) – The revision of the hardware of the device.

can_dfu() bool

Check to see if the Device can DFU

static make_serial() str

Make a new serial number string.

The default serial number is the current time and date in UTC in an ISO 8601-like format.

Returns:

The new serial number

Return type:

str

classmethod get_device(serial: str = None) Type[SquishyHardwareDevice] | None

Get attached Squishy device.

Get the attached and selected squishy device if possible, or if only one is attached to the system use that one.

Parameters:

serial (str) – The serial number if any.

Returns:

  • None – If no device is selected

  • squishy.core.device.SquishyHardwareDevice – The selected hardware if available.

classmethod enumerate() list[tuple[str, float, USBDevice]]

Enumerate attached devices

Returns:

The collection of SquishyDeviceContainer objects that match the enumeration critera.

Return type:

List[Tuple[str, float, usb1.USBDevice]]

reset() bool

Reset the device

upload(data: bytearray, slot: int, progress: Progress | None = None) bool

Push Firmware/Gateware to device

download(slot: int) bytearray | None

Pull Firmware/Gateware from device (if supported)