![]() |
SLAB_USB_SPI
1.0
Silicon Labs CP2130 USB-to-SPI Interface Library
|
The Silicon Labs USB to SPI Library provides an application programming interface (API) consists of a low-level API to interface directly at the USB device class with WinUSB transfers.
Windows 7 and later | SLAB_USB_SPI.dll | SLAB_USB_SPI.h (C, C++) |
The host library is released with the following files:
The host library is designed to be universally compatible with most programming languages and is exported in C.
Follow these steps to use the library in a C/C++ project:
SLAB_USB_SPI.lib
as a linker input dependency or#pragma comment (lib, "SLAB_USB_SPI.lib")
SLAB_USB_SPI.h
as needed.SLAB_USB_SPI.dll
with the executable (.exe) file.The host library and associated functions are not thread safe. This means that calling library functions simultaneously from multiple threads may have undesirable effects.
To use the library functions in more than one thread, the user should do the following:
Using the CP2130 Device GUID, Windows applications or services can register for the WM_DEVICECHANGE
Windows message. Once registered, the application will receive device arrival and removal notifications for all USB devices with matching GUID. The application should retrieve the device path to filter devices. Similarly if a DBT_DEVICEREMOVECOMPLETE
message is received, then the application should check to see if the device path matches the device path of any connected devices. If this is the case, then the device was removed, and the application should close the device. Also if a DBT_DEVICEARRIVAL
message is received, then the application might add the new device to a device list so that users can select any USB device matching the required GUID. See accompanying example code for information on how to implement surprise removal and device arrival. Search for Knowledge Base Article # 222649, 311158, and 311153 for programming examples for C++, Visual Basic .NET, and Visual C#.