Crates.io | mcp4725-async |
lib.rs | mcp4725-async |
version | 0.1.0 |
source | src |
created_at | 2024-03-25 21:50:45.464455 |
updated_at | 2024-03-25 21:50:45.464455 |
description | An async driver for the MCP4725 DAC |
homepage | |
repository | https://github.com/ThatRedox/mcp4725-async |
max_upload_size | |
id | 1185725 |
size | 32,474 |
An async driver for the MCP4725 DAC using embedded_hal_async
. It supports sending commands over I2C.
Warning: This is currently untested on real hardware.
The driver can be initialized by calling new
with an I2C interface and the chip address:
// Address corresponds to A2,A1=0, and A0 tied to Vss
let mut mcp = MCP4725::new(i2c, 0b1100000);
To quickly set the DAC output:
// 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);
Licensed under either of
at your option.