31 return INPUT_PULLDOWN_16;
34 return OUTPUT_OPEN_DRAIN;
40static constexpr uint32_t GPF_SLOTS_0_7 = 0x76fe4d5c;
41static constexpr uint32_t GPF_SLOTS_8_15 = 0x3210ba98;
42static inline volatile uint32_t &IRAM_ATTR isr_gpf(uint8_t num) {
43 const uint32_t slots = num < 8 ? GPF_SLOTS_0_7 : GPF_SLOTS_8_15;
44 return ESP8266_REG(0x804 + 4 * ((slots >> (4 * (num & 7))) & 0xF));
50 uint8_t arduino_mode = 0;
53 arduino_mode =
inverted_ ? FALLING : RISING;
56 arduino_mode =
inverted_ ? RISING : FALLING;
59 arduino_mode = CHANGE;
62 arduino_mode =
inverted_ ? ONHIGH : ONLOW;
65 arduino_mode =
inverted_ ? ONLOW : ONHIGH;
69 attachInterruptArg(
pin_, func, arg, arduino_mode);
76 return buf_append_printf(
buffer,
len, 0,
"GPIO%u", this->
pin_);
92using esp8266::isr_gpf;
96 const uint8_t num = pin->
get_pin();
97 return bool(num < 16 ? GPI & (1 << num) : GP16I & 1) != pin->is_inverted();
102 const uint8_t num = pin->get_pin();
104 if (
value != pin->is_inverted()) {
110 GP16O =
value != pin->is_inverted() ? GP16O | 1 : GP16O & ~1;
117 GPIO_REG_WRITE(GPIO_STATUS_W1TC_ADDRESS, 1UL << pin->get_pin());
126 GPC(num) = GPC(num) | (1 << GPCD);
128 GPC(num) &= ~(1 << GPCD);
134 isr_gpf(num) = isr_gpf(num) | (1 << GPFPU);
135 GPC(num) = GPC(num) | (1 << GPCD);
137 isr_gpf(num) = isr_gpf(num) & ~(1 << GPFPU);
ISR-safe handle to an internal pin (no virtual calls); every handle points at the pin itself and shar...
void digital_write(bool value)
void pin_mode(gpio::Flags flags)
friend class esp8266::ESP8266GPIOPin
ISRInternalGPIOPin to_isr() const
void attach_interrupt_(void(*func)(void *), void *arg, gpio::InterruptType type) const
void detach_interrupt() const
bool digital_read() override
void digital_write(bool value) override
void pin_mode(gpio::Flags flags) override
size_t dump_summary(char *buffer, size_t len) const override
ESPHOME_LOG_TAG(TAG, "esp8266")