Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

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.
 

Detailed Description

Function Documentation

◆ uart_poll_in()

int uart_poll_in ( const struct device * dev,
unsigned char * p_char )

#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.

Parameters
devUART device instance.
p_charPointer to character.
Return values
0If a character arrived.
-1If no character was available to read (i.e. the UART input buffer was empty).
-ENOSYSIf the operation is not implemented.
-EBUSYIf async reception was enabled using uart_rx_enable

◆ uart_poll_in_u16()

int uart_poll_in_u16 ( const struct device * dev,
uint16_t * p_u16 )

#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.

Parameters
devUART device instance.
p_u16Pointer to 16-bit data.
Return values
0If data arrived.
-1If no data was available to read (i.e., the UART input buffer was empty).
-ENOTSUPIf API is not enabled.
-ENOSYSIf the function is not implemented.
-EBUSYIf async reception was enabled using uart_rx_enable

◆ uart_poll_out()

void uart_poll_out ( const struct device * dev,
unsigned char out_char )

#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.

Parameters
devUART device instance.
out_charCharacter to send.

◆ uart_poll_out_u16()

void uart_poll_out_u16 ( const struct device * dev,
uint16_t out_u16 )

#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.

Parameters
devUART device instance.
out_u16Wide data to send.