![]() |
![]() |
USBLib API Guide
1.00.00.01
|
Macros | |
#define | USBHCDC_DATA_SIZE 64 |
#define | USBHCDC_DEVICE_PRESENT 0x00000001 |
Typedefs | |
typedef struct tUSBHCDCSerial | tUSBHCDCSerial |
typedef void(* | tUSBHCDCSerialCallback) (tUSBHCDCSerial *psCdcSerialInstance, uint32_t ui32Event, uint32_t ui32MsgParam, void *pvMsgData) |
Functions | |
tUSBHCDCSerial * | USBHCDCSerialOpen (tUSBHCDCSerialCallback pfnCallback) |
uint32_t | USBHCDCSerialClose (tUSBHCDCSerial *psCdcSerialInstance) |
uint32_t | USBHCDCSerialInit (tUSBHCDCSerial *psCdcInstance) |
uint32_t | USBHCDCGetDataFromDevice (tUSBHCDCSerial *psCdcSerialInstance, uint32_t ui32Interface) |
uint32_t | USBHCDCSendDataToDevice (tUSBHCDCSerial *psCdcSerialInstance, uint32_t ui32Interface, uint8_t *ui8SendBuffer, uint8_t byteSize) |
uint32_t | USBHCDCProcessData (tUSBHCDCSerial *psCdcSerialInstance, uint8_t ui8ArrayIndex) |
Variables | |
uint32_t | tUSBHCDCSerial::ui32CDCFlags |
tUSBHCDCSerialCallback | tUSBHCDCSerial::pfnCallback |
tCDCInstance * | tUSBHCDCSerial::psCDCInstance |
uint8_t | tUSBHCDCSerial::pui8Buffer [64] |
uint8_t | tUSBHCDCSerial::pui8OutBuffer [64] |
#define USBHCDC_DATA_SIZE 64 |
Referenced by USBHCDCGetDataFromDevice().
#define USBHCDC_DEVICE_PRESENT 0x00000001 |
typedef struct tUSBHCDCSerial tUSBHCDCSerial |
typedef void(* tUSBHCDCSerialCallback) (tUSBHCDCSerial *psCdcSerialInstance, uint32_t ui32Event, uint32_t ui32MsgParam, void *pvMsgData) |
tUSBHCDCSerial * USBHCDCSerialOpen | ( | tUSBHCDCSerialCallback | pfnCallback | ) |
This function is used open an instance of a CDC device.
pfnCallback | is the callback function to call when new events occur with the CDC device returned. |
pui8Buffer | is the memory used by the device to interact with the USB CDC device |
ui32Size | is the size of the buffer provided by pui8Buffer. |
This function is used to open an instance of the CDC device. The value returned from this function should be used as the instance identifier for all other USBHCDCSerial calls. The pui8Buffer memory buffer is used to access the device. The buffer size required is at least enough to hold a normal report descriptor for the device. If there is not enough space only a partial report descriptor will be read out.
References eUSBHCDCClassDirectLineControl, and USBHCDCOpen().
uint32_t USBHCDCSerialClose | ( | tUSBHCDCSerial * | psCdcSerialInstance | ) |
This function is used close an instance of a CDC device.
psCdcInstance | is the instance value for this device. |
This function is used to close an instance of the device that was opened with a call to USBHCDCSerialOpen(). The psCdcSerialInstance value is the value that was returned when the application called USBHCDCSerialOpen().
References USBHCDCClose().
uint32_t USBHCDCSerialInit | ( | tUSBHCDCSerial * | psCdcInstance | ) |
This function is used to initialize a CDC interface after a CDC device is detected.
psCdcInstance | is the instance value for this device. |
This function should be called after receiving a STATE_CDC_DEVICE_INIT event in the callback function provided by USBHCDCOpen(), however this function should only be called outside the callback function. This will initialize the CDC interface. The psCdcInstance value is the value that was returned when the application called USBHCDCOpen(). This function only needs to be called once per connection event but it should be called every time a STATE_CDC_DEVICE_INIT event occurs.
References CDC_DEACTIVATE_CARRIER, USB_GET_LINE_CODING_SIZE, USBHCDCGetLineCoding(), USBHCDCSetControlLineState(), and USBHCDCSetLineCoding().
uint32_t USBHCDCGetDataFromDevice | ( | tUSBHCDCSerial * | psCdcSerialInstance, |
uint32_t | ui32Interface | ||
) |
This function calls the api that gets the data at the CDC bulk endpoint sent by the CDC device.
psCdcSerialInstance | is the instance value for this device. |
ui32Interface | is the bulk endpoint interface |
This function is called after receiving a USB_EVENT_CONNECTED event in the callback function provided by USBHCDCOpen().
References USBH_EVENT_RX_CDC_DATA, USBHCDC_DATA_SIZE, and USBHCDCReadData().
uint32_t USBHCDCSendDataToDevice | ( | tUSBHCDCSerial * | psCdcSerialInstance, |
uint32_t | ui32Interface, | ||
uint8_t * | ui8SendBuffer, | ||
uint8_t | byteSize | ||
) |
This function calls the api that sends the bulk data to the CDC device
psCdcSerialInstance | is the instance value for this device. |
ui32Interface | is the bulk endpoint interface |
*ui8SendBuffer | is pointer of array |
byteSize | is number of data bytes to be sent to device |
This function is called after receiving a USB_EVENT_CONNECTED event in the callback function provided by USBHCDCOpen(). And it is called after receiving 74 bytes of data from the device
References USBH_EVENT_TX_CDC_DATA, and USBHCDCWriteData().
uint32_t USBHCDCProcessData | ( | tUSBHCDCSerial * | psCdcSerialInstance, |
uint8_t | ui8ArrayIndex | ||
) |
This function processes the data contained in the USB buffer.
psCdcInstance | is the instance value for this device. |
ui8ArrayIndex | index into the buffer array |
This function is called after receiving a USB_EVENT_CONNECTED event in the callback function provided by USBHCDCOpen().
uint32_t tUSBHCDCSerial::ui32CDCFlags |
tUSBHCDCSerialCallback tUSBHCDCSerial::pfnCallback |
tCDCInstance* tUSBHCDCSerial::psCDCInstance |
uint8_t tUSBHCDCSerial::pui8Buffer[64] |
uint8_t tUSBHCDCSerial::pui8OutBuffer[64] |