#include "mcp23xxx_base.h" #include "esphome/core/helpers.h" #include "esphome/core/log.h" namespace esphome { namespace mcp23xxx_base { template void MCP23XXXGPIOPin::setup() { this->pin_mode(flags_); // When interrupt_pin is configured, pin_mode() already auto-enables CHANGE // interrupt for input pins, so skip the explicit call if the user didn't // override the default (NO_INTERRUPT) if (this->interrupt_mode_ != MCP23XXX_NO_INTERRUPT || this->parent_->get_interrupt_pin() == nullptr) { this->parent_->pin_interrupt_mode(this->pin_, this->interrupt_mode_); } } template void MCP23XXXGPIOPin::pin_mode(gpio::Flags flags) { this->parent_->pin_mode(this->pin_, flags); } template bool MCP23XXXGPIOPin::digital_read() { return this->parent_->digital_read(this->pin_) != this->inverted_; } template void MCP23XXXGPIOPin::digital_write(bool value) { this->parent_->digital_write(this->pin_, value != this->inverted_); } template size_t MCP23XXXGPIOPin::dump_summary(char *buffer, size_t len) const { return buf_append_printf(buffer, len, 0, "%u via MCP23XXX", this->pin_); } template class MCP23XXXGPIOPin<8>; template class MCP23XXXGPIOPin<16>; } // namespace mcp23xxx_base } // namespace esphome