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. | |
USB_DEVICE_HANDLE USBTransport_GetHandle | ( | ) |
Return the USB Device handle.
void USBTransport_Initialize | ( | TransportRxFunction | rx_cb | ) |
Initialize the USB Transport.
rx_cb | The 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.
bool USBTransport_SendResponse | ( | uint8_t | token, |
Command | command, | ||
uint8_t | rc, | ||
const IOVec * | data, | ||
unsigned int | iov_count | ||
) |
Send a response to the Host.
token | The frame token, this should match the request. |
command | The command class of the response. |
rc | The return code of the response. |
data | The iovecs with the payload data. |
iov_count | The number of IOVecs. |
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.