1*61c4878aSAndroid Build Coastguard Worker.. _module-pw_sys_io: 2*61c4878aSAndroid Build Coastguard Worker 3*61c4878aSAndroid Build Coastguard Worker--------- 4*61c4878aSAndroid Build Coastguard Workerpw_sys_io 5*61c4878aSAndroid Build Coastguard Worker--------- 6*61c4878aSAndroid Build Coastguard WorkerThis module defines a simple and unoptimized interface for byte-by-byte 7*61c4878aSAndroid Build Coastguard Workerinput/output. This can be done over a logging system, stdio, UART, via a 8*61c4878aSAndroid Build Coastguard Workerphotodiode and modulated kazoo, or basically any way to get data in and out 9*61c4878aSAndroid Build Coastguard Workerof an application. 10*61c4878aSAndroid Build Coastguard Worker 11*61c4878aSAndroid Build Coastguard WorkerThis facade doesn't dictate any policies on input and output data encoding, 12*61c4878aSAndroid Build Coastguard Workerformat, or transmission protocol. It only requires that backends return a 13*61c4878aSAndroid Build Coastguard Worker``OkStatus()`` if the operation succeeds. Backends may provide useful error 14*61c4878aSAndroid Build Coastguard WorkerStatus types, but depending on the implementation-specific Status values is 15*61c4878aSAndroid Build Coastguard WorkerNOT recommended. Since this facade provides a very vague I/O interface, it 16*61c4878aSAndroid Build Coastguard Workerdoes NOT provide tests. Backends are expected to provide their own testing to 17*61c4878aSAndroid Build Coastguard Workervalidate correctness. 18*61c4878aSAndroid Build Coastguard Worker 19*61c4878aSAndroid Build Coastguard WorkerThe intent of this module for simplifying bringup or otherwise getting data 20*61c4878aSAndroid Build Coastguard Workerin/out of a CPU in a way that is platform-agnostic. The interface is designed 21*61c4878aSAndroid Build Coastguard Workerto be easy to understand. There's no initialization as part of this 22*61c4878aSAndroid Build Coastguard Workerinterface, there's no configuration, and the interface is no-frills WYSIWYG 23*61c4878aSAndroid Build Coastguard Workerbyte-by-byte i/o. 24*61c4878aSAndroid Build Coastguard Worker 25*61c4878aSAndroid Build Coastguard Worker**It is strongly advised NOT to build projects on top of this interface.** There 26*61c4878aSAndroid Build Coastguard Workerare many drawbacks to using this interface, so it's not generally suited for use 27*61c4878aSAndroid Build Coastguard Workerin production. 28*61c4878aSAndroid Build Coastguard Worker 29*61c4878aSAndroid Build Coastguard WorkerSetup 30*61c4878aSAndroid Build Coastguard Worker===== 31*61c4878aSAndroid Build Coastguard WorkerThis module requires relatively minimal setup: 32*61c4878aSAndroid Build Coastguard Worker 33*61c4878aSAndroid Build Coastguard Worker1. Choose a ``pw_sys_io`` backend, or write one yourself. 34*61c4878aSAndroid Build Coastguard Worker2. If using GN build, Specify the ``pw_sys_io_BACKEND`` GN build arg to point 35*61c4878aSAndroid Build Coastguard Worker the library that provides a ``pw_sys_io`` backend. 36*61c4878aSAndroid Build Coastguard Worker 37*61c4878aSAndroid Build Coastguard WorkerModule usage 38*61c4878aSAndroid Build Coastguard Worker============ 39*61c4878aSAndroid Build Coastguard WorkerSee backend docs for how to interact with the underlying system I/O 40*61c4878aSAndroid Build Coastguard Workerimplementation. 41*61c4878aSAndroid Build Coastguard Worker 42*61c4878aSAndroid Build Coastguard WorkerAPI reference 43*61c4878aSAndroid Build Coastguard Worker============= 44*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::sys_io::ReadByte(std::byte* dest) 45*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::sys_io::TryReadByte(std::byte* dest) 46*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::sys_io::WriteByte(std::byte b) 47*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::sys_io::WriteLine(std::string_view s) 48*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::sys_io::ReadBytes(ByteSpan dest) 49*61c4878aSAndroid Build Coastguard Worker.. doxygenfunction:: pw::sys_io::WriteBytes(ConstByteSpan src) 50*61c4878aSAndroid Build Coastguard Worker 51*61c4878aSAndroid Build Coastguard WorkerDependencies 52*61c4878aSAndroid Build Coastguard Worker============ 53*61c4878aSAndroid Build Coastguard Worker- :ref:`module-pw_sys_io` 54*61c4878aSAndroid Build Coastguard Worker- :ref:`module-pw_span` 55*61c4878aSAndroid Build Coastguard Worker- :ref:`module-pw_status` 56*61c4878aSAndroid Build Coastguard Worker 57*61c4878aSAndroid Build Coastguard Worker.. toctree:: 58*61c4878aSAndroid Build Coastguard Worker :hidden: 59*61c4878aSAndroid Build Coastguard Worker :maxdepth: 1 60*61c4878aSAndroid Build Coastguard Worker 61*61c4878aSAndroid Build Coastguard Worker Backends <backends> 62