ESPHome 2026.5.0b1
Loading...
Searching...
No Matches
mcp47a1.cpp
Go to the documentation of this file.
1#include "mcp47a1.h"
3#include "esphome/core/log.h"
4
5namespace esphome::mcp47a1 {
6
7static const char *const TAG = "mcp47a1";
8
10 ESP_LOGCONFIG(TAG, "MCP47A1 Output:");
11 LOG_I2C_DEVICE(this);
12}
13
15 const uint8_t value = remap(state, 0.0f, 1.0f, 63, 0);
16 this->write_byte(0, value);
17}
18
19} // namespace esphome::mcp47a1
bool write_byte(uint8_t a_register, uint8_t data) const
Definition i2c.h:265
void write_state(float state) override
Definition mcp47a1.cpp:14
void dump_config() override
Definition mcp47a1.cpp:9
bool state
Definition fan.h:2
T remap(U value, U min, U max, T min_out, T max_out)
Remap value from the range (min, max) to (min_out, max_out).
Definition helpers.h:765