1use ev3dev_lang_rust::motors::MotorPort;
2
3#[derive(Debug, Clone, Copy)]
5pub struct Motor {
6 pub port: MotorPort,
8 pub direction: Direction,
10}
11
12impl Motor {
13 #[must_use]
15 pub const fn new(port: MotorPort, direction: Direction) -> Self {
16 Self { port, direction }
17 }
18}
19
20#[derive(Debug, Clone, Copy)]
22#[repr(i8)]
23pub enum Direction {
24 Clockwise = 1,
26 CounterClockwise = -1,
28}
29
30impl Direction {
31 #[inline]
33 #[must_use]
34 pub const fn sign(self) -> i32 {
35 self as i8 as i32
36 }
37}