USB Component
Version 6.17.0
MDK Middleware for USB Device and Host Communication
|
User API reference of the Communication Device Class (Abstract Control Model). More...
Functions | |
void | USBH_CDC_ACM_Initialize (uint8_t instance) |
Callback function called when Communication Device Class device was enumerated and is ready. More... | |
void | USBH_CDC_ACM_Uninitialize (uint8_t instance) |
Callback function called when Communication Device Class device was disconnected. More... | |
uint8_t | USBH_CDC_ACM_GetDevice (uint8_t instance) |
Get Device instance of Communication Device Class device. More... | |
usbStatus | USBH_CDC_ACM_GetStatus (uint8_t instance) |
Get status of Communication Device Class device. More... | |
usbStatus | USBH_CDC_ACM_Send (uint8_t instance, const uint8_t *data, uint32_t num) |
Send data to Communication Device Class device. More... | |
uint32_t | USBH_CDC_ACM_GetTxCount (uint8_t instance) |
Get result of send data to Communication Device Class device. More... | |
usbStatus | USBH_CDC_ACM_AbortSend (uint8_t instance) |
Abort data sending to Communication Device Class device. More... | |
usbStatus | USBH_CDC_ACM_Receive (uint8_t instance, uint8_t *data, uint32_t num) |
Receive data from Communication Device Class device. More... | |
uint32_t | USBH_CDC_ACM_GetRxCount (uint8_t instance) |
Get result of receive data from Communication Device Class device. More... | |
usbStatus | USBH_CDC_ACM_AbortReceive (uint8_t instance) |
Abort data reception from Communication Device Class device. More... | |
usbStatus | USBH_CDC_ACM_SetLineCoding (uint8_t instance, const CDC_LINE_CODING *line_coding) |
Change communication settings of Communication Device Class device. More... | |
usbStatus | USBH_CDC_ACM_GetLineCoding (uint8_t instance, CDC_LINE_CODING *line_coding) |
Retrieve communication settings of Communication Device Class device. More... | |
usbStatus | USBH_CDC_ACM_SetControlLineState (uint8_t instance, uint16_t state) |
Set control line states of Communication Device Class device. More... | |
void | USBH_CDC_ACM_Notify (uint8_t instance, uint16_t status) |
Callback function called when Communication Device Class device modem line or error status changes. More... | |
usbStatus | USBH_CDC_ACM_SendBreak (uint8_t instance, uint16_t duration) |
Send break on Communication Device Class device. More... | |
User API reference of the Communication Device Class (Abstract Control Model).
void USBH_CDC_ACM_Initialize | ( | uint8_t | instance | ) |
Callback function called when Communication Device Class device was enumerated and is ready.
[in] | instance | instance of CDC Device. |
The function USBH_CDC_ACM_Initialize is called when a CDC device was connected and successfully enumerated and is ready for communication.
The argument instance specifies the CDC device instance.
void USBH_CDC_ACM_Uninitialize | ( | uint8_t | instance | ) |
Callback function called when Communication Device Class device was disconnected.
[in] | instance | instance of CDC Device. |
The function USBH_CDC_ACM_Unitialize is called when a CDC device was disconnected form the USB Bus.
The argument instance specifies the CDC device instance.
uint8_t USBH_CDC_ACM_GetDevice | ( | uint8_t | instance | ) |
Get Device instance of Communication Device Class device.
[in] | instance | instance of CDC Device. |
The function USBH_CDC_ACM_GetDevice is used to retrieve device instance that is used to handle CDC device instance.
The argument instance specifies the CDC device instance.
usbStatus USBH_CDC_ACM_GetStatus | ( | uint8_t | instance | ) |
Get status of Communication Device Class device.
[in] | instance | instance of CDC Device. |
The function USBH_CDC_ACM_GetStatus returns the status of a CDC device attached to the USB Host.
The argument instance specifies the instance of the CDC device to be queried.
Code Example
usbStatus USBH_CDC_ACM_Send | ( | uint8_t | instance, |
const uint8_t * | data, | ||
uint32_t | num | ||
) |
Send data to Communication Device Class device.
[in] | instance | index of CDC instance. |
[in] | data | buffer containing data bytes to send. |
[in] | num | number of bytes to send. |
The function USBH_CDC_ACM_Send transmits data to an attached CDC device.
The argument instance specifies the instance of the targeted CDC device.
The argument data is a pointer to the buffer containing the data that is to be sent. It is recommended that buffer is 4-byte aligned as some drivers might not support 1-byte alignment if DMA is used.
The argument num specifies the number of bytes to be sent.
Code Example
uint32_t USBH_CDC_ACM_GetTxCount | ( | uint8_t | instance | ) |
Get result of send data to Communication Device Class device.
[in] | instance | index of CDC instance. |
The function USBH_CDC_ACM_GetTxCount returns the number of data bytes sent to an attached CDC device.
The argument instance specifies the instance of the targeted CDC device.
Code Example
usbStatus USBH_CDC_ACM_AbortSend | ( | uint8_t | instance | ) |
Abort data sending to Communication Device Class device.
[in] | instance | index of CDC instance. |
The function USBH_CDC_ACM_AbortSend aborts the data sending to an attached CDC device.
The argument instance specifies the instance of the targeted CDC device.
usbStatus USBH_CDC_ACM_Receive | ( | uint8_t | instance, |
uint8_t * | data, | ||
uint32_t | num | ||
) |
Receive data from Communication Device Class device.
[in] | instance | index of CDC instance |
[out] | data | buffer that receives data. |
[in] | num | maximum number of bytes to receive. |
The function USBH_CDC_ACM_Receive receives data from an attached CDC device.
The argument instance specifies the instance of the CDC device that is sending the data.
The argument data is a pointer to the buffer storing the incoming data. It is recommended that buffer is 4-byte aligned as some drivers might not support 1-byte alignment if DMA is used.
The argument num specifies the maximum number of data bytes to be received (must be multiple of CDC device Bulk In endpoint maximum packet size).
Code Example
uint32_t USBH_CDC_ACM_GetRxCount | ( | uint8_t | instance | ) |
Get result of receive data from Communication Device Class device.
[in] | instance | index of CDC instance. |
The function USBH_CDC_ACM_GetRxCount returns the number of received data bytes from an attached CDC device.
The argument instance specifies the instance of the sending CDC device.
Code Example
usbStatus USBH_CDC_ACM_AbortReceive | ( | uint8_t | instance | ) |
Abort data reception from Communication Device Class device.
[in] | instance | index of CDC instance. |
The function USBH_CDC_ACM_AbortReceive aborts the data reception from an attached CDC device.
The argument instance specifies the instance of the CDC device that is sending the data.
usbStatus USBH_CDC_ACM_SetLineCoding | ( | uint8_t | instance, |
const CDC_LINE_CODING * | line_coding | ||
) |
Change communication settings of Communication Device Class device.
[in] | instance | index of CDC instance. |
[in] | line_coding | pointer to CDC_LINE_CODING structure. |
The function USBH_CDC_ACM_SetLineCoding changes the communication parameters of the attached CDC device.
The argument instance specifies the instance of the targeted CDC device.
The argument line_coding is a pointer to the CDC_LINE_CODING structure containing the communication parameters that are to be used.
Code Example
usbStatus USBH_CDC_ACM_GetLineCoding | ( | uint8_t | instance, |
CDC_LINE_CODING * | line_coding | ||
) |
Retrieve communication settings of Communication Device Class device.
[in] | instance | index of CDC instance. |
[out] | line_coding | pointer to CDC_LINE_CODING structure. |
The function USBH_CDC_ACM_GetLineCoding retrieves the communication parameters of the attached CDC device.
The argument instance specifies the instance of the targeted CDC device.
The argument line_coding is a pointer to the CDC_LINE_CODING to store the communication parameters.
usbStatus USBH_CDC_ACM_SetControlLineState | ( | uint8_t | instance, |
uint16_t | state | ||
) |
Set control line states of Communication Device Class device.
[in] | instance | index of CDC instance. |
[in] | state | control line settings bitmap :
|
The function USBH_CDC_ACM_SetControlLineState sets the states of the control lines of the attached CDC device.
The argument instance specifies the instance of the targeted CDC device.
The argument state sets the control line parameters.
Code Example
void USBH_CDC_ACM_Notify | ( | uint8_t | instance, |
uint16_t | status | ||
) |
Callback function called when Communication Device Class device modem line or error status changes.
[in] | instance | index of CDC instance. |
[in] | status | error status and line states :
|
The callback function USBH_CDC_ACM_Notify is called when an attached CDC device signals modem line or error status changes.
The argument instance specifies the instance of the calling CDC device.
The argument status shows the modem line or error status.
Code Example
usbStatus USBH_CDC_ACM_SendBreak | ( | uint8_t | instance, |
uint16_t | duration | ||
) |
Send break on Communication Device Class device.
[in] | instance | index of CDC instance. |
[in] | duration | duration of break (in milliseconds) :
|
The USBH_CDC_ACM_SendBreak function sends a break to the attached CDC device.
The argument instance specifies the instance of the targeted CDC device.
The argument duration specifies the duration of the break in milliseconds.
Code Example