Skip to content

Commit 323ab46

Browse files
committed
Merge branch 'master' of https://github.com/firmata/arduino into commoncode
2 parents f497ad6 + d4cde66 commit 323ab46

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

Boards.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,36 @@ writePort(port, value, bitmask): Write an 8 bit port.
536536
#define PIN_TO_PWM(p) PIN_TO_DIGITAL(p)
537537
#define PIN_TO_SERVO(p) (p)
538538

539+
// Teensy 4.0
540+
#elif defined(__IMXRT1062__)
541+
#define TOTAL_ANALOG_PINS 14
542+
#define TOTAL_PINS 40
543+
#define VERSION_BLINK_PIN 13
544+
#define PIN_SERIAL1_RX 0
545+
#define PIN_SERIAL1_TX 1
546+
#define PIN_SERIAL2_RX 7
547+
#define PIN_SERIAL2_TX 8
548+
#define PIN_SERIAL3_RX 15
549+
#define PIN_SERIAL3_TX 14
550+
#define PIN_SERIAL4_RX 16
551+
#define PIN_SERIAL4_TX 17
552+
#define PIN_SERIAL5_RX 21
553+
#define PIN_SERIAL5_TX 20
554+
#define PIN_SERIAL6_RX 25
555+
#define PIN_SERIAL6_TX 24
556+
#define PIN_SERIAL7_RX 28
557+
#define PIN_SERIAL7_TX 29
558+
#define IS_PIN_DIGITAL(p) ((p) >= 0 && (p) < TOTAL_PINS)
559+
#define IS_PIN_ANALOG(p) ((p) >= 14 && (p) <= 27)
560+
#define IS_PIN_PWM(p) (((p) >= 0 && (p) <= 16) || ((p) >= 18 && (p) <= 19) || ((p) >= 22 && (p) <= 25) || ((p) >= 28 && (p) <= 29)|| ((p) >= 33 && (p) <= 39))
561+
#define IS_PIN_SERVO(p) ((p) >= 0 && (p) < MAX_SERVOS)
562+
#define IS_PIN_I2C(p) ((p) == 18 || (p) == 19)
563+
#define IS_PIN_SERIAL(p) (((p) >= 0 && (p) <= 1) || ((p) >= 7 && (p) <= 8) || ((p) >= 14 && (p) <= 17) || ((p) >= 20 && (p) <= 21) || ((p) >= 24 && (p) <= 25) || ((p) >= 28 && (p) <= 29))
564+
#define PIN_TO_DIGITAL(p) (p)
565+
#define PIN_TO_ANALOG(p) ((p) - 14)
566+
#define PIN_TO_PWM(p) (p)
567+
#define PIN_TO_SERVO(p) (p)
568+
539569

540570
// Leonardo
541571
#elif defined(__AVR_ATmega32U4__)

readme.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ Most of the time you will be interacting with Arduino with a client library on t
7373
* [https://github.com/nfrancois/firmata](https://github.com/nfrancois/firmata)
7474
* Max/MSP
7575
* [http://www.maxuino.org/](http://www.maxuino.org/)
76+
* [https://github.com/NullMember/MaxFirmata](https://github.com/NullMember/MaxFirmata)
7677
* Elixir
7778
* [https://github.com/kfatehi/firmata](https://github.com/kfatehi/firmata)
7879
* Modelica
@@ -85,6 +86,8 @@ Most of the time you will be interacting with Arduino with a client library on t
8586
* [http://openframeworks.cc/documentation/communication/ofArduino/](http://openframeworks.cc/documentation/communication/ofArduino/)
8687
* Rust
8788
* [https://github.com/zankich/rust-firmata](https://github.com/zankich/rust-firmata)
89+
* Pure Data
90+
* [https://github.com/NullMember/PDFirmata](https://github.com/NullMember/PDFirmata)
8891

8992
Note: The above libraries may support various versions of the Firmata protocol and therefore may not support all features of the latest Firmata spec nor all Arduino and Arduino-compatible boards. Refer to the respective projects for details.
9093

utility/SerialFirmata.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
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]
57-
#define FIRMATA_SERIAL_RX_DELAY 50
5857

5958
#define FIRMATA_SERIAL_FEATURE
6059

@@ -66,7 +65,7 @@
6665
#define HW_SERIAL4 0x04
6766
#define HW_SERIAL5 0x05
6867
#define HW_SERIAL6 0x06
69-
// extensible up to 0x07
68+
#define HW_SERIAL7 0x07
7069

7170
#define SW_SERIAL0 0x08
7271
#define SW_SERIAL1 0x09
@@ -91,6 +90,8 @@
9190
#define RES_TX5 0x0b
9291
#define RES_RX6 0x0c
9392
#define RES_TX6 0x0d
93+
#define RES_RX7 0x0e
94+
#define RES_TX7 0x0f
9495

9596
// Serial command bytes
9697
#define SERIAL_CONFIG 0x10
@@ -143,6 +144,10 @@ namespace {
143144
#if defined(PIN_SERIAL6_RX)
144145
if (pin == PIN_SERIAL6_RX) return RES_RX6;
145146
if (pin == PIN_SERIAL6_TX) return RES_TX6;
147+
#endif
148+
#if defined(PIN_SERIAL7_RX)
149+
if (pin == PIN_SERIAL7_RX) return RES_RX7;
150+
if (pin == PIN_SERIAL7_TX) return RES_TX7;
146151
#endif
147152
return 0;
148153
}
@@ -193,6 +198,12 @@ namespace {
193198
pins.rx = PIN_SERIAL6_RX;
194199
pins.tx = PIN_SERIAL6_TX;
195200
break;
201+
#endif
202+
#if defined(PIN_SERIAL7_RX)
203+
case HW_SERIAL7:
204+
pins.rx = PIN_SERIAL7_RX;
205+
pins.tx = PIN_SERIAL7_TX;
206+
break;
196207
#endif
197208
default:
198209
pins.rx = 0;

0 commit comments

Comments
 (0)