summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2019-09-10 13:22:35 +1000
committerDamien George <damien.p.george@gmail.com>2019-09-10 13:22:35 +1000
commit50636e5296c2eb837a5c29941b392adeaab60d94 (patch)
tree259dbb5640b7ca9fb19354b7f199659d6d9556ad
parent2b07f56c2b6fecb4074d461f7ec50e6e9975fcbe (diff)
docs/library/pyb.rst: Update docs for pyb.usb_mode() function.
-rw-r--r--docs/library/pyb.rst26
1 files changed, 18 insertions, 8 deletions
diff --git a/docs/library/pyb.rst b/docs/library/pyb.rst
index 1e1e9ffaa..acb8fe450 100644
--- a/docs/library/pyb.rst
+++ b/docs/library/pyb.rst
@@ -259,14 +259,12 @@ Miscellaneous functions
Returns a string of 12 bytes (96 bits), which is the unique ID of the MCU.
-.. function:: usb_mode([modestr], vid=0xf055, pid=0x9801, hid=pyb.hid_mouse)
+.. function:: usb_mode([modestr], port=-1, vid=0xf055, pid=-1, msc=(), hid=pyb.hid_mouse, high_speed=False)
If called with no arguments, return the current USB mode as a string.
- If called with ``modestr`` provided, attempts to set USB mode.
- This can only be done when called from ``boot.py`` before
- :meth:`pyb.main()` has been called. The following values of
- ``modestr`` are understood:
+ If called with *modestr* provided, attempts to configure the USB mode.
+ The following values of *modestr* are understood:
- ``None``: disables USB
- ``'VCP'``: enable with VCP (Virtual COM Port) interface
@@ -277,16 +275,28 @@ Miscellaneous functions
For backwards compatibility, ``'CDC'`` is understood to mean
``'VCP'`` (and similarly for ``'CDC+MSC'`` and ``'CDC+HID'``).
- The ``vid`` and ``pid`` parameters allow you to specify the VID
- (vendor id) and PID (product id).
+ The *port* parameter should be an integer (0, 1, ...) and selects which
+ USB port to use if the board supports multiple ports. A value of -1 uses
+ the default or automatically selected port.
+
+ The *vid* and *pid* parameters allow you to specify the VID (vendor id)
+ and PID (product id). A *pid* value of -1 will select a PID based on the
+ value of *modestr*.
+
+ If enabling MSC mode, the *msc* parameter can be used to specify a list
+ of SCSI LUNs to expose on the mass storage interface. For example
+ ``msc=(pyb.Flash(), pyb.SDCard())``.
If enabling HID mode, you may also specify the HID details by
- passing the ``hid`` keyword parameter. It takes a tuple of
+ passing the *hid* keyword parameter. It takes a tuple of
(subclass, protocol, max packet length, polling interval, report
descriptor). By default it will set appropriate values for a USB
mouse. There is also a ``pyb.hid_keyboard`` constant, which is an
appropriate tuple for a USB keyboard.
+ The *high_speed* parameter, when set to ``True``, enables USB HS mode if
+ it is supported by the hardware.
+
Classes
-------