Skip to content

Commit 0595a29

Browse files
author
Space
authored
Arduino Uno Wifi Rev 2 Configured For Pyfirmata
Major Changes: Added Arduino Uno Wifi Rev 2's pinouts to boards.h Added HWSerial port ID to utility/SerialFirmata.h
1 parent d337c15 commit 0595a29

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

utility/SerialFirmata.h

+14-2
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
// a) continuous streaming at higher baud rates: enable but set to 0 (receive buffer store & forward)
4949
// b) messages: set to a value below min. inter message delay (message store & forward)
5050
// 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,
5252
// 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.
5454
// serial buffer/message size and the Firmata frame size (4 bytes) to prevent fragmentation
5555
// on the transport layer.
5656
//#define FIRMATA_SERIAL_RX_DELAY 50 // [ms]
@@ -78,6 +78,8 @@
7878
#define SERIAL_READ_ARR_LEN 12
7979

8080
// map configuration query response resolution value to serial pin type
81+
#define RES_RX0 0x00
82+
#define RES_TX0 0x01
8183
#define RES_RX1 0x02
8284
#define RES_TX1 0x03
8385
#define RES_RX2 0x04
@@ -121,6 +123,10 @@ namespace {
121123
#if defined(PIN_SERIAL_RX)
122124
// TODO when use of HW_SERIAL0 is enabled
123125
#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
124130
#if defined(PIN_SERIAL1_RX)
125131
if (pin == PIN_SERIAL1_RX) return RES_RX1;
126132
if (pin == PIN_SERIAL1_TX) return RES_TX1;
@@ -163,6 +169,12 @@ namespace {
163169
// // TODO when use of HW_SERIAL0 is enabled
164170
// break;
165171
#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
166178
#if defined(PIN_SERIAL1_RX)
167179
case HW_SERIAL1:
168180
pins.rx = PIN_SERIAL1_RX;

0 commit comments

Comments
 (0)