#dac #i2c #async #no-alloc #mcp4725

no-std mcp4725-async

MCP4725 DAC的异步驱动程序

1 个不稳定版本

0.1.0 2024年3月25日

#1773 in 嵌入式开发

MIT/Apache

19KB
401 代码行

mcp4725-async

GitHub Actions Workflow Status Codecov (with branch)

使用 embedded_hal_async 的MCP4725 DAC异步驱动程序。它支持通过I2C发送命令。

警告:目前尚未在实际硬件上测试。

可以通过调用带有I2C接口和芯片地址的 new 来初始化驱动程序

// Address corresponds to A2,A1=0, and A0 tied to Vss
let mut mcp = MCP4725::new(i2c, 0b1100000);

快速设置DAC输出

// Set DAC to 0xFFF = Full scale, don't write to eeprom
mcp.set_voltage(0xFFF, false);
// Set DAC to 0x800 = Half scale, don't write to eeprom
mcp.set_voltage(0x800, false);
// Set DAC to 0x000 = Zero volts, write to eeprom
mcp.set_voltage(0x000, true);

许可

许可以下任一协议:

由您选择。

依赖

~245KB