aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino/CDC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cores/arduino/CDC.cpp')
-rw-r--r--cores/arduino/CDC.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/cores/arduino/CDC.cpp b/cores/arduino/CDC.cpp
index d694a2d..90a1698 100644
--- a/cores/arduino/CDC.cpp
+++ b/cores/arduino/CDC.cpp
@@ -18,6 +18,7 @@
#include "USBAPI.h"
#include <avr/wdt.h>
+#include <util/atomic.h>
#if defined(USBCON)
@@ -205,6 +206,32 @@ Serial_::operator bool() {
return result;
}
+unsigned long Serial_::baud() {
+ ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
+ return _usbLineInfo.dwDTERate;
+ }
+}
+
+uint8_t Serial_::stopbits() {
+ return _usbLineInfo.bCharFormat;
+}
+
+uint8_t Serial_::paritytype() {
+ return _usbLineInfo.bParityType;
+}
+
+uint8_t Serial_::numbits() {
+ return _usbLineInfo.bDataBits;
+}
+
+bool Serial_::dtr() {
+ return _usbLineInfo.lineState & 0x1;
+}
+
+bool Serial_::rts() {
+ return _usbLineInfo.lineState & 0x2;
+}
+
Serial_ Serial;
#endif /* if defined(USBCON) */