7static const char *
const TAG =
"pcf8574";
11 ESP_LOGE(TAG,
"PCF8574 not available under 0x%02X", this->
address_);
47 ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
88 this->
input_mask_ = (uint16_t(data[1]) << 8) | (uint16_t(data[0]) << 0);
109 value |= ~this->mode_mask_;
113 data[1] = value >> 8;
129 return buf_append_printf(buffer,
len, 0,
"%u via PCF8574", 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.
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(const uint8_t *data, size_t len) const
writes an array of bytes to a device using an I2CBus
optional< std::array< uint8_t, N > > read_bytes_raw()
uint8_t address_
store the address of the device on the bus
uint16_t input_mask_
The state read in read_gpio_ - 1 means HIGH, 0 means LOW.
void setup() override
Check i2c availability and setup masks.
uint16_t mode_mask_
Mask for the pin mode - 1 means output, 0 means input.
static void IRAM_ATTR gpio_intr(PCF8574Component *arg)
uint16_t output_mask_
The mask to write as output state - 1 means HIGH, 0 means LOW.
float get_setup_priority() const override
void digital_write_hw(uint8_t pin, bool value) override
void pin_mode(uint8_t pin, gpio::Flags flags)
Helper function to set the pin mode of a pin.
void dump_config() override
bool digital_read_cache(uint8_t pin) override
InternalGPIOPin * interrupt_pin_
bool pcf8575_
TRUE->16-channel PCF8575, FALSE->8-channel PCF8574.
bool digital_read_hw(uint8_t pin) override
void digital_write(bool value) override
bool digital_read() override
void pin_mode(gpio::Flags flags) override
size_t dump_summary(char *buffer, size_t len) const override
PCF8574Component * parent_
@ 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.