Code Monkey home page Code Monkey logo

silabs_usb_xpress's Introduction

Silicon Labs USB Xpress driver

License: GPL v3 Crates.io silabs_usb_xpress

OS Status
Linux Linux Build Status
Windows (MSVC) Windows Build Status

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.3"

This crate is compatible with Unix and Windows. For unix system, pkg-config are required to link libusb. For windows, you must have vcpkg installed, hook up user-wide integration and install libusb-win32 with it. By default, libusb is linked dynamically, and set environment variable VCPKGRS_DYNAMIC=0 if you want to link statically.

To pack a available driver in Windows, use libusbk' inf wizard.

Example

// get device count
let num = devices_count();

// print serial number for selected 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 = UsbXpress::open(0).unwrap();

// write to device handle
let v = vec![0x55, 0x80, 0x00, 0x01, 0x01, 0xAA];
handle.write(&v);

// read 7 bytes from device handle
let read_res = handle.read(7);

// close device
handle.close();

License

License: GPL v3

silabs_usb_xpress's People

Contributors

dependabot-preview[bot] avatar fmeow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

silabs_usb_xpress's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.