Skip to content

Commit b2b183e

Browse files
committed
pybricks.common.BLE: Document multitasked broadcast.
1 parent 72f25cb commit b2b183e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/pybricks/_common.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,16 +1335,25 @@ def broadcast(self, data: Union[bool, int, float, str, bytes]) -> None:
13351335
"""broadcast(data)
13361336
13371337
Starts broadcasting the given data on
1338-
the *broadcast_channel* you selected when initializing the hub.
1338+
the ``broadcast_channel`` you selected when initializing the hub.
13391339
13401340
Data may be of type ``int``, ``float``, ``str``, ``bytes``,
1341-
``True``, or ``False``, or a tuple thereof.
1341+
``True``, or ``False``, or a list thereof.
1342+
1343+
Choose ``None`` to stop broadcasting. This helps improve performance
1344+
when you don't need the broadcast feature, especially when observing
1345+
at the same time.
13421346
13431347
The total data size is quite limited (26 bytes). ``True`` and
13441348
``False`` take 1 byte each. ``float`` takes 5 bytes. ``int`` takes 2 to
13451349
5 bytes depending on how big the number is. ``str`` and ``bytes`` take
13461350
the number of bytes in the object plus one extra byte.
13471351
1352+
When multitasking, only one task can broadcast at a time. To broadcast
1353+
information from multiple tasks (or block stacks), you could use a
1354+
dedicated separate task that broadcast new values when one or more
1355+
variables change.
1356+
13481357
Args:
13491358
data: The value or values to be broadcast.
13501359

0 commit comments

Comments
 (0)