Difference between revisions of "Component: USB HID (Comms: USB)"

From Flowcode Help
Jump to navigationJump to search
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color:gray;" | Author
 
| Matrix Ltd
 
| Matrix Ltd
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color:gray;" | Version
| 1.3 (Release)
+
| 1.4
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color:gray;" | Category
 
| Comms: USB
 
| Comms: USB
 
|}
 
|}
  
  
 +
==USB HID component==
 +
Component to create and communicate using a standard HID type USB class. Compatible with simulation and USB enabled microcontroller devices PIC/dsPIC/AVR. Note that AVR is currently in Beta and may have problems with custom descriptors.
  
==[[File:Component Icon 06a0a9b3_dd23_4592_a781_537a31b97c2a.png|Image]] USB HID component==
+
==Component Pack==
Component to create and communicate using a standard HID type USB class.
 
Compatible with simulation and USB enabled microcontroller devices PIC/dsPIC/AVR.
 
Note that AVR is currently in Beta and may have problems with custom descriptors.
 
  
==Examples==
+
COMMSC
Here are some examples to get you started with USB HID communications using Flowcode.
 
  
===HID Mouse===
+
==Detailed description==
  
Reads a EB014 keypad and depending on the key pressed sends the appropriate movement and button clicks to control the mouse. The speed is set by the speed variable which can range from 1 to 127.
 
{{Fcfile|USB_HID_Mouse.fcfx|Mouse Keypad Example}}
 
Key breakdown: 1 = UpLeft, 2=Up, 3=UpRight, 4=Left, 6=Right, 7=DownLeft, 8=Down, 9=DownRight, *=Left Click, #=Right Click.
 
  
  
  
Reads two encoders and moves the mouse cursor based on their movement since the last operation. A switch on pin B0 can be used to toggle the left mouse click on and off and pin B1 can be connected to an LED to show the status of the left mouse button. The EB073 encoders board connected to PortB will allow all of this functionality.
 
{{Fcfile|USB_HID_Etch_A_Sketch.fcfx|Mouse Encoder Example}}
 
===HID Keyboard===
 
  
Converts a ASCII character into a keypress that will be sent to the USB host device. A demo string is provided which is then broken down into characters and sent to the USB host.
 
{{Fcfile|USB_HID_Keyboard.fcfx|Keyboard Example}}
 
Here is a file showing the standard HID keyboard scan codes to help make sense of the example.
 
  
[[File:HID Keyboard Scan Codes.xls]]
 
  
  
With the example running if you create a text file and highlight the text file then the USB device will populate the file with data.
 
  
  
E.g.
 
  
HelloFromYourUSBKeyboardDevice12345
 
  
HelloFromYourUSBKeyboardDevice12345
 
  
HelloFromYourUSBKeyboardDevice12345
+
''No detailed description exists yet for this component''
  
 +
==Examples==
  
Currently only compatible with the following characters: 0123456789!"£$%^&*()/\*-+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n\t
 
  
===HID Descriptor Tool===
 
  
This tool allows you to create your own descriptors which can then be inserted into the HID descriptor property with the custom descriptor type selected.
 
  
[[File:HID Descriptor Tool.zip]]
 
  
  
==Downloadable macro reference==
 
  
===<span style="font-weight: normal;"><u><tt>ReceiveByte</tt></u></span>===
 
Receives a byte from the USB.
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Idx''
 
  
  
'''Return value'''
 
  
:[[Variable Types|BYTE]]
 
  
  
===<span style="font-weight: normal;"><u><tt>SetSerialNumber</tt></u></span>===
+
Here are some examples to get you started with USB HID communications using Flowcode.
Allows the device serial number to be edited.
 
  
'''Parameters'''
+
===HID Mouse===
  
:[[Variable Types|<- STRING]] ''SerialNumber''
+
Reads a EB014 keypad and depending on the key pressed sends the appropriate movement and button clicks to control the mouse.
::''This parameter may be returned back to the caller''
 
  
 +
The speed is set by the speed variable which can range from 1 to 127.
  
'''Return value'''
+
{{Fcfile|USB_HID_Mouse.fcfx|Mouse Keypad Example}}
  
:''This call does not return a value''
+
Key breakdown: 1 = UpLeft, 2=Up, 3=UpRight, 4=Left, 6=Right, 7=DownLeft, 8=Down, 9=DownRight, *=Left Click, #=Right Click.
  
  
===<span style="font-weight: normal;"><u><tt>SendData</tt></u></span>===
+
Reads two encoders and moves the mouse cursor based on their movement since the last operation.  
Sends the contents of the transmit buffer to the USB.
 
  
'''Parameters'''
+
A switch on pin B0 can be used to toggle the left mouse click on and off and pin B1 can be connected to an LED to show the status of the left mouse button.
  
:''This macro has no parameters''
+
The EB073 encoders board connected to PortB will allow all of this functionality.
  
  
'''Return value'''
+
{{Fcfile|USB_HID_Etch_A_Sketch.fcfx|Mouse Encoder Example}}
  
:[[Variable Types|BYTE]]
 
  
 +
===HID Keyboard===
  
===<span style="font-weight: normal;"><u><tt>CheckRx</tt></u></span>===
+
Converts a ASCII character into a keypress that will be sent to the USB host device.  
Checks for any incoming data.
 
  
Returns the number of data bytes received since the last check.
+
A demo string is provided which is then broken down into characters and sent to the USB host.
  
'''Parameters'''
+
{{Fcfile|USB_HID_Keyboard.fcfx|Keyboard Example}}
  
:''This macro has no parameters''
 
  
 +
Here is a file showing the standard HID keyboard scan codes to help make sense of the example.
  
'''Return value'''
+
[[File:HID Keyboard Scan Codes.xls]]
  
:[[Variable Types|BYTE]]
 
  
 +
With the example running if you create a text file and highlight the text file then the USB device will populate the file with data.
  
===<span style="font-weight: normal;"><u><tt>UpdateData</tt></u></span>===
 
Allows a byte of the transmit buffer to be assigned.
 
  
'''Parameters'''
+
E.g.
  
:[[Variable Types|BYTE]] ''idx''
+
HelloFromYourUSBKeyboardDevice12345
  
:[[Variable Types|BYTE]] ''value''
+
HelloFromYourUSBKeyboardDevice12345
  
 +
HelloFromYourUSBKeyboardDevice12345
  
'''Return value'''
 
  
:''This call does not return a value''
+
Currently only compatible with the following characters: 0123456789!"£$%^&*()/\*-+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n\t
  
  
===<span style="font-weight: normal;"><u><tt>ReceiveString</tt></u></span>===
+
A complete list of keyboard scan codes can be found here under section 7 - Keyboards.
Receives a string of bytes from the USB
 
  
'''Parameters'''
+
http://www.freebsddiary.org/APC/usb_hid_usages.php
  
:[[Variable Types|BYTE]] ''NumBytes''
 
  
 +
===HID Descriptor Tool===
  
'''Return value'''
+
This tool allows you to create your own descriptors which can then be inserted into the HID descriptor property with the custom descriptor type selected.
  
:[[Variable Types|STRING]]
+
[[File:HID Descriptor Tool.zip]]
  
 +
==Downloadable macro reference==
  
===<span style="font-weight: normal;"><u><tt>SendDataDirect</tt></u></span>===
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Sends data directly to the USB
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveByte'''
 +
|-
 +
| colspan="2" | Receives a byte from the USB.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Idx
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Parameters'''
 
  
:[[Variable Types|<- STRING]] ''Data''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::''This parameter may be returned back to the caller''
+
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetSerialNumber'''
 +
|-
 +
| colspan="2" | Allows the device serial number to be edited.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 +
| width="90%" | SerialNumber
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
'''Return value'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendData'''
 +
|-
 +
| colspan="2" | Sends the contents of the transmit buffer to the USB.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:[[Variable Types|BYTE]]
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckRx'''
 +
|-
 +
| colspan="2" | Checks for any incoming data. Returns the number of data bytes received since the last check.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
 
Starts up the USB connection and waits for the device driver to be correctly installed on the PC.
 
  
'''Parameters'''
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''UpdateData'''
 +
|-
 +
| colspan="2" | Allows a byte of the transmit buffer to be assigned.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | idx
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | value
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
:''This macro has no parameters''
 
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveString'''
 +
|-
 +
| colspan="2" | Receives a string of bytes from the USB&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | NumBytes
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
'''Return value'''
 
  
:[[Variable Types|BYTE]]
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendDataDirect'''
 +
|-
 +
| colspan="2" | Sends data directly to the USB&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 +
| width="90%" | Data
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
  
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 +
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
 +
|-
 +
| colspan="2" | Starts up the USB connection and waits for the device driver to be correctly installed on the PC. &nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
==Simulation macro reference==
 
  
''This component does not contain any simulation macros''
 
  
  
 
==Property reference==
 
==Property reference==
<span style="font-weight: normal;"><u>Vendor ID</u></span>
 
  
This property is of type ''Signed integer'' and can be referenced with the variable name ''vendor_ID''.
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
USB vendor identifier tied to the manufacturer of the USB device
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
<span style="font-weight: normal;"><u>Product ID</u></span>
+
|-
 
+
|-
This property is of type ''Signed integer'' and can be referenced with the variable name ''product_ID''.
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | USB Properties
USB product identifier
+
|-
 
+
|-
<span style="font-weight: normal;"><u>Device Name</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 
+
| width="90%" | Vendor ID
This property is of type ''Line of text'' and can be referenced with the variable name ''dev_name''.
+
|-
 
+
| colspan="2" | USB vendor identifier tied to the manufacturer of the USB device&nbsp;
Name used to identify the device
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
<span style="font-weight: normal;"><u>Manufacturer</u></span>
+
| width="90%" | Product ID
 
+
|-
This property is of type ''Line of text'' and can be referenced with the variable name ''dev_manufacturer''.
+
| colspan="2" | USB product identifier&nbsp;
 
+
|-
Manufacturer of the device
+
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
 
+
| width="90%" | Device Name
<span style="font-weight: normal;"><u>Major Version</u></span>
+
|-
 
+
| colspan="2" | Name used to identify the device&nbsp;
This property is of type ''Signed integer'' and can be referenced with the variable name ''major_version''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
Firmware major version
+
| width="90%" | Manufacturer
 
+
|-
<span style="font-weight: normal;"><u>Minor Version</u></span>
+
| colspan="2" | Manufacturer of the device&nbsp;
 
+
|-
This property is of type ''Signed integer'' and can be referenced with the variable name ''minor_version''.
+
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
+
| width="90%" | Major Version
Device firmware minor version
+
|-
 
+
| colspan="2" | Firmware major version&nbsp;
<span style="font-weight: normal;"><u>Enumeration Timeout</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
This property is of type ''True or false'' and can be referenced with the variable name ''enumeration_tout''.
+
| width="90%" | Minor Version
 
+
|-
Specifies if the initialise routine is allowed to timeout instead of waiting forever for success
+
| colspan="2" | Device firmware minor version &nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Maximum Current (mA)</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
+
| width="90%" | Enumeration Timeout
This property is of type ''Signed integer'' and can be referenced with the variable name ''max_current''.
+
|-
 
+
| colspan="2" | Specifies if the initialise routine is allowed to timeout instead of waiting forever for success&nbsp;
Maximum current the host should source to the device - max 500mA
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
<span style="font-weight: normal;"><u>Country Code</u></span>
+
| width="90%" | Maximum Current (mA)
 
+
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''cntry_code''.
+
| colspan="2" | Maximum current the host should source to the device - max 500mA&nbsp;
 
+
|-
Specific country code - if required
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Country Code
<span style="font-weight: normal;"><u>Descriptor Select</u></span>
+
|-
 
+
| colspan="2" | Specific country code - if required&nbsp;
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''descriptor_Select''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
Built in descriptor selection
+
| width="90%" | Descriptor Select
 
+
|-
<span style="font-weight: normal;"><u>HID Descriptor</u></span>
+
| colspan="2" | Built in descriptor selection &nbsp;
 
+
|-
This property is of type ''Multiple lines of text'' and can be referenced with the variable name ''HID_descriptor''.
+
| width="10%" align="center" | [[File:Fc9-type-11-icon.png]]
 
+
| width="90%" | HID Descriptor
Contents of the HID descriptor
+
|-
 
+
| colspan="2" | Contents of the HID descriptor&nbsp;
<span style="font-weight: normal;"><u>Subclass</u></span>
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''subclass''.
+
| width="90%" | Subclass
 
+
|-
USB Subclass - Normally only mice and keyboards are boot devices
+
| colspan="2" | USB Subclass - Normally only mice and keyboards are boot devices&nbsp;
 
+
|-
<span style="font-weight: normal;"><u>Interface</u></span>
+
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
+
| width="90%" | Interface
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''interface''.
+
|-
 
+
| colspan="2" | Standard HID interface type&nbsp;
Standard HID interface type
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
<span style="font-weight: normal;"><u>Transmit Packet Size</u></span>
+
| width="90%" | Transmit Packet Size
 
+
|-
This property is of type ''Signed integer'' and can be referenced with the variable name ''tx_packet_size''.
+
| colspan="2" | Number of bytes to send to the PC &nbsp;
 
+
|-
Number of bytes to send to the PC
+
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
+
| width="90%" | Transmit Period (ms)
<span style="font-weight: normal;"><u>Transmit Period (ms)</u></span>
+
|-
 
+
| colspan="2" | Delay between transmit packets&nbsp;
This property is of type ''Signed integer'' and can be referenced with the variable name ''tx_period''.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
Delay between transmit packets
+
| width="90%" | Receive Packet Size
 
+
|-
<span style="font-weight: normal;"><u>Receive Packet Size</u></span>
+
| colspan="2" | Number of bytes to receive from the PC&nbsp;
 
+
|-
This property is of type ''Signed integer'' and can be referenced with the variable name ''rx_packet_size''.
+
| width="10%" align="center" | [[File:Fc9-type-14-icon.png]]
 
+
| width="90%" | Receive Period (ms)
Number of bytes to receive from the PC
+
|-
 
+
| colspan="2" | Delay between receive packets&nbsp;
<span style="font-weight: normal;"><u>Receive Period (ms)</u></span>
+
|-
 
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
This property is of type ''Signed integer'' and can be referenced with the variable name ''rx_period''.
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
 
+
|-
Delay between receive packets
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
<span style="font-weight: normal;"><u>Label</u></span>
+
| width="90%" | Label
 
+
|-
This property is of type ''Line of text'' and can be referenced with the variable name ''label''.
+
| colspan="2" | Simulation label used to indicate the USB HID component on the panel.&nbsp;
 
+
|}
Simulation label used to indicate the USB HID component on the panel.
 

Latest revision as of 17:24, 9 November 2022

Author Matrix Ltd
Version 1.4
Category Comms: USB


USB HID component

Component to create and communicate using a standard HID type USB class. Compatible with simulation and USB enabled microcontroller devices PIC/dsPIC/AVR. Note that AVR is currently in Beta and may have problems with custom descriptors.

Component Pack

COMMSC

Detailed description

No detailed description exists yet for this component

Examples

Here are some examples to get you started with USB HID communications using Flowcode.

HID Mouse

Reads a EB014 keypad and depending on the key pressed sends the appropriate movement and button clicks to control the mouse.

The speed is set by the speed variable which can range from 1 to 127.

FC6 Icon.png Mouse Keypad Example

Key breakdown: 1 = UpLeft, 2=Up, 3=UpRight, 4=Left, 6=Right, 7=DownLeft, 8=Down, 9=DownRight, *=Left Click, #=Right Click.


Reads two encoders and moves the mouse cursor based on their movement since the last operation.

A switch on pin B0 can be used to toggle the left mouse click on and off and pin B1 can be connected to an LED to show the status of the left mouse button.

The EB073 encoders board connected to PortB will allow all of this functionality.


FC6 Icon.png Mouse Encoder Example


HID Keyboard

Converts a ASCII character into a keypress that will be sent to the USB host device.

A demo string is provided which is then broken down into characters and sent to the USB host.

FC6 Icon.png Keyboard Example


Here is a file showing the standard HID keyboard scan codes to help make sense of the example.

File:HID Keyboard Scan Codes.xls


With the example running if you create a text file and highlight the text file then the USB device will populate the file with data.


E.g.

HelloFromYourUSBKeyboardDevice12345

HelloFromYourUSBKeyboardDevice12345

HelloFromYourUSBKeyboardDevice12345


Currently only compatible with the following characters: 0123456789!"£$%^&*()/\*-+ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\n\t


A complete list of keyboard scan codes can be found here under section 7 - Keyboards.

http://www.freebsddiary.org/APC/usb_hid_usages.php


HID Descriptor Tool

This tool allows you to create your own descriptors which can then be inserted into the HID descriptor property with the custom descriptor type selected.

File:HID Descriptor Tool.zip

Downloadable macro reference

Fc9-comp-macro.png ReceiveByte
Receives a byte from the USB. 
Fc9-u8-icon.png - BYTE Idx
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png SetSerialNumber
Allows the device serial number to be edited. 
Fc9-string-icon.png - STRING SerialNumber
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png SendData
Sends the contents of the transmit buffer to the USB. 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png CheckRx
Checks for any incoming data. Returns the number of data bytes received since the last check. 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png UpdateData
Allows a byte of the transmit buffer to be assigned. 
Fc9-u8-icon.png - BYTE idx
 
Fc9-u8-icon.png - BYTE value
 
Fc9-void-icon.png - VOID Return


Fc9-comp-macro.png ReceiveString
Receives a string of bytes from the USB 
Fc9-u8-icon.png - BYTE NumBytes
 
Fc9-string-icon.png - STRING Return


Fc9-comp-macro.png SendDataDirect
Sends data directly to the USB 
Fc9-string-icon.png - STRING Data
 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png Initialise
Starts up the USB connection and waits for the device driver to be correctly installed on the PC.  
Fc9-u8-icon.png - BYTE Return



Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png USB Properties
Fc9-type-21-icon.png Vendor ID
USB vendor identifier tied to the manufacturer of the USB device 
Fc9-type-21-icon.png Product ID
USB product identifier 
Fc9-type-10-icon.png Device Name
Name used to identify the device 
Fc9-type-10-icon.png Manufacturer
Manufacturer of the device 
Fc9-type-14-icon.png Major Version
Firmware major version 
Fc9-type-14-icon.png Minor Version
Device firmware minor version  
Fc9-type-7-icon.png Enumeration Timeout
Specifies if the initialise routine is allowed to timeout instead of waiting forever for success 
Fc9-type-14-icon.png Maximum Current (mA)
Maximum current the host should source to the device - max 500mA 
Fc9-type-16-icon.png Country Code
Specific country code - if required 
Fc9-type-16-icon.png Descriptor Select
Built in descriptor selection  
Fc9-type-11-icon.png HID Descriptor
Contents of the HID descriptor 
Fc9-type-16-icon.png Subclass
USB Subclass - Normally only mice and keyboards are boot devices 
Fc9-type-16-icon.png Interface
Standard HID interface type 
Fc9-type-14-icon.png Transmit Packet Size
Number of bytes to send to the PC  
Fc9-type-14-icon.png Transmit Period (ms)
Delay between transmit packets 
Fc9-type-14-icon.png Receive Packet Size
Number of bytes to receive from the PC 
Fc9-type-14-icon.png Receive Period (ms)
Delay between receive packets 
Fc9-conn-icon.png Simulation
Fc9-type-10-icon.png Label
Simulation label used to indicate the USB HID component on the panel.