4 static const uint8_t TCA9555_INPUT_PORT_REGISTER_0 = 0x00;
5 static const uint8_t TCA9555_INPUT_PORT_REGISTER_1 = 0x01;
6 static const uint8_t TCA9555_OUTPUT_PORT_REGISTER_0 = 0x02;
7 static const uint8_t TCA9555_OUTPUT_PORT_REGISTER_1 = 0x03;
8 static const uint8_t TCA9555_POLARITY_REGISTER_0 = 0x04;
9 static const uint8_t TCA9555_POLARITY_REGISTER_1 = 0x05;
10 static const uint8_t TCA9555_CONFIGURATION_PORT_0 = 0x06;
11 static const uint8_t TCA9555_CONFIGURATION_PORT_1 = 0x07;
16 static const char *
const TAG =
"tca9555";
19 ESP_LOGCONFIG(TAG,
"Setting up TCA9555...");
30 ESP_LOGCONFIG(TAG,
"TCA9555:");
33 ESP_LOGE(TAG,
"Communication with TCA9555 failed!");
53 if (!this->
read_bytes(TCA9555_OUTPUT_PORT_REGISTER_0, data, 2)) {
57 this->
output_mask_ = (uint16_t(data[1]) << 8) | (uint16_t(data[0]) << 0);
66 bool success = this->
read_bytes(TCA9555_CONFIGURATION_PORT_0, data, 2);
71 this->
mode_mask_ = (uint16_t(data[1]) << 8) | (uint16_t(data[0]) << 0);
81 success = this->
read_bytes(TCA9555_INPUT_PORT_REGISTER_0, data, 2);
82 this->
input_mask_ = (uint16_t(data[1]) << 8) | (uint16_t(data[0]) << 0);
106 if (!this->
write_bytes(TCA9555_OUTPUT_PORT_REGISTER_0, data, 2)) {
121 if (!this->
write_bytes(TCA9555_CONFIGURATION_PORT_0, data, 2)) {
void pin_mode(gpio::Flags flags) override
uint16_t input_mask_
The state read in digital_read_hw - 1 means HIGH, 0 means LOW.
void status_set_warning(const char *message="unspecified")
bool digital_read_hw(uint8_t pin) override
uint16_t mode_mask_
Mask for the pin mode - 1 means output, 0 means input.
bool read_bytes(uint8_t a_register, uint8_t *data, uint8_t len)
Compat APIs All methods below have been added for compatibility reasons.
float get_setup_priority() const override
void pin_mode(uint8_t pin, gpio::Flags flags)
bool digital_read_cache(uint8_t pin) override
bool digital_read() override
void digital_write_hw(uint8_t pin, bool value) override
std::string str_sprintf(const char *fmt,...)
void status_clear_warning()
void dump_config() override
uint16_t output_mask_
The mask to write as output state - 1 means HIGH, 0 means LOW.
bool read_gpio_outputs_()
virtual void mark_failed()
Mark this component as failed.
const float IO
For components that represent GPIO pins like PCF8573.
Implementation of SPI Controller mode.
void digital_write(bool value) override
std::string dump_summary() const override
void setup() override
Check i2c availability and setup masks.
bool write_bytes(uint8_t a_register, const uint8_t *data, uint8_t len, bool stop=true)