Crates.io | dac5578 |
lib.rs | dac5578 |
version | 0.2.1 |
source | src |
created_at | 2021-05-18 19:47:16.677517 |
updated_at | 2021-05-24 18:45:00.569494 |
description | Texas Instruments DAC5578 Driver for Rust Embedded HAL |
homepage | |
repository | https://github.com/chmanie/dac5578 |
max_upload_size | |
id | 399110 |
size | 21,945 |
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);
Licensed under either of
at your option.
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.