Browse Source

Revert "teensy3: usb_serial: Parameterize wrappers"

This reverts commit 68b0b84c58.
main
PaulStoffregen 4 years ago
parent
commit
c5f55c6ba0
2 changed files with 5 additions and 48 deletions
  1. +0
    -8
      teensy3/usb_serial.h
  2. +5
    -40
      teensy3/usb_serial_template.h

+ 0
- 8
teensy3/usb_serial.h View File

@@ -34,15 +34,7 @@
#include "usb_desc.h"

#if (defined(CDC_STATUS_INTERFACE) && defined(CDC_DATA_INTERFACE)) || defined(USB_DISABLED)
#define USB_SERIAL_SUFFIX /* none */
#define SERIAL_CLASS_SUFFIX /* none */

#include "usb_serial_template.h"

#define usb_cdc_line_coding usb_serial_instance.cdc_line_coding
#define usb_cdc_line_rtsdtr_millis usb_serial_instance.cdc_line_rtsdtr_millis
#define usb_cdc_line_rtsdtr usb_serial_instance.cdc_line_rtsdtr
#define usb_cdc_transmit_flush_timer usb_serial_instance.cdc_transmit_flush_timer
#endif // CDC_STATUS_INTERFACE && CDC_DATA_INTERFACE

#endif // USBserial_h_

+ 5
- 40
teensy3/usb_serial_template.h View File

@@ -29,28 +29,9 @@
*/

#include <inttypes.h>
#include <sys/cdefs.h> // for __CONCAT()

#include "usb_serial_port.h"

#define USB_SERIAL_PREFIX __CONCAT(usb_serial, USB_SERIAL_SUFFIX)
#define USB_SERIAL_NAME(func) __CONCAT(USB_SERIAL_PREFIX, _ ## func)
#define usb_serial_available USB_SERIAL_NAME(available)
#define usb_serial_class USB_SERIAL_NAME(class)
#define usb_serial_flush_callback USB_SERIAL_NAME(flush_callback)
#define usb_serial_flush_input USB_SERIAL_NAME(flush_input)
#define usb_serial_flush_output USB_SERIAL_NAME(flush_output)
#define usb_serial_getchar USB_SERIAL_NAME(getchar)
#define usb_serial_instance USB_SERIAL_NAME(instance)
#define usb_serial_peekchar USB_SERIAL_NAME(peekchar)
#define usb_serial_putchar USB_SERIAL_NAME(putchar)
#define usb_serial_read USB_SERIAL_NAME(read)
#define usb_serial_write_buffer_free USB_SERIAL_NAME(write_buffer_free)
#define usb_serial_write USB_SERIAL_NAME(write)

#define Serial __CONCAT(Serial, SERIAL_CLASS_SUFFIX)
#define serialEvent __CONCAT(serialEvent, SERIAL_CLASS_SUFFIX)

#if F_CPU >= 20000000 && !defined(USB_DISABLED)

#include "core_pins.h" // for millis()
@@ -111,6 +92,11 @@ static inline void usb_serial_flush_callback(void)
__usb_serial_flush_callback(&usb_serial_instance);
}

#define usb_cdc_line_coding usb_serial_instance.cdc_line_coding
#define usb_cdc_line_rtsdtr_millis usb_serial_instance.cdc_line_rtsdtr_millis
#define usb_cdc_line_rtsdtr usb_serial_instance.cdc_line_rtsdtr
#define usb_cdc_transmit_flush_timer usb_serial_instance.cdc_transmit_flush_timer

#ifdef __cplusplus
}
#endif
@@ -236,24 +222,3 @@ extern void serialEvent(void);


#endif // F_CPU

#undef usb_serial_available
#undef usb_serial_class
#undef usb_serial_flush_callback
#undef usb_serial_flush_input
#undef usb_serial_flush_output
#undef usb_serial_getchar
#undef usb_serial_instance
#undef usb_serial_peekchar
#undef usb_serial_putchar
#undef usb_serial_read
#undef usb_serial_write_buffer_free
#undef usb_serial_write

#undef Serial
#undef serialEvent

#undef USB_SERIAL_SUFFIX
#undef USB_SERIAL_PREFIX
#undef USB_SERIAL_NAME
#undef SERIAL_CLASS_SUFFIX

Loading…
Cancel
Save