Nowdays the USB is a normal data communication mode. The USB specification is mostly supported by every decent device. Although it is relatively simple and small, you can reach high speed data connection with it. This was the main reason why was it spreading so fast. After the HID's appearance, the USB became more popular. The most important HID compliant drivers are built in every operation system and you can reach your devices fast. For instance, after you bought and plugged a mouse to a computer, you can immediately use it without any installation.
In the first part of my thesis, I will show how an USB device communicate with the host. After that I will describe what a device has to send to the host to be recognized. For that the device has to send its HID description, with this the host can use the device.
To demonstrate the USB communcation I chose the AT90USB162 microcontroller which is an ATMEL product. I developed all of my programs in C with AVR Studio and load it to the microcontroller with FLIP. I made a keyboard, a mouse and a jostick firmware with the LUFA project, which deals with programming HID devices. Actually, the joystick is a gamepad, this difference cannot been seen at all in the function, only in the description.
The next task was the renewal of my old gamepad which originally uses the PC's gameport. According to the original printed circuit board, I designed a new one which fits to the case of the gamepad. On the new board, every upper and front-side button is connected, and the AT90USB162 microcontroller and the necessary peripherals are also placed. In this way I got a programmable USB device. I use all of the buttons with every device except the mouse, because HID supports only three buttons for a mouse.
After each of the three devices work perfectly I planned an all-in-one device. The point was that I can switch between the functions with hold down the right button and connect the device in that way. The state is saved in the EEPROM of the microcontroller by the program. So if the device is connected without pressing any buttons, the program loads the last state.