9 static const char *
const TAG =
"rp2040";
19 return INPUT_PULLDOWN;
33 auto *arg =
new ISRPinArg{};
35 arg->inverted = inverted_;
40 PinStatus arduino_mode = LOW;
43 arduino_mode = inverted_ ? FALLING : RISING;
46 arduino_mode = inverted_ ? RISING : FALLING;
49 arduino_mode = CHANGE;
52 arduino_mode = inverted_ ? HIGH : LOW;
55 arduino_mode = inverted_ ? LOW : HIGH;
59 attachInterrupt(pin_, func, arduino_mode, arg);
62 pinMode(pin_, flags_to_mode(flags, pin_));
67 snprintf(buffer,
sizeof(buffer),
"GPIO%u", pin_);
72 return bool(digitalRead(pin_)) != inverted_;
75 digitalWrite(pin_, value != inverted_ ? 1 : 0);
81 using namespace rp2040;
84 auto *arg =
reinterpret_cast<ISRPinArg *
>(arg_);
85 return bool(digitalRead(arg->pin)) != arg->inverted;
88 auto *arg =
reinterpret_cast<ISRPinArg *
>(arg_);
89 digitalWrite(arg->pin, value != arg->inverted ? 1 : 0);
97 auto *arg =
reinterpret_cast<ISRPinArg *
>(arg_);
98 pinMode(arg->pin, flags_to_mode(flags, arg->pin));
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
bool digital_read() override
void digital_write(bool value) override
void pin_mode(gpio::Flags flags) override
ISRInternalGPIOPin to_isr() const override
void pin_mode(gpio::Flags flags)
void attach_interrupt(void(*func)(void *), void *arg, gpio::InterruptType type) const override
Implementation of SPI Controller mode.
std::string dump_summary() const override
void digital_write(bool value)
void detach_interrupt() const override