Hi:)
I need some help with a project I'm developing: the realization of a HID controller a software I have on PC.
I bought the board Arduino UNO because with the reprogramming of ATmega8U2 is possible to recognize it as HID device.
I thought, to do it using the firmware found on LUFA:
Pending the board arrives I'm trying to understand a bit how it all works. I'm going to describe briefly the project "features":
---- PC SIDE ----
The software uses an XML configuration file that specifies which bits, bytes, words, etc. ... will be assigned to a command which is then read by the program, for example:
<button bit="0x08" name="PLAY" />
By experiment with the Wiimote and the pad Play Station 2 (the only HID device I had at home, keyboard excluded) and using the program HID Trace get something like:
So in this case when bit 8 of the first line change from 0 to 1 (in the photo is already 1) the program will read the command "PLAY".
Of course for the buttons a bit is enough, if I have to read analog values ?i need 1 or 2 bytes containing the value read.
example:
<slider word="2" name="VOLUME" />
---- ARDUINO SIDE ----
At this point I have to send to the computer the "bit matrix" as the one you see in the picture, right?
From what I understand, in a HID device there are blocks of memory (size defined?) in which values ??are written.
Every time you change even one bit all memory block will be send to the PC
Your firmware writes in a small block of memory (usually located in the chipset HID) Corresponding bits and bytes to the state of your device (positions of sliders, state-of-buttons, etc.).
When something changes in this memory block, the HID chipset will signal the computer to read it.
Then, as soon as the software on the computer is ready, it will read the memory block and react to the changes found within.
(It Means That a slider can change Several times while the computer is busy, the computer will read only the current position When It has time to do so).The whole memory block is Transmitted to the computer every times, even if only one bit changed.
But the memory blocks are small enough (usually 32 or 16 bytes), That the bandwidth used is not much more than sending MIDI message to 4 bytes.
In real-life situations, the extra 12 or 28 bytes per message are ridiculously small Compared to the bandwidth of USB 1.0.
These memory blocks are in ATmega8U2, right?
How i can write them with Arduino?
Examples:
- I press the A button, and I therefore set to 1 bit 0x07 so that the PC is aware of the pressure.
- Turn the trimmer, I then assign the new value readed (suppose to be 16 bit even though he is only 10) from bit 0x10 to bit 0x1F
How do you do all this? : (
I need some help step by step