[][src]Trait libftd2xx::FtdiEeprom

pub trait FtdiEeprom: FtdiCommon {
    type Eeprom;
    fn eeprom_read(&mut self) -> Result<Self::Eeprom, FtStatus>;
fn eeprom_program(&mut self, eeprom: &Self::Eeprom) -> Result<(), FtStatus>; }

FTDI device-specific EEPROM trait.

Associated Types

type Eeprom

EEPROM data structure for the specific device.

Loading content...

Required methods

fn eeprom_read(&mut self) -> Result<Self::Eeprom, FtStatus>

Read from the FTD2XX device EEPROM.

Example

This example uses the FT232H.

use libftd2xx::{Ftdi, FtdiEeprom, Ft4232h};
use std::convert::TryFrom;

let mut ftdi = Ftdi::new()?;
let mut ft = Ft4232h::try_from(&mut ftdi)?;
let eeprom = ft.eeprom_read()?;
println!("FT4232H EEPROM contents: {:?}", eeprom);

fn eeprom_program(&mut self, eeprom: &Self::Eeprom) -> Result<(), FtStatus>

Program the FTD2XX EEPROM.

Warning

Writing bad values to the EEPROM can brick your device. Please take a moment to read the license for this crate before using this function.

Example

This example uses the FT232H.

use libftd2xx::{Ftdi, FtdiEeprom, Ft4232h};
use std::convert::TryFrom;

let mut ftdi = Ftdi::with_serial_number("FTaaa")?;
let mut ft = Ft4232h::try_from(&mut ftdi)?;
let mut eeprom = ft.eeprom_read()?;

let CURRENT: u16 = 150;
println!("Setting maximum current to {} mA", CURRENT);
eeprom.set_max_current(CURRENT);
ft.eeprom_program(&eeprom)?;
Loading content...

Implementors

impl FtdiEeprom for Ft232h[src]

type Eeprom = Eeprom232h

impl FtdiEeprom for Ft4232h[src]

type Eeprom = Eeprom4232h

Loading content...