Browse Source

Use names SerialUSB1 & SerialUSB2 for extra USB serial ports

main
PaulStoffregen 4 years ago
parent
commit
4a24e41108
8 changed files with 24 additions and 22 deletions
  1. +2
    -0
      keywords.txt
  2. +3
    -3
      teensy3/usb_desc.h
  3. +6
    -6
      teensy3/usb_inst.cpp
  4. +2
    -2
      teensy3/usb_serial2.h
  5. +2
    -2
      teensy3/usb_serial3.h
  6. +2
    -2
      teensy3/yield.cpp
  7. +3
    -3
      teensy4/usb_desc.h
  8. +4
    -4
      teensy4/usb_serial.h

+ 2
- 0
keywords.txt View File

@@ -38,6 +38,8 @@ Serial5 KEYWORD1
Serial6 KEYWORD1
Serial7 KEYWORD1
Serial8 KEYWORD1
SerialUSB1 KEYWORD1
SerialUSB2 KEYWORD1
setRX KEYWORD2
setTX KEYWORD2
write9bit KEYWORD2

+ 3
- 3
teensy3/usb_desc.h View File

@@ -160,7 +160,7 @@ let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports
#define CDC_ACM_SIZE 16
#define CDC_RX_SIZE 64
#define CDC_TX_SIZE 64
#define CDC2_STATUS_INTERFACE 2 // SerialA
#define CDC2_STATUS_INTERFACE 2 // SerialUSB1
#define CDC2_DATA_INTERFACE 3
#define CDC2_ACM_ENDPOINT 5
#define CDC2_RX_ENDPOINT 6
@@ -195,7 +195,7 @@ let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports
#define CDC_ACM_SIZE 16
#define CDC_RX_SIZE 64
#define CDC_TX_SIZE 64
#define CDC2_STATUS_INTERFACE 2 // SerialA
#define CDC2_STATUS_INTERFACE 2 // SerialUSB1
#define CDC2_DATA_INTERFACE 3
#define CDC2_ACM_ENDPOINT 5
#define CDC2_RX_ENDPOINT 6
@@ -203,7 +203,7 @@ let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports
#define CDC2_ACM_SIZE 16
#define CDC2_RX_SIZE 64
#define CDC2_TX_SIZE 64
#define CDC3_STATUS_INTERFACE 4 // SerialB
#define CDC3_STATUS_INTERFACE 4 // SerialUSB2
#define CDC3_DATA_INTERFACE 5
#define CDC3_ACM_ENDPOINT 8
#define CDC3_RX_ENDPOINT 9

+ 6
- 6
teensy3/usb_inst.cpp View File

@@ -41,13 +41,13 @@ usb_serial_class Serial;

#ifdef CDC2_DATA_INTERFACE
#ifdef CDC2_STATUS_INTERFACE
usb_serial2_class SerialA;
usb_serial2_class SerialUSB1;
#endif
#endif

#ifdef CDC3_DATA_INTERFACE
#ifdef CDC3_STATUS_INTERFACE
usb_serial3_class SerialB;
usb_serial3_class SerialUSB2;
#endif
#endif

@@ -100,7 +100,7 @@ usb_seremu_class Serial;

void serialEvent() __attribute__((weak));
void serialEvent() {}
void serialEventA() __attribute__((weak));
void serialEventA() {}
void serialEventB() __attribute__((weak));
void serialEventB() {}
void serialEventUSB1() __attribute__((weak));
void serialEventUSB1() {}
void serialEventUSB2() __attribute__((weak));
void serialEventUSB2() {}

+ 2
- 2
teensy3/usb_serial2.h View File

@@ -128,8 +128,8 @@ public:
}

};
extern usb_serial2_class SerialA;
extern void serialEventA(void);
extern usb_serial2_class SerialUSB1;
extern void serialEventUSB1(void);
#endif // __cplusplus

#endif // F_CPU

+ 2
- 2
teensy3/usb_serial3.h View File

@@ -128,8 +128,8 @@ public:
}

};
extern usb_serial3_class SerialB;
extern void serialEventB(void);
extern usb_serial3_class SerialUSB2;
extern void serialEventUSB2(void);
#endif // __cplusplus

#endif // F_CPU

+ 2
- 2
teensy3/yield.cpp View File

@@ -40,10 +40,10 @@ void yield(void)
running = 1;
if (Serial.available()) serialEvent();
#if defined(USB_DUAL_SERIAL) || defined(USB_TRIPLE_SERIAL)
if (SerialA.available()) serialEventA();
if (SerialUSB1.available()) serialEventUSB1();
#endif
#ifdef USB_TRIPLE_SERIAL
if (SerialB.available()) serialEventB();
if (SerialUSB2.available()) serialEventUSB2();
#endif
if (Serial1.available()) serialEvent1();
if (Serial2.available()) serialEvent2();

+ 3
- 3
teensy4/usb_desc.h View File

@@ -158,7 +158,7 @@ let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports
#define CDC_TX_SIZE_480 512
#define CDC_RX_SIZE_12 64
#define CDC_TX_SIZE_12 64
#define CDC2_STATUS_INTERFACE 2 // SerialA
#define CDC2_STATUS_INTERFACE 2 // SerialUSB1
#define CDC2_DATA_INTERFACE 3
#define CDC2_ACM_ENDPOINT 4
#define CDC2_RX_ENDPOINT 5
@@ -189,12 +189,12 @@ let me know? http://forum.pjrc.com/forums/4-Suggestions-amp-Bug-Reports
#define CDC_TX_SIZE_480 512
#define CDC_RX_SIZE_12 64
#define CDC_TX_SIZE_12 64
#define CDC2_STATUS_INTERFACE 2 // SerialA
#define CDC2_STATUS_INTERFACE 2 // SerialUSB1
#define CDC2_DATA_INTERFACE 3
#define CDC2_ACM_ENDPOINT 4
#define CDC2_RX_ENDPOINT 5
#define CDC2_TX_ENDPOINT 5
#define CDC3_STATUS_INTERFACE 4 // SerialB
#define CDC3_STATUS_INTERFACE 4 // SerialUSB2
#define CDC3_DATA_INTERFACE 5
#define CDC3_ACM_ENDPOINT 6
#define CDC3_RX_ENDPOINT 7

+ 4
- 4
teensy4/usb_serial.h View File

@@ -208,8 +208,8 @@ public:
}

};
extern usb_serial2_class SerialA;
extern void serialEventA(void);
extern usb_serial2_class SerialUSB1;
extern void serialEventUSB1(void);
#endif // __cplusplus

#endif // CDC2_STATUS_INTERFACE && CDC2_DATA_INTERFACE
@@ -296,8 +296,8 @@ public:
}

};
extern usb_serial3_class SerialB;
extern void serialEventB(void);
extern usb_serial3_class SerialUSB2;
extern void serialEventUSB2(void);
#endif // __cplusplus

#endif // CDC3_STATUS_INTERFACE && CDC3_DATA_INTERFACE

Loading…
Cancel
Save