Enum jetson_gpio::Mode

source ·
pub enum Mode {
    BOARD,
    BCM,
}
Expand description

Specifies the pin numbering mode.

The pin numbering mode is used to determine the mapping between the pin numbers and the GPIO channels. The pin numbering mode can be one of the following:

  • BOARD - The pin numbers are the physical pin numbers on the Jetson board.
  • BCM - The pin numbers are the Broadcom SOC channel numbers.
  • TEGRA_SOC - The pin numbers are the Tegra SOC channel numbers.
  • CVM - The pin numbers are the CVM channel numbers.

Example

use jetson_gpio::{GPIO, Mode};

let mut gpio = GPIO::new();
gpio.setmode(Mode::BOARD).unwrap();

Variants§

§

BOARD

§

BCM

Implementations§

Converts a string to a Mode enum.

Valid strings are:

  • "BOARD"
  • "BCM"
  • "TEGRA_SOC"
  • CVM
Example
use jetson_gpio::{GPIO, Mode};

let mut gpio = GPIO::new();
gpio.setmode(Mode::from_str("BOARD").unwrap()).unwrap();

Converts a Mode enum to a string.

Example
use jetson_gpio::{GPIO, Mode};

let mut gpio = GPIO::new();
gpio.setmode(Mode::BOARD).unwrap();
assert_eq!(gpio.getmode().unwrap().to_str(), "BOARD");

Checks if the Mode is valid.

Example
use jetson_gpio::{GPIO, Mode};

let mut gpio = GPIO::new();
assert_eq!(Mode::BOARD.is_valid(), true);
assert_eq!(Mode::BCM.is_valid(), true);
assert_eq!(Mode::TEGRA_SOC.is_valid(), false);
assert_eq!(Mode::CVM.is_valid(), false);

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.