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

Serial6 KEYWORD1 Serial6 KEYWORD1
Serial7 KEYWORD1 Serial7 KEYWORD1
Serial8 KEYWORD1 Serial8 KEYWORD1
SerialUSB1 KEYWORD1
SerialUSB2 KEYWORD1
setRX KEYWORD2 setRX KEYWORD2
setTX KEYWORD2 setTX KEYWORD2
write9bit KEYWORD2 write9bit KEYWORD2

+ 3
- 3
teensy3/usb_desc.h View File

#define CDC_ACM_SIZE 16 #define CDC_ACM_SIZE 16
#define CDC_RX_SIZE 64 #define CDC_RX_SIZE 64
#define CDC_TX_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_DATA_INTERFACE 3
#define CDC2_ACM_ENDPOINT 5 #define CDC2_ACM_ENDPOINT 5
#define CDC2_RX_ENDPOINT 6 #define CDC2_RX_ENDPOINT 6
#define CDC_ACM_SIZE 16 #define CDC_ACM_SIZE 16
#define CDC_RX_SIZE 64 #define CDC_RX_SIZE 64
#define CDC_TX_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_DATA_INTERFACE 3
#define CDC2_ACM_ENDPOINT 5 #define CDC2_ACM_ENDPOINT 5
#define CDC2_RX_ENDPOINT 6 #define CDC2_RX_ENDPOINT 6
#define CDC2_ACM_SIZE 16 #define CDC2_ACM_SIZE 16
#define CDC2_RX_SIZE 64 #define CDC2_RX_SIZE 64
#define CDC2_TX_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_DATA_INTERFACE 5
#define CDC3_ACM_ENDPOINT 8 #define CDC3_ACM_ENDPOINT 8
#define CDC3_RX_ENDPOINT 9 #define CDC3_RX_ENDPOINT 9

+ 6
- 6
teensy3/usb_inst.cpp View File



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


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




void serialEvent() __attribute__((weak)); void serialEvent() __attribute__((weak));
void serialEvent() {} 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

} }


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


#endif // F_CPU #endif // F_CPU

+ 2
- 2
teensy3/usb_serial3.h View File

} }


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


#endif // F_CPU #endif // F_CPU

+ 2
- 2
teensy3/yield.cpp View File

running = 1; running = 1;
if (Serial.available()) serialEvent(); if (Serial.available()) serialEvent();
#if defined(USB_DUAL_SERIAL) || defined(USB_TRIPLE_SERIAL) #if defined(USB_DUAL_SERIAL) || defined(USB_TRIPLE_SERIAL)
if (SerialA.available()) serialEventA();
if (SerialUSB1.available()) serialEventUSB1();
#endif #endif
#ifdef USB_TRIPLE_SERIAL #ifdef USB_TRIPLE_SERIAL
if (SerialB.available()) serialEventB();
if (SerialUSB2.available()) serialEventUSB2();
#endif #endif
if (Serial1.available()) serialEvent1(); if (Serial1.available()) serialEvent1();
if (Serial2.available()) serialEvent2(); if (Serial2.available()) serialEvent2();

+ 3
- 3
teensy4/usb_desc.h View File

#define CDC_TX_SIZE_480 512 #define CDC_TX_SIZE_480 512
#define CDC_RX_SIZE_12 64 #define CDC_RX_SIZE_12 64
#define CDC_TX_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_DATA_INTERFACE 3
#define CDC2_ACM_ENDPOINT 4 #define CDC2_ACM_ENDPOINT 4
#define CDC2_RX_ENDPOINT 5 #define CDC2_RX_ENDPOINT 5
#define CDC_TX_SIZE_480 512 #define CDC_TX_SIZE_480 512
#define CDC_RX_SIZE_12 64 #define CDC_RX_SIZE_12 64
#define CDC_TX_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_DATA_INTERFACE 3
#define CDC2_ACM_ENDPOINT 4 #define CDC2_ACM_ENDPOINT 4
#define CDC2_RX_ENDPOINT 5 #define CDC2_RX_ENDPOINT 5
#define CDC2_TX_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_DATA_INTERFACE 5
#define CDC3_ACM_ENDPOINT 6 #define CDC3_ACM_ENDPOINT 6
#define CDC3_RX_ENDPOINT 7 #define CDC3_RX_ENDPOINT 7

+ 4
- 4
teensy4/usb_serial.h View File

} }


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


#endif // CDC2_STATUS_INTERFACE && CDC2_DATA_INTERFACE #endif // CDC2_STATUS_INTERFACE && CDC2_DATA_INTERFACE
} }


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


#endif // CDC3_STATUS_INTERFACE && CDC3_DATA_INTERFACE #endif // CDC3_STATUS_INTERFACE && CDC3_DATA_INTERFACE

Loading…
Cancel
Save