mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-25 10:43:44 +00:00
more clean up
This commit is contained in:
parent
ffdd925854
commit
584b6f716d
@ -94,12 +94,12 @@ void virtual_com_task(void)
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// tinyusb callbacks
|
// tinyusb callbacks
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void tud_mount_cb(uint8_t port)
|
void tud_mount_cb(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tud_umount_cb(uint8_t port)
|
void tud_umount_cb(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,12 +95,12 @@ void virtual_com_task(void)
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// tinyusb callbacks
|
// tinyusb callbacks
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void tud_mount_cb(uint8_t rhport)
|
void tud_mount_cb(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tud_umount_cb(uint8_t rhport)
|
void tud_umount_cb(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,15 +111,17 @@ int main(void)
|
|||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// tinyusb callbacks
|
// tinyusb callbacks
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
void tud_mount_cb(uint8_t rhport)
|
void tud_mount_cb(void)
|
||||||
{
|
{
|
||||||
|
uint8_t rhport = 0; // TODO remove
|
||||||
cdc_serial_app_mount(rhport);
|
cdc_serial_app_mount(rhport);
|
||||||
keyboard_app_mount(rhport);
|
keyboard_app_mount(rhport);
|
||||||
msc_app_mount(rhport);
|
msc_app_mount(rhport);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tud_umount_cb(uint8_t rhport)
|
void tud_umount_cb(void)
|
||||||
{
|
{
|
||||||
|
uint8_t rhport = 0; // TODO remove
|
||||||
cdc_serial_app_umount(rhport);
|
cdc_serial_app_umount(rhport);
|
||||||
keyboard_app_umount(rhport);
|
keyboard_app_umount(rhport);
|
||||||
msc_app_umount(rhport);
|
msc_app_umount(rhport);
|
||||||
|
@ -323,7 +323,7 @@ static tusb_error_t proc_control_request_st(uint8_t rhport, tusb_control_request
|
|||||||
{
|
{
|
||||||
TU_ASSERT( len <= CFG_TUD_CTRL_BUFSIZE, TUSB_ERROR_NOT_ENOUGH_MEMORY);
|
TU_ASSERT( len <= CFG_TUD_CTRL_BUFSIZE, TUSB_ERROR_NOT_ENOUGH_MEMORY);
|
||||||
memcpy(_usbd_ctrl_buf, buffer, len);
|
memcpy(_usbd_ctrl_buf, buffer, len);
|
||||||
usbd_control_xfer_st(rhport, p_request->bmRequestType_bit.direction, (uint8_t*) _usbd_ctrl_buf, len );
|
usbd_control_xfer_st(rhport, p_request->bmRequestType_bit.direction, _usbd_ctrl_buf, len );
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
dcd_control_stall(rhport); // stall unsupported descriptor
|
dcd_control_stall(rhport); // stall unsupported descriptor
|
||||||
@ -332,7 +332,7 @@ static tusb_error_t proc_control_request_st(uint8_t rhport, tusb_control_request
|
|||||||
else if (TUSB_REQ_GET_CONFIGURATION == p_request->bRequest )
|
else if (TUSB_REQ_GET_CONFIGURATION == p_request->bRequest )
|
||||||
{
|
{
|
||||||
memcpy(_usbd_ctrl_buf, &_usbd_dev.config_num, 1);
|
memcpy(_usbd_ctrl_buf, &_usbd_dev.config_num, 1);
|
||||||
usbd_control_xfer_st(rhport, p_request->bmRequestType_bit.direction, (uint8_t*) _usbd_ctrl_buf, 1);
|
usbd_control_xfer_st(rhport, p_request->bmRequestType_bit.direction, _usbd_ctrl_buf, 1);
|
||||||
}
|
}
|
||||||
else if ( TUSB_REQ_SET_ADDRESS == p_request->bRequest )
|
else if ( TUSB_REQ_SET_ADDRESS == p_request->bRequest )
|
||||||
{
|
{
|
||||||
@ -452,7 +452,7 @@ static tusb_error_t proc_set_config_req(uint8_t rhport, uint8_t config_number)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// invoke callback
|
// invoke callback
|
||||||
tud_mount_cb(rhport);
|
tud_mount_cb();
|
||||||
|
|
||||||
return TUSB_ERROR_NONE;
|
return TUSB_ERROR_NONE;
|
||||||
}
|
}
|
||||||
@ -551,7 +551,7 @@ void dcd_bus_event(uint8_t rhport, usbd_bus_event_type_t bus_event)
|
|||||||
|
|
||||||
case USBD_BUS_EVENT_UNPLUGGED:
|
case USBD_BUS_EVENT_UNPLUGGED:
|
||||||
varclr_(&_usbd_dev);
|
varclr_(&_usbd_dev);
|
||||||
tud_umount_cb(rhport); // invoke callback
|
tud_umount_cb(); // invoke callback
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case USBD_BUS_EVENT_SUSPENDED:
|
case USBD_BUS_EVENT_SUSPENDED:
|
||||||
@ -632,8 +632,8 @@ void usbd_defer_func(osal_task_func_t func, void* param, bool isr )
|
|||||||
{
|
{
|
||||||
usbd_task_event_t event =
|
usbd_task_event_t event =
|
||||||
{
|
{
|
||||||
.rhport = 0,
|
.rhport = 0,
|
||||||
.event_id = USBD_EVT_FUNC_CALL,
|
.event_id = USBD_EVT_FUNC_CALL,
|
||||||
};
|
};
|
||||||
|
|
||||||
event.func_call.func = func;
|
event.func_call.func = func;
|
||||||
|
@ -78,18 +78,16 @@ bool tud_mounted(void);
|
|||||||
// APPLICATION CALLBACK
|
// APPLICATION CALLBACK
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
/** \brief Callback function that will be invoked device is mounted (configured) by USB host
|
/** \brief Callback function that will be invoked device is mounted (configured) by USB host
|
||||||
* \param[in] rhport USB Controller ID of the interface
|
|
||||||
* \note This callback should be used by Application to \b set-up application data
|
* \note This callback should be used by Application to \b set-up application data
|
||||||
*/
|
*/
|
||||||
void tud_mount_cb(uint8_t rhport);
|
void tud_mount_cb(void);
|
||||||
|
|
||||||
/** \brief Callback function that will be invoked when device is unmounted (bus reset/unplugged)
|
/** \brief Callback function that will be invoked when device is unmounted (bus reset/unplugged)
|
||||||
* \param[in] rhport USB Controller ID of the interface
|
|
||||||
* \note This callback should be used by Application to \b tear-down application data
|
* \note This callback should be used by Application to \b tear-down application data
|
||||||
*/
|
*/
|
||||||
void tud_umount_cb(uint8_t rhport);
|
void tud_umount_cb(void);
|
||||||
|
|
||||||
//void tud_device_suspended_cb(uint8_t rhport);
|
//void tud_device_suspended_cb(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user