examples/blinky.cpp: Use toggleLED() instead of digitalWrite().

Keep things simple.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Add fix to support Summon/Linaro GCC ARM embedded toolchain.

Signed-off-by: Dmitry Prokhorov <dipspb@gmail.com>
Add double buffering routines

Signed-off-by: Manuel Odendahl <wesen@ruinwesen.com>
Rename USB_EP_EP_KIND to USB_EP_EP_KIND_DBL_BUF

Signed-off-by: Manuel Odendahl <wesen@ruinwesen.com>
Refactor setting a USB EP rx count

Signed-off-by: Manuel Odendahl <wesen@ruinwesen.com>
Set DCNTR before starting DMA transfer.

I am not sure why this would work for most DMA transfers but I ran into trouble when doing
SDIO DMA.

Signed-off-by: Manuel Odendahl <wesen@ruinwesen.com>
Fix BKP write enable

Signed-off-by: Manuel Odendahl <wesen@ruinwesen.com>
Rename misleading ptr function

Signed-off-by: Manuel Odendahl <wesen@ruinwesen.com>
Move endpoint definitions to include files (they are now needed outside in usb_serial.cpp)

Signed-off-by: Manuel Odendahl <wesen@ruinwesen.com>
Merge remote-tracking branch 'wesen/bug/bkp'

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.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_reg_map.h: Fix incorrect register bit definitions.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
usb_reg_map.c: Fix incorrect function name call.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Merge branch 'dbl-buf-usb'

For bulk double buffer support.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.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>
usb_cdcacm: Make USB lib globals weak symbols.

This allows users to override them.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
usb_cdcacm: Reset transmitting flag in usbReset().

Thanks to Manuel Odenahl for the fix.

Signed-off-by: Marti Bolivar <mbolivar@leaflabs.com>
Preserve previous usb state when suspending / restore on resume

Signed-off-by: Manuel Odendahl <wesen@ruinwesen.com>