ESPHome 2026.6.0-dev
Loading...
Searching...
No Matches
emc2101.h
Go to the documentation of this file.
1#pragma once
2
5
6namespace esphome::emc2101 {
7
24
29 public:
34 void set_dac_mode(bool dac_mode) {
35 this->dac_mode_ = dac_mode;
36 this->max_output_value_ = 63;
37 }
38
45 this->max_output_value_ = 2 * resolution;
46 }
47
52 void set_pwm_divider(uint8_t divider) { this->pwm_divider_ = divider; }
53
59 this->dac_conversion_rate_ = conversion_rate;
60 }
61
66 void set_inverted(bool inverted) { this->inverted_ = inverted; }
67
72 void set_duty_cycle(float value);
73
78 float get_duty_cycle();
79
85
91
96 float get_speed();
97
99 void setup() override;
101 void dump_config() override;
103 float get_setup_priority() const override;
104
105 bool dac_mode_{false};
106 bool inverted_{false};
111};
112
113} // namespace esphome::emc2101
This class includes support for the EMC2101 i2c fan controller.
Definition emc2101.h:28
void set_dac_mode(bool dac_mode)
Sets the mode of the output.
Definition emc2101.h:34
void setup() override
Used by ESPHome framework.
Definition emc2101.cpp:58
void set_dac_conversion_rate(Emc2101DACConversionRate conversion_rate)
Sets the DAC conversion rate (how many conversions per second).
Definition emc2101.h:58
float get_duty_cycle()
Gets the Fan output duty cycle.
Definition emc2101.cpp:118
void set_pwm_divider(uint8_t divider)
Sets the PWM divider used to derive the PWM frequency.
Definition emc2101.h:52
void set_pwm_resolution(uint8_t resolution)
Sets the PWM resolution.
Definition emc2101.h:43
void dump_config() override
Used by ESPHome framework.
Definition emc2101.cpp:90
float get_setup_priority() const override
Used by ESPHome framework.
Definition emc2101.cpp:56
float get_speed()
Gets the tachometer speed sensor reading.
Definition emc2101.cpp:153
float get_internal_temperature()
Gets the internal temperature sensor reading.
Definition emc2101.cpp:128
float get_external_temperature()
Gets the external temperature sensor reading.
Definition emc2101.cpp:138
Emc2101DACConversionRate dac_conversion_rate_
Definition emc2101.h:110
void set_inverted(bool inverted)
Inverts the polarity of the Fan output.
Definition emc2101.h:66
void set_duty_cycle(float value)
Sets the Fan output duty cycle.
Definition emc2101.cpp:108
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:132
Resolution resolution
Definition msa3xx.h:1
Emc2101DACConversionRate
Enum listing all DAC conversion rates for the EMC2101.
Definition emc2101.h:12
@ EMC2101_DAC_1_EVERY_8_S
Definition emc2101.h:14
@ EMC2101_DAC_2_EVERY_SECOND
Definition emc2101.h:18
@ EMC2101_DAC_8_EVERY_SECOND
Definition emc2101.h:20
@ EMC2101_DAC_1_EVERY_16_S
Definition emc2101.h:13
@ EMC2101_DAC_16_EVERY_SECOND
Definition emc2101.h:21
@ EMC2101_DAC_1_EVERY_SECOND
Definition emc2101.h:17
@ EMC2101_DAC_32_EVERY_SECOND
Definition emc2101.h:22
@ EMC2101_DAC_4_EVERY_SECOND
Definition emc2101.h:19
@ EMC2101_DAC_1_EVERY_4_S
Definition emc2101.h:15
@ EMC2101_DAC_1_EVERY_2_S
Definition emc2101.h:16