8static const char *
const TAG =
"esp8266";
28 return INPUT_PULLDOWN_16;
31 return OUTPUT_OPEN_DRAIN;
50 auto *arg =
new ISRPinArg{};
51 arg->pin = this->
pin_;
53 if (this->
pin_ < 16) {
55 arg->out_set_reg = &GPOS;
56 arg->out_clr_reg = &GPOC;
57 arg->mode_set_reg = &GPES;
58 arg->mode_clr_reg = &GPEC;
59 arg->func_reg = &GPF(this->
pin_);
60 arg->control_reg = &GPC(this->
pin_);
61 arg->mask = 1 << this->
pin_;
64 arg->out_set_reg = &GP16O;
65 arg->out_clr_reg =
nullptr;
66 arg->mode_set_reg = &GP16E;
67 arg->mode_clr_reg =
nullptr;
68 arg->func_reg = &GPF16;
69 arg->control_reg =
nullptr;
76 uint8_t arduino_mode = 0;
79 arduino_mode =
inverted_ ? FALLING : RISING;
82 arduino_mode =
inverted_ ? RISING : FALLING;
85 arduino_mode = CHANGE;
88 arduino_mode =
inverted_ ? ONHIGH : ONLOW;
91 arduino_mode =
inverted_ ? ONLOW : ONHIGH;
95 attachInterruptArg(
pin_, func, arg, arduino_mode);
102 return snprintf(buffer,
len,
"GPIO%u", this->
pin_);
117using esp8266::ISRPinArg;
120 auto *arg =
reinterpret_cast<ISRPinArg *
>(this->
arg_);
121 return bool(*arg->in_reg & arg->mask) != arg->inverted;
125 auto *arg =
reinterpret_cast<ISRPinArg *
>(
arg_);
127 if (value != arg->inverted) {
128 *arg->out_set_reg = arg->mask;
130 *arg->out_clr_reg = arg->mask;
133 if (value != arg->inverted) {
134 *arg->out_set_reg = *arg->out_set_reg | 1;
136 *arg->out_set_reg = *arg->out_set_reg & ~1;
142 auto *arg =
reinterpret_cast<ISRPinArg *
>(
arg_);
143 GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, 1UL << arg->pin);
147 auto *arg =
reinterpret_cast<ISRPinArg *
>(this->
arg_);
150 *arg->mode_set_reg = arg->mask;
152 *arg->control_reg = *arg->control_reg | (1 << GPCD);
154 *arg->control_reg &= ~(1 << GPCD);
157 *arg->mode_clr_reg = arg->mask;
160 *arg->func_reg = *arg->func_reg | (1 << GPFPU);
161 *arg->control_reg = *arg->control_reg | (1 << GPCD);
163 *arg->func_reg = *arg->func_reg & ~(1 << GPFPU);
167 *arg->mode_set_reg = *arg->mode_set_reg | 1;
169 *arg->mode_set_reg = *arg->mode_set_reg & ~1;
172 *arg->func_reg = *arg->func_reg | (1 << GP16FPD);
174 *arg->func_reg = *arg->func_reg & ~(1 << GP16FPD);
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)
bool digital_read() override
ISRInternalGPIOPin to_isr() const override
void digital_write(bool value) override
void attach_interrupt(void(*func)(void *), void *arg, gpio::InterruptType type) const override
void detach_interrupt() const override
void pin_mode(gpio::Flags flags) override
size_t dump_summary(char *buffer, size_t len) const override
Providing packet encoding functions for exchanging data with a remote host.