reworking device hid class driver

This commit is contained in:
hathach
2018-07-23 15:25:45 +07:00
parent 141ac25e3b
commit 4342325ee1
31 changed files with 583 additions and 501 deletions

View File

@@ -38,7 +38,7 @@
#include "tusb_option.h"
#if (MODE_DEVICE_SUPPORTED && CFG_TUD_CDC)
#if (TUSB_OPT_DEVICE_ENABLED && CFG_TUD_CDC)
#define _TINY_USB_SOURCE_FILE_
//--------------------------------------------------------------------+
@@ -157,13 +157,13 @@ uint32_t tud_cdc_n_write(uint8_t itf, void const* buffer, uint32_t bufsize)
bool tud_cdc_n_write_flush (uint8_t itf)
{
cdcd_interface_t* p_cdc = &_cdcd_itf[itf];
VERIFY( !dcd_edpt_busy(TUD_RHPORT, p_cdc->ep_in) ); // skip if previous transfer not complete
VERIFY( !dcd_edpt_busy(TUD_OPT_RHPORT, p_cdc->ep_in) ); // skip if previous transfer not complete
uint16_t count = tu_fifo_read_n(&_cdcd_itf[itf].tx_ff, p_cdc->epout_buf, CFG_TUD_CDC_EPSIZE);
VERIFY( tud_cdc_n_connected(itf) ); // fifo is empty if not connected
if ( count ) TU_ASSERT( dcd_edpt_xfer(TUD_RHPORT, p_cdc->ep_in, p_cdc->epout_buf, count) );
if ( count ) TU_ASSERT( dcd_edpt_xfer(TUD_OPT_RHPORT, p_cdc->ep_in, p_cdc->epout_buf, count) );
return true;
}