ev3robot 0.3.1

Rust library for ev3dev
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use super::{Degrees, TachoCounts};

pub trait TachoMotorPositionUnit: Clone {
    fn tacho_counts(self, count_per_rot: TachoCounts) -> TachoCounts;
}

impl TachoMotorPositionUnit for TachoCounts {
    fn tacho_counts(self, _: TachoCounts) -> TachoCounts {
        self
    }
}

impl<T: Into<Degrees> + Clone> TachoMotorPositionUnit for T {
    fn tacho_counts(self, count_per_rot: TachoCounts) -> TachoCounts {
        let degrees = self.into();
        TachoCounts::new(degrees.value() * count_per_rot.value() / 360)
    }
}