Skip to content

Commit

Permalink
Berry update 'serial.read()'
Browse files Browse the repository at this point in the history
  • Loading branch information
s-hadinger authored Feb 22, 2025
1 parent c7d8923 commit 910868c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/Berry.md
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ Tasmota Function|Parameters and details
serial (constructor)<a class="cmnd" id="serial"></a>|`serial(gpio_rx:int, gpio_tx:int, baud:int [, mode:int, inverted:bool])`<br>Creates a `serial` object<br>`gpio_rx` receive GPIO (or -1 if transmit only)<br>`gpio_tx` transmit GPIO (or -1 if receive only)<br>`baud` speed, ex: 9600, 115200<br>`mode` serial message format, default is `serial.SERIAL_8N1` (8 bits, no parity, 1 stop bit)<br>`inverted` true if signal is inverted (inactive low), default `false`<br>Other mode values are described below.
config_tx_en<a class="cmnd" id="serial_config_tx_en"></a>|`config_tx_en(phy_gpio:int) -> nil`<br>Configures the Tx EN GPIO, or `-1` to clear it. Typically used for RS485.
write<a class="cmnd" id="serial_write"></a>|`write(val:int || bytes()) -> bytes_sent:int`<br>Send either a single byte if argument is int, or send a binary message from a `bytes()` object.<br>The methods blocks until all messages are sent to the UART hardware buffer; they may not all have been sent over the wire
read<a class="cmnd" id="serial_read"></a>|`read(void) -> bytes()`<br>Read all bytes received in the incoming buffer. If the buffer is empty, returns an empty `bytes()` object
read<a class="cmnd" id="serial_read"></a>|`read( [max_bytes:int] ) -> bytes()`<br>Read all bytes received in the incoming buffer. If the buffer is empty, returns an empty `bytes()` object; in such case you can call `available()` first to check if the buffer is empty<br>Takes an optional argument `max_bytes` to limit the number of bytes returned, remaining bytes are kept in the internal serial buffer.
flush<a class="cmnd" id="serial_flush"></a>|`flush(void) -> void`<br>Flushes all buffers. Waits for all outgoing messages to be sent over the wire and clear the incoming buffer.
available<a class="cmnd" id="serial_available"></a>|`available(void) -> int`<br>Returns the number of incoming bytes in the incoming buffer, `0` in none.
close<a class="cmnd" id="serial_close"></a>|`close(void) -> nil`<br>Closes the serial port and deallocates resources and hardware serial. After this, any call to the serial instance will return `nil` and will have no effect
Expand Down

0 comments on commit 910868c

Please sign in to comment.