1.. _module-pw_digital_io_mcuxpresso: 2 3------------------------ 4pw_digital_io_mcuxpresso 5------------------------ 6``pw_digital_io_mcuxpresso`` implements the :ref:`module-pw_digital_io` interface using 7the NXP MCUXpresso SDK. 8 9Setup 10===== 11Use of this module requires setting up the MCUXpresso SDK for use with Pigweed. Follow 12the steps in :ref:`module-pw_build_mcuxpresso` to create a ``pw_source_set`` for an 13MCUXpresso SDK. Include the GPIO and PINT driver components in this SDK definition. 14 15This example shows what your SDK setup would look like if using an RT595 board. 16 17.. code-block:: text 18 19 import("$dir_pw_third_party/mcuxpresso/mcuxpresso.gni") 20 21 pw_mcuxpresso_sdk("sample_project_sdk") { 22 manifest = "$dir_pw_third_party/mcuxpresso/evkmimxrt595/EVK-MIMXRT595_manifest_v3_13.xml" 23 include = [ 24 "component.serial_manager_uart.MIMXRT595S", 25 "platform.drivers.lpc_gpio.MIMXRT595S", 26 "platform.drivers.pint.MIMXRT595S", 27 "project_template.evkmimxrt595.MIMXRT595S", 28 "utility.debug_console.MIMXRT595S", 29 ] 30 } 31 32Next, specify the ``pw_third_party_mcuxpresso_SDK`` GN global variable to specify 33the name of this source set. Edit your GN args with ``gn args out``. 34 35.. code-block:: text 36 37 pw_third_party_mcuxpresso_SDK = "//targets/mimxrt595_evk:sample_project_sdk" 38 39Then, depend on this module in your BUILD.gn to use. 40 41.. code-block:: text 42 43 deps = [ dir_pw_digital_io_mcuxpresso ] 44 45Examples 46======== 47Use ``pw::digital_io::McuxpressoDigitalIn`` and ``pw::digital_io::McuxpressoDigitalOut`` 48classes to control GPIO pins. 49 50Example code to use GPIO pins from an NXP SDK board definition: 51 52.. code-block:: text 53 54 McuxpressoDigitalOut out(BOARD_INITPINS_D8_GPIO, 55 BOARD_INITPINS_D8_PORT, 56 BOARD_INITPINS_D8_PIN, 57 pw::digital_io::State::kActive); 58 out.SetState(pw::digital_io::State::kInactive); 59 60 McuxpressoDigitalIn in( 61 BOARD_INITPINS_D9_GPIO, BOARD_INITPINS_D9_PORT, BOARD_INITPINS_D9_PIN); 62 auto state = in.GetState(); 63