19 ESP_LOGCONFIG(TAG,
"XL9535:");
24static uint8_t port_index(uint8_t pin) {
return pin / 10; }
25static uint8_t port_register(uint8_t port_0_register, uint8_t pin) {
return port_0_register + port_index(pin); }
26static uint8_t pin_mask(uint8_t pin) {
return 1 << (pin % 10); }
32 return (port & pin_mask(pin)) != 0;
39 uint8_t &output = this->
output_[port_index(pin)];
48 const uint8_t mask = pin_mask(pin);
BedjetMode mode
BedJet operating mode.
bool status_comm_result(bool ok)
Clears the warning when ok, else sets it with message (default "Communication failed"); returns ok.
bool ESPHOME_ALWAYS_INLINE setup_check(bool ok)
Marks the component failed with message (default "Communication failed") unless ok; returns ok.
bool write_byte(uint8_t a_register, uint8_t data) const
bool read_byte(uint8_t a_register, uint8_t *data)
bool update_register(uint8_t a_register, uint8_t mask, uint8_t value)
Read a register, replace the bits in mask with those of value and write it back.
bool digital_read(uint8_t pin)
void digital_write(uint8_t pin, bool value)
void pin_mode(uint8_t pin, gpio::Flags mode)
void dump_config() override
ESPHOME_LOG_TAG(TAG, "xl9535")
@ XL9535_INPUT_PORT_0_REGISTER
@ XL9535_OUTPUT_PORT_0_REGISTER
@ XL9535_CONFIG_PORT_0_REGISTER
@ XL9535_OUTPUT_PORT_1_REGISTER
ESPHOME_ALWAYS_INLINE constexpr void assign_bits(T &value, std::type_identity_t< T > mask, bool on)
Set the bits of mask in value when on is true, clear them otherwise.