Skip to content

Commit da5bc86

Browse files
committed
fix some weak symbols
1 parent b66f12b commit da5bc86

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/class/vendor/vendor_device.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,16 +259,12 @@ bool vendord_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
259259
tu_edpt_stream_read_xfer_complete(&p_vendor->rx.stream, xferred_bytes);
260260

261261
// Invoked callback if any
262-
if (tud_vendor_rx_cb) {
263-
tud_vendor_rx_cb(itf, p_epbuf->epout, (uint16_t) xferred_bytes);
264-
}
262+
tud_vendor_rx_cb(itf, p_epbuf->epout, (uint16_t) xferred_bytes);
265263

266264
tu_edpt_stream_read_xfer(rhport, &p_vendor->rx.stream);
267265
} else if ( ep_addr == p_vendor->tx.stream.ep_addr ) {
268266
// Send complete
269-
if (tud_vendor_tx_cb) {
270-
tud_vendor_tx_cb(itf, (uint16_t) xferred_bytes);
271-
}
267+
tud_vendor_tx_cb(itf, (uint16_t) xferred_bytes);
272268

273269
#if CFG_TUD_VENDOR_TX_BUFSIZE > 0
274270
// try to send more if possible
@@ -282,4 +278,8 @@ bool vendord_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint
282278
return true;
283279
}
284280

281+
// Dummy implementatiions of weak callbacks
282+
TU_ATTR_WEAK void tud_vendor_rx_cb(uint8_t, uint8_t const*, uint16_t) {}
283+
TU_ATTR_WEAK void tud_vendor_tx_cb(uint8_t, uint32_t) {}
284+
285285
#endif

src/class/vendor/vendor_device.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ TU_ATTR_ALWAYS_INLINE static inline uint32_t tud_vendor_write_available(void) {
119119
//--------------------------------------------------------------------+
120120

121121
// Invoked when received new data
122-
TU_ATTR_WEAK void tud_vendor_rx_cb(uint8_t itf, uint8_t const* buffer, uint16_t bufsize);
122+
void tud_vendor_rx_cb(uint8_t itf, uint8_t const* buffer, uint16_t bufsize);
123123
// Invoked when last rx transfer finished
124-
TU_ATTR_WEAK void tud_vendor_tx_cb(uint8_t itf, uint32_t sent_bytes);
124+
void tud_vendor_tx_cb(uint8_t itf, uint32_t sent_bytes);
125125

126126
//--------------------------------------------------------------------+
127127
// Inline Functions

src/device/usbd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void tud_event_hook_cb(uint8_t rhport, uint32_t eventid, bool in_isr);
171171
void tud_sof_cb(uint32_t frame_count);
172172

173173
// Invoked when received control request with VENDOR TYPE
174-
TU_ATTR_WEAK bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request);
174+
bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request);
175175

176176
//--------------------------------------------------------------------+
177177
// Binary Device Object Store (BOS) Descriptor Templates

0 commit comments

Comments
 (0)