1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-03 09:20:29 +01:00

Update mcp4461.cpp

This commit is contained in:
Oliver Kleinecke 2025-02-03 23:41:54 +01:00 committed by GitHub
parent 5b8691d4af
commit ccfab65fb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -121,7 +121,7 @@ uint8_t Mcp4461Component::get_wiper_address_(uint8_t wiper) {
return addr;
}
uint16_t Mcp4461Component::get_wiper_level(MCP4461WiperIdx wiper) {
uint16_t Mcp4461Component::get_wiper_level(Mcp4461WiperIdx wiper) {
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
return this->read_wiper_level_(wiper_idx);
}
@ -145,7 +145,7 @@ uint16_t Mcp4461Component::read_wiper_level_(uint8_t wiper) {
return buf;
}
void Mcp4461Component::update_wiper_level(MCP4461WiperIdx wiper) {
void Mcp4461Component::update_wiper_level(Mcp4461WiperIdx wiper) {
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
uint16_t data;
data = this->get_wiper_level(wiper);
@ -153,7 +153,7 @@ void Mcp4461Component::update_wiper_level(MCP4461WiperIdx wiper) {
this->reg_[wiper_idx].state = data;
}
void Mcp4461Component::set_wiper_level(MCP4461WiperIdx wiper, uint16_t value) {
void Mcp4461Component::set_wiper_level(Mcp4461WiperIdx wiper, uint16_t value) {
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
if (data > 0x100) {
ESP_LOGW(TAG, "ignoring invalid wiper level %" PRIu16 "!");
@ -173,21 +173,21 @@ void Mcp4461Component::write_wiper_level_(uint8_t wiper, uint16_t value) {
this->mcp4461_write_(this->get_wiper_address_(wiper_idx), value, nonvolatile);
}
void Mcp4461Component::enable_wiper(MCP4461WiperIdx wiper) {
void Mcp4461Component::enable_wiper(Mcp4461WiperIdx wiper) {
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
ESP_LOGV(TAG, "Enabling wiper %" PRIu8, wiper_idx);
this->reg_[wiper_idx].terminal_hw = true;
this->update_ = true;
}
void Mcp4461Component::disable_wiper(MCP4461WiperIdx wiper) {
void Mcp4461Component::disable_wiper(Mcp4461WiperIdx wiper) {
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
ESP_LOGV(TAG, "Disabling wiper %" PRIu8, wiper_idx);
this->reg_[wiper_idx].terminal_hw = false;
this->update_ = true;
}
void Mcp4461Component::increase_wiper(MCP4461WiperIdx wiper) {
void Mcp4461Component::increase_wiper(Mcp4461WiperIdx wiper) {
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
ESP_LOGV(TAG, "Increasing wiper %" PRIu8 "", wiper_idx);
uint8_t reg = 0;
@ -199,7 +199,7 @@ void Mcp4461Component::increase_wiper(MCP4461WiperIdx wiper) {
this->reg_[wiper_idx].state++;
}
void Mcp4461Component::decrease_wiper(MCP4461WiperIdx wiper) {
void Mcp4461Component::decrease_wiper(Mcp4461WiperIdx wiper) {
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
ESP_LOGV(TAG, "Decreasing wiper %" PRIu8 "", wiper_idx);
uint8_t reg = 0;
@ -291,7 +291,7 @@ void Mcp4461Component::set_terminal_register(Mcp4461TerminalIdx terminal_connect
this->mcp4461_write_(addr, data);
}
void Mcp4461Component::enable_terminal(MCP4461WiperIdx wiper, char terminal) {
void Mcp4461Component::enable_terminal(Mcp4461WiperIdx wiper, char terminal) {
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
if (wiper_idx > 3) {
return;
@ -318,7 +318,7 @@ void Mcp4461Component::enable_terminal(MCP4461WiperIdx wiper, char terminal) {
this->update_ = true;
}
void Mcp4461Component::disable_terminal(MCP4461WiperIdx wiper, char terminal) {
void Mcp4461Component::disable_terminal(Mcp4461WiperIdx wiper, char terminal) {
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
if (wiper_idx > 3) {
return;