Crates.io | ace128_driver |
lib.rs | ace128_driver |
version | 0.1.2 |
source | src |
created_at | 2021-04-21 09:11:49.176929 |
updated_at | 2021-04-21 09:29:41.045597 |
description | An embedded hal driver for the Bourns Absolute Contact Encoder (ACE-128) |
homepage | |
repository | https://github.com/jamesklarke/ace128 |
max_upload_size | |
id | 387508 |
size | 10,102 |
GPIO based driver for the ACE128 Absolute Contacting Encoder.
The driver converts the 128 bit output into an absolute angle in radians as a 64 bit floating point value, with a discrete interval of 2*pi/128. An example based on the Raspberry Pi is shown below.
use rppal::gpio::{Gpio, OutputPin, InputPin};
use ace128_driver::Ace128;
fn main() {
let encoder = Ace128::new(
Gpio::new().unwrap().get(1).unwrap().into_input(),
Gpio::new().unwrap().get(2).unwrap().into_input(),
Gpio::new().unwrap().get(3).unwrap().into_input(),
Gpio::new().unwrap().get(4).unwrap().into_input(),
Gpio::new().unwrap().get(5).unwrap().into_input(),
Gpio::new().unwrap().get(6).unwrap().into_input(),
Gpio::new().unwrap().get(7).unwrap().into_input(),
Gpio::new().unwrap().get(8).unwrap().into_input()
);
loop {
let angle = encoder.read_angle().unwrap();
}
}