Difference between revisions of "Component: USB Slave (Comms: USB)"
From Flowcode Help
Jump to navigationJump to search (Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | Matrix Ltd. |- | width="20%" style="color:gray;" | Version | 1.3 |- | width="20%" style="color:gra...") |
|||
| (8 intermediate revisions by the same user not shown) | |||
| Line 17: | Line 17: | ||
==Component Source Code== | ==Component Source Code== | ||
| − | Please click here | + | Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_USBSlave.fcfx FC_Comp_Source_USBSlave.fcfx] |
| + | |||
| + | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_USBSlave.fcfx FC_Comp_Source_USBSlave.fcfx] | ||
==Detailed description== | ==Detailed description== | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
''No detailed description exists yet for this component'' | ''No detailed description exists yet for this component'' | ||
==Examples== | ==Examples== | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
''<span style="color:red;">No additional examples</span>'' | ''<span style="color:red;">No additional examples</span>'' | ||
| − | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ==Macro reference== | ||
| + | |||
| + | ===CheckRx=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckRx''' |
| + | |- | ||
| + | | colspan="2" | Called to check if there is any incoming data waiting to be received. Returns the number of incoming data bytes. Only needed when not running the slave service. | ||
| + | |- | ||
|- | |- | ||
| − | | | + | | 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'' | ||
| + | |} | ||
| + | |||
| + | |||
| + | ===GetByte=== | ||
| + | {| 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;" | '''GetByte''' | ||
|- | |- | ||
| − | | | + | | colspan="2" | Retreives the byte at location Idx from the incoming data buffer. |
| − | |||
|- | |- | ||
| − | |||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| − | | width="90%" | | + | | width="90%" | Idx |
|- | |- | ||
| − | | colspan="2" | | + | | colspan="2" | Specifies the location in the incoming buffer |
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| Line 52: | Line 94: | ||
| + | ===GetString=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| Line 70: | Line 113: | ||
| + | ===Initialise=== | ||
| + | {| 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 communications and attempts to enumerate. Returns 0 for a successful startup or 255 for a enumeration timeout. | ||
| + | |- | ||
| + | |- | ||
| + | | 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'' | ||
| + | |} | ||
| + | |||
| + | |||
| + | ===RunSlaveService=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| Line 83: | Line 141: | ||
| + | ===SendByte=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| Line 101: | Line 160: | ||
| + | ===SendByteArray=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| Line 124: | Line 184: | ||
| + | ===SendString=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
| − | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | ''' | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendString''' |
|- | |- | ||
| − | | colspan="2" | | + | | colspan="2" | Adds a string of bytes onto the end of the outgoing data buffer. |
|- | |- | ||
|- | |- | ||
| − | | width="10%" align="center | + | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING |
| − | | width="90%" | + | | width="90%" | Data |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|- | |- | ||
| + | | colspan="2" | Data String To Send | ||
|- | |- | ||
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| − | | width="90%" | | + | | width="90%" | Length |
|- | |- | ||
| − | | colspan="2" | | + | | colspan="2" | Max number of bytes to try and add to the outgoing buffer. |
|- | |- | ||
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
| Line 155: | Line 208: | ||
| + | ===StopSlaveService=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
| Line 166: | Line 220: | ||
| width="90%" style="border-top: 2px solid #000;" | ''Return'' | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
|} | |} | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Latest revision as of 13:13, 7 February 2023
| Author | Matrix Ltd. |
| Version | 1.3 |
| Category | Comms: USB |
Contents
USB Slave component
Component to create and communicate using a generic USB communications profile. Has the ability to allow the device to be a slave to the PC. Compatible with simulation and USB enabled microcontroller devices (PIC/dsPIC).
Component Source Code
Please click here to download the component source project: FC_Comp_Source_USBSlave.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_USBSlave.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
CheckRx
| CheckRx | |
| Called to check if there is any incoming data waiting to be received. Returns the number of incoming data bytes. Only needed when not running the slave service. | |
| Return | |
GetByte
| GetByte | |
| Retreives the byte at location Idx from the incoming data buffer. | |
| Idx | |
| Specifies the location in the incoming buffer | |
| Return | |
GetString
Initialise
| Initialise | |
| Starts up the USB communications and attempts to enumerate. Returns 0 for a successful startup or 255 for a enumeration timeout. | |
| Return | |
RunSlaveService
SendByte
| SendByte | |
| Adds the byte onto the end of the outgoing data buffer. | |
| Data | |
| Data byte to transmit to the host | |
| Return | |
SendByteArray
SendString
| SendString | |
| Adds a string of bytes onto the end of the outgoing data buffer. | |
| Data | |
| Data String To Send | |
| Length | |
| Max number of bytes to try and add to the outgoing buffer. | |
| Return | |
StopSlaveService