Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vgasparyan/mcp4725-rs
A platform agnostic driver to interface with the MCP4725 DAC module written in Rust using embedded-hal
https://github.com/vgasparyan/mcp4725-rs
embedded-hal embedded-linux raspberry-pi rust
Last synced: about 1 month ago
JSON representation
A platform agnostic driver to interface with the MCP4725 DAC module written in Rust using embedded-hal
- Host: GitHub
- URL: https://github.com/vgasparyan/mcp4725-rs
- Owner: vgasparyan
- Created: 2018-12-24T16:52:54.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-31T15:29:14.000Z (almost 6 years ago)
- Last Synced: 2024-10-18T04:58:05.644Z (2 months ago)
- Topics: embedded-hal, embedded-linux, raspberry-pi, rust
- Language: Rust
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[![crates.io](https://img.shields.io/crates/v/mcp4725-rs.svg)](https://crates.io/crates/mcp4725-rs)
# `Rust MCP4725 Driver`
> This is a platform agnostic Rust driver for the MCP4725, based on the
[`embedded-hal`](https://github.com/japaric/embedded-hal) traits.## The Device
The Microchip MCP4725 is a low-power, high accuracy, single channel,
12-bit buffered voltage output Digital-to-Analog Convertor (DAC)
with non-volatile memory (EEPROM).Datasheet: http://ww1.microchip.com/downloads/en/DeviceDoc/22039d.pdf
## Status
- [x] Support generation of DAC output using Fast Mode Write Command
- [x] Support writing DAC Input register and EEPROM
- [x] Support RESET command
- [x] Test on Raspberry Pi## [Examples](examples)
From [`examples/linux_raspi.rs`](examples/linux_raspi.rs):
```rust
extern crate linux_embedded_hal as linux_hal;
extern crate mcp4725_rs;use linux_hal::{Delay, I2cdev};
use mcp4725_rs::MCP4725;fn main() {
println!("Hello, MCP4725!");
println!();
println!("Generating sawtooth wave signal on DAC output...");let dev = I2cdev::new("/dev/i2c-1").unwrap();
let address = 0x60;let mut dac = MCP4725::new(dev, address, Delay).unwrap();
loop {
for dac_code in 0..4096 {
dac.set_dac_value(dac_code);
}
}
}
```Build the example on Raspberry PI
cargo build --examples
## License
Licensed under either of
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
http://opensource.org/licenses/MIT) at your option.