Commit Graph

16 Commits

Author SHA1 Message Date
Damien George 69661f3343 all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-28 10:33:03 +11:00
Damien George 6705767da1 stm32/usb: Add support for VCP+MSC+HID mode, incl 2xVCP and 3xVCP. 2019-09-11 15:17:38 +10:00
Damien George 46b3cc4572 stm32/usb: Add support to auto-detect USB interface, either FS or HS.
If both FS and HS USB peripherals are enabled for a board then the active
one used for the REPL will now be auto-detected, by checking to see if both
the DP and DM lines are actively pulled low.  By default the code falls
back to use MICROPY_HW_USB_MAIN_DEV if nothing can be detected.
2019-07-03 11:51:13 +10:00
Damien George 53200247b7 stm32/usb: Add "msc" kw-arg to pyb.usb_mode to select MSC logical units.
With this the user can select multiple logical units to expose over USB MSC
at once, eg: pyb.usb_mode('VCP+MSC', msc=(pyb.Flash(), pyb.SDCard())).  The
default behaviour is the original behaviour of just one unit at a time.
2019-06-11 16:22:09 +10:00
Damien George ff91b05cfa stm32/usb: Support up to 3 VCP interfaces on USB device peripheral.
To enable define MICROPY_HW_USB_CDC_NUM to 3.
2019-05-31 11:35:42 +10:00
Damien George 0c29502ad9 stm32/usb: Refactor CDC VCP code to enable N CDC interfaces.
The board config option MICROPY_HW_USB_ENABLE_CDC2 is now changed to
MICROPY_HW_USB_CDC_NUM, and the latter should be defined to the maximum
number of CDC interfaces to support (defaults to 1).
2019-05-30 21:11:04 +10:00
Andrew Leech 70a28e3ad9 stm32/usb: Add USB device mode for VCP+VCP without MSC.
Selectable via pyb.usb_mode('VCP+VCP').
2019-04-28 21:31:47 +10:00
Andrew Leech 9d6f70f715 stm32: Make default USB_VCP stream go through uos.dupterm for main REPL.
Use uos.dupterm for REPL configuration of the main USB_VCP(0) stream on
dupterm slot 1, if USB is enabled.  This means dupterm can also be used to
disable the boot REPL port if desired, via uos.dupterm(None, 1).

For efficiency this adds a simple hook to the global uos.dupterm code to
work with streams that are known to be native streams.
2019-04-01 13:04:05 +11:00
Damien George e1ae9939ac stm32: Support compiling with object representation D.
With this and previous patches the stm32 port can now be compiled using
object representation D (nan boxing).  Note that native code and frozen mpy
files with float constants are currently not supported with this object
representation.
2018-07-08 23:25:11 +10:00
Damien George 47ecbbbecb stm32/usb: Add ability to have 2x VCP interfaces on the one USB device.
This patch adds the configuration MICROPY_HW_USB_ENABLE_CDC2 which enables
a new USB device configuration at runtime: VCP+VCP+MSC.  It will give two
independent VCP interfaces available via pyb.USB_VCP(0) and pyb.USB_VCP(1).
The first one is the usual one and has the REPL on it.  The second one is
available for general use.

This configuration is disabled by default because if the mode is not used
then it takes up about 2200 bytes of RAM.  Also, F4 MCUs can't support this
mode on their USB FS peripheral (eg PYBv1.x) because they don't have enough
endpoints.  The USB HS peripheral of an F4 supports it, as well as both the
USB FS and USB HS peripherals of F7 MCUs.
2018-05-14 23:44:45 +10:00
Damien George d966a33486 stm32: Change header include guards from STMHAL to STM32 to match dir. 2018-02-15 15:47:04 +11:00
Damien George 3130424b54 stm32/usbdev: Add support for MSC-only USB device class.
Select this mode in boot.py via: pyb.usb_mode('MSC')
2018-02-01 15:47:16 +11:00
Damien George 0eb333e3cf stm32/mphalport: Improve efficiency of mp_hal_stdout_tx_strn_cooked.
Also simplifies the code by removing the specialised (and inefficient)
cooked functions from UART and USB_VCP.
2017-10-19 14:15:32 +11:00
Damien George dbff0164b3 stm32/usbdev: Merge all global USB device state into a single struct.
This is the final piece of USB device refactoring to support multiple
USB device instances.
2017-09-21 21:51:15 +10:00
Damien George 3101a8fe32 stm32: Replace stray tabs with spaces. 2017-09-06 14:53:17 +10:00
Damien George 01dd7804b8 ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is
core and what is a port, and to allow the repository to grow with new ports
in a sustainable way.
2017-09-06 13:40:51 +10:00