| Crates.io | dacx578 |
| lib.rs | dacx578 |
| version | 0.1.0 |
| created_at | 2025-12-13 14:39:56.945398+00 |
| updated_at | 2025-12-15 08:37:14.147231+00 |
| description | Texas Instruments DACx578 Driver for Rust Embedded HAL |
| homepage | |
| repository | https://github.com/louisreg/dacx578 |
| max_upload_size | |
| id | 1982978 |
| size | 40,802 |
Unified Rust driver for Texas Instruments DAC5578, DAC6578, and DAC7578 digital-to-analog converters.
This crate is built on top of the Rust
embedded-hal and provides a
single, resolution-aware and no_std compatible API for the entire
DACx578 family.
| Device | Resolution |
|---|---|
| DAC5578 | 8-bit |
| DAC6578 | 10-bit |
| DAC7578 | 12-bit |
This crate is based on the original open-source DAC5578 driver:
The original project provided a clean and minimal driver for the DAC5578.
This codebase extends that work by generalizing the implementation to support the full DACx578 family, adding:
while preserving the original command structure and API philosophy.
Note: This driver has been tested on real hardware with the DAC6578. The DAC5578 and DAC7578 are expected to behave identically (aside from resolution) based on the datasheets and the original DAC5578 driver, but have not been fully tested on hardware.
#![no_std] compatibleembedded-hal 1.0use dacx578::{DACx578, I2cAddress, AddrPin, DacResolution};
use embedded_hal_mock::eh1::i2c::Mock;
let i2c = Mock::new(&[]);
let mut dac = DACx578::new(
i2c,
I2cAddress::SinglePin { addr0: AddrPin::Low },
DacResolution::Bits12,
);
use dacx578::{DACx578, I2cAddress, AddrPin, DacResolution};
use embedded_hal_mock::eh1::i2c::Mock;
let i2c = Mock::new(&[]);
let mut dac = DACx578::new(
i2c,
I2cAddress::DualPin {
addr1: AddrPin::High,
addr0: AddrPin::Low,
},
DacResolution::Bits10,
);
use dacx578::Channel;
// Write a value and immediately update channel A
dac.write_and_update(Channel::A, 0x0FFF).unwrap();
The provided value is automatically masked and aligned according to the selected DAC resolution.
The DACx578 family supports multiple I²C addressing configurations depending on the package variant. This driver supports both single-pin and dual-pin address selection schemes.
Some DACx578 variants expose only a single address selection pin (ADDR0). In this case, the I²C address is determined solely by the state of this pin.
| ADDR0 state | I²C Address |
|---|---|
| Low | 0x48 |
| High | 0x4A |
| Float | 0x4C |
Use this configuration with:
I2cAddress::SinglePin { addr0 }
This mode matches the behavior of the original DAC5578 driver.
QFN-24 (RGE) package variants expose two address pins: ADDR1 and ADDR0. This allows up to 8 distinct I²C addresses on the same bus.
| ADDR1 | ADDR0 | I²C Address |
|---|---|---|
| Low | Low | 0x48 |
| Low | High | 0x49 |
| High | Low | 0x4A |
| High | High | 0x4B |
| Float | Low | 0x4C |
| Float | High | 0x4D |
| Low | Float | 0x4E |
| High | Float | 0x4F |
⚠️ The combination ADDR1 = Float and ADDR0 = Float is not supported by the hardware. Attempting to use this configuration will cause a panic.
Use this configuration with:
I2cAddress::DualPin { addr1, addr0 }
The base address for all DACx578 devices is 0x48
Address bits are derived directly from the pin configuration, following the TI datasheet
The addressing mode does not affect command encoding or resolution handling
Both modes are fully supported by the same DACx578 driver API
Vref) to allow writing values directly in voltsMIT OR Apache-2.0