Skip to content

Commit 34362e5

Browse files
authored
Merge pull request #277 from adafruit/sync-tinyusb
sync tinyusb
2 parents 409f909 + 3ff38c9 commit 34362e5

File tree

6 files changed

+32
-12
lines changed

6 files changed

+32
-12
lines changed

src/arduino/Adafruit_TinyUSB_API.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ void TinyUSB_Device_FlushCDC(void) {
5757

5858
// Debug log with Serial1
5959
#if CFG_TUSB_DEBUG && defined(CFG_TUSB_DEBUG_PRINTF)
60-
int CFG_TUSB_DEBUG_PRINTF(const char *__restrict format, ...) {
60+
__attribute__((used)) int CFG_TUSB_DEBUG_PRINTF(const char *__restrict format,
61+
...) {
6162
static bool ser1_inited = false;
6263
if (!ser1_inited) {
6364
ser1_inited = true;

src/class/hid/hid_host.c

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,15 @@ static bool _hidh_set_idle(uint8_t daddr, uint8_t itf_num, uint16_t idle_rate, t
337337
// Interrupt Endpoint API
338338
//--------------------------------------------------------------------+
339339

340+
// Check if HID interface is ready to receive report
341+
bool tuh_hid_receive_ready(uint8_t dev_addr, uint8_t idx)
342+
{
343+
hidh_interface_t* p_hid = get_hid_itf(dev_addr, idx);
344+
TU_VERIFY(p_hid);
345+
346+
return !usbh_edpt_busy(dev_addr, p_hid->ep_in);
347+
}
348+
340349
bool tuh_hid_receive_report(uint8_t daddr, uint8_t idx)
341350
{
342351
hidh_interface_t* p_hid = get_hid_itf(daddr, idx);
@@ -354,13 +363,13 @@ bool tuh_hid_receive_report(uint8_t daddr, uint8_t idx)
354363
return true;
355364
}
356365

357-
//bool tuh_n_hid_n_ready(uint8_t dev_addr, uint8_t instance)
358-
//{
359-
// TU_VERIFY(tuh_n_hid_n_mounted(dev_addr, instance));
360-
//
361-
// hidh_interface_t* hid_itf = get_instance(dev_addr, instance);
362-
// return !usbh_edpt_busy(dev_addr, hid_itf->ep_in);
363-
//}
366+
bool tuh_hid_send_ready(uint8_t dev_addr, uint8_t idx)
367+
{
368+
hidh_interface_t* p_hid = get_hid_itf(dev_addr, idx);
369+
TU_VERIFY(p_hid);
370+
371+
return !usbh_edpt_busy(dev_addr, p_hid->ep_out);
372+
}
364373

365374
bool tuh_hid_send_report(uint8_t daddr, uint8_t idx, uint8_t report_id, const void* report, uint16_t len)
366375
{

src/class/hid/hid_host.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ typedef struct
6262
// Interface API
6363
//--------------------------------------------------------------------+
6464

65-
// Get the number of mounted HID interfaces of a device
65+
// Get the total number of mounted HID interfaces of a device
6666
uint8_t tuh_hid_itf_get_count(uint8_t dev_addr);
6767

6868
// Get all mounted interfaces across devices
@@ -109,14 +109,17 @@ bool tuh_hid_set_report(uint8_t dev_addr, uint8_t idx, uint8_t report_id, uint8_
109109
// Interrupt Endpoint API
110110
//--------------------------------------------------------------------+
111111

112-
// Check if the interface is ready to use
113-
//bool tuh_n_hid_n_ready(uint8_t dev_addr, uint8_t idx);
112+
// Check if HID interface is ready to receive report
113+
bool tuh_hid_receive_ready(uint8_t dev_addr, uint8_t idx);
114114

115115
// Try to receive next report on Interrupt Endpoint. Immediately return
116116
// - true If succeeded, tuh_hid_report_received_cb() callback will be invoked when report is available
117117
// - false if failed to queue the transfer e.g endpoint is busy
118118
bool tuh_hid_receive_report(uint8_t dev_addr, uint8_t idx);
119119

120+
// Check if HID interface is ready to send report
121+
bool tuh_hid_send_ready(uint8_t dev_addr, uint8_t idx);
122+
120123
// Send report using interrupt endpoint
121124
// If report_id > 0 (composite), it will be sent as 1st byte, then report contents. Otherwise only report content is sent.
122125
bool tuh_hid_send_report(uint8_t dev_addr, uint8_t idx, uint8_t report_id, const void* report, uint16_t len);

src/class/net/net_device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void tud_network_init_cb(void);
9494

9595
// client must provide this: 48-bit MAC address
9696
// TODO removed later since it is not part of tinyusb stack
97-
extern const uint8_t tud_network_mac_address[6];
97+
extern uint8_t tud_network_mac_address[6];
9898

9999
//------------- NCM -------------//
100100

src/common/tusb_mcu.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,12 @@
229229
#define TUP_USBIP_DWC2_STM32
230230
#define TUP_DCD_ENDPOINT_MAX 6
231231

232+
#elif TU_CHECK_MCU(OPT_MCU_STM32L5)
233+
#define TUP_USBIP_FSDEV
234+
#define TUP_USBIP_FSDEV_STM32
235+
#define TUP_DCD_ENDPOINT_MAX 8
236+
237+
232238
//--------------------------------------------------------------------+
233239
// Sony
234240
//--------------------------------------------------------------------+

src/tusb_option.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
#define OPT_MCU_STM32G4 311 ///< ST G4
8383
#define OPT_MCU_STM32WB 312 ///< ST WB
8484
#define OPT_MCU_STM32U5 313 ///< ST U5
85+
#define OPT_MCU_STM32L5 314 ///< ST L5
8586

8687
// Sony
8788
#define OPT_MCU_CXD56 400 ///< SONY CXD56

0 commit comments

Comments
 (0)