Skip to content

Commit c75d1a8

Browse files
committed
sync with tinyusb lib latest
1 parent c0b04bc commit c75d1a8

File tree

5 files changed

+18
-21
lines changed

5 files changed

+18
-21
lines changed

cores/rp2040/Arduino.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ unsigned long millis();
9797
#ifdef __cplusplus
9898

9999
#ifdef USE_TINYUSB
100-
#include "Adafruit_USBD_Interface.h"
100+
// Needed for declaring Serial
101101
#include "Adafruit_USBD_CDC.h"
102102
#else
103103
#include "SerialUSB.h"

cores/rp2040/TinyUSB/tusb_config.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
#define CFG_TUSB_OS OPT_OS_PICO
4343

4444
#define CFG_TUSB_DEBUG 0
45-
#if CFG_TUSB_DEBUG
46-
#define tu_printf serial1_printf
47-
extern int serial1_printf(const char *__restrict __format, ...);
48-
#endif
45+
//#if CFG_TUSB_DEBUG
46+
// #define tu_printf serial1_printf
47+
// extern int serial1_printf(const char *__restrict __format, ...);
48+
//#endif
4949

5050
#define CFG_TUSB_MEM_SECTION
5151
#define CFG_TUSB_MEM_ALIGN TU_ATTR_ALIGNED(4)

cores/rp2040/delay.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,19 @@
2121
#include <pico.h>
2222
#include <pico/time.h>
2323

24+
#ifdef USE_TINYUSB
25+
#include "Adafruit_TinyUSB_API.h"
26+
#endif
27+
2428
extern "C"
2529
{
2630

27-
static void __empty(void) {
28-
// NOOP
29-
}
30-
31-
void yield(void) __attribute__ ((weak, alias("__empty")));
31+
void yield(void) {
32+
TinyUSB_Device_Task();
33+
TinyUSB_Device_FlushCDC();
3234
}
3335

34-
extern "C" void delay( unsigned long ms ) {
36+
void delay( unsigned long ms ) {
3537
if (!ms) {
3638
return;
3739
}
@@ -46,18 +48,19 @@ extern "C" void delay( unsigned long ms ) {
4648
}
4749
}
4850

49-
extern "C" void delayMicroseconds( unsigned int usec ) {
51+
void delayMicroseconds( unsigned int usec ) {
5052
if (!usec) {
5153
return;
5254
}
5355
sleep_us(usec);
5456
}
5557

56-
extern "C" uint32_t millis() {
58+
uint32_t millis() {
5759
return to_ms_since_boot(get_absolute_time());
5860
}
5961

60-
extern "C" uint32_t micros() {
62+
uint32_t micros() {
6163
return to_us_since_boot(get_absolute_time());
6264
}
6365

66+
}

cores/rp2040/main.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ extern void loop();
3636
void initVariant() __attribute__((weak));
3737
void initVariant() { }
3838

39-
#ifdef USE_TINYUSB
40-
// Called by main.cpp to initialize usb device typically with CDC device for Serial
41-
void TinyUSB_Device_Init(uint8_t rhport) __attribute__((weak));
42-
#endif
43-
44-
4539

4640
// Optional 2nd core setup and loop
4741
extern void setup1() __attribute__((weak));

0 commit comments

Comments
 (0)