|
@@ -75,27 +75,26 @@
|
75
|
75
|
#define BIN 2
|
76
|
76
|
#define BYTE 0
|
77
|
77
|
|
78
|
|
-#ifndef USBCON
|
79
|
|
- // Define constants and variables for buffering incoming serial data. We're
|
80
|
|
- // using a ring buffer (I think), in which rx_buffer_head is the index of the
|
81
|
|
- // location to which to write the next incoming character and rx_buffer_tail
|
82
|
|
- // is the index of the location from which to read.
|
83
|
|
- // Use only powers of 2.
|
84
|
|
- // : [0, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...]
|
85
|
|
- #ifndef RX_BUFFER_SIZE
|
86
|
|
- #define RX_BUFFER_SIZE 128
|
87
|
|
- #endif
|
88
|
|
- // 256 is the max TX buffer climit due to uint8_t head and tail.
|
89
|
|
- #ifndef TX_BUFFER_SIZE
|
90
|
|
- #define TX_BUFFER_SIZE 32
|
91
|
|
- #endif
|
|
78
|
+// Define constants and variables for buffering serial data.
|
|
79
|
+// Use only 0 or powers of 2 greater than 1
|
|
80
|
+// : [0, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...]
|
|
81
|
+#ifndef RX_BUFFER_SIZE
|
|
82
|
+ #define RX_BUFFER_SIZE 128
|
|
83
|
+#endif
|
|
84
|
+// 256 is the max TX buffer limit due to uint8_t head and tail.
|
|
85
|
+#ifndef TX_BUFFER_SIZE
|
|
86
|
+ #define TX_BUFFER_SIZE 32
|
|
87
|
+#endif
|
92
|
88
|
|
|
89
|
+#ifndef USBCON
|
93
|
90
|
#if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024
|
94
|
|
- #error "XON/XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
|
|
91
|
+ #error "SERIAL_XON_XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops."
|
95
|
92
|
#endif
|
|
93
|
+
|
96
|
94
|
#if !IS_POWER_OF_2(RX_BUFFER_SIZE) || RX_BUFFER_SIZE < 2
|
97
|
95
|
#error "RX_BUFFER_SIZE must be a power of 2 greater than 1."
|
98
|
96
|
#endif
|
|
97
|
+
|
99
|
98
|
#if TX_BUFFER_SIZE && (TX_BUFFER_SIZE < 2 || TX_BUFFER_SIZE > 256 || !IS_POWER_OF_2(TX_BUFFER_SIZE))
|
100
|
99
|
#error "TX_BUFFER_SIZE must be 0, a power of 2 greater than 1, and no greater than 256."
|
101
|
100
|
#endif
|