ESPHome 2025.5.0
Loading...
Searching...
No Matches
cd74hc4067.h
Go to the documentation of this file.
1#pragma once
2
4#include "esphome/core/hal.h"
7
8namespace esphome {
9namespace cd74hc4067 {
10
12 public:
14 void setup() override;
15 void dump_config() override;
16 float get_setup_priority() const override;
17
19 void activate_pin(uint8_t pin);
20
22 void set_pin_s0(GPIOPin *pin) { this->pin_s0_ = pin; }
24 void set_pin_s1(GPIOPin *pin) { this->pin_s1_ = pin; }
26 void set_pin_s2(GPIOPin *pin) { this->pin_s2_ = pin; }
28 void set_pin_s3(GPIOPin *pin) { this->pin_s3_ = pin; }
29
31 void set_switch_delay(uint32_t switch_delay) { this->switch_delay_ = switch_delay; }
32
33 private:
34 GPIOPin *pin_s0_;
35 GPIOPin *pin_s1_;
36 GPIOPin *pin_s2_;
37 GPIOPin *pin_s3_;
39 uint8_t active_pin_;
40 uint32_t switch_delay_;
41};
42
44 public:
46
47 void update() override;
48
49 void dump_config() override;
51 float get_setup_priority() const override;
52 void set_pin(uint8_t pin) { this->pin_ = pin; }
53 void set_source(voltage_sampler::VoltageSampler *source) { this->source_ = source; }
54
55 float sample() override;
56
57 protected:
61
62 uint8_t pin_;
63};
64} // namespace cd74hc4067
65} // namespace esphome
This class simplifies creating components that periodically check a state.
Definition component.h:301
void activate_pin(uint8_t pin)
setting pin active by setting the right combination of the four multiplexer input pins
void setup() override
Set up the internal sensor array.
void set_pin_s0(GPIOPin *pin)
set the pin connected to multiplexer control pin 0
Definition cd74hc4067.h:22
void set_pin_s3(GPIOPin *pin)
set the pin connected to multiplexer control pin 3
Definition cd74hc4067.h:28
void set_pin_s2(GPIOPin *pin)
set the pin connected to multiplexer control pin 2
Definition cd74hc4067.h:26
void set_pin_s1(GPIOPin *pin)
set the pin connected to multiplexer control pin 1
Definition cd74hc4067.h:24
float get_setup_priority() const override
void set_switch_delay(uint32_t switch_delay)
set the delay needed after an input switch
Definition cd74hc4067.h:31
void set_source(voltage_sampler::VoltageSampler *source)
Definition cd74hc4067.h:53
CD74HC4067Sensor(CD74HC4067Component *parent)
voltage_sampler::VoltageSampler * source_
The sampling source to read values from.
Definition cd74hc4067.h:60
float get_setup_priority() const override
HARDWARE_LATE setup priority.
Base-class for all sensors.
Definition sensor.h:57
Abstract interface for components to request voltage (usually ADC readings)
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7