Skip to content

bsaintjo/ds3502

Repository files navigation

I2C Digitial Potentiometer DS3502 driver in Rust

Crates.io License Crates.io Version docs.rs Crates.io MSRV embedded-hal Version

Rust embedded driver for the DS3502 Digital Potentiometer by Analog Devices Inc./Maxim Integrated. Supports block and async APIs.

Usage

use ds3502::{Ds3502, Wiper, ControlRegisterMode};
let mut digipot = Ds3502::blocking_init(i2c, Default::default())?;

// By default, driver initialized with Control Register in Mode 1 (Don't save to EEPROM)
assert_eq!(digipot.mode(), ControlRegisterMode::WiperOnly);

let wv = Wiper::try_from(88)?;
digipot.write_wiper(wv)?;

// Set wiper value and save to EEPROM
let wv = Wiper::try_from(123)?;
digipot.write_and_save_wiper(wv);

For a complete example that builds and flashes to a Raspberry Pi Pico using the embassy framework, checkout the pico-example directory.

Installation

Add to your Cargo.toml:

ds3502 = "0.1"

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.

About

Rust embedded-hal driver for the DS3502 digital potentiometer

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages