ESPHome 2026.2.4
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
18 void activate_pin(uint8_t pin);
19
21 void set_pin_s0(GPIOPin *pin) { this->pin_s0_ = pin; }
23 void set_pin_s1(GPIOPin *pin) { this->pin_s1_ = pin; }
25 void set_pin_s2(GPIOPin *pin) { this->pin_s2_ = pin; }
27 void set_pin_s3(GPIOPin *pin) { this->pin_s3_ = pin; }
28
30 void set_switch_delay(uint32_t switch_delay) { this->switch_delay_ = switch_delay; }
31
32 private:
33 GPIOPin *pin_s0_;
34 GPIOPin *pin_s1_;
35 GPIOPin *pin_s2_;
36 GPIOPin *pin_s3_;
38 uint8_t active_pin_;
39 uint32_t switch_delay_;
40};
41
43 public:
45
46 void update() override;
47
48 void dump_config() override;
50 float get_setup_priority() const override;
51 void set_pin(uint8_t pin) { this->pin_ = pin; }
52 void set_source(voltage_sampler::VoltageSampler *source) { this->source_ = source; }
53
54 float sample() override;
55
56 protected:
60
61 uint8_t pin_;
62};
63} // namespace cd74hc4067
64} // namespace esphome
This class simplifies creating components that periodically check a state.
Definition component.h:512
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:21
void set_pin_s3(GPIOPin *pin)
set the pin connected to multiplexer control pin 3
Definition cd74hc4067.h:27
void set_pin_s2(GPIOPin *pin)
set the pin connected to multiplexer control pin 2
Definition cd74hc4067.h:25
void set_pin_s1(GPIOPin *pin)
set the pin connected to multiplexer control pin 1
Definition cd74hc4067.h:23
void set_switch_delay(uint32_t switch_delay)
set the delay needed after an input switch
Definition cd74hc4067.h:30
void set_source(voltage_sampler::VoltageSampler *source)
Definition cd74hc4067.h:52
CD74HC4067Sensor(CD74HC4067Component *parent)
voltage_sampler::VoltageSampler * source_
The sampling source to read values from.
Definition cd74hc4067.h:59
float get_setup_priority() const override
HARDWARE_LATE setup priority.
Base-class for all sensors.
Definition sensor.h:43
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