[][src]Struct rpi_embedded::servo::Servo

pub struct Servo {
    pub min_us: u16,
    pub max_us: u16,
    pub enable: bool,
    pub period: u64,
    // some fields omitted
}

servos should have an internal minimum and maximum PWs check your data sheet and adjust accordingly

Fields

min_us: u16

this would be 0-deg

max_us: u16

this would be MAX deg

enable: bool

on or off

period: u64

Implementations

impl Servo[src]

pub fn new(n_channel: u8) -> Self[src]

Creates a new instance on a PWM channal, should be either 1 or 0 passed into it do note that it sets the defualt values for input for min and max

pub fn set_min_max(&mut self, min: u16, max: u16)[src]

allows changing the minima and maxima

pub fn set_period(&mut self, perio: u64)[src]

allows changing the period, same as changing the period for PWM

pub fn enable(&mut self)[src]

Turns the PWM channel on

pub fn disable(&mut self)[src]

Turns the Pwm channel off

pub fn motor_mode(&mut self)[src]

USE WITH CAUTION some servos allow spinning if a suitable singal is sent.

pub fn write(&mut self, value: u8) -> Result<u64, u64>[src]

takes value as deg and then simply sends a singal to go there, makes sure that it worked

pub fn write_pwm(&mut self, value: u64) -> Result<u64, u64>[src]

pub fn is_enabled(&mut self) -> bool[src]

boolean to see if the servo is active

pub fn get_min(&mut self) -> u16[src]

gets the minimum pulse width

pub fn get_max(&mut self) -> u16[src]

gets the maximum pulse width

pub fn get_period(&mut self) -> Result<u64, u64>[src]

gets the current period from the pwm and double checks if it is the one that is stored good to use to check if some other code is messing with the servo

pub fn get_channel(&mut self) -> u8[src]

Auto Trait Implementations

impl RefUnwindSafe for Servo

impl Send for Servo

impl Sync for Servo

impl Unpin for Servo

impl UnwindSafe for Servo

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.