C/C++ API Reference
Loading...
Searching...
No Matches
pw_stream_uart_linux

Oveview

Main docs: https://pigweed.dev/pw_stream_uart_linux.

Classes

class  pw::stream::UartStreamLinux
 pw::stream::NonSeekableReaderWriter implementation for UARTs on Linux. More...
 
struct  pw::stream::UartStreamLinux::Config
 

Functions

UartStreamLinuxpw::stream::UartStreamLinux::operator= (UartStreamLinux &&other)
 
 pw::stream::UartStreamLinux::UartStreamLinux (UartStreamLinux &&other) noexcept
 
 pw::stream::UartStreamLinux::UartStreamLinux (const UartStreamLinux &)=delete
 
UartStreamLinuxpw::stream::UartStreamLinux::operator= (const UartStreamLinux &)=delete
 
Status pw::stream::UartStreamLinux::Open (const char *path, uint32_t baud_rate)
 
Status pw::stream::UartStreamLinux::Open (const char *path, Config config)
 
void pw::stream::UartStreamLinux::Close ()
 
Status pw::stream::UartStreamLinux::DoWrite (ConstByteSpan data) override
 Virtual Write() function implemented by derived classes.
 
StatusWithSize pw::stream::UartStreamLinux::DoRead (ByteSpan dest) override
 Virtual Read() function implemented by derived classes.
 

Variables

std::optional< uint32_t > pw::stream::UartStreamLinux::Config::baud_rate
 
std::optional< bool > pw::stream::UartStreamLinux::Config::flow_control
 

Function Documentation

◆ DoRead()

StatusWithSize pw::stream::UartStreamLinux::DoRead ( ByteSpan  destination)
overrideprivatevirtual

Virtual Read() function implemented by derived classes.

Implements pw::stream::Stream.

◆ DoWrite()

Status pw::stream::UartStreamLinux::DoWrite ( ConstByteSpan  data)
overrideprivatevirtual

Virtual Write() function implemented by derived classes.

Implements pw::stream::Stream.

◆ Open() [1/2]

Status pw::stream::UartStreamLinux::Open ( const char *  path,
Config  config 
)

Open a UART device using the specified Config struct.

Parameters
[in]pathPath to the TTY device.
[in]configUartStreamLinux configuration structure.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: The device was successfully opened and configured.
* 
*     INVALID_ARGUMENT: Invalid config, for e.g. unsupported baud rate.
* 
*     FAILED_PRECONDITION: A device was already open.
* 
*     UNKNOWN: An error was returned by the operating system.
* 
*  

◆ Open() [2/2]

Status pw::stream::UartStreamLinux::Open ( const char *  path,
uint32_t  baud_rate 
)
inline

Open a UART device using the specified baud rate.

Parameters
[in]pathPath to the TTY device.
[in]baud_rateBaud rate to use for the device.
Returns
embed:rst:leading-asterisk
 
* 
*  .. pw-status-codes::
* 
*     OK: The device was successfully opened and configured.
* 
*     INVALID_ARGUMENT: An unsupported baud rate was supplied.
* 
*     FAILED_PRECONDITION: A device was already open.
* 
*     UNKNOWN: An error was returned by the operating system.
* 
*