Skip to content

Commit 7585cb7

Browse files
authored
Merge pull request #298 from adafruit/rework-tinyusb
Rework tinyusb lib
2 parents 32b62c8 + 461f855 commit 7585cb7

File tree

14 files changed

+54
-232
lines changed

14 files changed

+54
-232
lines changed

.github/workflows/githubci.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10-
arduino-platform: ['metro_m0', 'hallowing', 'circuitplayground_m0',
11-
'metro_m4', 'pybadge_m4', 'pygamer_m4', 'hallowing_m4', 'pyportal_m4', 'pyportal_m4_titano']
10+
arduino-platform:
11+
# Alphabetical order
12+
- 'metro_m0'
13+
- 'hallowing'
14+
- 'circuitplayground_m0'
15+
- 'metro_m4'
16+
- 'pybadge_m4'
17+
- 'pygamer_m4'
18+
- 'hallowing_m4'
19+
- 'pyportal_m4'
20+
- 'pyportal_m4_titano'
21+
- 'feather_m4_can'
1222

1323
runs-on: ubuntu-latest
1424

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
*.atsuo
33

44
bootloaders/*/build/
5-
*~
5+
*~
6+
/libraries/**/build/

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "cores/arduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore"]
2-
path = cores/arduino/TinyUSB/Adafruit_TinyUSB_ArduinoCore
3-
url = https://github.com/adafruit/Adafruit_TinyUSB_ArduinoCore.git
1+
[submodule "libraries/Adafruit_TinyUSB_Arduino"]
2+
path = libraries/Adafruit_TinyUSB_Arduino
3+
url = https://github.com/adafruit/Adafruit_TinyUSB_Arduino.git

cores/arduino/Arduino.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,13 @@ void loop( void ) ;
150150

151151
// USB
152152
#ifdef USE_TINYUSB
153-
#include "Adafruit_TinyUSB_Core.h"
153+
// Needed for declaring Serial
154+
#include "Adafruit_USBD_CDC.h"
154155
#else
155-
#include "USB/USBDesc.h"
156-
#include "USB/USBCore.h"
157-
#include "USB/USBAPI.h"
158-
#include "USB/USB_host.h"
156+
#include "USB/USBDesc.h"
157+
#include "USB/USBCore.h"
158+
#include "USB/USBAPI.h"
159+
#include "USB/USB_host.h"
159160
#endif
160161

161162
#endif // Arduino_h
Lines changed: 0 additions & 1 deletion
This file was deleted.

cores/arduino/TinyUSB/Adafruit_TinyUSB_SAMD.cpp

Lines changed: 0 additions & 195 deletions
This file was deleted.

cores/arduino/delay.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,17 @@ void SysTick_DefaultHandler(void)
117117
tickReset();
118118
}
119119

120+
#if defined(USE_TINYUSB)
121+
122+
// run TinyUSB background task when yield()
123+
void yield(void)
124+
{
125+
TinyUSB_Device_Task();
126+
TinyUSB_Device_FlushCDC();
127+
}
128+
129+
#endif
130+
120131
#ifdef __cplusplus
121132
}
122133
#endif

cores/arduino/main.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int main( void )
4141
delay(1);
4242

4343
#if defined(USE_TINYUSB)
44-
Adafruit_TinyUSB_Core_init();
44+
TinyUSB_Device_Init(0);
4545
#elif defined(USBCON)
4646
USBDevice.init();
4747
USBDevice.attach();
@@ -59,14 +59,3 @@ int main( void )
5959

6060
return 0;
6161
}
62-
63-
#if defined(USE_TINYUSB)
64-
65-
// run TinyUSB background task when yield()
66-
extern "C" void yield(void)
67-
{
68-
tud_task();
69-
tud_cdc_write_flush();
70-
}
71-
72-
#endif
File renamed without changes.

extras/build_all.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
metavar='board',
2828
nargs='*',
2929
help='list of boards to be built -- Note that the fqbn is created by prepending "{}"'.format(FQBN_PREFIX),
30-
default= [ 'metro_m0', 'metro_m4', 'circuitplayground_m0' ]
30+
default= [ 'metro_m0', 'metro_m4', 'circuitplayground_m0', 'feather_m4_can' ]
3131
)
3232
args = parser.parse_args()
3333

@@ -59,6 +59,10 @@ def build_examples(variant: str):
5959
fqbn = "{}{}".format(FQBN_PREFIX, variant)
6060

6161
for sketch in glob.iglob('libraries/**/*.ino', recursive=True):
62+
# TODO skip TinyUSB library examples for now
63+
if "libraries/Adafruit_TinyUSB_Arduino" in sketch:
64+
continue
65+
6266
start_time = time.monotonic()
6367

6468
# Skip if contains: ".board.test.skip" or ".all.test.skip"

0 commit comments

Comments
 (0)