-
-
Notifications
You must be signed in to change notification settings - Fork 16
Allow USB Serial to be disabled, redirect to UART Serial #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -28,6 +28,14 @@ | |||||
|
|
||||||
| #include "variant.h" | ||||||
|
|
||||||
| #ifndef USB_CDC_DEFAULT_SERIAL | ||||||
| #define USB_CDC_DEFAULT_SERIAL (0) | ||||||
|
||||||
| #define USB_CDC_DEFAULT_SERIAL (0) | |
| #define USB_CDC_DEFAULT_SERIAL (1) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,10 +91,18 @@ static const uint8_t AREF = PIN_AREF; | |
| */ | ||
|
|
||
| // Arduino Header D0, D1 | ||
| #define PIN_SERIAL1_RX (33) // P1.01 | ||
| #define PIN_SERIAL1_TX (34) // P1.02 | ||
| #define USB_CDC_DEFAULT_SERIAL 1 | ||
| #ifndef USB_CDC_DEFAULT_SERIAL | ||
| #define USB_CDC_DEFAULT_SERIAL (1) | ||
| #endif | ||
|
|
||
| #if USB_CDC_DEFAULT_SERIAL | ||
| #define PIN_SERIAL1_RX (33) | ||
| #define PIN_SERIAL1_TX (34) | ||
| #else | ||
| #define PIN_SERIAL_RX (33) | ||
| #define PIN_SERIAL_TX (34) | ||
| #define Serial1 Serial | ||
|
||
| #endif | ||
|
|
||
| /* | ||
| * SPI Interfaces | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of SerialTinyUSB.begin(115200) changes the initialization behavior for USB CDC Serial. Previously, USB CDC Serial was automatically initialized; now it requires explicit Serial.begin() calls in user code. While this creates consistency with UART Serial behavior (which always required initialization), it represents a breaking API change that could cause existing sketches to fail silently. Consider documenting this breaking change, or add conditional initialization based on USB_CDC_DEFAULT_SERIAL to maintain backward compatibility for USB CDC mode while requiring initialization for UART mode.