1.. _module-pw_uart_mcuxpresso: 2 3================== 4pw_uart_mcuxpresso 5================== 6.. pigweed-module:: 7 :name: pw_uart_mcuxpresso 8 9``pw_uart_mcuxpresso`` implements the ``pw_uart`` interface for reading 10and writing to a UART using the NXP MCUXpresso SDK. 11 12There are two implementations available: 13 14* `DmaUartMcuxpresso`: Implements `pw::Uart`. 15* `DmaUartMcuxpressoNonBlocking`: Implements `pw::UartNonBlocking`. 16 17Both implementations use DMA transfers to read andwrite to the UART, 18minimizing CPU utilization. 19 20.. note:: 21 For a simpler UART interface, see ``pw_stream_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``DmaUartMcuxpresso`` 42--------------------- 43 44.. literalinclude:: dma_uart_example.cc 45 :language: cpp 46 :linenos: 47 :start-after: [pw_uart_mcuxpresso-DmaUartExample] 48 :end-before: [pw_uart_mcuxpresso-DmaUartExample] 49 50 51-------------------------------- 52``DmaUartMcuxpressoNonBlocking`` 53-------------------------------- 54.. literalinclude:: dma_uart_nonblocking_example.cc 55 :language: cpp 56 :linenos: 57 :start-after: [pw_uart_mcuxpresso-DmaUartNonBlockingBasicExample] 58 :end-before: [pw_uart_mcuxpresso-DmaUartNonBlockingBasicExample] 59 60The nonblocking UART can be converted to a blocking UART via an adapter: 61 62.. literalinclude:: dma_uart_nonblocking_example.cc 63 :language: cpp 64 :linenos: 65 :start-after: [pw_uart_mcuxpresso-DmaUartNonBlockingAdapterExample] 66 :end-before: [pw_uart_mcuxpresso-DmaUartNonBlockingAdapterExample] 67