Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions micropython/usb/examples/device/cdc_repl_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import usb.device
from usb.device.cdc import CDCInterface

cdc = CDCInterface()
cdc.init(timeout=0) # zero timeout makes this non-blocking, suitable for os.dupterm()
# Zero timeout makes this non-blocking, suitable for os.dupterm().
cdc = CDCInterface(timeout=0)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have to make this change, but I thought it was a little cleaner to set the timeout in the constructor.


# pass builtin_driver=True so that we get the built-in USB-CDC alongside,
# if it's available.
Expand Down
2 changes: 1 addition & 1 deletion micropython/usb/usb-device-cdc/manifest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
metadata(version="0.1.3")
metadata(version="0.1.4")
require("usb-device")
package("usb")
8 changes: 2 additions & 6 deletions micropython/usb/usb-device-cdc/usb/device/cdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,14 @@ def __init__(self, **kwargs):
self.line_coding_cb = None

self._line_state = 0 # DTR & RTS
# Set a default line coding of 115200/8N1
self._line_coding = bytearray(b"\x00\xc2\x01\x00\x00\x00\x08")

self._wb = () # Optional write Buffer (IN endpoint), set by CDC.init()
self._rb = () # Optional read Buffer (OUT endpoint), set by CDC.init()
self._timeout = 1000 # set from CDC.init() as well
self._line_coding = bytearray(7) # Will be populated by .init()

# one control interface endpoint, two data interface endpoints
self.ep_c_in = self.ep_d_in = self.ep_d_out = None

self._c_itf = None # Number of control interface, data interface is one more

# The _timeout, _wb and _rb attributes will be set by this call to .init().
self.init(**kwargs)

def init(
Expand Down
Loading