8000 Merge branch 'master' into mimxrt/bootloader · micropython/micropython@8c58533 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8c58533

Browse files
committed
Merge branch 'master' into mimxrt/bootloader
2 parents 9babd85 + 71344c1 commit 8c58533

File tree

220 files changed

+5064
-2639
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

220 files changed

+5064
-2639
lines changed

.github/workflows/examples.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Check examples
2+
3+
on:
4+
push:
5+
pull_request:
6+
paths:
7+
- '.github/workflows/*.yml'
8+
- 'examples/**'
9+
- 'ports/unix/**'
10+
- 'py/**'
11+
- 'shared/**'
12+
13+
jobs:
14+
embedding:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Build
19+
run: make -C examples/embedding
20+
- name: Run
21+
run: test "$(./examples/embedding/hello-embed)" = "Hello world of easy embedding!"

docs/differences/python_35.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Below is a list of finalised/accepted PEPs for Python 3.5 grouped into their imp
88
+----------------------------------------------------------------------------------------------------------+---------------+
99
| **Extensions to the syntax:** | **Status** |
1010
+--------------------------------------------------------+-------------------------------------------------+---------------+
11-
| `PEP 448 <https://www.python.org/dev/peps/pep-0448/>`_ | additional unpacking generalizations | |
11+
| `PEP 448 <https://www.python.org/dev/peps/pep-0448/>`_ | additional unpacking generalizations | Partial |
1212
+--------------------------------------------------------+-------------------------------------------------+---------------+
1313
| `PEP 465 <https://www.python.org/dev/peps/pep-0465/>`_ | a new matrix multiplication operator | Completed |
1414
+--------------------------------------------------------+-------------------------------------------------+---------------+

docs/esp32/quickref.rst

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ safe maximum source/sink currents and approximate internal driver resistances:
177177
- ``Pin.DRIVE_2``: 20mA / 30 ohm (default strength if not configured)
178178
- ``Pin.DRIVE_3``: 40mA / 15 ohm
179179

180+
The ``hold=`` keyword argument to ``Pin()`` and ``Pin.init()`` will enable the
181+
ESP32 "pad hold" feature. When set to ``True``, the pin configuration
182+
(direction, pull resistors and output value) will be held and any further
183+
changes (including changing the output level) will not be applied. Setting
184+
``hold=False`` will immediately apply any outstanding pin configuration changes
185+
and release the pin. Using ``hold=True`` while a pin is already held will apply
186+
any configuration changes and then immediately reapply the hold.
187+
180188
Notes:
181189

182190
* Pins 1 and 3 are REPL UART TX and RX respectively
@@ -186,8 +194,7 @@ Notes:
186194

187195
* Pins 34-39 are input only, and also do not have internal pull-up resistors
188196

189-
* The pull value of some pins can be set to ``Pin.PULL_HOLD`` to reduce power
190-
consumption during deepsleep.
197+
* See :ref:`Deep_sleep_Mode` for a discussion of pin behaviour during sleep
191198

192199
There's a higher-level abstraction :ref:`machine.Signal <machine.Signal>`
193200
which can be used to invert a pin. Useful for illuminating active-low LEDs
@@ -508,6 +515,8 @@ See :ref:`machine.WDT <machine.WDT>`. ::
508515
wdt = WDT(timeout=5000)
509516
wdt.feed()
510517

518+
.. _Deep_sleep_mode:
519+
511520
Deep-sleep mode
512521
---------------
513522

@@ -527,15 +536,49 @@ Notes:
527536
* Calling ``deepsleep()`` without an argument will put the device to sleep
528537
indefinitely
529538
* A software reset does not change the reset cause
530-
* There may be some leakage current flowing through enabled internal pullups.
531-
To further reduce power consumption it is possible to disable the internal pullups::
532539

533-
p1 = Pin(4, Pin.IN, Pin.PULL_HOLD)
540+
Some ESP32 pins (0, 2, 4, 12-15, 25-27, 32-39) are connected to the RTC during
541+
deep-sleep and can be used to wake the device with the ``wake_on_`` functions in
542+
the :mod:`esp32` module. The output-capable RTC pins (all except 34-39) will
543+
also retain their pull-up or pull-down resistor configuration when entering
544+
deep-sleep.
545+
546+
If the pull resistors are not actively required during deep-sleep and are likely
547+
to cause current leakage (for example a pull-up resistor is connected to ground
548+
through a switch), then they should be disabled to save power before entering
549+
deep-sleep mode::
550+
551+
from machine import Pin, deepsleep
552+
553+
# configure input RTC pin with pull-up on boot
554+
pin = Pin(2, Pin.IN, Pin.PULL_UP)
555+
556+
# disable pull-up and put the device to sleep for 10 seconds
557+
pin.init(pull=None)
558+
machine.deepsleep(10000)
559+
560+
Output-configured RTC pins will also retain their output direction and level in
561+
deep-sleep if pad hold is enabled with the ``hold=True`` argument to
562+
``Pin.init()``.
563+
564+
Non-RTC GPIO pins will be disconnected by default on entering deep-sleep.
565+
Configuration of non-RTC pins - including output level - can be retained by
566+
enabling pad hold on the pin and enabling GPIO pad hold during deep-sleep::
567+
568+
from machine import Pin, deepsleep
569+
import esp32
534570

535-
After leaving deepsleep it may be necessary to un-hold the pin explicitly (e.g. if
536-
it is an output pin) via::
571+
opin = Pin(19, Pin.OUT, value=1, hold=True) # hold output level
572+
ipin = Pin(21, Pin.IN, Pin.PULL_UP, hold=True) # hold pull-up
573+
574+
# enable pad hold in deep-sleep for non-RTC GPIO
575+
esp32.gpio_deep_sleep_hold(True)
576+
577+
# put the device to sleep for 10 seconds
578+
deepsleep(10000)
537579

538-
p1 = Pin(4, Pin.OUT, None)
580+
The pin configuration - including the pad hold - will be retained on wake from
581+
sleep. See :ref:`Pins_and_GPIO` above for a further discussion of pad holding.
539582

540583
SD card
541584
-------

docs/library/esp32.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ Functions
3030
or a tuple/list of valid Pin objects. *level* should be ``esp32.WAKEUP_ALL_LOW``
3131
or ``esp32.WAKEUP_ANY_HIGH``.
3232

33+
.. function:: gpio_deep_sleep_hold(enable)
34+
35+
Configure whether non-RTC GPIO pin configuration is retained during
36+
deep-sleep mode for held pads. *enable* should be a boolean value.
37+
3338
.. function:: raw_temperature()
3439

3540
Read the raw value of the internal temperature sensor, returning an integer.

docs/library/machine.I2S.rst

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,27 +75,24 @@ uasyncio::
7575
Constructor
7676
-----------
7777

78-
.. class:: I2S(id, *, sck, ws, sd, mode, bits, format, rate, ibuf)
78+
.. class:: I2S(id, *, sck, ws, sd, mck=None, mode, bits, format, rate, ibuf)
7979

8080
Construct an I2S object of the given id:
8181

82-
- ``id`` identifies a particular I2S bus.
83-
84-
``id`` is board and port specific:
85-
86-
- PYBv1.0/v1.1: has one I2S bus with id=2.
87-
- PYBD-SFxW: has two I2S buses with id=1 and id=2.
88-
- ESP32: has two I2S buses with id=0 and id=1.
82+
- ``id`` identifies a particular I2S bus; it is board and port specific
8983

9084
Keyword-only parameters that are supported on all ports:
9185

9286
- ``sck`` is a pin object for the serial clock line
9387
- ``ws`` is a pin object for the word select line
9488
- ``sd`` is a pin object for the serial data line
89+
- ``mck`` is a pin object for the master clock line;
90+
master clock frequency is sampling rate * 256
9591
- ``mode`` specifies receive or transmit
9692
- ``bits`` specifies sample size (bits), 16 or 32
9793
- ``format`` specifies channel format, STEREO or MONO
98-
- ``rate`` specifies audio sampling rate (samples/s)
94+
- ``rate`` specifies audio sampling rate (Hz);
95+
this is the frequency of the ``ws`` signal
9996
- ``ibuf`` specifies internal buffer length (bytes)
10097

10198
For all ports, DMA runs continuously in the background and allows user applications to perform other operations while

0 commit comments

Comments
 (0)
0