Skip to content

Commit d069ea1

Browse files
committed
vendor: Add tx callback
Other drivers already have notification about data sent. It allows batter control in application on vendor protocol level.
1 parent e40547a commit d069ea1

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/class/vendor/vendor_device.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ bool vendord_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
247247
}
248248
else if ( ep_addr == p_itf->ep_in )
249249
{
250+
if (tud_vendor_tx_cb) tud_vendor_tx_cb(itf, xferred_bytes);
250251
// Send complete, try to send more if possible
251252
maybe_transmit(p_itf);
252253
}

src/class/vendor/vendor_device.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ static inline uint32_t tud_vendor_write_available (void);
7171

7272
// Invoked when received new data
7373
TU_ATTR_WEAK void tud_vendor_rx_cb(uint8_t itf);
74+
// Invoked when last rx transfer finished
75+
TU_ATTR_WEAK void tud_vendor_tx_cb(uint8_t itf, uint32_t sent_bytes);
7476

7577
//--------------------------------------------------------------------+
7678
// Inline Functions

0 commit comments

Comments
 (0)