Skip to content

ThingM Implementation

Blink(1) devices with fade effects

This module contains the low-level implementation details for ThingM devices, including enumerations, bit fields, and state management classes.

Available Components

ThingM Blink(1) implementation details.

Classes

busylight_core.vendors.thingm.implementation.LEDS

Bases: IntEnum

LED selection enumeration for multi-LED Blink(1) devices.

Specifies which LED(s) to control on devices that have multiple LEDs, such as the Blink(1) mk2 which has both top and bottom LEDs.

Attributes
busylight_core.vendors.thingm.implementation.LEDS.All class-attribute instance-attribute
All = 0
busylight_core.vendors.thingm.implementation.LEDS.Top class-attribute instance-attribute
Top = 1
busylight_core.vendors.thingm.implementation.LEDS.Bottom class-attribute instance-attribute
Bottom = 2

busylight_core.vendors.thingm.implementation.Action

Bases: IntEnum

Action enumeration for ThingM Blink(1) device commands.

Defines the available actions that can be performed on Blink(1) devices. Each action corresponds to a specific ASCII character that the device firmware recognizes.

Attributes
busylight_core.vendors.thingm.implementation.Action.FadeColor class-attribute instance-attribute
FadeColor = ord('c')
busylight_core.vendors.thingm.implementation.Action.SetColor class-attribute instance-attribute
SetColor = ord('n')
busylight_core.vendors.thingm.implementation.Action.ReadColor class-attribute instance-attribute
ReadColor = ord('r')
busylight_core.vendors.thingm.implementation.Action.ServerTickle class-attribute instance-attribute
ServerTickle = ord('D')
busylight_core.vendors.thingm.implementation.Action.PlayLoop class-attribute instance-attribute
PlayLoop = ord('p')
busylight_core.vendors.thingm.implementation.Action.PlayStateRead class-attribute instance-attribute
PlayStateRead = ord('S')
busylight_core.vendors.thingm.implementation.Action.SetColorPattern class-attribute instance-attribute
SetColorPattern = ord('P')
busylight_core.vendors.thingm.implementation.Action.SaveColorPatterns class-attribute instance-attribute
SaveColorPatterns = ord('W')
busylight_core.vendors.thingm.implementation.Action.ReadColorPattern class-attribute instance-attribute
ReadColorPattern = ord('R')
busylight_core.vendors.thingm.implementation.Action.SetLEDn class-attribute instance-attribute
SetLEDn = ord('l')
busylight_core.vendors.thingm.implementation.Action.ReadEEPROM class-attribute instance-attribute
ReadEEPROM = ord('e')
busylight_core.vendors.thingm.implementation.Action.WriteEEPROM class-attribute instance-attribute
WriteEEPROM = ord('E')
busylight_core.vendors.thingm.implementation.Action.GetVersion class-attribute instance-attribute
GetVersion = ord('v')
busylight_core.vendors.thingm.implementation.Action.TestCommand class-attribute instance-attribute
TestCommand = ord('!')
busylight_core.vendors.thingm.implementation.Action.WriteNote class-attribute instance-attribute
WriteNote = ord('F')
busylight_core.vendors.thingm.implementation.Action.ReadNote class-attribute instance-attribute
ReadNote = ord('f')
busylight_core.vendors.thingm.implementation.Action.Bootloader class-attribute instance-attribute
Bootloader = ord('G')
busylight_core.vendors.thingm.implementation.Action.LockBootLoader class-attribute instance-attribute
LockBootLoader = ord('L')
busylight_core.vendors.thingm.implementation.Action.SetStartupParams class-attribute instance-attribute
SetStartupParams = ord('B')
busylight_core.vendors.thingm.implementation.Action.GetStartupParams class-attribute instance-attribute
GetStartupParams = ord('b')
busylight_core.vendors.thingm.implementation.Action.ServerModeTickle class-attribute instance-attribute
ServerModeTickle = ord('D')
busylight_core.vendors.thingm.implementation.Action.GetChipID class-attribute instance-attribute
GetChipID = ord('U')

busylight_core.vendors.thingm.implementation.Report

Bases: IntEnum

Report type enumeration for HID communication.

Defines the HID report numbers used for different types of communication with Blink(1) devices.

Attributes
busylight_core.vendors.thingm.implementation.Report.One class-attribute instance-attribute
One = 1
busylight_core.vendors.thingm.implementation.Report.Two class-attribute instance-attribute
Two = 2

busylight_core.vendors.thingm.implementation.ActionField

ActionField()

Bases: BitField

8-bit action field specifying the command to execute.

Attributes
busylight_core.vendors.thingm.implementation.ActionField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.thingm.implementation.ActionField.offset instance-attribute
offset = offset
busylight_core.vendors.thingm.implementation.ActionField.width instance-attribute
width = width

busylight_core.vendors.thingm.implementation.BlueField

BlueField()

Bases: BitField

8-bit blue color component.

Attributes
busylight_core.vendors.thingm.implementation.BlueField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.thingm.implementation.BlueField.offset instance-attribute
offset = offset
busylight_core.vendors.thingm.implementation.BlueField.width instance-attribute
width = width

busylight_core.vendors.thingm.implementation.CountField

CountField()

Bases: BitField

8-bit count field for repetition control.

Attributes
busylight_core.vendors.thingm.implementation.CountField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.thingm.implementation.CountField.offset instance-attribute
offset = offset
busylight_core.vendors.thingm.implementation.CountField.width instance-attribute
width = width

busylight_core.vendors.thingm.implementation.FadeField

FadeField()

Bases: BitField

16-bit fade field for transition timing in milliseconds.

Attributes
busylight_core.vendors.thingm.implementation.FadeField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.thingm.implementation.FadeField.offset instance-attribute
offset = offset
busylight_core.vendors.thingm.implementation.FadeField.width instance-attribute
width = width

busylight_core.vendors.thingm.implementation.GreenField

GreenField()

Bases: BitField

8-bit green color component.

Attributes
busylight_core.vendors.thingm.implementation.GreenField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.thingm.implementation.GreenField.offset instance-attribute
offset = offset
busylight_core.vendors.thingm.implementation.GreenField.width instance-attribute
width = width

busylight_core.vendors.thingm.implementation.LedsField

LedsField()

Bases: BitField

8-bit LED selection field for multi-LED devices.

Attributes
busylight_core.vendors.thingm.implementation.LedsField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.thingm.implementation.LedsField.offset instance-attribute
offset = offset
busylight_core.vendors.thingm.implementation.LedsField.width instance-attribute
width = width

busylight_core.vendors.thingm.implementation.LinesField

LinesField()

Bases: BitField

8-bit line field for pattern line indexing.

Attributes
busylight_core.vendors.thingm.implementation.LinesField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.thingm.implementation.LinesField.offset instance-attribute
offset = offset
busylight_core.vendors.thingm.implementation.LinesField.width instance-attribute
width = width

busylight_core.vendors.thingm.implementation.PlayField

PlayField()

Bases: BitField

8-bit play field for pattern playback control.

Attributes
busylight_core.vendors.thingm.implementation.PlayField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.thingm.implementation.PlayField.offset instance-attribute
offset = offset
busylight_core.vendors.thingm.implementation.PlayField.width instance-attribute
width = width

busylight_core.vendors.thingm.implementation.RedField

RedField()

Bases: BitField

8-bit red color component.

Attributes
busylight_core.vendors.thingm.implementation.RedField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.thingm.implementation.RedField.offset instance-attribute
offset = offset
busylight_core.vendors.thingm.implementation.RedField.width instance-attribute
width = width

busylight_core.vendors.thingm.implementation.ReportField

ReportField()

Bases: BitField

8-bit report field for HID communication.

Attributes
busylight_core.vendors.thingm.implementation.ReportField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.thingm.implementation.ReportField.offset instance-attribute
offset = offset
busylight_core.vendors.thingm.implementation.ReportField.width instance-attribute
width = width

busylight_core.vendors.thingm.implementation.StartField

StartField()

Bases: BitField

8-bit start field for pattern range specification.

Attributes
busylight_core.vendors.thingm.implementation.StartField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.thingm.implementation.StartField.offset instance-attribute
offset = offset
busylight_core.vendors.thingm.implementation.StartField.width instance-attribute
width = width

busylight_core.vendors.thingm.implementation.StopField

StopField()

Bases: BitField

8-bit stop field for pattern range specification.

Attributes
busylight_core.vendors.thingm.implementation.StopField.field instance-attribute
field = slice(offset, offset + width)
busylight_core.vendors.thingm.implementation.StopField.offset instance-attribute
offset = offset
busylight_core.vendors.thingm.implementation.StopField.width instance-attribute
width = width

busylight_core.vendors.thingm.implementation.State

State()

Bases: Word

Complete device state for ThingM Blink(1) commands.

The State class manages command construction for Blink(1) devices. It provides high-level methods for color control, pattern management, and device configuration while handling the low-level bit manipulation required for device communication.

Attributes
busylight_core.vendors.thingm.implementation.State.initial_value instance-attribute
initial_value = value
busylight_core.vendors.thingm.implementation.State.length instance-attribute
length = length
busylight_core.vendors.thingm.implementation.State.bits instance-attribute
bits = array('B', [value >> n & 1 for n in range])
busylight_core.vendors.thingm.implementation.State.value property
value

Return the integer value of the word.

busylight_core.vendors.thingm.implementation.State.range property
range

Return the range of bit offsets for this word.

busylight_core.vendors.thingm.implementation.State.hex property
hex

Return a string hexadecimal representation of the word.

busylight_core.vendors.thingm.implementation.State.bin property
bin

Return a string binary representation of the word.

busylight_core.vendors.thingm.implementation.State.report class-attribute instance-attribute
report = ReportField()
busylight_core.vendors.thingm.implementation.State.action class-attribute instance-attribute
action = ActionField()
busylight_core.vendors.thingm.implementation.State.red class-attribute instance-attribute
red = RedField()
busylight_core.vendors.thingm.implementation.State.green class-attribute instance-attribute
green = GreenField()
busylight_core.vendors.thingm.implementation.State.blue class-attribute instance-attribute
blue = BlueField()
busylight_core.vendors.thingm.implementation.State.play class-attribute instance-attribute
play = PlayField()
busylight_core.vendors.thingm.implementation.State.start class-attribute instance-attribute
start = StartField()
busylight_core.vendors.thingm.implementation.State.stop class-attribute instance-attribute
stop = StopField()
busylight_core.vendors.thingm.implementation.State.count class-attribute instance-attribute
count = CountField()
busylight_core.vendors.thingm.implementation.State.fade class-attribute instance-attribute
fade = FadeField()
busylight_core.vendors.thingm.implementation.State.leds class-attribute instance-attribute
leds = LedsField()
busylight_core.vendors.thingm.implementation.State.line class-attribute instance-attribute
line = LinesField()
busylight_core.vendors.thingm.implementation.State.color property writable
color

Get the current RGB color as a tuple.

Functions
busylight_core.vendors.thingm.implementation.State.clear
clear()

Clear all bits in the word.

busylight_core.vendors.thingm.implementation.State.fade_to_color
fade_to_color(color, fade_ms=10, leds=All)

Configure device to fade to specified color.

:param color: RGB color tuple (red, green, blue) with values 0-255 :param fade_ms: Fade duration in milliseconds :param leds: Which LEDs to control (All, Top, or Bottom)

busylight_core.vendors.thingm.implementation.State.write_pattern_line
write_pattern_line(color, fade_ms, index)

Write a single line to the device's pattern memory.

:param color: RGB color tuple for this pattern line :param fade_ms: Fade duration for this pattern step :param index: Pattern line index (0-15)

busylight_core.vendors.thingm.implementation.State.save_patterns
save_patterns()

Save current pattern memory to device flash storage.

busylight_core.vendors.thingm.implementation.State.play_loop
play_loop(play, start, stop, count=0)

Start pattern playback loop.

:param play: Play mode (0=stop, 1=play) :param start: Starting pattern line index :param stop: Ending pattern line index :param count: Number of loops (0=infinite)

busylight_core.vendors.thingm.implementation.State.clear_patterns
clear_patterns(start=0, count=16)

Clear pattern memory by writing black to specified range.

:param start: Starting pattern line index :param count: Number of pattern lines to clear