8 static const char *
const TAG =
"cd74hc4067";
13 ESP_LOGCONFIG(TAG,
"Setting up CD74HC4067...");
15 this->pin_s0_->
setup();
16 this->pin_s1_->
setup();
17 this->pin_s2_->
setup();
18 this->pin_s3_->
setup();
21 this->active_pin_ = 1;
26 ESP_LOGCONFIG(TAG,
"CD74HC4067 Multiplexer:");
27 LOG_PIN(
" S0 Pin: ", this->pin_s0_);
28 LOG_PIN(
" S1 Pin: ", this->pin_s1_);
29 LOG_PIN(
" S2 Pin: ", this->pin_s2_);
30 LOG_PIN(
" S3 Pin: ", this->pin_s3_);
31 ESP_LOGCONFIG(TAG,
"switch delay: %" PRIu32, this->switch_delay_);
35 if (this->active_pin_ != pin) {
36 ESP_LOGD(TAG,
"switch to input %d", pin);
38 static int mux_channel[16][4] = {
61 delay(this->switch_delay_);
62 this->active_pin_ = pin;
69 float value_v = this->
sample();
81 LOG_SENSOR(TAG,
"CD74HC4067 Sensor",
this);
82 ESP_LOGCONFIG(TAG,
" Pin: %u", this->
pin_);
83 LOG_UPDATE_INTERVAL(
this);
virtual void digital_write(bool value)=0
const float DATA
For components that import data from directly connected sensors like DHT.
void dump_config() override
virtual float sample()=0
Get a voltage reading, in V.
void publish_state(float state)
Publish a new state to the front-end.
float get_setup_priority() const override
HARDWARE_LATE setup priority.
void dump_config() override
void activate_pin(uint8_t pin)
setting pin active by setting the right combination of the four multiplexer input pins ...
voltage_sampler::VoltageSampler * source_
The sampling source to read values from.
float get_setup_priority() const override
Implementation of SPI Controller mode.
CD74HC4067Component * parent_
void setup() override
Set up the internal sensor array.
CD74HC4067Sensor(CD74HC4067Component *parent)
void IRAM_ATTR HOT delay(uint32_t ms)