1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//! A device abstraction trait for direct servo control shared across platforms.
pub use crate;
pub use crate;
/// Logical angle direction for servo mapping.
/// Platform-agnostic servo device contract.
///
/// Platform crates implement this trait for their concrete servo types so direct
/// servo operations resolve through trait methods instead of inherent methods.
///
/// This page serves as the definitive reference for direct servo control across
/// platforms.
///
/// # Example
///
/// This example demonstrates basic servo control: move to 45 degrees, then
/// 90 degrees, then relax.
///
/// ```rust,no_run
/// use device_envoy_core::servo::Servo;
/// use embassy_time::{Duration, Timer};
///
/// async fn move_and_relax(servo: &impl Servo) {
/// servo.set_degrees(45); // Move to 45 degrees and hold.
/// Timer::after(Duration::from_secs(1)).await; // Give servo reasonable time to reach position
/// servo.set_degrees(90); // Move to 90 degrees and hold.
/// Timer::after(Duration::from_secs(1)).await; // Give servo reasonable time to reach position
/// servo.relax(); // Let the servo relax. It will re-enable on next set_degrees()
/// }
///
/// # struct ServoMock;
/// # impl Servo for ServoMock {
/// # const DEFAULT_MAX_DEGREES: u16 = 180;
/// # fn set_degrees(&self, _degrees: u16) {}
/// # fn hold(&self) {}
/// # fn relax(&self) {}
/// # }
/// # let servo = ServoMock;
/// # let _future = move_and_relax(&servo);
/// # servo.hold();
/// ```