👽️ Update Teensy 4.0/4.1 Serial (#26457)

This commit is contained in:
ellensp 2023-11-25 16:27:55 +13:00 committed by GitHub
parent e98e307d17
commit ae695e8309
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 3 deletions

View file

@ -39,9 +39,19 @@
#define _IMPLEMENT_SERIAL(X) DefaultSerial##X MSerial##X(false, Serial##X)
#define IMPLEMENT_SERIAL(X) _IMPLEMENT_SERIAL(X)
#if WITHIN(SERIAL_PORT, 0, 3)
#if WITHIN(SERIAL_PORT, 0, 8)
IMPLEMENT_SERIAL(SERIAL_PORT);
#endif
#ifdef SERIAL_PORT_2
#if WITHIN(SERIAL_PORT_2, 0, 8)
IMPLEMENT_SERIAL(SERIAL_PORT_2);
#endif
#endif
#ifdef SERIAL_PORT_3
#if WITHIN(SERIAL_PORT_3, 0, 8)
IMPLEMENT_SERIAL(SERIAL_PORT_3);
#endif
#endif
USBSerialType USBSerial(false, SerialUSB);
// ------------------------

View file

@ -80,7 +80,7 @@ extern USBSerialType USBSerial;
#define MSERIAL(X) _MSERIAL(X)
#if SERIAL_PORT == -1
#define MYSERIAL1 SerialUSB
#define MYSERIAL1 USBSerial
#elif WITHIN(SERIAL_PORT, 0, 8)
DECLARE_SERIAL(SERIAL_PORT);
#define MYSERIAL1 MSERIAL(SERIAL_PORT)
@ -90,16 +90,28 @@ extern USBSerialType USBSerial;
#ifdef SERIAL_PORT_2
#if SERIAL_PORT_2 == -1
#define MYSERIAL2 usbSerial
#define MYSERIAL2 USBSerial
#elif SERIAL_PORT_2 == -2
#define MYSERIAL2 ethernet.telnetClient
#elif WITHIN(SERIAL_PORT_2, 0, 8)
DECLARE_SERIAL(SERIAL_PORT_2);
#define MYSERIAL2 MSERIAL(SERIAL_PORT_2)
#else
#error "SERIAL_PORT_2 must be from 0 to 8, or -1 for Native USB, or -2 for Ethernet."
#endif
#endif
#ifdef SERIAL_PORT_3
#if SERIAL_PORT_3 == -1
#define MYSERIAL3 USBSerial
#elif WITHIN(SERIAL_PORT_3, 0, 8)
DECLARE_SERIAL(SERIAL_PORT_3);
#define MYSERIAL3 MSERIAL(SERIAL_PORT_3)
#else
#error "SERIAL_PORT_3 must be from 0 to 8, or -1 for Native USB."
#endif
#endif
// ------------------------
// Types
// ------------------------