work onmemberfunctions

master
edwin 4 years ago
parent 2161aee82a
commit 30ad9964f6

@ -16,7 +16,7 @@ MCP4725::MCP4725(pwrd_md power_down_mode,
temp[4] = temp[1];
temp[5] = temp[2];
i2c_write(temp,6);
i2c_write(address, temp,6);
}
MCP4725::MCP4725(i2c_addr address,
@ -34,7 +34,7 @@ MCP4725::MCP4725(i2c_addr address,
temp[4] = temp[1];
temp[5] = temp[2];
i2c_write(temp,6);
i2c_write(address, temp, 6);
}
MCP4725::~MCP4725()
@ -42,4 +42,35 @@ MCP4725::~MCP4725()
}
void MCP4725::operator=(uint16_t dac_value)
{
uint8_t temp[3];
this.dac_value = dac_value;
temp[0] = write_dac | (power_down_mode << 1);
temp[1] = static_cast<uint8_t>(dac_value >> 4);
temp[2] = static_cast<uint8_t>(dac_value << 4);
i2c_write(address, temp, 3);
}
void MCP4725::operator==(uint16_t dac_and_eeprom_value)
{
uint8_t temp[6];
dac_value = dac_and_eeprom_value;
eeprom_value = dac_value;
temp[0] = write_dac_and_eeprom | (power_down_mode << 1);
}
void MCP4725::write_dac(uint16_t dac_value)
{
&this = dac_value;
}
void MCP4725::write_dac_and_eeprom(uint16_t dac_and_eeprom_value)
{
&this == dac_and_eeprom_value;
}

@ -31,7 +31,7 @@ class MCP4725
//using std::functional<uint8_t(uint8_t, uint8_t)> i2c_read_n_t;
using std::functional<void(uint8_t*,uint8_t)> i2c_write_n_t;
using i2c_write_n_t = std::functional<void(uint8_t, uint8_t*,uint8_t)>;
MCP4725(pwrd_md power_down_mode,
i2c_addr address,

Loading…
Cancel
Save