Skip to content

Commit 1fd0b04

Browse files
Add TinyUSB include to all libs (#180)
Fixes #167 For Serial when selecting TinyUSB. Can't include in the core because Arduino IDE will not link in libraries called from the core. Instead, add the header to all the standard libraries in the hope it will still catch some user cases where they use these libraries. See #167 (comment)
1 parent d0f3e89 commit 1fd0b04

File tree

7 files changed

+63
-0
lines changed

7 files changed

+63
-0
lines changed

libraries/EEPROM/EEPROM.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@
2525
#include <hardware/flash.h>
2626
#include <hardware/sync.h>
2727

28+
#ifdef USE_TINYUSB
29+
// For Serial when selecting TinyUSB. Can't include in the core because Arduino IDE
30+
// will not link in libraries called from the core. Instead, add the header to all
31+
// the standard libraries in the hope it will still catch some user cases where they
32+
// use these libraries.
33+
// See https://github.com/earlephilhower/arduino-pico/issues/167#issuecomment-848622174
34+
#include <Adafruit_TinyUSB.h>
35+
#endif
36+
2837
extern "C" uint8_t _EEPROM_start;
2938

3039
EEPROMClass::EEPROMClass(void)

libraries/I2S/src/I2S.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@
2121
#include <Arduino.h>
2222
#include "I2S.h"
2323

24+
#ifdef USE_TINYUSB
25+
// For Serial when selecting TinyUSB. Can't include in the core because Arduino IDE
26+
// will not link in libraries called from the core. Instead, add the header to all
27+
// the standard libraries in the hope it will still catch some user cases where they
28+
// use these libraries.
29+
// See https://github.com/earlephilhower/arduino-pico/issues/167#issuecomment-848622174
30+
#include <Adafruit_TinyUSB.h>
31+
#endif
32+
2433
I2SClass::I2SClass() {
2534
_running = false;
2635
_pool = nullptr;

libraries/LittleFS/src/LittleFS.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
#include <hardware/flash.h>
2828
#include <hardware/sync.h>
2929

30+
#ifdef USE_TINYUSB
31+
// For Serial when selecting TinyUSB. Can't include in the core because Arduino IDE
32+
// will not link in libraries called from the core. Instead, add the header to all
33+
// the standard libraries in the hope it will still catch some user cases where they
34+
// use these libraries.
35+
// See https://github.com/earlephilhower/arduino-pico/issues/167#issuecomment-848622174
36+
#include <Adafruit_TinyUSB.h>
37+
#endif
38+
3039
extern uint8_t _FS_start;
3140
extern uint8_t _FS_end;
3241

libraries/SD/src/SD.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
#include "SD.h"
22

3+
#ifdef USE_TINYUSB
4+
// For Serial when selecting TinyUSB. Can't include in the core because Arduino IDE
5+
// will not link in libraries called from the core. Instead, add the header to all
6+
// the standard libraries in the hope it will still catch some user cases where they
7+
// use these libraries.
8+
// See https://github.com/earlephilhower/arduino-pico/issues/167#issuecomment-848622174
9+
#include <Adafruit_TinyUSB.h>
10+
#endif
11+
312
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SD)
413
SDClass SD;
514
#endif

libraries/SPI/SPI.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@
2222
#include <hardware/spi.h>
2323
#include <hardware/gpio.h>
2424

25+
#ifdef USE_TINYUSB
26+
// For Serial when selecting TinyUSB. Can't include in the core because Arduino IDE
27+
// will not link in libraries called from the core. Instead, add the header to all
28+
// the standard libraries in the hope it will still catch some user cases where they
29+
// use these libraries.
30+
// See https://github.com/earlephilhower/arduino-pico/issues/167#issuecomment-848622174
31+
#include <Adafruit_TinyUSB.h>
32+
#endif
33+
2534
SPIClassRP2040::SPIClassRP2040(spi_inst_t *spi, pin_size_t rx, pin_size_t cs, pin_size_t sck, pin_size_t tx) {
2635
_spi = spi;
2736
_running = false;

libraries/Servo/src/Servo.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@
2424
#include <hardware/clocks.h>
2525
#include <hardware/pio.h>
2626

27+
#ifdef USE_TINYUSB
28+
// For Serial when selecting TinyUSB. Can't include in the core because Arduino IDE
29+
// will not link in libraries called from the core. Instead, add the header to all
30+
// the standard libraries in the hope it will still catch some user cases where they
31+
// use these libraries.
32+
// See https://github.com/earlephilhower/arduino-pico/issues/167#issuecomment-848622174
33+
#include <Adafruit_TinyUSB.h>
34+
#endif
35+
2736
#include "servo.pio.h"
2837
static PIOProgram _servoPgm(&servo_program);
2938

libraries/Wire/Wire.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@
2828
#include <hardware/regs/intctrl.h>
2929
#include "Wire.h"
3030

31+
#ifdef USE_TINYUSB
32+
// For Serial when selecting TinyUSB. Can't include in the core because Arduino IDE
33+
// will not link in libraries called from the core. Instead, add the header to all
34+
// the standard libraries in the hope it will still catch some user cases where they
35+
// use these libraries.
36+
// See https://github.com/earlephilhower/arduino-pico/issues/167#issuecomment-848622174
37+
#include <Adafruit_TinyUSB.h>
38+
#endif
39+
3140
TwoWire::TwoWire(i2c_inst_t *i2c, pin_size_t sda, pin_size_t scl) {
3241
_sda = sda;
3342
_scl = scl;

0 commit comments

Comments
 (0)