pub struct Ftdi { /* private fields */ }
Expand description
Generic FTDI device.
This structure can be used for all FTDI devices. A device-specific structure is only necessary to access the EEPROM traits for that device.
Implementations§
source§impl Ftdi
impl Ftdi
sourcepub fn new() -> Result<Ftdi, FtStatus>
pub fn new() -> Result<Ftdi, FtStatus>
Open the first device on the system.
This is equivalent to calling with_index
with an index of 0
.
This function cannot be used to open a specific device.
Ordering of devices on a system is not guaranteed to remain constant.
Calling this function multiple times may result in a different device
each time when there is more than one device connected to the system.
Use with_serial_number
to open a specific device.
§Example
use libftd2xx::Ftdi;
Ftdi::new()?;
sourcepub fn with_index(index: i32) -> Result<Ftdi, FtStatus>
pub fn with_index(index: i32) -> Result<Ftdi, FtStatus>
Open the device by an arbitrary index and initialize the handle.
This function can open multiple devices, but it cannot be used to open
a specific device.
Ordering of devices on a system is not guaranteed to remain constant.
Calling this function multiple times with the same index may result in a
different device each time when there is more than one device connected
to the system.
Use with_serial_number
to open a specific device.
§Example
use libftd2xx::Ftdi;
Ftdi::with_index(0)?;