7static const char *
const TAG =
"tca9548a";
27 ESP_LOGCONFIG(TAG,
"Setting up TCA9548A...");
30 ESP_LOGE(TAG,
"TCA9548A failed");
34 ESP_LOGD(TAG,
"Channels currently open: %d",
status);
37 ESP_LOGCONFIG(TAG,
"TCA9548A:");
45 uint8_t channel_val = 1 << channel;
46 return this->
write(&channel_val, 1);
51 ESP_LOGE(TAG,
"Failed to disable all channels.");
virtual void mark_failed()
Mark this component as failed.
void status_set_error(const char *message="unspecified")
virtual ErrorCode readv(uint8_t address, ReadBuffer *buffers, size_t count)=0
This virtual method reads bytes from an I2CBus into an array of ReadBuffer.
virtual ErrorCode writev(uint8_t address, WriteBuffer *buffers, size_t cnt)
ErrorCode write(const uint8_t *data, size_t len, bool stop=true)
writes an array of bytes to a device using an I2CBus
I2CBus * bus_
pointer to I2CBus instance
ErrorCode read(uint8_t *data, size_t len)
reads an array of bytes from the device using an I2CBus
i2c::ErrorCode writev(uint8_t address, i2c::WriteBuffer *buffers, size_t cnt, bool stop) override
i2c::ErrorCode readv(uint8_t address, i2c::ReadBuffer *buffers, size_t cnt) override
TCA9548AComponent * parent_
i2c::ErrorCode switch_to_channel(uint8_t channel)
void disable_all_channels()
void dump_config() override
ErrorCode
Error codes returned by I2CBus and I2CDevice methods.
@ ERROR_OK
No error found during execution of method.
@ ERROR_NOT_INITIALIZED
call method to a not initialized bus
Providing packet encoding functions for exchanging data with a remote host.
the ReadBuffer structure stores a pointer to a read buffer and its length
the WriteBuffer structure stores a pointer to a write buffer and its length