kernelvex/utils.rs
1/// Represents the orientation or direction of a tracking wheel or component.
2///
3/// Used to indicate the mounting direction and rotation sense of tracking wheels
4/// and other directional components in the robot system.
5
6use vexide_devices::smart::PortError;
7#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8pub enum Orientation {
9 /// Left orientation
10 Left,
11 /// Right orientation
12 Right,
13 /// Clockwise rotation
14 CW,
15 /// Counter-clockwise rotation
16 CCW,
17}
18
19#[macro_export]
20macro_rules! shared_motor {
21 ($($motor:expr),+ $(,)?) => {{
22 const N: usize = <[()]>::len(&[$(shared_motor!(@replace $motor)),*]);
23
24 let motors: [Motor; N] = [$($motor),+];
25 Rc::new(RefCell::new(motors))
26 }};
27 (@replace $_:expr) => (());
28}
29
30pub type GroupErrors = Vec<PortError>;