3#include <zephyr/drivers/gpio.h>
9static const char *
const TAG =
"zephyr";
11static int flags_to_mode(
gpio::Flags flags,
bool inverted,
bool value) {
18 if (value != inverted) {
19 ret |= GPIO_OUTPUT_INIT_HIGH;
21 ret |= GPIO_OUTPUT_INIT_LOW;
28 ret |= GPIO_PULL_DOWN;
31 ret |= GPIO_OPEN_DRAIN;
42 auto *arg =
new ISRPinArg{};
43 arg->pin = this->
pin_;
53 const struct device *gpio =
nullptr;
54 if (this->
pin_ < 32) {
55#define GPIO0 DT_NODELABEL(gpio0)
56#if DT_NODE_HAS_STATUS(GPIO0, okay)
57 gpio = DEVICE_DT_GET(GPIO0);
59#error "gpio0 is disabled"
62#define GPIO1 DT_NODELABEL(gpio1)
63#if DT_NODE_HAS_STATUS(GPIO1, okay)
64 gpio = DEVICE_DT_GET(GPIO1);
66#error "gpio1 is disabled"
69 if (device_is_ready(gpio)) {
72 ESP_LOGE(TAG,
"gpio %u is not ready.", this->
pin_);
79 if (
nullptr == this->
gpio_) {
87 snprintf(buffer,
sizeof(buffer),
"GPIO%u, P%u.%u", this->
pin_, this->
pin_ / 32, this->
pin_ % 32);
92 if (
nullptr == this->
gpio_) {
102 if (
nullptr == this->
gpio_) {
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
void digital_write(bool value) override
void attach_interrupt(void(*func)(void *), void *arg, gpio::InterruptType type) const override
bool digital_read() override
std::string dump_summary() const override
ISRInternalGPIOPin to_isr() const override
void detach_interrupt() const override
void pin_mode(gpio::Flags flags) override
Providing packet encoding functions for exchanging data with a remote host.