tinyusb  0.4
Click here to lend your support to tinyusb donation and make a donation at pledgie.com
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Device

Functions

bool tusbd_cdc_is_busy (uint8_t coreid, cdc_pipeid_t pipeid) ATTR_PURE ATTR_WARN_UNUSED_RESULT
 Check if the interface is currently busy or not. More...
 
tusb_error_t tusbd_cdc_send (uint8_t coreid, void *p_data, uint32_t length, bool is_notify)
 Submit USB transfer. More...
 
tusb_error_t tusbd_cdc_receive (uint8_t coreid, void *p_buffer, uint32_t length, bool is_notify)
 Submit USB transfer. More...
 
void tusbd_cdc_mounted_cb (uint8_t coreid)
 Callback function that will be invoked when this interface is mounted (configured) by USB host. More...
 
void tusbd_cdc_unmounted_cb (uint8_t coreid)
 Callback function that will be invoked when this interface is unmounted (bus reset/unplugged) More...
 
void tusbd_cdc_xfer_cb (uint8_t coreid, tusb_event_t event, cdc_pipeid_t pipe_id, uint32_t xferred_bytes)
 Callback function that is invoked when an completion (error or success) of an USB transfer previously submitted by application (e.g tusbd_cdc_send or tusbd_cdc_send) with is_notify set to true. More...
 

Detailed Description

Function Documentation

bool tusbd_cdc_is_busy ( uint8_t  coreid,
cdc_pipeid_t  pipeid 
)

Check if the interface is currently busy or not.

Parameters
[in]coreidUSB Controller ID
Return values
trueif the interface is busy meaning the stack is still transferring/waiting data from/to host
falseif the interface is not busy meaning the stack successfully transferred data from/to host
Note
This function is primarily used for polling/waiting result after tusbd_hid_keyboard_send.
void tusbd_cdc_mounted_cb ( uint8_t  coreid)

Callback function that will be invoked when this interface is mounted (configured) by USB host.

Parameters
[in]coreidUSB Controller ID of the interface
Note
This callback should be used by Application to set-up interface-related data
tusb_error_t tusbd_cdc_receive ( uint8_t  coreid,
void *  p_buffer,
uint32_t  length,
bool  is_notify 
)

Submit USB transfer.

Parameters
[in]coreidUSB Controller ID
[in]p_bufferapplication's buffer to receive data. Must be accessible by USB controller (see TUSB_CFG_ATTR_USBRAM)
[in]lengthnumber of bytes in p_buffer.
[in]is_notifyindicates whether the hardware completion (data transferred through USB bus) will be notified to Application (via tusbd_cdc_xfer_cb)
Returns
tusb_error_t type to indicate success or error condition.
Return values
TUSB_ERROR_NONEon success
TUSB_ERROR_INTERFACE_IS_BUSYif the interface is busy transferring previous data.
TUSB_ERROR_DEVICE_NOT_READYif device is not yet configured (by SET CONFIGURED request)
TUSB_ERROR_INVALID_PARAif input parameters are not correct
Note
This function is non-blocking and returns immediately. Data will be transferred when USB Host work with this interface. The result of usb transfer will be reported by the interface's callback function if is_notify is true
tusb_error_t tusbd_cdc_send ( uint8_t  coreid,
void *  p_data,
uint32_t  length,
bool  is_notify 
)

Submit USB transfer.

Parameters
[in]coreidUSB Controller ID
[in]p_databuffer containing data from application. Must be accessible by USB controller (see TUSB_CFG_ATTR_USBRAM)
[in]lengthnumber of bytes in p_data.
[in]is_notifyindicates whether the hardware completion (data transferred through USB bus) will be notified to Application (via tusbd_cdc_xfer_cb)
Returns
tusb_error_t type to indicate success or error condition.
Return values
TUSB_ERROR_NONEon success
TUSB_ERROR_INTERFACE_IS_BUSYif the interface is busy transferring previous data.
TUSB_ERROR_DEVICE_NOT_READYif device is not yet configured (by SET CONFIGURED request)
TUSB_ERROR_INVALID_PARAif input parameters are not correct
Note
This function is non-blocking and returns immediately. Data will be transferred when USB Host work with this interface. The result of usb transfer will be reported by the interface's callback function if is_notify is true
void tusbd_cdc_unmounted_cb ( uint8_t  coreid)

Callback function that will be invoked when this interface is unmounted (bus reset/unplugged)

Parameters
[in]coreidUSB Controller ID of the interface
Note
This callback should be used by Application to tear-down interface-related data
void tusbd_cdc_xfer_cb ( uint8_t  coreid,
tusb_event_t  event,
cdc_pipeid_t  pipe_id,
uint32_t  xferred_bytes 
)

Callback function that is invoked when an completion (error or success) of an USB transfer previously submitted by application (e.g tusbd_cdc_send or tusbd_cdc_send) with is_notify set to true.

Parameters
[in]coreidUSB Controller ID
[in]eventan value from tusb_event_t
[in]pipe_idindicates which pipe of this interface the event occured.
[in]xferred_bytesis actual number of bytes transferred via USB bus. This value in general can be different to the one that previously submitted by application.