ESPHome  2025.2.0
xl9535.h
Go to the documentation of this file.
1 #pragma once
2 
5 #include "esphome/core/hal.h"
6 
7 namespace esphome {
8 namespace xl9535 {
9 
10 enum {
19 };
20 
21 class XL9535Component : public Component, public i2c::I2CDevice {
22  public:
23  bool digital_read(uint8_t pin);
24  void digital_write(uint8_t pin, bool value);
25  void pin_mode(uint8_t pin, gpio::Flags mode);
26 
27  void setup() override;
28  void dump_config() override;
29  float get_setup_priority() const override { return setup_priority::IO; }
30 };
31 
32 class XL9535GPIOPin : public GPIOPin {
33  public:
34  void set_parent(XL9535Component *parent) { this->parent_ = parent; }
35  void set_pin(uint8_t pin) { this->pin_ = pin; }
36  void set_inverted(bool inverted) { this->inverted_ = inverted; }
37  void set_flags(gpio::Flags flags) { this->flags_ = flags; }
38 
39  gpio::Flags get_flags() const override { return this->flags_; }
40 
41  void setup() override;
42  std::string dump_summary() const override;
43  void pin_mode(gpio::Flags flags) override;
44  bool digital_read() override;
45  void digital_write(bool value) override;
46 
47  protected:
49 
50  uint8_t pin_;
51  bool inverted_;
53 };
54 
55 } // namespace xl9535
56 } // namespace esphome
void pin_mode(uint8_t pin, gpio::Flags mode)
Definition: xl9535.cpp:87
void digital_write(uint8_t pin, bool value)
Definition: xl9535.cpp:53
gpio::Flags get_flags() const override
Definition: xl9535.h:39
void set_parent(XL9535Component *parent)
Definition: xl9535.h:34
bool digital_read(uint8_t pin)
Definition: xl9535.cpp:29
void set_inverted(bool inverted)
Definition: xl9535.h:36
XL9535Component * parent_
Definition: xl9535.h:48
void set_flags(gpio::Flags flags)
Definition: xl9535.h:37
BedjetMode mode
BedJet operating mode.
Definition: bedjet_codec.h:183
float get_setup_priority() const override
Definition: xl9535.h:29
const uint32_t flags
Definition: stm32flash.h:85
void dump_config() override
Definition: xl9535.cpp:20
const float IO
For components that represent GPIO pins like PCF8573.
Definition: component.cpp:17
Implementation of SPI Controller mode.
Definition: a01nyub.cpp:7
void set_pin(uint8_t pin)
Definition: xl9535.h:35
This Class provides the methods to read/write bytes from/to an i2c device.
Definition: i2c.h:133