pw_digital_io_zephyr#

Experimental C++

pw_digital_io_zephyr implements the pw_digital_io interface using the Zephyr API.

Setup#

Use of this module requires setting up the Zephyr build environment for use with Pigweed. Follow steps in Zephyr quickstart to get setup.

Examples#

Used devicetree to initialize any of the digital IO classes. Assume the following devicetree snippet:

my_node: node@20 {
  compatible = "org,foo-bar";
  gpios = <&gpio0 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
};

Then in your application:

#include "pw_digital_io_zephyr/digital_io.h"
#include "zephyr/gpio.h"

constexpr pw::digital_io::ZephyrDigitalInInterrupt
    kNodeGpio(GPIO_DT_SPEC_GET(DT_NODELABEL(my_node), gpios));