5.5.LibUSB
The LibUSB sample application is functionally similar to the previous HID application. The difference is that this sample includes software
for a Windows host PC called RSK_LibUSB. The intention of this open source library is to provide a platform independent operating system
interface allowing a device to be used on multiple operating systems with a common code base.
The target RSK code is not dependant upon any external library code however it is written to support the LibUSB functionality.
To use the supplied host SW you will need to have installed LibUSB-Win32 which is a port of the LibUSB code for Windows 32 bit
environments. This can be obtained from the LibUSB32 web site:
http://libusb-win32.sourceforge.net/
You can then build the supplied Microsoft Visual C++ project or use the pre-built executable which is located in the release directory under
the project and called RSK_LibUSB.exe. Run it and the following Window will be displayed:
Figure 5 - LibUSB application window
Note: This is a screen shot after a connection has been made and the ‘Read ADC’ button and the ‘Set LCD’ button have been used.
Program the RSK with the LibUSB sample code as described in the RSK tutorial manual. Then run the code. Connect a USB cable
between the host PC and the RSK. The first time the device is connected to a specific USB port Windows will detect the new device and
ask for the appropriate driver. This has been provided in a subdirectory of the sample code. Following the same process as described in the
Communications Device Class Application above navigate to the LibUSB driver as described and install it.
It should now be possible to make a connection from the application. Click the “Connect” button and you will be asked to confirm the VID
and PID of the device you wish to connect with. If you’ve not altered the firmware on the RSK to use your own VID and PID then the defaults
will be correct. When a connection is successfully made information about the device will be displayed and the rest of the buttons will be
enabled.
1.
The “Toggle LED” button enables a LED on the RSK to be toggled on and off.
2.
The “Read ADC” button will command the RSK to read its ADC and return the value back to the host where it will be
displayed.
17