ESPHome 2025.5.0
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 {
6namespace mcp47a1 {
7
8static const char *const TAG = "mcp47a1";
9
11 ESP_LOGCONFIG(TAG, "MCP47A1 Output:");
12 LOG_I2C_DEVICE(this);
13}
14
16 const uint8_t value = remap(state, 0.0f, 1.0f, 63, 0);
17 this->write_byte(0, value);
18}
19
20} // namespace mcp47a1
21} // namespace esphome
bool write_byte(uint8_t a_register, uint8_t data, bool stop=true)
Definition i2c.h:266
void write_state(float state) override
Definition mcp47a1.cpp:15
void dump_config() override
Definition mcp47a1.cpp:10
bool state
Definition fan.h:0
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7
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:162