[][src]Struct matrix_rhal::gpio::Gpio

pub struct Gpio<'a> { /* fields omitted */ }

Controls the GPIO pins on a MATRIX device.

Methods

impl<'a> Gpio<'a>[src]

pub fn new(bus: &'a Bus) -> Gpio[src]

Returns an instance of GPIO.

impl<'a> Gpio<'a>[src]

pub fn get_state(&self, pin: u8) -> bool[src]

Returns the current digital value of a MATRIX GPIO pin (0->15).

pub fn get_states(&self) -> [bool; 16][src]

Returns the current digital value of every MATRIX GPIO pin (0->15)

impl<'a> Gpio<'a>[src]

pub fn set_config<T>(&self, pin: u8, config: T) -> Result<(), Error> where
    T: PinConfig
[src]

Configure a specific pin's mode, function, state, etc..

pub fn set_configs<T>(&self, pins: &[u8], config: T) -> Result<(), Error> where
    T: PinConfig
[src]

Configure multiple pins' mode, function, state, etc..

pub fn set_prescaler(&self, bank: usize, prescaler: u16) -> Result<(), Error>[src]

Set the prescaler value for a specific bank

pub fn set_pwm(
    &self,
    pin: u8,
    frequency: f32,
    percentage: f32
) -> Result<(), Error>
[src]

Set the Pulse Width Modulation output for a pin.

pub fn set_servo_angle(
    &self,
    pin: u8,
    angle: u32,
    min_pulse_ms: f32
) -> Result<(), Error>
[src]

Abstraction over set_pwm to easily control a servo.

min_pulse_ms accepts values from 0 to 1.5. Inputs outside this range will be set to the closest valid number.

Trait Implementations

impl<'a> Debug for Gpio<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Gpio<'a>

impl<'a> Send for Gpio<'a>

impl<'a> Sync for Gpio<'a>

impl<'a> Unpin for Gpio<'a>

impl<'a> UnwindSafe for Gpio<'a>

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.