ESPHome 2025.5.0
Loading...
Searching...
No Matches
emc2101.h
Go to the documentation of this file.
1#pragma once
2
5
6namespace esphome {
7namespace emc2101 {
8
25
30 public:
35 void set_dac_mode(bool dac_mode) {
36 this->dac_mode_ = dac_mode;
37 this->max_output_value_ = 63;
38 }
39
46 this->max_output_value_ = 2 * resolution;
47 }
48
53 void set_pwm_divider(uint8_t divider) { this->pwm_divider_ = divider; }
54
60 this->dac_conversion_rate_ = conversion_rate;
61 }
62
67 void set_inverted(bool inverted) { this->inverted_ = inverted; }
68
73 void set_duty_cycle(float value);
74
79 float get_duty_cycle();
80
86
92
97 float get_speed();
98
100 void setup() override;
102 void dump_config() override;
104 float get_setup_priority() const override;
105
106 bool dac_mode_{false};
107 bool inverted_{false};
112};
113
114} // namespace emc2101
115} // namespace esphome
This class includes support for the EMC2101 i2c fan controller.
Definition emc2101.h:29
void set_dac_mode(bool dac_mode)
Sets the mode of the output.
Definition emc2101.h:35
void setup() override
Used by ESPHome framework.
Definition emc2101.cpp:59
void set_dac_conversion_rate(Emc2101DACConversionRate conversion_rate)
Sets the DAC conversion rate (how many conversions per second).
Definition emc2101.h:59
float get_duty_cycle()
Gets the Fan output duty cycle.
Definition emc2101.cpp:119
void set_pwm_divider(uint8_t divider)
Sets the PWM divider used to derive the PWM frequency.
Definition emc2101.h:53
void set_pwm_resolution(uint8_t resolution)
Sets the PWM resolution.
Definition emc2101.h:44
void dump_config() override
Used by ESPHome framework.
Definition emc2101.cpp:93
float get_setup_priority() const override
Used by ESPHome framework.
Definition emc2101.cpp:57
float get_speed()
Gets the tachometer speed sensor reading.
Definition emc2101.cpp:154
float get_internal_temperature()
Gets the internal temperature sensor reading.
Definition emc2101.cpp:129
float get_external_temperature()
Gets the external temperature sensor reading.
Definition emc2101.cpp:139
Emc2101DACConversionRate dac_conversion_rate_
Definition emc2101.h:111
void set_inverted(bool inverted)
Inverts the polarity of the Fan output.
Definition emc2101.h:67
void set_duty_cycle(float value)
Sets the Fan output duty cycle.
Definition emc2101.cpp:109
This Class provides the methods to read/write bytes from/to an i2c device.
Definition i2c.h:133
Resolution resolution
Definition msa3xx.h:1
Emc2101DACConversionRate
Enum listing all DAC conversion rates for the EMC2101.
Definition emc2101.h:13
@ EMC2101_DAC_1_EVERY_8_S
Definition emc2101.h:15
@ EMC2101_DAC_2_EVERY_SECOND
Definition emc2101.h:19
@ EMC2101_DAC_8_EVERY_SECOND
Definition emc2101.h:21
@ EMC2101_DAC_1_EVERY_16_S
Definition emc2101.h:14
@ EMC2101_DAC_16_EVERY_SECOND
Definition emc2101.h:22
@ EMC2101_DAC_1_EVERY_SECOND
Definition emc2101.h:18
@ EMC2101_DAC_32_EVERY_SECOND
Definition emc2101.h:23
@ EMC2101_DAC_4_EVERY_SECOND
Definition emc2101.h:20
@ EMC2101_DAC_1_EVERY_4_S
Definition emc2101.h:16
@ EMC2101_DAC_1_EVERY_2_S
Definition emc2101.h:17
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7