Add support for a triple serial port configuration (USB_TRIPLE_SERIAL),
providing a composite USB device, comprised of three serial ports.
The third serial port is called usb_serial3 (C) or SerialB (C++).
Note that no dummy C++ class is created if USB_DISABLED is defined,
unlike for the first port.
This increases binary size by ca. 0.5 KiB (despite needing 720 more
bytes for USB buffers, as gcc-5.4.1 no longer decides to unroll a loop
over all endpoints in usb_isr()).
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Add support for a dual serial port configuration (USB_DUAL_SERIAL),
providing a composite USB device, comprised of two serial ports.
The second serial port is called usb_serial2 (C) or SerialA (C++).
Note that no dummy C++ class is created if USB_DISABLED is defined,
unlike for the first port.
This increases binary size by ca. 1.2 KiB (720 bytes for USB buffers).
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Add preprocessor macros to control the naming of functions, structures
and classes, to ease the creation of multiple USB serial instances.
Name generation for each instance is controlled using the
USB_SERIAL_SUFFIX and SERIAL_CLASS_SUFFIX defines.
Move the preprocessor macro wrappers around the usb_serial_port data
members to usb_serial.h, as preprocessor macro names cannot be
parameterized.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Extract core USB serial functionality in a new usb_serial_port C class,
to allow creating multiple USB serial instances without duplicating all
code.
The original API is retained by creating static inline functions and
preprocessor macros using the old names, which are wrappers around the
new usb_serial_port functions and data members.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Create a macro to emit all values for a CDC Interface Association
Descriptor, and use it.
This will avoid duplication when adding support for multiple USB serial
interfaces.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Create a macro to emit all values for the various CDC descriptors, and
use it. Note that this does not include the CDC Interface Association
Descriptor, as the latter is needed only for composite USB devices.
This will avoid duplication when adding support for multiple USB serial
interfaces.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
When including "core_pins.h":
teensy3/usb_dev.c: In function '_reboot_Teensyduino_':
teensy3/usb_dev.c:899:1: warning: 'noreturn' function does return
Fix this by adding a call to __builtin_unreachable().
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
- usb_serial_class::readBytes() calls millis(), hence it should
include "core_pins.h",
- usb_serial_flush_callback() is a public function, but is not
declared in the header file.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
When processing CDC_SET_CONTROL_LINE_STATE and CDC_SET_LINE_CODING
requests, wIndex is ignored. Hence if the CDC Status Interface is
enabled, these requests are always processed, even when not destined for
the actual serial status interface.
Fix this by adding a check to ensure that wIndex matches the CDC status
interface.
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Longer term we might consider changing timer over to using system clock, with default(max) divisior of 4 to go to PID instead of fixed 24mhz...
But in the mean time, try to allow IntervalTimer Settings that work at least as well as default settings for T3.2 whoes BUS speed is 48mhz, so the magic number of 36 was used which allowed a minimum value passed into begin/update of 36
48*.75-.5
With T4 code we just blindly left the magic number of 36... So this one simply sort of halves it. 24*.75-.5 ... I rounded down to 17
If you call set priority it was only looking at priority of first two items, even though there could be 4. The main code that started an interrupt checked all 4. So I sort of copied that code over, only change was to simply set the top_priority to the first item to start with instead of 255 and then look at the first item
Add T4 ADC_ETC definitions for bits plus structure
Decided to go to the format that is closer to the the manual to
and use names like: chain_1_0, chain_3_2...