pub struct ServoPlayerGenerated;target_os=none only.Expand description
Sample struct type generated by the servo_player! macro, showing all methods and constants.
This page serves as the definitive reference for what a generated servo player type
provides. For first-time readers, start with the examples in the servo_player module
documentation, then return here for a complete list of available methods and
associated constants.
Auto-generated.
Implementations§
Source§impl ServoPlayerGenerated
impl ServoPlayerGenerated
Sourcepub const MAX_STEPS: usize = 16
pub const MAX_STEPS: usize = 16
Maximum number of animation steps allowed.
Specified in the servo_player! macro.
Sourcepub fn new(
pin: Peri<'static, PIN_11>,
slice: Peri<'static, PWM_SLICE5>,
spawner: Spawner,
) -> Result<&'static Self>
pub fn new( pin: Peri<'static, PIN_11>, slice: Peri<'static, PWM_SLICE5>, spawner: Spawner, ) -> Result<&'static Self>
Create a new servo player instance of the struct type
defined by servo_player!.
See the servo_player module docs for usage.
The pin and slice parameters must correspond to the
GPIO pin specified in the macro.
§Parameters
pin: GPIO pin for servoslice: PWM slice for servo control (slice = (pin / 2) % 8)spawner: Task spawner for background operations
Sourcepub fn set_degrees(&self, degrees: u16)
pub fn set_degrees(&self, degrees: u16)
Set the target angle. The most recent command always wins.
See the servo_player module docs for usage.
Sourcepub fn hold(&self)
pub fn hold(&self)
Hold the servo at its current position.
See the servo_player module docs for usage.
Sourcepub fn relax(&self)
pub fn relax(&self)
Relax the servo. Servo can move freely.
See the servo_player module docs for usage.
Sourcepub fn animate<I>(&self, steps: I, at_end: AtEnd)
pub fn animate<I>(&self, steps: I, at_end: AtEnd)
Animate the servo through a sequence of angles with per-step hold durations.
Each step is a tuple (degrees, duration). Accepts both owned iterators and
references to collections.
See the servo_player module docs for usage.
Auto Trait Implementations§
impl Freeze for ServoPlayerGenerated
impl RefUnwindSafe for ServoPlayerGenerated
impl Send for ServoPlayerGenerated
impl Sync for ServoPlayerGenerated
impl Unpin for ServoPlayerGenerated
impl UnwindSafe for ServoPlayerGenerated
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more