[][src]Struct teensy::port::Gpio

pub struct Gpio { /* fields omitted */ }

Chapter 49: General-Purpose Input/Output (GPIO) doc/teensy_3.2.pdf - Page 1331

Methods

impl Gpio[src]

pub unsafe fn new(pin: Pin) -> Gpio[src]

Consume a Pin into a Gpio.

pub fn input(&mut self)[src]

Switch the pin in input mode (can read but not write)

This function can be implemented with a single write, eliminating the potential race condition. Thus its use is safe

pub fn with_input(self) -> Self[src]

Switch the pin in input mode (can read but not write) See input function

This function can be implemented with a single write, eliminating the potential race condition. Thus its use is safe

pub fn output(&mut self)[src]

Switch the pin in output mode (can write but not read)

This function can be implemented with a single write, eliminating the potential race condition. Thus its use is safe

pub fn with_output(self) -> Self[src]

Switch the pin in output mode (can write but not read) See output function

This function can be implemented with a single write, eliminating the potential race condition. Thus its use is safe

pub fn read(&mut self) -> u32[src]

Before use, call the input function

let pin = unsafe { port::Port::new(port::PortName::C).pin(3) };
let mut gpio = pin.make_gpio();
gpio.input();
gpio.read();

This function can be implemented with a single write, eliminating the potential race condition. Thus its use is safe

pub fn high(&mut self)[src]

Before use, call the output function

let pin = unsafe { port::Port::new(port::PortName::C).pin(5) };
let mut gpio = pin.make_gpio();
gpio.output();
gpio.high();

This function can be implemented with a single write, eliminating the potential race condition. Thus its use is safe

pub fn low(&mut self)[src]

Before use, call the output function

let pin = unsafe { port::Port::new(port::PortName::C).pin(5) };
let mut gpio = pin.make_gpio();
gpio.output();
gpio.low();

This function can be implemented with a single write, eliminating the potential race condition. Thus its use is safe

pub fn toggle(&mut self)[src]

Before use, call the output function

let pin = unsafe { port::Port::new(port::PortName::C).pin(5) };
let mut gpio = pin.make_gpio();
gpio.output();
gpio.toggle();

This function can be implemented with a single write, eliminating the potential race condition. Thus its use is safe

Auto Trait Implementations

impl !Send for Gpio

impl !Sync for Gpio

impl Unpin for Gpio

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.