work on DAC

master
edwin 4 years ago
parent c2320eac28
commit 342a41250b

@ -0,0 +1,11 @@
#include "mcp4725.hpp"
MCP4725::MCP4725()
{
}
MCP4725::~MCP4725()
{
}

@ -0,0 +1,56 @@
#ifndef _MCP4725_HPP_
#define _MCP4725_HPP_
class MCP4725
{
public:
// address list
enum i2c_addr
{
addr_0x0 = 0b01100000,
addr_0x1 = addr_0x0 + 1,
addr_0x2 = addr_0x0 + 1,
addr_0x3 = addr_0x0 + 1,
addr_0x4 = addr_0x0 + 1,
addr_0x5 = addr_0x0 + 1,
addr_0x6 = addr_0x0 + 1,
addr_0x7 = addr_0x0 + 1
}
// power down impedance modes
enum pwrd_md
{
normal = 0x04,
ohm_1k = 0x01,
ohm_100k = 0x02,
ohm_500k = 0x03
};
MCP4725(pwrd_md power_down_mode,
i2c_addr address);
MCP4725(i2c_addr address);
~MCP4725();
void operator=(uint16_t dac_value);
void operator==(uint16_t dac_and_eeprom_value);
void write_dac_and_eeprom(uint16_t value);
void set_powerdown_impedance(pwrd_md mode);
i2c_addr get_i2c_addr();
void set_power
private:
i2c_addr address;
pwrd_md power_down_mode;
};
#endif // _MCP4725_HPP_
Loading…
Cancel
Save