Browse Source

Teensy USB / serial followup (#21316)

vanilla_fb_2.0.x
X-Ryl669 4 years ago
committed by GitHub
parent
commit
c07f99d5e4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      Marlin/src/HAL/TEENSY31_32/HAL.cpp
  2. 10
      Marlin/src/HAL/TEENSY31_32/HAL.h
  3. 2
      Marlin/src/HAL/TEENSY35_36/HAL.cpp
  4. 2
      Marlin/src/HAL/TEENSY35_36/HAL.h
  5. 6
      Marlin/src/HAL/TEENSY40_41/HAL.cpp
  6. 9
      Marlin/src/HAL/TEENSY40_41/HAL.h

6
Marlin/src/HAL/TEENSY31_32/HAL.cpp

@ -31,7 +31,11 @@
#include <Wire.h> #include <Wire.h>
DefaultSerial1 MSerial0(false); #define _IMPLEMENT_SERIAL(X) DefaultSerial##X MSerial##X(false, Serial##X)
#define IMPLEMENT_SERIAL(X) _IMPLEMENT_SERIAL(X)
#if WITHIN(SERIAL_PORT, 0, 3)
IMPLEMENT_SERIAL(SERIAL_PORT);
#endif
USBSerialType USBSerial(false, SerialUSB); USBSerialType USBSerial(false, SerialUSB);
uint16_t HAL_adc_result; uint16_t HAL_adc_result;

10
Marlin/src/HAL/TEENSY31_32/HAL.h

@ -51,8 +51,13 @@
#endif #endif
#include "../../core/serial_hook.h" #include "../../core/serial_hook.h"
typedef Serial1Class<decltype(Serial)> DefaultSerial1;
extern DefaultSerial1 MSerial0; #define Serial0 Serial
#define _DECLARE_SERIAL(X) \
typedef ForwardSerial1Class<decltype(Serial##X)> DefaultSerial##X; \
extern DefaultSerial##X MSerial##X
#define DECLARE_SERIAL(X) _DECLARE_SERIAL(X)
typedef ForwardSerial1Class<decltype(SerialUSB)> USBSerialType; typedef ForwardSerial1Class<decltype(SerialUSB)> USBSerialType;
extern USBSerialType USBSerial; extern USBSerialType USBSerial;
@ -62,6 +67,7 @@ extern USBSerialType USBSerial;
#if SERIAL_PORT == -1 #if SERIAL_PORT == -1
#define MYSERIAL1 USBSerial #define MYSERIAL1 USBSerial
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
DECLARE_SERIAL(SERIAL_PORT);
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#endif #endif

2
Marlin/src/HAL/TEENSY35_36/HAL.cpp

@ -31,7 +31,7 @@
#include <Wire.h> #include <Wire.h>
#define _IMPLEMENT_SERIAL(X) DefaultSerial##X MSerial##X(false) #define _IMPLEMENT_SERIAL(X) DefaultSerial##X MSerial##X(false, Serial##X)
#define IMPLEMENT_SERIAL(X) _IMPLEMENT_SERIAL(X) #define IMPLEMENT_SERIAL(X) _IMPLEMENT_SERIAL(X)
#if WITHIN(SERIAL_PORT, 0, 3) #if WITHIN(SERIAL_PORT, 0, 3)
IMPLEMENT_SERIAL(SERIAL_PORT); IMPLEMENT_SERIAL(SERIAL_PORT);

2
Marlin/src/HAL/TEENSY35_36/HAL.h

@ -57,7 +57,7 @@
#define Serial0 Serial #define Serial0 Serial
#define _DECLARE_SERIAL(X) \ #define _DECLARE_SERIAL(X) \
typedef Serial1Class<decltype(Serial##X)> DefaultSerial##X; \ typedef ForwardSerial1Class<decltype(Serial##X)> DefaultSerial##X; \
extern DefaultSerial##X MSerial##X extern DefaultSerial##X MSerial##X
#define DECLARE_SERIAL(X) _DECLARE_SERIAL(X) #define DECLARE_SERIAL(X) _DECLARE_SERIAL(X)

6
Marlin/src/HAL/TEENSY40_41/HAL.cpp

@ -32,7 +32,11 @@
#include <Wire.h> #include <Wire.h>
DefaultSerial1 MSerial0(false); #define _IMPLEMENT_SERIAL(X) DefaultSerial##X MSerial##X(false, Serial##X)
#define IMPLEMENT_SERIAL(X) _IMPLEMENT_SERIAL(X)
#if WITHIN(SERIAL_PORT, 0, 3)
IMPLEMENT_SERIAL(SERIAL_PORT);
#endif
USBSerialType USBSerial(false, SerialUSB); USBSerialType USBSerial(false, SerialUSB);
uint16_t HAL_adc_result, HAL_adc_select; uint16_t HAL_adc_result, HAL_adc_select;

9
Marlin/src/HAL/TEENSY40_41/HAL.h

@ -56,8 +56,12 @@
#endif #endif
#include "../../core/serial_hook.h" #include "../../core/serial_hook.h"
typedef Serial1Class<decltype(Serial)> DefaultSerial1; #define Serial0 Serial
extern DefaultSerial1 MSerial0; #define _DECLARE_SERIAL(X) \
typedef ForwardSerial1Class<decltype(Serial##X)> DefaultSerial##X; \
extern DefaultSerial##X MSerial##X
#define DECLARE_SERIAL(X) _DECLARE_SERIAL(X)
typedef ForwardSerial1Class<decltype(SerialUSB)> USBSerialType; typedef ForwardSerial1Class<decltype(SerialUSB)> USBSerialType;
extern USBSerialType USBSerial; extern USBSerialType USBSerial;
@ -67,6 +71,7 @@ extern USBSerialType USBSerial;
#if SERIAL_PORT == -1 #if SERIAL_PORT == -1
#define MYSERIAL1 SerialUSB #define MYSERIAL1 SerialUSB
#elif WITHIN(SERIAL_PORT, 0, 8) #elif WITHIN(SERIAL_PORT, 0, 8)
DECLARE_SERIAL(SERIAL_PORT);
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
#else #else
#error "The required SERIAL_PORT must be from -1 to 8. Please update your configuration." #error "The required SERIAL_PORT must be from -1 to 8. Please update your configuration."

Loading…
Cancel
Save