Skip to content

Commit a6a102d

Browse files
committed
lowpower: disable_pins added and defaulted False.
1 parent c7c788e commit a6a102d

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

lowpower/README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# A low power usayncio adaptation
22

3-
Release 0.12 23rd April 2019
3+
Release 0.13 17th Oct 2019
44

55
API changes: low power applications must now import `rtc_time_cfg` and set its
66
`enabled` flag.
@@ -21,6 +21,7 @@ This module is specific to Pyboards including the D series.
2121
3.2.3 [Current waveforms Pyboard 1](./README.md#323-current-waveforms-pyboard-1)
2222
3.2.4 [Pyboard D measurements](./README.md#324-pyboard-d-measurements)
2323
4. [The rtc_time module](./README.md#4-the-rtc_time-module)
24+
4.1 [rtc_time_cfg](./README.md#41-rtc_time_cfg)
2425
5. [Application design](./README.md#5-application-design)
2526
5.1 [Hardware](./README.md#51-hardware)
2627
5.2 [Application Code](./README.md#52-application-code)
@@ -327,6 +328,22 @@ around or to make it global. Once instantiated, latency may be changed by
327328
Latency(t)
328329
```
329330

331+
## 4.1 rtc_time_cfg
332+
333+
This consists of the following:
334+
```python
335+
enabled = False
336+
disable_3v3 = False
337+
disable_leds = False
338+
disable_pins = False
339+
```
340+
These variables may selectively be set `True` by the application prior to
341+
importing `uasyncio`. Setting `enabled` is mandatory if low power mode is to be
342+
engaged. The other variables control the 3.3V regulator, the LED drivers and
343+
GPIO pins: the latter may be set to inputs with pulldown resistors to minimise
344+
current draw. Unfortunately at the time of writing this feature seems to have
345+
a fatal effect. I am investigating.
346+
330347
###### [Contents](./README.md#a-low-power-usayncio-adaptation)
331348

332349
# 5. Application design

lowpower/rtc_time.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import sys
1313
import utime
1414
from os import uname
15-
from rtc_time_cfg import enabled, disable_3v3, disable_leds
15+
from rtc_time_cfg import enabled, disable_3v3, disable_leds, disable_pins
1616

1717
if not enabled: # uasyncio traps this and uses utime
1818
raise ImportError('rtc_time is not enabled.')
@@ -72,8 +72,9 @@ def low_power_pins():
7272
pins_bt = ['D5', 'D10', 'E3', 'E4', 'E5', 'E6', 'G8', 'G13', 'G14', 'G15', 'I4', 'I5', 'I6', 'I10']
7373
pins_qspi1 = ['B2', 'B6', 'D11', 'D12', 'D13', 'E2']
7474
pins_qspi2 = ['E7', 'E8', 'E9', 'E10', 'E11', 'E13']
75-
for p in pins:
76-
pyb.Pin(p, pyb.Pin.IN, pyb.Pin.PULL_DOWN)
75+
if disable_pins:
76+
for p in pins:
77+
pyb.Pin(p, pyb.Pin.IN, pyb.Pin.PULL_DOWN)
7778
if disable_3v3:
7879
pyb.Pin('EN_3V3', pyb.Pin.IN, None)
7980
if disable_leds:

lowpower/rtc_time_cfg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
enabled = False
33
disable_3v3 = False
44
disable_leds = False
5+
disable_pins = False

0 commit comments

Comments
 (0)