Simplify transfer failure cb.

This commit is contained in:
HiFiPhile 2024-04-26 17:45:14 +02:00
parent 81e63ed6d8
commit 4af67dd007
3 changed files with 11 additions and 4 deletions

6
.clang-format Normal file
View File

@ -0,0 +1,6 @@
---
BreakBeforeBraces: Linux
ColumnLimit: '200'
ReflowComments: 'true'
...

View File

@ -381,6 +381,8 @@ bool hidd_control_xfer_cb (uint8_t rhport, uint8_t stage, tusb_control_request_t
bool hidd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_t xferred_bytes)
{
(void) result;
uint8_t instance = 0;
hidd_interface_t * p_hid = _hidd_itf;
@ -396,9 +398,9 @@ bool hidd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_
if (XFER_RESULT_SUCCESS != result)
{
// Inform application about the issue
if (tud_hid_report_issue_cb)
if (tud_hid_report_fail_cb)
{
tud_hid_report_issue_cb(instance, ep_addr, result, (uint16_t) xferred_bytes);
tud_hid_report_fail_cb(instance, ep_addr, (uint16_t) xferred_bytes);
}
// Allow a new transfer to be received if issue happened on an OUT endpoint

View File

@ -119,7 +119,7 @@ TU_ATTR_WEAK bool tud_hid_set_idle_cb(uint8_t instance, uint8_t idle_rate);
TU_ATTR_WEAK void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint16_t len);
// Invoked when a transfer wasn't successful
TU_ATTR_WEAK void tud_hid_report_issue_cb(uint8_t instance, uint8_t ep_addr, xfer_result_t result, uint16_t len);
TU_ATTR_WEAK void tud_hid_report_fail_cb(uint8_t instance, uint8_t ep_addr, uint16_t len);
//--------------------------------------------------------------------+
// Inline Functions
@ -413,7 +413,6 @@ uint16_t hidd_open (uint8_t rhport, tusb_desc_interface_t const * itf
bool hidd_control_xfer_cb (uint8_t rhport, uint8_t stage, tusb_control_request_t const * request);
bool hidd_xfer_cb (uint8_t rhport, uint8_t ep_addr, xfer_result_t event, uint32_t xferred_bytes);
void test(void);
#ifdef __cplusplus
}