16 void setup()
override;
22#ifdef USE_PCA9554_PCAL
29 const uint8_t shift = 2 * pin;
38#ifdef USE_PCA9554_PCAL
56#ifdef USE_PCA9554_PCAL
66#ifdef USE_PCA9554_PCAL
78#ifdef USE_PCA9554_PCAL
Base for expanders that cache reads per loop. With an interrupt pin the cache stays valid until INT f...
This Class provides the methods to read/write bytes from/to an i2c device.
I2CRegister reg(uint8_t a_register)
calls the I2CRegister constructor
void dump_config() override
bool write_pcal_shadows_()
Write every PCAL shadow to the chip; false when any write failed.
bool digital_read_cache(uint8_t pin) override
void set_latch(uint8_t pin)
Only updates the shadow, which setup() writes.
const uint8_t reg_width_
width of registers
bool write_register_(uint8_t reg, uint16_t value)
uint32_t drive_
Drive strength shadow, two bits per pin; the low reg_width_ bytes go to OUTPUT_DRIVE_0.
void retry_pcal_shadows_()
Retry the shadows when an earlier PCAL write failed.
uint16_t output_mask_
The mask to write as output state - 1 means HIGH, 0 means LOW.
void digital_write_hw(uint8_t pin, bool value) override
bool write_address_(uint8_t address, uint16_t value)
const uint8_t pin_count_
number of bits the expander has
void set_drive_strength(uint8_t pin, uint8_t strength)
Only updates the shadow, which setup() writes. 0 is a quarter of the full drive strength,...
void update_pcal_register_(uint8_t reg, uint16_t &shadow, uint16_t mask, uint16_t value)
Changes the masked bits of a shadow and writes the register only when it changed.
bool digital_read_hw(uint8_t pin) override
uint16_t input_mask_
The state of the actual input pins - 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.
PCA9554Component(uint8_t pin_count)
uint16_t config_mask_
Mask for the pin config - 1 means OUTPUT, 0 means INPUT.
bool write_pcal_register_(uint8_t reg, uint16_t value)
void setup() override
Check i2c availability and setup masks.
void set_pcal()
The PCAL parts add pull resistors, input latches, an interrupt mask and drive strength.
ESPHOME_EXPANDER_PIN_SUMMARY_DECL(esphome::pca9554::PCA9554Component)