summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2021-11-14 05:23:14 +1100
committerGitHub <noreply@github.com>2021-11-13 18:23:14 +0000
commit04b51e381e2ff3f4c7aba662e1c817ce5daa931d (patch)
tree3b5c4415b94184f182d11e2629b405af9b3f0c57 /docs
parent7e86c37962935e2f791864201b684345995f0b82 (diff)
Update UART driver API (#14839)
* Add uart_puts() and uart_gets() * Add some docs * Rework API * Formatting * Update docs/uart_driver.md Co-authored-by: Sergey Vlasov <sigprof@gmail.com> * Simplify a uart_write() loop * Update platforms/avr/drivers/uart.c Co-authored-by: Joel Challis <git@zvecr.com> Co-authored-by: Sergey Vlasov <sigprof@gmail.com> Co-authored-by: Joel Challis <git@zvecr.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/uart_driver.md38
1 files changed, 32 insertions, 6 deletions
diff --git a/docs/uart_driver.md b/docs/uart_driver.md
index 4d1716975f..340b648189 100644
--- a/docs/uart_driver.md
+++ b/docs/uart_driver.md
@@ -60,30 +60,56 @@ Initialize the UART driver. This function must be called only once, before any o
---
-### `void uart_putchar(uint8_t c)`
+### `void uart_write(uint8_t data)`
Transmit a single byte.
#### Arguments
- - `uint8_t c`
- The byte (character) to send, from 0 to 255.
+ - `uint8_t data`
+ The byte to write.
---
-### `uint8_t uart_getchar(void)`
+### `uint8_t uart_read(void)`
Receive a single byte.
#### Return Value
-The byte read from the receive buffer.
+The byte read from the receive buffer. This function will block if the buffer is empty (ie. no data to read).
+
+---
+
+### `void uart_transmit(const uint8_t *data, uint16_t length)`
+
+Transmit multiple bytes.
+
+#### Arguments
+
+ - `const uint8_t *data`
+ A pointer to the data to write from.
+ - `uint16_t length`
+ The number of bytes to write. Take care not to overrun the length of `data`.
+
+---
+
+### `void uart_receive(char *data, uint16_t length)`
+
+Receive multiple bytes.
+
+#### Arguments
+
+ - `uint8_t *data`
+ A pointer to the buffer to read into.
+ - `uint16_t length`
+ The number of bytes to read. Take care not to overrun the length of `data`.
---
### `bool uart_available(void)`
-Return whether the receive buffer contains data. Call this function to determine if `uart_getchar()` will return meaningful data.
+Return whether the receive buffer contains data. Call this function to determine if `uart_read()` will return data immediately.
#### Return Value