4 releases

0.2.1 May 24, 2021
0.2.0 May 19, 2021
0.1.1 May 18, 2021
0.1.0 May 18, 2021

#1811 in Embedded development

MIT/Apache

10KB
108 lines

dac5578  

Texas Instruments DAC5578 Driver for Rust Embedded HAL This is a driver crate for embedded Rust. It's built on top of the Rust embedded HAL It supports sending commands to a TI DAC5578 over I2C.

The driver can be initialized by calling create and passing it an I2C interface. The device address (set by ADDR0) also needs to be specified. It can be set by pulling the ADDR0 on the device high/low or floating.

# use embedded_hal_mock::i2c::Mock;
# use dac5578::*;
# let mut i2c = Mock::new(&[]);
let mut dac = DAC5578::new(i2c, Address::PinLow);

To set the dac output for channel A:

# use embedded_hal_mock::i2c::{Mock, Transaction};
# use dac5578::*;
# let mut i2c = Mock::new(&[Transaction::write(98, vec![0x40, 0xff, 0xf0]),]);
# let mut dac = DAC5578::new(i2c, Address::PinLow);
dac.write_channel(Channel::A, 128);

More information

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~71KB