9 static const char *
const TAG =
"lt.gpio";
19 return INPUT_PULLDOWN;
21 return OUTPUT_OPEN_DRAIN;
33 auto *arg =
new ISRPinArg{};
35 arg->inverted = inverted_;
40 PinStatus arduino_mode = (PinStatus) 255;
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 attachInterruptParam(pin_, func, arduino_mode, arg);
63 pinMode(pin_, flags_to_mode(flags));
68 snprintf(buffer,
sizeof(buffer),
"%u", pin_);
73 return bool(digitalRead(pin_)) ^ inverted_;
76 digitalWrite(pin_, value ^ inverted_);
79 detachInterrupt(pin_);
84 using namespace libretiny;
87 auto *arg =
reinterpret_cast<ISRPinArg *
>(arg_);
88 return bool(digitalRead(arg->pin)) ^ arg->inverted;
91 auto *arg =
reinterpret_cast<ISRPinArg *
>(arg_);
92 digitalWrite(arg->pin, value ^ arg->inverted);
95 auto *arg =
reinterpret_cast<ISRPinArg *
>(arg_);
96 detachInterrupt(arg->pin);
99 auto *arg =
reinterpret_cast<ISRPinArg *
>(arg_);
100 pinMode(arg->pin, flags_to_mode(flags));
105 #endif // USE_LIBRETINY void digital_write(bool value) override
ISRInternalGPIOPin to_isr() const override
Copy of GPIOPin that is safe to use from ISRs (with no virtual functions)
void pin_mode(gpio::Flags flags)
std::string dump_summary() const override
void detach_interrupt() const override
void pin_mode(gpio::Flags flags) override
bool digital_read() override
Implementation of SPI Controller mode.
void attach_interrupt(void(*func)(void *), void *arg, gpio::InterruptType type) const override
void digital_write(bool value)