OLE Developer Guide  Latest Git
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
USB Transport

Detailed Description

A USB Transport.

A implementation of the generic transport that uses USB. The PIC acts as an custom USB device.

Files

file  usb_transport.h
 A USB Transport.
 

Functions

void USBTransport_Initialize (TransportRxFunction rx_cb)
 Initialize the USB Transport. More...
 
void USBTransport_Tasks ()
 Perform the periodic USB layer tasks. More...
 
bool USBTransport_SendResponse (uint8_t token, Command command, uint8_t rc, const IOVec *data, unsigned int iov_count)
 Send a response to the Host. More...
 
bool USBTransport_WritePending ()
 Check if there is a write in progress.
 
USB_DEVICE_HANDLE USBTransport_GetHandle ()
 Return the USB Device handle. More...
 
bool USBTransport_IsConfigured ()
 Check if the USB driver is configured. More...
 
void USBTransport_SoftReset ()
 Perform a soft reset. This aborts any outbound (write) transfers.
 

Function Documentation

USB_DEVICE_HANDLE USBTransport_GetHandle ( )

Return the USB Device handle.

Returns
The device handle or USB_DEVICE_HANDLE_INVALID.
void USBTransport_Initialize ( TransportRxFunction  rx_cb)

Initialize the USB Transport.

Parameters
rx_cbThe function to call when data is received from the host. This can be overridden, see below.

If PIPELINE_TRANSPORT_RX is defined in app_pipeline.h, the macro will override the rx_cb argument.

bool USBTransport_IsConfigured ( )

Check if the USB driver is configured.

Returns
true if the device if configured, false otherwise.
bool USBTransport_SendResponse ( uint8_t  token,
Command  command,
uint8_t  rc,
const IOVec data,
unsigned int  iov_count 
)

Send a response to the Host.

Parameters
tokenThe frame token, this should match the request.
commandThe command class of the response.
rcThe return code of the response.
dataThe iovecs with the payload data.
iov_countThe number of IOVecs.
Returns
true if the message was queued for sending. False if the device was not yet configured, or is there was already a message queued.

Only one message can be sent at a time. Until the send completes, any further messages will be dropped.

void USBTransport_Tasks ( )

Perform the periodic USB layer tasks.

This must be called within the main event loop.