فهرست منبع

vendor: Add tx callback

Other drivers already have notification about data sent.
It allows batter control in application on vendor
protocol level.
Jerzy Kasenberg 4 سال پیش
والد
کامیت
d069ea1421
2فایلهای تغییر یافته به همراه3 افزوده شده و 0 حذف شده
  1. 1 0
      src/class/vendor/vendor_device.c
  2. 2 0
      src/class/vendor/vendor_device.h

+ 1 - 0
src/class/vendor/vendor_device.c

@@ -247,6 +247,7 @@ bool vendord_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
   }
   else if ( ep_addr == p_itf->ep_in )
   {
+    if (tud_vendor_tx_cb) tud_vendor_tx_cb(itf, xferred_bytes);
     // Send complete, try to send more if possible
     maybe_transmit(p_itf);
   }

+ 2 - 0
src/class/vendor/vendor_device.h

@@ -71,6 +71,8 @@ static inline uint32_t tud_vendor_write_available (void);
 
 // Invoked when received new data
 TU_ATTR_WEAK void tud_vendor_rx_cb(uint8_t itf);
+// Invoked when last rx transfer finished
+TU_ATTR_WEAK void tud_vendor_tx_cb(uint8_t itf, uint32_t sent_bytes);
 
 //--------------------------------------------------------------------+
 // Inline Functions