Browse Source

Tricked-out declaration

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
parent
commit
048f6b4731
  1. 7
      Marlin/src/HAL/TEENSY35_36/HAL.cpp
  2. 10
      Marlin/src/HAL/TEENSY35_36/HAL.h

7
Marlin/src/HAL/TEENSY35_36/HAL.cpp

@ -31,7 +31,12 @@
#include <Wire.h> #include <Wire.h>
DefaultSerial1 MSerial0(false); #define _IMPLEMENT_SERIAL(X) DefaultSerial##X MSerial##X(false)
#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;

10
Marlin/src/HAL/TEENSY35_36/HAL.h

@ -54,8 +54,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 Serial1Class<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;
@ -66,6 +71,7 @@ extern USBSerialType USBSerial;
#define MYSERIAL1 USBSerial #define MYSERIAL1 USBSerial
#elif WITHIN(SERIAL_PORT, 0, 3) #elif WITHIN(SERIAL_PORT, 0, 3)
#define MYSERIAL1 MSERIAL(SERIAL_PORT) #define MYSERIAL1 MSERIAL(SERIAL_PORT)
DECLARE_SERIAL(SERIAL_PORT);
#endif #endif
#define HAL_SERVO_LIB libServo #define HAL_SERVO_LIB libServo

Loading…
Cancel
Save