13 static const char *
const TAG =
"pca9554";
16 ESP_LOGCONFIG(TAG,
"Setting up PCA9554/PCA9554A...");
20 ESP_LOGE(TAG,
"PCA95xx not detected at 0x%02X", this->
address_);
36 ESP_LOGD(TAG,
"Initialization complete. Warning: %d, Error: %d", this->
status_has_warning(),
48 ESP_LOGCONFIG(TAG,
"PCA9554:");
49 ESP_LOGCONFIG(TAG,
" I/O Pins: %d", this->
pin_count_);
52 ESP_LOGE(TAG,
"Communication with PCA9554 failed!");
94 ESP_LOGD(TAG,
"Device marked failed");
101 ESP_LOGE(TAG,
"read_register_(): I2C I/O error: %d", (
int) this->
last_error_);
106 if (this->reg_width_ == 2) {
114 outputs[0] = (uint8_t) value;
115 outputs[1] = (uint8_t) (value >> 8);
119 ESP_LOGE(TAG,
"write_register_(): I2C I/O error: %d", (
int) this->
last_error_);
139 snprintf(buffer,
sizeof(buffer),
"%u via PCA9554", pin_);
ErrorCode read_register(uint8_t a_register, uint8_t *data, size_t len, bool stop=true)
reads an array of bytes from a specific register in the I²C device
void status_set_warning(const char *message="unspecified")
bool status_has_warning() const
I2CRegister reg(uint8_t a_register)
calls the I2CRegister constructor
void setup() override
Check i2c availability and setup masks.
esphome::i2c::ErrorCode last_error_
Storage for last I2C error seen.
std::string dump_summary() const override
void pin_mode(gpio::Flags flags) override
bool digital_read() override
float get_setup_priority() const override
void digital_write(bool value) override
uint16_t was_previously_read_
Flags to check if read previously during this loop.
bool status_has_error() const
void digital_write(uint8_t pin, bool value)
Helper function to write the value of a pin.
No error found during execution of method.
size_t pin_count_
number of bits the expander has
void status_clear_warning()
bool digital_read(uint8_t pin)
Helper function to read the value of a pin.
uint16_t input_mask_
The state of the actual input pin states - 1 means HIGH, 0 means LOW.
void loop() override
Poll for input changes periodically.
uint16_t config_mask_
Mask for the pin config - 1 means OUTPUT, 0 means INPUT.
uint16_t output_mask_
The mask to write as output state - 1 means HIGH, 0 means LOW.
uint8_t address_
store the address of the device on the bus
size_t reg_width_
width of registers
virtual void mark_failed()
Mark this component as failed.
const float IO
For components that represent GPIO pins like PCF8573.
void dump_config() override
Implementation of SPI Controller mode.
void pin_mode(uint8_t pin, gpio::Flags flags)
Helper function to set the pin mode of a pin.
ErrorCode write_register(uint8_t a_register, const uint8_t *data, size_t len, bool stop=true)
writes an array of bytes to a specific register in the I²C device
float get_loop_priority() const override
bool write_register_(uint8_t reg, uint16_t value)