9static const char *
const TAG =
"rp2040";
11static int flags_to_mode(
gpio::Flags flags, uint8_t pin) {
19 return INPUT_PULLDOWN;
34 auto *arg =
new ISRPinArg{};
35 arg->pin = this->
pin_;
37 arg->mask = 1 << this->
pin_;
42 PinStatus arduino_mode = LOW;
45 arduino_mode =
inverted_ ? FALLING : RISING;
48 arduino_mode =
inverted_ ? RISING : FALLING;
51 arduino_mode = CHANGE;
61 attachInterrupt(
pin_, func, arduino_mode, arg);
64 pinMode(
pin_, flags_to_mode(flags,
pin_));
69 snprintf(buffer,
sizeof(buffer),
"GPIO%u",
pin_);
83using namespace rp2040;
86 auto *arg =
reinterpret_cast<ISRPinArg *
>(this->
arg_);
87 return bool(sio_hw->gpio_in & arg->mask) != arg->inverted;
91 auto *arg =
reinterpret_cast<ISRPinArg *
>(this->
arg_);
92 if (value != arg->inverted) {
93 sio_hw->gpio_set = arg->mask;
95 sio_hw->gpio_clr = arg->mask;
106 auto *arg =
reinterpret_cast<ISRPinArg *
>(this->
arg_);
108 sio_hw->gpio_oe_set = arg->mask;
110 sio_hw->gpio_oe_clr = arg->mask;
111 hw_write_masked(&padsbank0_hw->io[arg->pin],
114 PADS_BANK0_GPIO0_PUE_BITS | PADS_BANK0_GPIO0_PDE_BITS);
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
void digital_write(bool value)
void pin_mode(gpio::Flags flags)
void detach_interrupt() const override
void digital_write(bool value) override
bool digital_read() override
ISRInternalGPIOPin to_isr() const override
void pin_mode(gpio::Flags flags) override
std::string dump_summary() const override
void attach_interrupt(void(*func)(void *), void *arg, gpio::InterruptType type) const override
Providing packet encoding functions for exchanging data with a remote host.