kopia lustrzana https://github.com/micropython/micropython-lib
rodzic
942c80cbd0
commit
befd307535
|
@ -166,7 +166,9 @@ class _Device:
|
||||||
# Keep track of the interface and endpoint indexes
|
# Keep track of the interface and endpoint indexes
|
||||||
itf_num = builtin_driver.itf_max
|
itf_num = builtin_driver.itf_max
|
||||||
ep_num = max(builtin_driver.ep_max, 1) # Endpoint 0 always reserved for control
|
ep_num = max(builtin_driver.ep_max, 1) # Endpoint 0 always reserved for control
|
||||||
while len(strs) < builtin_driver.str_max - 1: # This is possibly unnecessary or wrong because
|
while (
|
||||||
|
len(strs) < builtin_driver.str_max - 1
|
||||||
|
): # This is possibly unnecessary or wrong because
|
||||||
# https://docs.micropython.org/en/latest/library/machine.USBDevice.html
|
# https://docs.micropython.org/en/latest/library/machine.USBDevice.html
|
||||||
# states all string values except index 0 should be plain ASCII
|
# states all string values except index 0 should be plain ASCII
|
||||||
strs.append(None) # Reserve other string indexes used by builtin drivers
|
strs.append(None) # Reserve other string indexes used by builtin drivers
|
||||||
|
@ -822,7 +824,7 @@ class Buffer:
|
||||||
# (No critical section needed as self._w is only updated by the producer.)
|
# (No critical section needed as self._w is only updated by the producer.)
|
||||||
self._w = (_w := self._n)
|
self._w = (_w := self._n)
|
||||||
end = (_w + wmax) if wmax else self._l
|
end = (_w + wmax) if wmax else self._l
|
||||||
return self._b[_w : end]
|
return self._b[_w:end]
|
||||||
|
|
||||||
def finish_write(self, nbytes):
|
def finish_write(self, nbytes):
|
||||||
# Called by the producer to indicate it wrote nbytes into the buffer.
|
# Called by the producer to indicate it wrote nbytes into the buffer.
|
||||||
|
@ -888,4 +890,4 @@ class Buffer:
|
||||||
if to_r:
|
if to_r:
|
||||||
b[:to_r] = pr[:to_r]
|
b[:to_r] = pr[:to_r]
|
||||||
self.finish_read(to_r)
|
self.finish_read(to_r)
|
||||||
return to_r
|
return to_r
|
||||||
|
|
Ładowanie…
Reference in New Issue