mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-04 03:48:29 +02:00
pca9554 cache reads (#5137)
This commit is contained in:
@@ -13,6 +13,8 @@ class PCA9554Component : public Component, public i2c::I2CDevice {
|
||||
|
||||
/// Check i2c availability and setup masks
|
||||
void setup() override;
|
||||
/// Poll for input changes periodically
|
||||
void loop() override;
|
||||
/// Helper function to read the value of a pin.
|
||||
bool digital_read(uint8_t pin);
|
||||
/// Helper function to write the value of a pin.
|
||||
@@ -22,6 +24,8 @@ class PCA9554Component : public Component, public i2c::I2CDevice {
|
||||
|
||||
float get_setup_priority() const override;
|
||||
|
||||
float get_loop_priority() const override;
|
||||
|
||||
void dump_config() override;
|
||||
|
||||
protected:
|
||||
@@ -35,6 +39,8 @@ class PCA9554Component : public Component, public i2c::I2CDevice {
|
||||
uint8_t output_mask_{0x00};
|
||||
/// The state of the actual input pin states - 1 means HIGH, 0 means LOW
|
||||
uint8_t input_mask_{0x00};
|
||||
/// Flags to check if read previously during this loop
|
||||
uint8_t was_previously_read_ = {0x00};
|
||||
/// Storage for last I2C error seen
|
||||
esphome::i2c::ErrorCode last_error_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user