Skip to content

Use Serial1 without including "Adafruit_TinyUSB.h" #734

Open
@arms22

Description

@arms22

Is your feature request related to a problem? Please describe.

the following code causes undefined reference to 'Adafruit_USBD_CDC::available()' when targeting the nRF52840 boards.
I understand that the header "Adafruit_TinyUSB.h" needs to be included, but I don't want to include it for power saving.

void setup() {
  Serial1.begin(115200);
}

void loop() {
}

This is because serialEventRun refers to Serial.

if (serialEvent && Serial.available() ) serialEvent();

How about changing the call to Serial.available to a call to the weak symbol?

int Serial_available() __attribute__((weak));

void serialEventRun(void)
{
  if (serialEvent && Serial_available() ) serialEvent();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions