Hardware

class ledsign.LEDSignHardware

Read-only representation of a LEDSign device’s hardware, returned by LEDSign.get_hardware().

get_raw() bytes

Returns the raw, 8-byte hardware configuration sequence returned by the device.

get_string() str

Returns a pretty-printed version of the raw device hardware configuration returned by get_raw().

get_user_string() str

Returns a user-friendly string identifying the device’s hardware configuration.

class ledsign.LEDSignSelector

This static class contains several common pattern generators, to be used within a LEDSignProgramBuilder context.

Every method accepts an optional hardware argument, which when omitted will default to the one used by the current LEDSignProgramBuilder instance (if a program builder is currently active).

static get_bounding_box(mask: int = -1, hardware: LEDSignHardware | None = None) tuple[float, float, float, float]

Returns the bounding box (sx, sy, ex, ey) of all pixels selected by mask. If no mask is given, the bounding box of all pixels is computed.

static get_center(mask: int = -1, weighted: bool = False, hardware: LEDSignHardware | None = None) tuple[float, float]

Returns the center (cx, cy) of all pixels selected by mask. If no mask is given, the bounding box of all pixels is computed.

If the weighted flag is set, the center is weighted across all pixels locations. Otherwise, the center of the bounding box returned by get_bounding_box() is calculated.

static get_circle_mask(cx: int | float, cy: int | float, r: int | float, mask: int = -1, hardware: LEDSignHardware | None = None) int

Returns a mask selecting all pixels within the circle centered at (cx, cy) with radius r, selected by the provided mask. If no mask is given, the all pixels are processed.

static get_led_depth(hardware: LEDSignHardware | None = None) int

Returns the longest LED chain present in the current hardware configuration.

static get_letter_count(hardware: LEDSignHardware | None = None) int

Returns the number of letters in the current hardware configuration.

static get_letter_mask(index: int, hardware: LEDSignHardware | None = None) int

Returns the pixel mask corresponding to the letter selected by index. Raises an IndexError if the index is out of bounds.

static get_letter_masks(hardware: LEDSignHardware | None = None) Iterator[tuple[int, str, int]]

Returns all letter (index, character, mask) tuples of the current hardware configuration.

static get_mask(hardware: LEDSignHardware | None = None) int

Returns a mask selecting all pixels.

static get_pixels(mask: int = -1, letter: int | None = None, hardware: LEDSignHardware | None = None) Iterator[tuple[float, float, int]]

Returns all pixel (x, y, mask) tuples selected by mask. If no mask is given, the bounding box of all pixels is computed.

If the letter index is given, only pixels from the given letter are processed.