1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-16 07:40:29 +01:00

Merge pull request #26 from p1ngb4ck/mcp4461

merge latest mcp4461 changes to dev
This commit is contained in:
Oliver Kleinecke 2025-02-20 16:34:49 +01:00 committed by GitHub
commit 977d6325c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 151 additions and 171 deletions

View File

@ -13,7 +13,7 @@ void Mcp4461Component::setup() {
ESP_LOGCONFIG(TAG, "Setting up mcp4461 using address (0x%02" PRIX8 ")...", this->address_);
auto err = this->write(nullptr, 0);
if (err != i2c::ERROR_OK) {
this->error_code_ = MCP4461_STATUS_I2C_ERROR;
this->error_code = MCP4461_STATUS_I2C_ERROR;
this->mark_failed();
return;
}
@ -24,9 +24,9 @@ void Mcp4461Component::begin_() {
// save WP/WL status
this->update_write_protection_status_();
for (uint8_t i = 0; i < 8; i++) {
if (this->reg_[i].initial_value.has_value()) {
if (this->reg_[i].initial_value.has_value() && std::isfinite(this->reg_[i].initial_value.value())) {
uint16_t initial_state;
initial_state = static_cast<uint16_t>(*this->reg_[i].initial_value * 1000.f);
initial_state = static_cast<uint16_t>(*this->reg_[i].initial_value * 256.0f);
this->write_wiper_level_(i, initial_state);
}
if (this->reg_[i].enabled) {
@ -100,7 +100,7 @@ void Mcp4461Component::dump_config() {
ESP_LOGCONFIG(TAG, "mcp4461:");
LOG_I2C_DEVICE(this);
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
}
// log wiper status
for (uint8_t i = 0; i < 8; ++i) {
@ -163,7 +163,7 @@ void Mcp4461Component::loop() {
uint8_t Mcp4461Component::get_status_register_() {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return 0;
}
uint8_t reg = 0;
@ -171,7 +171,7 @@ uint8_t Mcp4461Component::get_status_register_() {
reg |= static_cast<uint8_t>(Mcp4461Commands::READ);
uint16_t buf;
if (!this->read_byte_16(reg, &buf)) {
this->error_code_ = MCP4461_STATUS_REGISTER_ERROR;
this->error_code = MCP4461_STATUS_REGISTER_ERROR;
this->mark_failed();
return 0;
}
@ -181,7 +181,7 @@ uint8_t Mcp4461Component::get_status_register_() {
if (msb != 1 || ((lsb >> 7) & 0x01) != 1 || ((lsb >> 1) & 0x01) != 1) {
// D8, D7 and R1 bits are hardlocked to 1 -> a status msb bit 0 (bit 9 of status register) of 0 or lsb bit 1/7 = 0
// indicate device/communication issues, therefore mark component failed
this->error_code_ = MCP4461_STATUS_REGISTER_INVALID;
this->error_code = MCP4461_STATUS_REGISTER_INVALID;
this->mark_failed();
return 0;
}
@ -221,7 +221,7 @@ uint8_t Mcp4461Component::get_wiper_address_(uint8_t wiper) {
uint16_t Mcp4461Component::get_wiper_level_(Mcp4461WiperIdx wiper) {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return 0;
}
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
@ -247,7 +247,7 @@ uint16_t Mcp4461Component::read_wiper_level_(uint8_t wiper) {
}
}
if (!(this->read_byte_16(reg, &buf))) {
this->error_code_ = MCP4461_STATUS_I2C_ERROR;
this->error_code = MCP4461_STATUS_I2C_ERROR;
this->status_set_warning();
ESP_LOGW(TAG, "Error fetching %swiper %" PRIu8 " value", (wiper > 3) ? "nonvolatile " : "", wiper);
return 0;
@ -257,7 +257,7 @@ uint16_t Mcp4461Component::read_wiper_level_(uint8_t wiper) {
bool Mcp4461Component::update_wiper_level_(Mcp4461WiperIdx wiper) {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return false;
}
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
@ -274,7 +274,7 @@ bool Mcp4461Component::update_wiper_level_(Mcp4461WiperIdx wiper) {
bool Mcp4461Component::set_wiper_level_(Mcp4461WiperIdx wiper, uint16_t value) {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return false;
}
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
@ -302,7 +302,7 @@ void Mcp4461Component::write_wiper_level_(uint8_t wiper, uint16_t value) {
nonvolatile = true;
}
if (!(this->mcp4461_write_(this->get_wiper_address_(wiper), value, nonvolatile))) {
this->error_code_ = MCP4461_STATUS_I2C_ERROR;
this->error_code = MCP4461_STATUS_I2C_ERROR;
this->status_set_warning();
ESP_LOGW(TAG, "Error writing %swiper %" PRIu8 " level %" PRIu16 "", (wiper > 3) ? "nonvolatile " : "", wiper,
value);
@ -311,7 +311,7 @@ void Mcp4461Component::write_wiper_level_(uint8_t wiper, uint16_t value) {
void Mcp4461Component::enable_wiper_(Mcp4461WiperIdx wiper) {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return;
}
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
@ -333,7 +333,7 @@ void Mcp4461Component::enable_wiper_(Mcp4461WiperIdx wiper) {
void Mcp4461Component::disable_wiper_(Mcp4461WiperIdx wiper) {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return;
}
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
@ -355,7 +355,7 @@ void Mcp4461Component::disable_wiper_(Mcp4461WiperIdx wiper) {
bool Mcp4461Component::increase_wiper_(Mcp4461WiperIdx wiper) {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return false;
}
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
@ -379,7 +379,7 @@ bool Mcp4461Component::increase_wiper_(Mcp4461WiperIdx wiper) {
reg |= static_cast<uint8_t>(Mcp4461Commands::INCREMENT);
auto err = this->write(&this->address_, reg, sizeof(reg));
if (err != i2c::ERROR_OK) {
this->error_code_ = MCP4461_STATUS_I2C_ERROR;
this->error_code = MCP4461_STATUS_I2C_ERROR;
this->status_set_warning();
return false;
}
@ -389,7 +389,7 @@ bool Mcp4461Component::increase_wiper_(Mcp4461WiperIdx wiper) {
bool Mcp4461Component::decrease_wiper_(Mcp4461WiperIdx wiper) {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return false;
}
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
@ -413,7 +413,7 @@ bool Mcp4461Component::decrease_wiper_(Mcp4461WiperIdx wiper) {
reg |= static_cast<uint8_t>(Mcp4461Commands::DECREMENT);
auto err = this->write(&this->address_, reg, sizeof(reg));
if (err != i2c::ERROR_OK) {
this->error_code_ = MCP4461_STATUS_I2C_ERROR;
this->error_code = MCP4461_STATUS_I2C_ERROR;
this->status_set_warning();
return false;
}
@ -447,7 +447,7 @@ uint8_t Mcp4461Component::calc_terminal_connector_byte_(Mcp4461TerminalIdx termi
uint8_t Mcp4461Component::get_terminal_register_(Mcp4461TerminalIdx terminal_connector) {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return 0;
}
uint8_t reg = 0;
@ -461,7 +461,7 @@ uint8_t Mcp4461Component::get_terminal_register_(Mcp4461TerminalIdx terminal_con
if (this->read_byte_16(reg, &buf)) {
return static_cast<uint8_t>(buf & 0x00ff);
} else {
this->error_code_ = MCP4461_STATUS_I2C_ERROR;
this->error_code = MCP4461_STATUS_I2C_ERROR;
this->status_set_warning();
ESP_LOGW(TAG, "Error fetching terminal register value");
return 0;
@ -470,7 +470,7 @@ uint8_t Mcp4461Component::get_terminal_register_(Mcp4461TerminalIdx terminal_con
void Mcp4461Component::update_terminal_register_(Mcp4461TerminalIdx terminal_connector) {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return;
}
if ((static_cast<uint8_t>(terminal_connector) != 0 && static_cast<uint8_t>(terminal_connector) != 1)) {
@ -498,7 +498,7 @@ void Mcp4461Component::update_terminal_register_(Mcp4461TerminalIdx terminal_con
bool Mcp4461Component::set_terminal_register_(Mcp4461TerminalIdx terminal_connector, uint8_t data) {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return false;
}
uint8_t addr;
@ -511,7 +511,7 @@ bool Mcp4461Component::set_terminal_register_(Mcp4461TerminalIdx terminal_connec
return false;
}
if (!(this->mcp4461_write_(addr, data))) {
this->error_code_ = MCP4461_STATUS_I2C_ERROR;
this->error_code = MCP4461_STATUS_I2C_ERROR;
this->status_set_warning();
return false;
}
@ -520,7 +520,7 @@ bool Mcp4461Component::set_terminal_register_(Mcp4461TerminalIdx terminal_connec
void Mcp4461Component::enable_terminal_(Mcp4461WiperIdx wiper, char terminal) {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return;
}
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
@ -547,7 +547,7 @@ void Mcp4461Component::enable_terminal_(Mcp4461WiperIdx wiper, char terminal) {
void Mcp4461Component::disable_terminal_(Mcp4461WiperIdx wiper, char terminal) {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return;
}
uint8_t wiper_idx = static_cast<uint8_t>(wiper);
@ -574,7 +574,7 @@ void Mcp4461Component::disable_terminal_(Mcp4461WiperIdx wiper, char terminal) {
uint16_t Mcp4461Component::get_eeprom_value(Mcp4461EepromLocation location) {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return 0;
}
uint8_t reg = 0;
@ -585,7 +585,7 @@ uint16_t Mcp4461Component::get_eeprom_value(Mcp4461EepromLocation location) {
return 0;
}
if (!this->read_byte_16(reg, &buf)) {
this->error_code_ = MCP4461_STATUS_I2C_ERROR;
this->error_code = MCP4461_STATUS_I2C_ERROR;
this->status_set_warning();
ESP_LOGW(TAG, "Error fetching EEPRom location value");
return 0;
@ -595,7 +595,7 @@ uint16_t Mcp4461Component::get_eeprom_value(Mcp4461EepromLocation location) {
bool Mcp4461Component::set_eeprom_value(Mcp4461EepromLocation location, uint16_t value) {
if (this->is_failed()) {
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code_)));
ESP_LOGE(TAG, "%s", LOG_STR_ARG(mcp4461_get_message_string(this->error_code)));
return false;
}
uint8_t addr = 0;
@ -607,7 +607,7 @@ bool Mcp4461Component::set_eeprom_value(Mcp4461EepromLocation location, uint16_t
}
addr |= static_cast<uint8_t>(Mcp4461EepromLocation::MCP4461_EEPROM_1) + (static_cast<uint8_t>(location) * 0x10);
if (!(this->mcp4461_write_(addr, value, true))) {
this->error_code_ = MCP4461_STATUS_I2C_ERROR;
this->error_code = MCP4461_STATUS_I2C_ERROR;
this->status_set_warning();
ESP_LOGW(TAG, "Error writing EEPRom value");
return false;

View File

@ -7,6 +7,8 @@
namespace esphome {
namespace mcp4461 {
/// @brief Struct representing current wiper details/state
/// Default wiper state is 0x80h (128 int)
struct WiperState {
bool enabled = true;
uint16_t state = 0;
@ -20,9 +22,10 @@ struct WiperState {
bool update_terminal = false;
};
// default wiper state is 128 / 0x80h
/// @brief Class containing i2c commands supported by the device
enum class Mcp4461Commands : uint8_t { WRITE = 0x00, INCREMENT = 0x04, DECREMENT = 0x08, READ = 0x0C };
/// @brief Class containing register addresses of the device
enum class Mcp4461Addresses : uint8_t {
MCP4461_VW0 = 0x00,
MCP4461_VW1 = 0x10,
@ -34,6 +37,7 @@ enum class Mcp4461Addresses : uint8_t {
MCP4461_EEPROM_1 = 0xB0
};
// @brief Class to enumerate allowed channels/wipers
enum Mcp4461WiperIdx : uint8_t {
MCP4461_WIPER_0 = 0,
MCP4461_WIPER_1 = 1,
@ -45,6 +49,7 @@ enum Mcp4461WiperIdx : uint8_t {
MCP4461_WIPER_7 = 7
};
/// @brief Class containing valid EEProm user data locations
enum class Mcp4461EepromLocation : uint8_t {
MCP4461_EEPROM_0 = 0,
MCP4461_EEPROM_1 = 1,
@ -53,6 +58,7 @@ enum class Mcp4461EepromLocation : uint8_t {
MCP4461_EEPROM_4 = 4
};
/// @brief Class containing valid terminal register params for terminal functions
enum class Mcp4461TerminalIdx : uint8_t { MCP4461_TERMINAL_0 = 0, MCP4461_TERMINAL_1 = 1 };
class Mcp4461Wiper;
@ -65,21 +71,37 @@ class Mcp4461Component : public Component, public i2c::I2CDevice {
wiper_1_disabled_(disable_wiper_1),
wiper_2_disabled_(disable_wiper_2),
wiper_3_disabled_(disable_wiper_3) {
this->reg_[0].enabled = !wiper_0_disabled_;
this->reg_[1].enabled = !wiper_1_disabled_;
this->reg_[2].enabled = !wiper_2_disabled_;
this->reg_[3].enabled = !wiper_3_disabled_;
this->reg_[0].enabled = !this->wiper_0_disabled_;
this->reg_[1].enabled = !this->wiper_1_disabled_;
this->reg_[2].enabled = !this->wiper_2_disabled_;
this->reg_[3].enabled = !this->wiper_3_disabled_;
}
/// @brief perform initialisation of component
void setup() override;
/// @brief dump component config on boot
void dump_config() override;
/// @brief set hardware priority for component
float get_setup_priority() const override { return setup_priority::HARDWARE; }
void loop() override;
/// @brief get user-data value from eeprom location
/// @param[in] location The location to fetch data from, valid is uint8_t in range of 0-4
/// mcp4461 provides 5x 9 bits (=max int of 511) of user-data storage
/// @return uint16_t - returns the eeprom value stored in given eeprom user-data location
uint16_t get_eeprom_value(Mcp4461EepromLocation location);
/// @brief set user-data value from eeprom location
/// @param[in] location The location to write data to, valid is uint8_t in range of 0-4 for 5x 9 bits of user-data
/// @return bool - return true on successful write, false on error/warning
bool set_eeprom_value(Mcp4461EepromLocation location, uint16_t value);
/// @brief set initial value for wiper
/// @param[wiper] wiper for which initial_value shall be set
/// @param[initial_value] the float value in range 0 to 1.0 the wiper shall be set to
void set_initial_value(Mcp4461WiperIdx wiper, float initial_value);
/// @brief initialize terminal of wiper with state disabled
/// @param[wiper] wiper for which terminal shall be initialized disabled
/// @param[terminal] terminal to disable, one of { 'a', 'b', 'w', 'h' }
void initialize_terminal_disabled(Mcp4461WiperIdx wiper, char terminal);
/// @brief available/required status codes
enum ErrorCode {
MCP4461_STATUS_OK = 0, // CMD completed successfully
MCP4461_FAILED, // component failed
@ -93,30 +115,75 @@ class Mcp4461Component : public Component, public i2c::I2CDevice {
MCP4461_WIPER_DISABLED, // The wiper is disabled - all actions for this wiper will be aborted/discarded
MCP4461_WIPER_LOCKED, // The wiper is locked using WiperLock-technology - all actions for this wiper will be
// aborted/discarded
} error_code_{MCP4461_STATUS_OK};
} error_code{MCP4461_STATUS_OK};
protected:
friend class Mcp4461Wiper;
/// @brief update write protection status of device
void update_write_protection_status_();
/// @brief fetch wiper address for given wiper
/// @param[wiper] wiper to fetch address for, int in range 0-7
/// @return wiper address from Mcp4461Addresses
uint8_t get_wiper_address_(uint8_t wiper);
/// @brief internal i2c function to read given wiper value
/// @return uint16_t value in range 0-256 representing current wiper state/level
uint16_t read_wiper_level_(uint8_t wiper);
/// @brief fetch device status register values
/// @return uint8_t status register value - see datasheet for bit values
uint8_t get_status_register_();
/// @brief read current level/state of given wiper with validation checks
/// @return uint16_t value in range 0-256 representing current wiper state/level
uint16_t get_wiper_level_(Mcp4461WiperIdx wiper);
/// @brief set level/state of given wiper
/// @return bool - true on success, false on error/warning
bool set_wiper_level_(Mcp4461WiperIdx wiper, uint16_t value);
/// @brief update current level/state of given wiper
/// @return bool - true on success, false on error/warning
bool update_wiper_level_(Mcp4461WiperIdx wiper);
/// @brief enable given wiper
/// @param[in] wiper The wiper to enable
void enable_wiper_(Mcp4461WiperIdx wiper);
/// @brief disable given wiper
/// @param[in] wiper The wiper to disable
void disable_wiper_(Mcp4461WiperIdx wiper);
/// @brief increase given wiper
/// @param[wiper] wiper to increase
/// @return bool - true on success, false on error/warning
bool increase_wiper_(Mcp4461WiperIdx wiper);
/// @brief increase given wiper
/// @param[wiper] wiper to increase
/// @return bool - true on success, false on error/warning
bool decrease_wiper_(Mcp4461WiperIdx wiper);
/// @brief enable terminal of wiper
/// @param[wiper] desired wiper for which the terminal shall be enabled
void enable_terminal_(Mcp4461WiperIdx wiper, char terminal);
/// @brief disable terminal of wiper
/// @param[wiper] desired wiper for which the terminal shall be disabled
void disable_terminal_(Mcp4461WiperIdx, char terminal);
/// @brief check if device is still busy writing to eeprom
/// @return bool - true if device is currently writing to eeprom
bool is_writing_();
/// @brief wait until timeout if device is busy
/// @param[wait_if_not_ready] set to true to wait until timeout again, if previous write timed out already
/// @return bool - true if device eeprom still busy, false if rdy for write to nonvolatile wiper/eeprom
bool is_eeprom_ready_for_writing_(bool wait_if_not_ready);
/// @brief set wiper level
/// @param[wiper] wiper for which the new state shall be set
/// @param[value] the int value in range 0-256 the wiper shall be set to
void write_wiper_level_(uint8_t wiper, uint16_t value);
/// @brief internal i2c write function
/// @return bool - true write successful, false if not
bool mcp4461_write_(uint8_t addr, uint16_t data, bool nonvolatile = false);
/// @brief calculate correct terminal register values
/// @return uint8_t - calculated terminal register value for current internal terminal states
uint8_t calc_terminal_connector_byte_(Mcp4461TerminalIdx terminal_connector);
/// @brief internal function to update terminal registers
void update_terminal_register_(Mcp4461TerminalIdx terminal_connector);
/// @brief internal function to get terminal register values
/// /// @return uint8_t - get terminal register value of specified terminal
uint8_t get_terminal_register_(Mcp4461TerminalIdx terminal_connector);
/// @brief internal function to set terminal registers
/// @return bool - true if write successful, false if not
bool set_terminal_register_(Mcp4461TerminalIdx terminal_connector, uint8_t data);
WiperState reg_[8];

View File

@ -0,0 +1,28 @@
i2c:
- id: i2c_mcp4461
sda: ${sda_pin}
scl: ${scl_pin}
mcp4461:
- id: mcp4461_digipot_01
output:
- platform: mcp4461
id: digipot_wiper_1
mcp4461_id: mcp4461_digipot_01
channel: A
- platform: mcp4461
id: digipot_wiper_2
mcp4461_id: mcp4461_digipot_01
channel: B
- platform: mcp4461
id: digipot_wiper_3
mcp4461_id: mcp4461_digipot_01
channel: C
- platform: mcp4461
id: digipot_wiper_4
mcp4461_id: mcp4461_digipot_01
channel: D

View File

@ -1,28 +1,5 @@
i2c:
- id: i2c_mcp4461
sda: 16
scl: 17
substitutions:
sda_pin: GPIO16
scl_pin: GPIO17
mcp4461:
- id: mcp4461_digipot_01
output:
- platform: mcp4461
id: digipot_wiper_1
mcp4461_id: mcp4461_digipot_01
channel: A
- platform: mcp4461
id: digipot_wiper_2
mcp4461_id: mcp4461_digipot_01
channel: B
- platform: mcp4461
id: digipot_wiper_3
mcp4461_id: mcp4461_digipot_01
channel: C
- platform: mcp4461
id: digipot_wiper_4
mcp4461_id: mcp4461_digipot_01
channel: D
<<: !include common.yaml

View File

@ -1,28 +1,5 @@
i2c:
- id: i2c_mcp4461
sda: 4
scl: 5
substitutions:
sda_pin: GPIO4
scl_pin: GPIO5
mcp4461:
- id: mcp4461_digipot_01
output:
- platform: mcp4461
id: digipot_wiper_1
mcp4461_id: mcp4461_digipot_01
channel: A
- platform: mcp4461
id: digipot_wiper_2
mcp4461_id: mcp4461_digipot_01
channel: B
- platform: mcp4461
id: digipot_wiper_3
mcp4461_id: mcp4461_digipot_01
channel: C
- platform: mcp4461
id: digipot_wiper_4
mcp4461_id: mcp4461_digipot_01
channel: D
<<: !include common.yaml

View File

@ -1,28 +1,5 @@
i2c:
- id: i2c_mcp4461
sda: 4
scl: 5
substitutions:
sda_pin: GPIO4
scl_pin: GPIO5
mcp4461:
- id: mcp4461_digipot_01
output:
- platform: mcp4461
id: digipot_wiper_1
mcp4461_id: mcp4461_digipot_01
channel: A
- platform: mcp4461
id: digipot_wiper_2
mcp4461_id: mcp4461_digipot_01
channel: B
- platform: mcp4461
id: digipot_wiper_3
mcp4461_id: mcp4461_digipot_01
channel: C
- platform: mcp4461
id: digipot_wiper_4
mcp4461_id: mcp4461_digipot_01
channel: D
<<: !include common.yaml

View File

@ -1,28 +1,5 @@
i2c:
- id: i2c_mcp4461
sda: 16
scl: 17
substitutions:
sda_pin: GPIO16
scl_pin: GPIO17
mcp4461:
- id: mcp4461_digipot_01
output:
- platform: mcp4461
id: digipot_wiper_1
mcp4461_id: mcp4461_digipot_01
channel: A
- platform: mcp4461
id: digipot_wiper_2
mcp4461_id: mcp4461_digipot_01
channel: B
- platform: mcp4461
id: digipot_wiper_3
mcp4461_id: mcp4461_digipot_01
channel: C
- platform: mcp4461
id: digipot_wiper_4
mcp4461_id: mcp4461_digipot_01
channel: D
<<: !include common.yaml

View File

@ -1,28 +1,5 @@
i2c:
- id: i2c_mcp4461
sda: 4
scl: 5
substitutions:
sda_pin: GPIO4
scl_pin: GPIO5
mcp4461:
- id: mcp4461_digipot_01
output:
- platform: mcp4461
id: digipot_wiper_1
mcp4461_id: mcp4461_digipot_01
channel: A
- platform: mcp4461
id: digipot_wiper_2
mcp4461_id: mcp4461_digipot_01
channel: B
- platform: mcp4461
id: digipot_wiper_3
mcp4461_id: mcp4461_digipot_01
channel: C
- platform: mcp4461
id: digipot_wiper_4
mcp4461_id: mcp4461_digipot_01
channel: D
<<: !include common.yaml