6 releases (breaking)

0.6.0 Aug 6, 2023
0.5.0 Jun 9, 2022
0.4.0 Dec 4, 2021
0.3.0 Dec 3, 2021
0.1.0 Nov 28, 2021

#395 in Hardware support

Download history 10/week @ 2023-10-29 2/week @ 2023-11-12 8/week @ 2023-11-19 20/week @ 2023-11-26 13/week @ 2023-12-03 1/week @ 2023-12-10 7/week @ 2023-12-17 12/week @ 2023-12-24 2/week @ 2023-12-31 1/week @ 2024-01-07 9/week @ 2024-01-14 5/week @ 2024-01-21 25/week @ 2024-01-28 3/week @ 2024-02-04 23/week @ 2024-02-11

58 downloads per month

MIT/Apache

36KB
818 lines

as5600-rs

Rust Embedded HAL driver for the AS5600 contactless 12-bit digital potentiometer

Status

  • Reading/parsing all device registers
  • Writing configuration settings
  • Setting zero position, maximum position, maximum angle
  • Burn Settings and angle

Example

Here's how using this driver looks on a raspberry pi:

use std::{thread, time::Duration};

use as5600::As5600;
use linux_embedded_hal::I2cdev;

fn main() {
    let mut i2c = I2cdev::new("/dev/i2c-1").unwrap();
    let mut as5600 = As5600::new(i2c);
    let config = as5600.config().unwrap();
    println!("{:?}", config);

    thread::sleep(Duration::from_secs(2));

    let status = as5600.magnet_status().unwrap();
    let agc = as5600.automatic_gain_control().unwrap();
    let mag = as5600.magnitude().unwrap();
    let zmco = as5600.zmco().unwrap();

    println!("{:?}", status);
    println!("{:?}", agc);
    println!("{:?}", mag);
    println!("{:?}", zmco);

    thread::sleep(Duration::from_secs(2));

    loop {
        let value = as5600.angle().unwrap();
        println!("{:?}", value);
        thread::sleep(Duration::from_millis(100));
    }
}

TODO for a more relaxed and civilized age

[ ] make a wooden harness for the as5600 with a knob that turns a radial magnet at the right distance to the sensor [ ] make a CLI/GUI tool similar to ebyte-e32-ui [ ] use klask progress bars or something comparable to show the current magnet angle

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

~0.5–1MB
~21K SLoC