Move endpoint definitions to include files (they are now needed outside in usb_serial.cpp)

Signed-off-by: Manuel Odendahl <wesen@ruinwesen.com>
Handle sending 0 byte packets.

Added a flag to see if we are currently waiting on an interrupt to acknowledge the sending of the current
IN packet.
Added a method usb_cdcacm_is_transmitting() to check for that flag.

Signed-off-by: Manuel Odendahl <wesen@ruinwesen.com>
Check if the last packet sent was the full endpoint size, in this case flush the host buffers by sending a 0 byte packet

Signed-off-by: Manuel Odendahl <wesen@ruinwesen.com>
usb_cdcacm.c: Fixups for usb_cdcacm_tx().

- Check if we're transmitting (instead of how many bytes are left
  untransmitted) before bailing, in case we're transmitting a
  zero-length packet.

- Set transmitting=1 before setting the endpoint valid to avoid races
  with the USB interrupt.

- Eliminate some duplicated code.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Merge branch 'bug/usb-full-ep'

This resolves issues related to sending full (64B) packets via USB
2.0. In this case, some hosts continue to expect more data. Add
infrastructure for sending 0-byte packets to signal end of
transmission, and use it in SerialUSB.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>