13static const char *
const TAG =
"pca9554";
19 ESP_LOGE(TAG,
"PCA95xx not detected at 0x%02X", this->
address_);
35 ESP_LOGD(TAG,
"Initialization complete. Warning: %d, Error: %d", this->
status_has_warning(),
67 ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
110 ESP_LOGD(TAG,
"Device marked failed");
117 ESP_LOGE(TAG,
"read_register_(): I2C I/O error: %d", (
int) this->
last_error_);
122 if (this->reg_width_ == 2) {
130 outputs[0] = (uint8_t) value;
131 outputs[1] = (uint8_t) (value >> 8);
135 ESP_LOGE(TAG,
"write_register_(): I2C I/O error: %d", (
int) this->
last_error_);
150 return buf_append_printf(buffer,
len, 0,
"%u via PCA9554", this->
pin_);
void mark_failed()
Mark this component as failed.
void status_set_warning()
void enable_loop_soon_any_context()
Thread and ISR-safe version of enable_loop() that can be called from any context.
void enable_loop()
Enable this component's loop.
bool status_has_warning() const
bool status_has_error() const
void disable_loop()
Disable this component's loop.
void status_clear_warning()
void attach_interrupt(void(*func)(T *), T *arg, gpio::InterruptType type) const
void digital_write(P pin, bool value)
void set_invalidate_on_read_(bool invalidate)
bool digital_read(P pin)
Read the state of the given pin.
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 dump_config() override
float get_setup_priority() const override
size_t pin_count_
number of bits the expander has
bool digital_read_cache(uint8_t pin) override
InternalGPIOPin * interrupt_pin_
bool write_register_(uint8_t reg, uint16_t value)
static void IRAM_ATTR gpio_intr(PCA9554Component *arg)
uint16_t output_mask_
The mask to write as output state - 1 means HIGH, 0 means LOW.
size_t reg_width_
width of registers
void digital_write_hw(uint8_t pin, bool value) override
bool digital_read_hw(uint8_t pin) override
uint16_t input_mask_
The state of the actual input pin states - 1 means HIGH, 0 means LOW.
void pin_mode(uint8_t pin, gpio::Flags flags)
Helper function to set the pin mode of a pin.
uint16_t config_mask_
Mask for the pin config - 1 means OUTPUT, 0 means INPUT.
void setup() override
Check i2c availability and setup masks.
esphome::i2c::ErrorCode last_error_
Storage for last I2C error seen.
void pin_mode(gpio::Flags flags) override
bool digital_read() override
PCA9554Component * parent_
void digital_write(bool value) override
size_t dump_summary(char *buffer, size_t len) const override
@ ERROR_OK
No error found during execution of method.
constexpr float IO
For components that represent GPIO pins like PCF8573.
Providing packet encoding functions for exchanging data with a remote host.