summaryrefslogtreecommitdiff
path: root/src/class
diff options
context:
space:
mode:
authorJerzy Kasenberg <[email protected]>2021-08-25 10:41:07 +0200
committerJerzy Kasenberg <[email protected]>2022-01-19 14:06:00 +0100
commitd069ea1421eace1768157e76c44164262ed9a1e6 (patch)
tree234ef2993c0c5c53832404c7e97e955ee917f2f7 /src/class
parente40547ada133525e5cd6249cec547277a97e3a79 (diff)
vendor: Add tx callback
Other drivers already have notification about data sent. It allows batter control in application on vendor protocol level.
Diffstat (limited to 'src/class')
-rw-r--r--src/class/vendor/vendor_device.c1
-rw-r--r--src/class/vendor/vendor_device.h2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/class/vendor/vendor_device.c b/src/class/vendor/vendor_device.c
index 8a4ca1d2e..02a4220be 100644
--- a/src/class/vendor/vendor_device.c
+++ b/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);
}
diff --git a/src/class/vendor/vendor_device.h b/src/class/vendor/vendor_device.h
index d71c2a3e9..75cb77f5b 100644
--- a/src/class/vendor/vendor_device.h
+++ b/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