Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
|
Functions | |
int | uart_poll_in (const struct device *dev, unsigned char *p_char) |
Read a character from the device for input. | |
int | uart_poll_in_u16 (const struct device *dev, uint16_t *p_u16) |
Read a 16-bit datum from the device for input. | |
void | uart_poll_out (const struct device *dev, unsigned char out_char) |
Write a character to the device for output. | |
void | uart_poll_out_u16 (const struct device *dev, uint16_t out_u16) |
Write a 16-bit datum to the device for output. | |
#include <zephyr/drivers/uart.h>
Read a character from the device for input.
This routine checks if the receiver has valid data. When the receiver has valid data, it reads a character from the device, stores to the location pointed to by p_char, and returns 0 to the calling thread. It returns -1, otherwise. This function is a non-blocking call.
dev | UART device instance. |
p_char | Pointer to character. |
0 | If a character arrived. |
-1 | If no character was available to read (i.e. the UART input buffer was empty). |
-ENOSYS | If the operation is not implemented. |
-EBUSY | If async reception was enabled using uart_rx_enable |
#include <zephyr/drivers/uart.h>
Read a 16-bit datum from the device for input.
This routine checks if the receiver has valid data. When the receiver has valid data, it reads a 16-bit datum from the device, stores to the location pointed to by p_u16, and returns 0 to the calling thread. It returns -1, otherwise. This function is a non-blocking call.
dev | UART device instance. |
p_u16 | Pointer to 16-bit data. |
0 | If data arrived. |
-1 | If no data was available to read (i.e., the UART input buffer was empty). |
-ENOTSUP | If API is not enabled. |
-ENOSYS | If the function is not implemented. |
-EBUSY | If async reception was enabled using uart_rx_enable |
#include <zephyr/drivers/uart.h>
Write a character to the device for output.
This routine checks if the transmitter is full. When the transmitter is not full, it writes a character to the data register. It waits and blocks the calling thread, otherwise. This function is a blocking call.
To send a character when hardware flow control is enabled, the handshake signal CTS must be asserted.
dev | UART device instance. |
out_char | Character to send. |
#include <zephyr/drivers/uart.h>
Write a 16-bit datum to the device for output.
This routine checks if the transmitter is full. When the transmitter is not full, it writes a 16-bit datum to the data register. It waits and blocks the calling thread, otherwise. This function is a blocking call.
To send a datum when hardware flow control is enabled, the handshake signal CTS must be asserted.
dev | UART device instance. |
out_u16 | Wide data to send. |