30 ESP_LOGE(TAG,
"PCA6416A not available under 0x%02X", this->
address_);
50 ESP_LOGD(TAG,
"Initialization complete. Warning: %d, Error: %d", this->
status_has_warning(),
58 ESP_LOGCONFIG(TAG,
"PCAL6416A:");
60 ESP_LOGCONFIG(TAG,
"PCA6416A:");
105 ESP_LOGW(TAG,
"Your PCA6416A does not support pull-up resistors");
116 ESP_LOGD(TAG,
"Device marked failed");
122 ESP_LOGE(TAG,
"read_register_(): I2C I/O error: %d", (
int) this->
last_error_);
130 ESP_LOGD(TAG,
"Device marked failed");
136 ESP_LOGE(TAG,
"write_register_(): I2C I/O error: %d", (
int) this->
last_error_);
143 uint8_t bit = pin % 8;
144 uint8_t reg_value = 0;
void mark_failed()
Mark this component as failed.
bool status_comm_result(bool ok)
Clears the warning when ok, else sets it with message (default "Communication failed"); returns ok.
bool status_has_warning() const
bool status_has_error() const
void setup_interrupt_pin_()
InternalGPIOPin * interrupt_pin_
void enable_polling_loop_()
Call from pin_mode() for an input pin: without an interrupt pin the loop polls instead.
ErrorCode write_register(uint8_t a_register, const uint8_t *data, size_t len) const
writes an array of bytes to a specific register in the I²C device
uint8_t address_
store the address of the device on the bus
ErrorCode read_register(uint8_t a_register, uint8_t *data, size_t len)
reads an array of bytes from a specific register in the I²C device
void digital_write_hw(uint8_t pin, bool value) override
bool write_register_(uint8_t reg, uint8_t value)
bool read_register_(uint8_t reg, uint8_t *value)
esphome::i2c::ErrorCode last_error_
Storage for last I2C error seen.
void update_register_(uint8_t pin, bool pin_value, uint8_t reg_addr)
uint16_t input_mask_
Cache for input values (16-bit combined for both banks)
bool has_pullup_
Only the PCAL6416A has pull-up resistors.
void pin_mode(uint8_t pin, gpio::Flags flags)
Helper function to set the pin mode of a pin.
void setup() override
Check i2c availability and setup masks.
void dump_config() override
bool digital_read_hw(uint8_t pin) override
bool digital_read_cache(uint8_t pin) override
uint8_t output_0_
The mask to write as output state - 1 means HIGH, 0 means LOW.
@ ERROR_OK
No error found during execution of method.
ESPHOME_LOG_TAG(TAG, "pca6416a")
ESPHOME_ALWAYS_INLINE constexpr void assign_bits(T &value, std::type_identity_t< T > mask, bool on)
Set the bits of mask in value when on is true, clear them otherwise.