ESPHome 2026.5.0-dev
Loading...
Searching...
No Matches
pi4ioe5v6408.h
Go to the documentation of this file.
1#pragma once
2
6#include "esphome/core/hal.h"
7
8namespace esphome {
9namespace pi4ioe5v6408 {
11 public i2c::I2CDevice,
12 public gpio_expander::CachedGpioExpander<uint8_t, 8> {
13 public:
15
16 void setup() override;
17 void pin_mode(uint8_t pin, gpio::Flags flags);
18
19 float get_setup_priority() const override;
20 void dump_config() override;
21 void loop() override;
22
24 void set_reset(bool reset) { this->reset_ = reset; }
26
27 protected:
28 static void IRAM_ATTR gpio_intr(PI4IOE5V6408Component *arg);
29
30 bool digital_read_hw(uint8_t pin) override;
31 bool digital_read_cache(uint8_t pin) override;
32 void digital_write_hw(uint8_t pin, bool value) override;
33
35 uint8_t mode_mask_{0x00};
37 uint8_t output_mask_{0x00};
39 uint8_t input_mask_{0x00};
41 uint8_t pull_enable_mask_{0x00};
43 uint8_t pull_up_down_mask_{0x00};
44
45 bool reset_{true};
47
48 bool read_gpio_modes_();
49 bool write_gpio_modes_();
50 bool read_gpio_outputs_();
51};
52
53class PI4IOE5V6408GPIOPin : public GPIOPin, public Parented<PI4IOE5V6408Component> {
54 public:
55 void setup() override;
56 void pin_mode(gpio::Flags flags) override;
57 bool digital_read() override;
58 void digital_write(bool value) override;
59 size_t dump_summary(char *buffer, size_t len) const override;
60
61 void set_pin(uint8_t pin) { this->pin_ = pin; }
62 void set_inverted(bool inverted) { this->inverted_ = inverted; }
64
65 gpio::Flags get_flags() const override { return this->flags_; }
66
67 protected:
68 uint8_t pin_;
71};
72
73} // namespace pi4ioe5v6408
74} // namespace esphome
Helper class to easily give an object a parent of type T.
Definition helpers.h:2013
A class to cache the read state of a GPIO expander.
Definition cached_gpio.h:29
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
static void IRAM_ATTR gpio_intr(PI4IOE5V6408Component *arg)
uint8_t pull_enable_mask_
The mask to write as input buffer state - 1 means enabled, 0 means disabled.
uint8_t output_mask_
The mask to write as output state - 1 means HIGH, 0 means LOW.
uint8_t pull_up_down_mask_
The mask to write as pullup state - 1 means pullup, 0 means pulldown.
bool digital_read_cache(uint8_t pin) override
void digital_write_hw(uint8_t pin, bool value) override
uint8_t input_mask_
The state read in digital_read_hw - 1 means HIGH, 0 means LOW.
uint8_t mode_mask_
Mask for the pin mode - 1 means output, 0 means input.
void set_interrupt_pin(InternalGPIOPin *pin)
void pin_mode(uint8_t pin, gpio::Flags flags)
void set_reset(bool reset)
Indicate if the component should reset the state during setup.
void pin_mode(gpio::Flags flags) override
size_t dump_summary(char *buffer, size_t len) const override
gpio::Flags get_flags() const override
uint16_t flags
uint16_t reset
Definition ina226.h:5
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
std::string size_t len
Definition helpers.h:1045