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