|
@@ -33,6 +33,10 @@
|
33
|
33
|
|
34
|
34
|
#include "MarlinSerialUSB_Due.h"
|
35
|
35
|
|
|
36
|
+#if ENABLED(EMERGENCY_PARSER)
|
|
37
|
+ #include "../../feature/emergency_parser.h"
|
|
38
|
+#endif
|
|
39
|
+
|
36
|
40
|
// Imports from Atmel USB Stack/CDC implementation
|
37
|
41
|
extern "C" {
|
38
|
42
|
bool usb_task_cdc_isenabled(void);
|
|
@@ -46,6 +50,10 @@ extern "C" {
|
46
|
50
|
// Pending character
|
47
|
51
|
static int pending_char = -1;
|
48
|
52
|
|
|
53
|
+#if ENABLED(EMERGENCY_PARSER)
|
|
54
|
+ static EmergencyParser::State emergency_state; // = EP_RESET
|
|
55
|
+#endif
|
|
56
|
+
|
49
|
57
|
// Public Methods
|
50
|
58
|
void MarlinSerialUSB::begin(const long baud_setting) {
|
51
|
59
|
}
|
|
@@ -66,6 +74,11 @@ int MarlinSerialUSB::peek(void) {
|
66
|
74
|
return -1;
|
67
|
75
|
|
68
|
76
|
pending_char = udi_cdc_getc();
|
|
77
|
+
|
|
78
|
+ #if ENABLED(EMERGENCY_PARSER)
|
|
79
|
+ emergency_parser.update(emergency_state, (char)pending_char);
|
|
80
|
+ #endif
|
|
81
|
+
|
69
|
82
|
return pending_char;
|
70
|
83
|
}
|
71
|
84
|
|
|
@@ -84,7 +97,13 @@ int MarlinSerialUSB::read(void) {
|
84
|
97
|
if (!udi_cdc_is_rx_ready())
|
85
|
98
|
return -1;
|
86
|
99
|
|
87
|
|
- return udi_cdc_getc();
|
|
100
|
+ int c = udi_cdc_getc();
|
|
101
|
+
|
|
102
|
+ #if ENABLED(EMERGENCY_PARSER)
|
|
103
|
+ emergency_parser.update(emergency_state, (char)c);
|
|
104
|
+ #endif
|
|
105
|
+
|
|
106
|
+ return c;
|
88
|
107
|
}
|
89
|
108
|
|
90
|
109
|
bool MarlinSerialUSB::available(void) {
|