vlfd-rs

Crates.iovlfd-rs
lib.rsvlfd-rs
version1.0.0
created_at2025-09-24 06:14:10.107856+00
updated_at2025-09-28 14:47:32.328113+00
descriptionModern Rust driver for the VLFD board
homepage
repository
max_upload_size
id1852560
size36,124
Zhengyi Zhang (0xtaruhi)

documentation

https://docs.rs/vlfd-rs

README

vlfd-rs

vlfd-rs is a modern Rust driver for a VeriComm-compatible USB interface board. It exposes ergonomic APIs for bringing the hardware online, exchanging FIFO data, and programming the onboard FPGA fabric.

Features

  • Automatic USB session and endpoint management with sensible timeouts
  • Transparent encryption/decryption for VeriComm FIFO transfers
  • High-level configuration getters and setters with caching
  • Bitstream upload support for the integrated FPGA programmer
  • Hotplug callbacks powered by libusb's hotplug subsystem

Quick Start

use vlfd_rs::{Device, IoSettings, Result};

fn main() -> Result<()> {
    let mut device = Device::connect()?;

    let mut settings = IoSettings::default();
    device.enter_io_mode(&settings)?;

    let mut tx = [0x1234u16; 4];
    let mut rx = [0u16; 4];
    device.transfer_io(&mut tx, &mut rx)?;

    device.exit_io_mode()?;
    Ok(())
}

Installation

Add the crate to your Cargo.toml:

[dependencies]
vlfd-rs = "1.0"

Hotplug Example

use vlfd_rs::{Device, HotplugEventKind, HotplugOptions};

fn main() -> vlfd_rs::Result<()> {
    let device = Device::new()?;
    let _registration = device.usb().register_hotplug_callback(
        HotplugOptions::default(),
        |event| match event.kind {
            HotplugEventKind::Arrived => println!("Device arrived: {:?}", event.device),
            HotplugEventKind::Left => println!("Device left: {:?}", event.device),
        },
    )?;

    loop {
        std::thread::sleep(std::time::Duration::from_secs(1));
    }
}

License

Apache-2.0

Commit count: 0

cargo fmt