Trait libftd2xx::FtdiEeprom
source · pub trait FtdiEeprom<T: Debug + From<Eeprom>, Eeprom: Default + Debug + From<T>>: FtdiCommon {
// Provided methods
fn eeprom_read(&mut self) -> Result<(Eeprom, EepromStrings), FtStatus> { ... }
fn eeprom_program(
&mut self,
eeprom: Eeprom,
strings: EepromStrings
) -> Result<(), FtStatus> { ... }
}
Expand description
FTDI device-specific EEPROM trait.
Provided Methods§
sourcefn eeprom_read(&mut self) -> Result<(Eeprom, EepromStrings), FtStatus>
fn eeprom_read(&mut self) -> Result<(Eeprom, EepromStrings), FtStatus>
Read from the FTD2XX device EEPROM.
§Example
This example uses the FT232H.
use libftd2xx::{Ft4232h, Ftdi, FtdiEeprom};
let mut ft: Ft4232h = Ftdi::new()?.try_into()?;
let (eeprom, eeprom_strings) = ft.eeprom_read()?;
println!("FT4232H EEPROM contents: {:?}", eeprom);
println!("FT4232H EEPROM strings: {:?}", eeprom_strings);
sourcefn eeprom_program(
&mut self,
eeprom: Eeprom,
strings: EepromStrings
) -> Result<(), FtStatus>
fn eeprom_program( &mut self, eeprom: Eeprom, strings: EepromStrings ) -> 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::{DriverType, Eeprom232h, EepromStrings, Ft232h, Ftdi, FtdiEeprom};
let mut ft = Ft232h::with_serial_number("FT4PWSEOA")?;
let strings = EepromStrings::with_strs("FTDI", "FT", "Hello World", "FT1234567")?;
let mut eeprom = Eeprom232h::default();
eeprom.set_driver_type(DriverType::D2XX);
ft.eeprom_program(eeprom, strings)?;
Object Safety§
This trait is not object safe.