|
48 | 48 | // a) continuous streaming at higher baud rates: enable but set to 0 (receive buffer store & forward) |
49 | 49 | // b) messages: set to a value below min. inter message delay (message store & forward) |
50 | 50 | // c) continuous streaming at lower baud rates or random characters: undefine or set to -1 (disable) |
51 | | -// 3) Smaller delays may not have the desired effect, especially with less powerful CPUs, |
| 51 | +// 3) Smaller delays may not have the desired effect, especially with less powerful CPUs, |
52 | 52 | // if set to a value near or below the average Firmata main loop duration. |
53 | | -// 4) The Firmata stream write buffer size must be equal or greater than the max. |
| 53 | +// 4) The Firmata stream write buffer size must be equal or greater than the max. |
54 | 54 | // serial buffer/message size and the Firmata frame size (4 bytes) to prevent fragmentation |
55 | 55 | // on the transport layer. |
56 | 56 | //#define FIRMATA_SERIAL_RX_DELAY 50 // [ms] |
|
78 | 78 | #define SERIAL_READ_ARR_LEN 12 |
79 | 79 |
|
80 | 80 | // map configuration query response resolution value to serial pin type |
| 81 | +#define RES_RX0 0x00 |
| 82 | +#define RES_TX0 0x01 |
81 | 83 | #define RES_RX1 0x02 |
82 | 84 | #define RES_TX1 0x03 |
83 | 85 | #define RES_RX2 0x04 |
@@ -121,6 +123,10 @@ namespace { |
121 | 123 | #if defined(PIN_SERIAL_RX) |
122 | 124 | // TODO when use of HW_SERIAL0 is enabled |
123 | 125 | #endif |
| 126 | + #if defined(PIN_SERIAL0_RX) |
| 127 | + if (pin == PIN_SERIAL0_RX) return RES_RX0; |
| 128 | + if (pin == PIN_SERIAL0_TX) return RES_TX0; |
| 129 | + #endif |
124 | 130 | #if defined(PIN_SERIAL1_RX) |
125 | 131 | if (pin == PIN_SERIAL1_RX) return RES_RX1; |
126 | 132 | if (pin == PIN_SERIAL1_TX) return RES_TX1; |
@@ -163,6 +169,12 @@ namespace { |
163 | 169 | // // TODO when use of HW_SERIAL0 is enabled |
164 | 170 | // break; |
165 | 171 | #endif |
| 172 | + #if defined(PIN_SERIAL0_RX) |
| 173 | + case HW_SERIAL0: |
| 174 | + pins.rx = PIN_SERIAL0_RX; |
| 175 | + pins.tx = PIN_SERIAL0_TX; |
| 176 | + break; |
| 177 | + #endif |
166 | 178 | #if defined(PIN_SERIAL1_RX) |
167 | 179 | case HW_SERIAL1: |
168 | 180 | pins.rx = PIN_SERIAL1_RX; |
|
0 commit comments