• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. _module-pw_stream_uart_mcuxpresso:
2
3=========================
4pw_stream_uart_mcuxpresso
5=========================
6``pw_stream_uart_mcuxpresso`` implements the ``pw_stream`` interface for reading
7and writing to a UART using the NXP MCUXpresso SDK. ``UartStreamMcuxpresso``
8version uses the CPU to read and write to the UART, while ``UartDmaStreamMcuxpresso``
9uses DMA transfers to read and write to the UART minimizing the CPU utilization.
10
11``InterruptSafeUartWriterMcuxpresso`` implements an interrupt safe
12write-only stream to UART. Intended for use in fault handlers. It can be
13constructed ``constinit`` for use in pre-static constructor environments as well.
14
15.. note::
16  This module will likely be superseded by a future ``pw_uart`` interface.
17
18Setup
19=====
20This module requires a little setup:
21
221. Use ``pw_build_mcuxpresso`` to create a ``pw_source_set`` for an
23   MCUXpresso SDK.
242. Include the debug console component in this SDK definition.
253. Specify the ``pw_third_party_mcuxpresso_SDK`` GN global variable to specify
26   the name of this source set.
274. Use a target that calls ``pw_sys_io_mcuxpresso_Init`` in
28   ``pw_boot_PreMainInit`` or similar.
29
30The name of the SDK source set must be set in the
31"pw_third_party_mcuxpresso_SDK" GN arg
32
33Usage
34=====
35
36``UartStreamMcuxpresso`` example:
37
38.. literalinclude:: stream_example.cc
39   :language: cpp
40   :linenos:
41   :start-after: [pw_stream_uart_mcuxpresso-UartStreamExample]
42   :end-before: [pw_stream_uart_mcuxpresso-UartStreamExample]
43
44``UartDmaStreamMcuxpresso`` example:
45
46.. literalinclude:: dma_stream_example.cc
47   :language: cpp
48   :linenos:
49   :start-after: [pw_stream_uart_mcuxpresso-UartDmaStreamExample]
50   :end-before: [pw_stream_uart_mcuxpresso-UartDmaStreamExample]
51
52``InterruptSafeUartWriterMcuxpresso`` example:
53
54.. literalinclude:: interrupt_safe_writer_example.cc
55   :language: cpp
56   :linenos:
57   :start-after: [pw_stream_uart_mcuxpresso-UartInterruptSafeWriterExample]
58   :end-before: [pw_stream_uart_mcuxpresso-UartInterruptSafeWriterExample]
59