Struct ftd2xx_embedded_hal::Ft232hHal[][src]

pub struct Ft232hHal<INITIALIZED> { /* fields omitted */ }

FT232H device.

Implementations

impl Ft232hHal<Uninitialized>[src]

pub fn new() -> Result<Ft232hHal<Uninitialized>, DeviceTypeError>[src]

Create a new FT232H structure.

Example

use ftd2xx_embedded_hal as hal;

let ftdi = hal::Ft232hHal::new()?.init_default()?;

pub fn with_serial_number(
    sn: &str
) -> Result<Ft232hHal<Uninitialized>, DeviceTypeError>
[src]

Create a new FT232H structure from a serial number.

Example

use ftd2xx_embedded_hal as hal;

let ftdi = hal::Ft232hHal::with_serial_number("FT6ASGXH")?.init_default()?;

pub fn with_description(
    description: &str
) -> Result<Ft232hHal<Uninitialized>, DeviceTypeError>
[src]

Open a Ft4232h device by its device description.

Example

use libftd2xx::Ft4232h;

Ft4232h::with_description("FT4232H-56Q MiniModule A")?;

pub fn init_default(self) -> Result<Ft232hHal<Initialized>, TimeoutError>[src]

Initialize the FTDI MPSSE with sane defaults.

Default values:

  • Reset the FTDI device.
  • 4k USB transfer size.
  • 1s USB read timeout.
  • 1s USB write timeout.
  • 16ms latency timer.
  • 100kHz clock frequency.

Example

use ftd2xx_embedded_hal as hal;
use hal::{Ft232hHal, Initialized, Uninitialized};

let ftdi: Ft232hHal<Uninitialized> = hal::Ft232hHal::new()?;
let ftdi: Ft232hHal<Initialized> = ftdi.init_default()?;

pub fn init(
    self,
    mpsse_settings: &MpsseSettings
) -> Result<Ft232hHal<Initialized>, TimeoutError>
[src]

Initialize the FTDI MPSSE with custom values.

Note: The mask field of MpsseSettings is ignored for this function.

Panics

Panics if the clock_frequency field of MpsseSettings is None.

Example

use ftd2xx_embedded_hal as hal;
use hal::libftd2xx::MpsseSettings;
use hal::{Ft232hHal, Initialized, Uninitialized};

let ftdi: Ft232hHal<Uninitialized> = hal::Ft232hHal::new()?;
let ftdi: Ft232hHal<Initialized> = ftdi.init(&MpsseSettings {
    clock_frequency: Some(500_000),
    ..MpsseSettings::default()
})?;

impl Ft232hHal<Initialized>[src]

pub fn spi(&self) -> Result<Spi<'_>, TimeoutError>[src]

Aquire the SPI peripheral for the FT232H.

Pin assignments:

  • AD0 => SCK
  • AD1 => MOSI
  • AD2 => MISO

Panics

Panics if pin 0, 1, or 2 are already in use.

Example

use ftd2xx_embedded_hal as hal;

let ftdi = hal::Ft232hHal::new()?.init_default()?;
let mut spi = ftdi.spi()?;

pub fn i2c(&self) -> Result<I2c<'_>, TimeoutError>[src]

Aquire the I2C peripheral for the FT232H.

Pin assignments:

  • AD0 => SCL
  • AD1 => SDA
  • AD2 => SDA

Yes, AD1 and AD2 are both SDA. These pins must be shorted together for I2C operation.

Panics

Panics if pin 0, 1, or 2 are already in use.

Example

use ftd2xx_embedded_hal as hal;

let ftdi = hal::Ft232hHal::new()?.init_default()?;
let mut i2c = ftdi.i2c()?;

pub fn ad0(&self) -> OutputPin<'_>[src]

Aquire the digital output pin 0 for the FT232H.

Panics

Panics if the pin is already in-use.

pub fn ad1(&self) -> OutputPin<'_>[src]

Aquire the digital output pin 1 for the FT232H.

Panics

Panics if the pin is already in-use.

pub fn ad2(&self) -> OutputPin<'_>[src]

Aquire the digital output pin 2 for the FT232H.

Panics

Panics if the pin is already in-use.

pub fn ad3(&self) -> OutputPin<'_>[src]

Aquire the digital output pin 3 for the FT232H.

Panics

Panics if the pin is already in-use.

pub fn ad4(&self) -> OutputPin<'_>[src]

Aquire the digital output pin 4 for the FT232H.

Panics

Panics if the pin is already in-use.

pub fn ad5(&self) -> OutputPin<'_>[src]

Aquire the digital output pin 5 for the FT232H.

Panics

Panics if the pin is already in-use.

pub fn ad6(&self) -> OutputPin<'_>[src]

Aquire the digital output pin 6 for the FT232H.

Panics

Panics if the pin is already in-use.

pub fn ad7(&self) -> OutputPin<'_>[src]

Aquire the digital output pin 7 for the FT232H.

Panics

Panics if the pin is already in-use.

Trait Implementations

impl<INITIALIZED: Debug> Debug for Ft232hHal<INITIALIZED>[src]

impl From<Ft232h> for Ft232hHal<Uninitialized>[src]

fn from(ft: Ft232h) -> Self[src]

Create a new FT232H structure from a specific FT232H device.

Examples

Selecting a device with a specific serial number.

use ftd2xx_embedded_hal as hal;
use hal::libftd2xx::Ft232h;
use hal::Ft232hHal;

let ft = Ft232h::with_serial_number("FT59UO4C")?;
let ftdi = Ft232hHal::from(ft).init_default()?;

Selecting a device with a specific description.

use ftd2xx_embedded_hal as hal;
use hal::libftd2xx::Ft232h;
use hal::Ft232hHal;

let ft = Ft232h::with_description("My device description")?;
let ftdi = Ft232hHal::from(ft).init_default()?;

Auto Trait Implementations

impl<INITIALIZED> RefUnwindSafe for Ft232hHal<INITIALIZED> where
    INITIALIZED: RefUnwindSafe

impl<INITIALIZED> !Send for Ft232hHal<INITIALIZED>

impl<INITIALIZED> !Sync for Ft232hHal<INITIALIZED>

impl<INITIALIZED> Unpin for Ft232hHal<INITIALIZED> where
    INITIALIZED: Unpin

impl<INITIALIZED> UnwindSafe for Ft232hHal<INITIALIZED> where
    INITIALIZED: UnwindSafe

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.