zephyr_serial
– Zephyr UART driver for fixed busses.
Available on these boards
- class zephyr_serial.UART
- A bidirectional serial protocol. Already initialized for Zephyr defined
busses in
board
.
Available on these boards
-
{% for board in support_matrix_reverse["zephyr_serial.UART"] %}
- {{ board }} {% endfor %}
- __exit__() None
Automatically deinitializes the hardware when exiting a context. See Lifetime and ContextManagers for more info.
- read(nbytes: int | None = None) bytes | None
Read bytes. If
nbytes
is specified then read at most that many bytes. Otherwise, read everything that arrives until the connection times out. Providing the number of bytes expected is highly recommended because it will be faster. If no bytes are read, returnNone
.Note
When no bytes are read due to a timeout, this function returns
None
. This matches the behavior ofio.RawIOBase.read
in Python 3, but differs from pyserial which returnsb''
in that situation.- Returns:
Data read
- Return type:
bytes or None
- readinto(buf: circuitpython_typing.WriteableBuffer) int | None
Read bytes into the
buf
. Read at mostlen(buf)
bytes.- Returns:
number of bytes read and stored into
buf
- Return type:
int or None (on a non-blocking error)
New in CircuitPython 4.0: No length parameter is permitted.
- readline() bytes
Read a line, ending in a newline character, or return
None
if a timeout occurs sooner, or return everything readable if no newline is found andtimeout=0
- Returns:
the line read
- Return type:
bytes or None
- write(buf: circuitpython_typing.ReadableBuffer) int | None
Write the buffer of bytes to the bus.
New in CircuitPython 4.0:
buf
must be bytes, not a string.- return:
the number of bytes written
- rtype:
int or None