Skip to content

Commit d1cf81d

Browse files
committed
lowpower: README and rtc_time.py refelect change to uasyncio.version
1 parent 5d495ed commit d1cf81d

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lowpower/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ following:
113113

114114
```python
115115
try:
116-
if asyncio.version != 'fast_io':
116+
if asyncio.version[0] != 'fast_io':
117117
raise AttributeError
118118
except AttributeError:
119119
raise OSError('This requires fast_io fork of uasyncio.')
@@ -161,7 +161,7 @@ Applications can detect which timebase is in use by issuing:
161161

162162
```python
163163
try:
164-
if asyncio.version != 'fast_io':
164+
if asyncio.version[0] != 'fast_io':
165165
raise AttributeError
166166
except AttributeError:
167167
raise OSError('This requires fast_io fork of uasyncio.')
@@ -272,7 +272,7 @@ hardware and code. The only *required* change to application code is to add
272272

273273
```python
274274
try:
275-
if asyncio.version != 'fast_io':
275+
if asyncio.version[0] != 'fast_io':
276276
raise AttributeError
277277
except AttributeError:
278278
raise OSError('This requires fast_io fork of uasyncio.')

lowpower/rtc_time.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@
2323
if mode is None: # USB is disabled
2424
use_utime = False # use RTC timebase
2525
elif 'VCP' in mode: # User has enabled VCP in boot.py
26-
if pyb.Pin.board.USB_VBUS.value() == 1: # USB physically connected
26+
usb_conn = pyb.Pin.board.USB_VBUS.value() # USB physically connected to pyb V1.x
27+
if not usb_conn:
28+
usb_conn = hasattr(pyb.Pin.board, 'USB_HS_DP') and pyb.Pin.board.USB_HS_DP.value()
29+
if not usb_conn:
30+
usb_conn = hasattr(pyb.Pin.board, 'USB_DP') and pyb.Pin.board.USB_DP.value()
31+
if usb_conn:
2732
print('USB connection: rtc_time disabled.')
2833
else:
2934
pyb.usb_mode(None) # Save power

0 commit comments

Comments
 (0)