From d0ae34d293645c0c06fda4b80958924e0fa6f216 Mon Sep 17 00:00:00 2001 From: Pascal Romahn Date: Tue, 28 Nov 2023 12:05:36 +0100 Subject: [PATCH] Move lineinfo into class instead of static variable --- cores/arduino/USB/CDC.cpp | 16 ---------------- cores/arduino/USB/CDC.h | 8 ++++++++ cores/arduino/USB/USBAPI.h | 8 ++++++++ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index 8d6c6f4b8..7b5bd5643 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -42,22 +42,6 @@ extern USBDevice_SAMD21G18x usbd; extern USBDeviceClass USBDevice; -typedef struct { - uint32_t dwDTERate; - uint8_t bCharFormat; - uint8_t bParityType; - uint8_t bDataBits; - uint8_t lineState; -} LineInfo; - -static volatile LineInfo _usbLineInfo = { - 115200, // dWDTERate - 0x00, // bCharFormat - 0x00, // bParityType - 0x08, // bDataBits - 0x00 // lineState -}; - static volatile int32_t breakValue = -1; // CDC diff --git a/cores/arduino/USB/CDC.h b/cores/arduino/USB/CDC.h index 8e88db5b5..ee5aa07d9 100644 --- a/cores/arduino/USB/CDC.h +++ b/cores/arduino/USB/CDC.h @@ -73,6 +73,14 @@ typedef struct EndpointDescriptor out; } CDCDescriptor; +typedef struct { + uint32_t dwDTERate; + uint8_t bCharFormat; + uint8_t bParityType; + uint8_t bDataBits; + uint8_t lineState; +} LineInfo; + #endif #endif \ No newline at end of file diff --git a/cores/arduino/USB/USBAPI.h b/cores/arduino/USB/USBAPI.h index b06b5e56e..c1cee4ce0 100644 --- a/cores/arduino/USB/USBAPI.h +++ b/cores/arduino/USB/USBAPI.h @@ -176,6 +176,14 @@ friend USBDeviceClass; bool stalled; unsigned int epType[3]; + volatile LineInfo _usbLineInfo = { + 115200, // dWDTERate + 0x00, // bCharFormat + 0x00, // bParityType + 0x08, // bDataBits + 0x00 // lineState + }; + }; extern Serial_ SerialUSB;