Voice Solutions for Your PC

FTT-300 USB Foot Pedal

FTT-200USB Foot Pedal

The FTT-300 is specifically designed for use with any PTT (push to talk) software using game port commands rather than keyboard commands. This directly competes with Plantronics game Port Foot Pedal with similar cost and short delivery time.

buynow

FTT-300 Cut Sheet

FTT-300 Operating Manual

Example Software for the LMC Systems Foot Pedal

Overview

The example software uses the C# programming language and the .Net application framework. The development environment is Visual Studio.

This program is a simple example which will guide you to writing software and lower level interfaces to communicate with the LMC Systems foot pedal.

The software shows in a visual way whether the pedal is connected, what the IDs for the pedal are and when the pedal is pressed and released. Developers can run this program and see what needs to be done in their software to communicate with the HID-compliant game port controller interface.

Setup

The foot pedal uses a USB cable to connect with the PC. To see the example program communicate with the foot pedal connect the USB cable to a USB port on your Windows PC. See the “Interfacing the LMC Systems USB Foot Pedal” document for more information about connecting to the PC.

You can either run the sample program .exe file or you can build the source code using Visual Studio and then run the program in the debugger. To see the details of how the example application works you will need to run it in Visual Studio.

Setup using the executable program

In order for the program to run you must copy all of the files that came with it in the same directory on your PC and then run the executable from that directory.  

Setup using Visual Studio and the debugger

Copy the project folder structure to the desired location on your hard drive and uncompress it. Navigate to and double click the .sln file to load it into Visual Studio. This assumes you have Visual Studio on your system.

You may need to upgrade the project to run in a newer version of Visual Studio. If you need to you will be prompted.

Notes and Comments

This code started with the SimpleHIDLibrary software found at

http://simplehidlibrary.codeplex.com/.

It has been substantially modified to reach the goal of this project which is to illustrate how to interface the LMC Systems foot pedal via the USB game port interface. A lot of unneeded code has been removed to simplify the interface. There is still extra code but the interface is much cleaner so you can navigate it easier.

Although the software is a complete system from hardware to the application level it is not necessarily robust.

The example software’s purpose is solely to illustrate how to communicate with the foot pedal. Therefore it is not a complete turn-key system.  It may be lacking in areas required by your company. You will need to build your own application in order to meet your goals and needs.

WPF vs. WinForms interface.  A WinForms interface was chosen for this software because of its simplicity. Your application may use WPF or another UI (User Interface) option.

Software details

Software organization
The software is divided up into two sections – an application layer and a lower level “driver” layer.  The Visual Studio solution has two projects; one is the app layer and one is the driver layer.

The application layer uses Winforms to implement the user interface. The original SimpleHIDLibrary project uses WPF (Windows Presentation Foundation), Microsoft’s newer user interface technology. WPF can be much more flexible and powerful but it can also be more difficult to follow, especially if you don’t have experience with it. Winforms was chosen because it is a more straight-forward, easy to follow interface.

The driver layer results in .dll files that contain functions that the application layer can call to interface with the driver.

Running the application

After copying all files onto your hard drive you can open the Visual Studio solution and run it. Once running you can connect to the foot pedal by following these steps.

  • ensure that the VID and PID are the correct values
  • click on the Search button

If VID/PID are correct and the foot pedal is connected via USB cable to the PC you will see “Connected” above the Search button.

This could be done differently in application code. Instead of a Search button the foot pedal could be programmatically watched so that connecting the foot pedal automatically connects and reports that it is connected on the UI. The search button code should give you enough information to make your application dynamic if needed.

Once the foot pedal is found the UI starts looking for data from the foot pedal. A pedal press is reported in the UI with a “Pedal Pressed” message and a release reports “Pedal Released.”

Background worker

The application layer uses a background worker thread. This section explains why this is needed.

Winforms applications run in a single thread called the UI thread. If anything stops the thread (like calling a function that blocks waiting for data or for other events to happen) the UI “freezes up.” If the user clicks things nothing is processed because the thread is blocked and can’t process key clicks or anything else. The user can’t even click on the X to exit. The Winform just sits there and looks like it is hung.  So another thread needs to be used to keep the UI thread “freed up” to process key presses and mouse clicks while it waits for things, like in this case foot pedal activity.

To read the state of the foot pedal ReadRawInputReport() is called in the driver. ReadRawInputReport() blocks waiting for the foot pedal to change from pressed to released or from released to pressed. Therefore it can’t be called in the UI thread.

The background worker simply loops calling ReadRawInputReport() at the start of the loop which blocks until the foot pedal state changes.

Each time the foot pedal state changes it sends three bytes of information. If the pedal was just released it sends 00 00 00. If it was just pressed it sends 00 01 00. ReadRawInputReport() returns that data when this happens.

Each time ReadRawInputReport() returns the background worker looks at the data sent and updates the field variable ‘pressed.’ When the foot pedal is pressed ‘pressed’ is set and when it is released ‘pressed’ is cleared.

Meanwhile, back in the UI thread

The UI thread has a timer that fires every 50 milliseconds. Each time it fires, a function ‘timer_Tick() is called.  timer_Tick() checks the variable ‘pressed’ that the background thread updates and updates the UI with either “Pedal Pressed” or “Pedal Released.”

Summary

This document should give you enough information to understand the example application. Studying the example application should help you understand what you need to do to integrate the foot pedal into your company’s application.