Skip to content

Commit 280eda0

Browse files
committed
sync with tinyusb lib latest
1 parent 039c0a2 commit 280eda0

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
@@ -89,7 +89,7 @@ unsigned long millis();
8989
#ifdef __cplusplus
9090

9191
#ifdef USE_TINYUSB
92-
#include "Adafruit_USBD_Interface.h"
92+
// Needed for declaring Serial
9393
#include "Adafruit_USBD_CDC.h"
9494
#else
9595
#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
@@ -34,12 +34,6 @@ extern void loop();
3434
void initVariant() __attribute__((weak));
3535
void initVariant() { }
3636

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

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

0 commit comments

Comments
 (0)