pw_digital_io_mcuxpresso#

Pigweed AI summary: The pw_digital_io_mcuxpresso module implements the pw_digital_io interface using the NXP MCUXpresso SDK. To use this module, the MCUXpresso SDK must be set up for use with Pigweed, including the GPIO and PINT driver components. An example SDK setup is provided for an RT595 board. The module can be used to control GPIO pins using the McuxpressoDigitalIn and McuxpressoDigitalOut classes. Example code is provided for using GPIO pins from an

pw_digital_io_mcuxpresso implements the pw_digital_io interface using the NXP MCUXpresso SDK.

Setup#

Pigweed AI summary: To use this module, the MCUXpresso SDK must be set up for use with Pigweed, including the GPIO and PINT driver components. An example of the SDK setup for an RT595 board is provided. The pw_third_party_mcuxpresso_SDK GN global variable must be specified and the module must be depended on in the BUILD.gn file.

Use of this module requires setting up the MCUXpresso SDK for use with Pigweed. Follow the steps in pw_build_mcuxpresso to create a pw_source_set for an MCUXpresso SDK. Include the GPIO and PINT driver components in this SDK definition.

This example shows what your SDK setup would look like if using an RT595 board.

import("$dir_pw_third_party/mcuxpresso/mcuxpresso.gni")

pw_mcuxpresso_sdk("sample_project_sdk") {
  manifest = "$dir_pw_third_party/mcuxpresso/evkmimxrt595/EVK-MIMXRT595_manifest_v3_8.xml"
  include = [
    "component.serial_manager_uart.MIMXRT595S",
    "platform.drivers.lpc_gpio.MIMXRT595S",
    "platform.drivers.pint.MIMXRT595S",
    "project_template.evkmimxrt595.MIMXRT595S",
    "utility.debug_console.MIMXRT595S",
  ]
}

Next, specify the pw_third_party_mcuxpresso_SDK GN global variable to specify the name of this source set. Edit your GN args with gn args out.

pw_third_party_mcuxpresso_SDK = "//targets/mimxrt595_evk:sample_project_sdk"

Then, depend on this module in your BUILD.gn to use.

deps = [ dir_pw_digital_io_mcuxpresso ]

Examples#

Pigweed AI summary: The article provides an example of how to use the pw::digital_io::McuxpressoDigitalIn and pw::digital_io::McuxpressoDigitalOut classes to control GPIO pins. It includes example code for using GPIO pins from an NXP SDK board definition.

Use pw::digital_io::McuxpressoDigitalIn and pw::digital_io::McuxpressoDigitalOut classes to control GPIO pins.

Example code to use GPIO pins from an NXP SDK board definition:

McuxpressoDigitalOut out(BOARD_INITPINS_D8_GPIO,
                        BOARD_INITPINS_D8_PORT,
                        BOARD_INITPINS_D8_PIN,
                        pw::digital_io::State::kActive);
out.SetState(pw::digital_io::State::kInactive);

McuxpressoDigitalIn in(
   BOARD_INITPINS_D9_GPIO, BOARD_INITPINS_D9_PORT, BOARD_INITPINS_D9_PIN);
auto state = in.GetState();