ESPHome
2024.10.2
esphome
esphome
components
mcp47a1
mcp47a1.cpp
Go to the documentation of this file.
1
#include "
mcp47a1.h
"
2
#include "
esphome/core/helpers.h
"
3
#include "
esphome/core/log.h
"
4
5
namespace
esphome
{
6
namespace
mcp47a1 {
7
8
static
const
char
*
const
TAG =
"mcp47a1"
;
9
10
void
MCP47A1::dump_config
() {
11
ESP_LOGCONFIG(TAG,
"MCP47A1 Output:"
);
12
LOG_I2C_DEVICE(
this
);
13
}
14
15
void
MCP47A1::write_state
(
float
state
) {
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
esphome::mcp47a1::MCP47A1::write_state
void write_state(float state) override
Definition:
mcp47a1.cpp:15
esphome::mcp47a1::MCP47A1::dump_config
void dump_config() override
Definition:
mcp47a1.cpp:10
mcp47a1.h
esphome::remap
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:153
esphome::i2c::I2CDevice::write_byte
bool write_byte(uint8_t a_register, uint8_t data, bool stop=true)
Definition:
i2c.h:262
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
helpers.h
log.h
state
bool state
Definition:
fan.h:34
Generated by
1.8.13