• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. _module-pw_stream_uart_linux:
2
3====================
4pw_stream_uart_linux
5====================
6``pw_stream_uart_linux`` implements the
7:cpp:class:`pw::stream::NonSeekableReaderWriter` interface for reading from and
8writing to a UART using Linux TTY interfaces.
9
10.. note::
11  This module will likely be superseded by a future ``pw_uart`` interface.
12
13C++
14===
15.. doxygenclass:: pw::stream::UartStreamLinux
16   :members:
17
18Examples
19========
20A simple example illustrating writing to a UART:
21
22.. code-block:: cpp
23
24   constexpr const char* kUartPath = "/dev/ttyS0";
25   constexpr uint32_t kBaudRate = 115200;
26
27   pw::stream::UartStreamLinux stream;
28   PW_TRY(stream.Open(kUartPath, kBaudRate));
29
30   std::array<std::byte, 10> to_write = {};
31   PW_TRY(stream.Write(to_write));
32
33Caveats
34=======
35No interfaces are supplied for configuring data bits, stop bits, or parity.
36These attributes are left as they are already configured on the TTY; only the
37speed is modified.
38