[−][src]Crate silabs_usb_xpress
Silicon Labs USB Xpress driver
This library port API from SiUSBXp, which is an open source port to SiUSBXp.dll, supplied with SiLabs USBXpress. The underlying USB backend is libusb, which enable the cross platform compilation.
Usage
Add to your Cargo.toml
:
[dependencies]
silabs_usb_xpress = "0.1"
You must have pkg-config
and cc
available.
Example
ⓘThis example is not tested
// get device count let num = devices_count(); // print serial number for all devices let if_sn = product_string(0, ProductStringType::SerialNumber); // print VID for selected devices let pst = ProductStringType::VID; let if_vid = product_string(0, pst); // get timeouts let t = timeouts().unwrap(); // set timeouts set_timeouts(Duration::from_millis(500), None).unwrap(); // open handle let mut handle = open(0).unwrap(); // write to device handle let v = vec![0x55, 0x80, 0x00, 0x01, 0x01, 0xAA]; write(&mut handle, &v); // read 7 bytes from device handle let read_res = read(&mut handle, 7); // close device close(handle.unwrap());
License
Structs
SiHandle | |
Timeout |
Enums
ProductStringType | |
SilabsUsbXpressError |
Functions
check_rx_queue | Returns the number of bytes in a device's RX queue |
close | Cancels pending IO and closes a device |
device_io_control | Allows sending low-level commands to the device driver |
devices_count | Returns the number of devices connected |
flush_buffers | Flushes the TX and RX buffers for a device |
open | Opens a device and returns a handle |
product_string | Returns a descriptor for a device |
read | Reads a block of data from a device |
set_timeouts | Sets read and write block timeouts |
timeouts | Gets read and write block timeouts |
write | Writes a block of data to a device |