question of HID
question of HID
Helo,
I am spirit to modify the firmware of my microcontrolor C8051F320 to make it pass for a joystick or all other produced HID.
I have 2 or 3 question, somebody if know in HID here??
For example which is the diférence between maximum Logical and physical maximum?
Thank you
PS. I am one study Swiss, I speak French and not English to afflict for the translation!
I am spirit to modify the firmware of my microcontrolor C8051F320 to make it pass for a joystick or all other produced HID.
I have 2 or 3 question, somebody if know in HID here??
For example which is the diférence between maximum Logical and physical maximum?
Thank you
PS. I am one study Swiss, I speak French and not English to afflict for the translation!
Well..
Device Class Definition for Human Interface Devices (HID) Version 1.11, chapter 6.2.2.7 wrote:While Logical Minimum and Logical Maximum (extents) bound the values returned by a device, Physical Minimum and Physical Maximum give meaning to those bounds by allowing the report value to be offset and scaled.
For example, a thermometer might have logical extents of 0 and 999 but physical extents of 32 and 212 degrees. The resolution can be determined with the following algorithm:
if ((Physical Maximum == UNDEFINED)
|| (Physical Minimum == UNDEFINED)
|| ((Physical Maximum == 0) && (Physical Minimum == 0)))
{
Physical Maximum = Logical Maximum;
Physical Minimum = Logical Minimum;
}
If (Unit Exponent == UNDEFINED)
Unit Exponent = 0;
Resolution = (Logical Maximum – Logical Minimum) / ((Physical Maximum – Physical Minimum) * pow(10, Unit Exponent));
That's a short item w/ a 2 byte value -- it's just the way the encoding is defined:
If I remember correct, the LOGICAL values are signed, to express a positive value the most significant bit has to be zero. Since 255 as a byte has the highest bit set it would be interpreted as -1. So you need a 2nd byte.
I really would recommend studying that document, it'll answer your questions
Device Class Definition for Human Interface Devices (HID) Version 1.11, chapter 6.2.2.2 wrote:6.2.2.2 Short Items
The short item format packs the item size, type, and tag into the first byte. The first byte may be followed by 0, 1, 2, or 4 optional data bytes depending on the size of the data.
[..]
A short item tag doesn’t have an explicit value for bSize associated with it. Instead, the value of the item data part determines the size of the item. That is, if the item data can be represented in one byte, then the data part can be specified as 1 byte, although this is not required.
If I remember correct, the LOGICAL values are signed, to express a positive value the most significant bit has to be zero. Since 255 as a byte has the highest bit set it would be interpreted as -1. So you need a 2nd byte.
I really would recommend studying that document, it'll answer your questions
Thank you, I tried to study this document, but it is in English and I does not understand it all!
I had already to study article 6.2.2.2 but I do not have to find answer has my question!
If LOGICAL_MAXIMUM is of (255) why one write 0x26, 0xff, 0x00, and not 0x26, 0xff,! It is that which I do not arrive has to understand!
Thank you
I had already to study article 6.2.2.2 but I do not have to find answer has my question!
If LOGICAL_MAXIMUM is of (255) why one write 0x26, 0xff, 0x00, and not 0x26, 0xff,! It is that which I do not arrive has to understand!
Thank you
I have another question, I submitted my report descriptor and now I want to send data of my kit to the PC, by pressing on a button of the kit it sendings a tram of data to the PC!
To send it is given in HID of the kit to the PC, there are a special standard or I to send data as in normal USB little?
With the In_Packet[ BYTE ];
To send it is given in HID of the kit to the PC, there are a special standard or I to send data as in normal USB little?
With the In_Packet[ BYTE ];
Helo,
In the example which is given: F32x_Firmware
There is its in the code:
void Timer2_ISR(void) interrupt 5
{
if (!(B1)) // Check for switch #1 pressed
{
if (Toggle1 == 0) // Toggle is used to debounce switch
{ // so that one press and release will
Switch1State = ~Switch1State; // toggle the state of the switch sent
Toggle1 = 1; // to the host
}
}
else Toggle1 = 0; // Reset toggle variable
if (!(B2)) // Same as above, but Switch2
{
if (Toggle2 == 0)
{
Switch2State = ~Switch2State;
Toggle2 = 1;
}
}
else Toggle2 = 0;
TF2H = 0; // Clear Timer2 interrupt flag*/
}
Are you know has what its useful?
In the example which is given: F32x_Firmware
There is its in the code:
void Timer2_ISR(void) interrupt 5
{
if (!(B1)) // Check for switch #1 pressed
{
if (Toggle1 == 0) // Toggle is used to debounce switch
{ // so that one press and release will
Switch1State = ~Switch1State; // toggle the state of the switch sent
Toggle1 = 1; // to the host
}
}
else Toggle1 = 0; // Reset toggle variable
if (!(B2)) // Same as above, but Switch2
{
if (Toggle2 == 0)
{
Switch2State = ~Switch2State;
Toggle2 = 1;
}
}
else Toggle2 = 0;
TF2H = 0; // Clear Timer2 interrupt flag*/
}
Are you know has what its useful?