Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
c1ed5f7
lib/libhydrogen: Update to latest release.
ant9000 Feb 13, 2026
9e2df2d
rp2/boards/POLOLU_ZUMO_2040_ROBOT: Remove header file.
Feb 13, 2026
158cbd6
rp2: Switch all RNG sources from ROSC to pico_rand.
mimi89999 Feb 18, 2026
f02dc6d
esp32/esp32_rmt: Release GIL while waiting for TX done.
DvdGiessen Feb 16, 2026
b46f9f5
py/asmthumb: Do not clobber index register on viper load/store.
agatti Feb 15, 2026
424ae08
py/asmrv32: Do not clobber index register on viper load/store.
agatti Feb 15, 2026
43a4914
tests/micropython: Add a test for checking viper value clobbering.
agatti Feb 15, 2026
b006bb0
extmod/vfs_reader: Process pending events during file reads.
iabdalkader Feb 17, 2026
fdb7c0f
docs/develop/writingtests: Document parameters of run_test.py.
Josverl Oct 9, 2025
2e62b56
ports: Refactor os.urandom().
robert-hh Feb 17, 2026
6b8bcb6
extmod/modos: Raise an error at a negative argument of os.urandom().
robert-hh Feb 22, 2026
6dbabc9
tests/extmod/os_urandom.py: Add test for os.urandom.
dpgeorge Feb 23, 2026
2050055
tests/micropython: Add a test for throwing incomplete exception.
jepler Oct 14, 2025
aaa30ab
py/objtype: Expose mp_native_base_init_wrapper_obj.
jepler Oct 14, 2025
c199ba9
py/objexcept: Check for incompletely constructed exceptions.
jepler Oct 14, 2025
2631b06
tests/cpydiff: Add a section for throwing incomplete exceptions.
jepler Oct 16, 2025
412ffd4
tools/codeformat.py: Use input files when formatting python code.
stinos Feb 11, 2026
2ab88c3
tests/run-tests.py: Add an argument for showing which tests would run.
stinos Feb 9, 2026
ff4d4bf
tests/run-tests.py: Make skip logic work irregardless of test path.
stinos Feb 9, 2026
b8098df
tests/run-tests.py: Use normal discovery if tests dir passed explicitly.
stinos Feb 9, 2026
7b91633
tests/cmdline: Make tests succeed irregardless of invocation path.
stinos Feb 11, 2026
e08e3d7
tests/run-tests.py: Output consistent test file paths.
stinos Feb 11, 2026
0dac591
tests/run-multitests.py: Improve error handling for communication error.
projectgus Feb 5, 2026
104deaa
zephyr: Use nodelabel when printing device name.
maass-hamburg Jan 13, 2026
30cc160
zephyr: Fix macro for getting erase_block_size.
ant9000 Feb 11, 2026
ab86f75
github/workflows: Bump actions/upload-artifact from 6 to 7.
dependabot[bot] Feb 26, 2026
947d04e
github: Add a Generative AI Usage declaration to the PR template.
projectgus Feb 19, 2026
e8304ee
samd/boards: Add more flash choices for Adafruit M4 boards.
robert-hh Feb 24, 2026
f013735
tests/net_inet: Use the letsencrypt TLS root cert for all tests.
projectgus Feb 26, 2026
8a1f050
tests/run-internalbench.py: Add option for running against CPython.
AJMansfield Sep 11, 2025
1bbce9c
extmod/mbedtls: Factor out mbedtls_hardware_poll() to common code.
robert-hh Feb 26, 2026
d4b5eb8
lib/alif_ensemble-cmsis-dfp: Update to v1.3.4.
dpgeorge Jan 25, 2026
45556c4
alif: Fix ALIF_TOOLS to use $(TOP) and remove unused ALIF_CONFIG.
dpgeorge Jan 25, 2026
6d9d880
alif/modmachine: Disable IRQs before going to sleep.
dpgeorge Jan 25, 2026
3b92139
alif/ospi_flash: Add ospi_flash_sleep helper function.
dpgeorge Jan 25, 2026
414fcbf
alif/boards/OPENMV_AE3: Save power upon deepsleep.
dpgeorge Jan 25, 2026
aac4653
alif/boards/OPENMV_AE3: Allow user button to wake from sleep.
dpgeorge Jan 25, 2026
58d2610
alif/boards/ALIF_ENSEMBLE: Add all SW1 pins and enable pull-ups on them.
dpgeorge Jan 25, 2026
04bf835
alif/boards/ALIF_ENSEMBLE: Add an off-profile.
dpgeorge Feb 26, 2026
4191cec
alif/machine_rtc: Factor out RTC helper functions.
dpgeorge Feb 4, 2026
1a01f76
alif/modmachine: Implement timeout_ms argument to deepsleep.
dpgeorge Feb 4, 2026
bebb404
alif/boards/OPENMV_AE3: Configure sensor interrupts as GPIO input.
dpgeorge Feb 25, 2026
63e4529
alif/machine_pwm: Implement machine.PWM.
dpgeorge Feb 7, 2026
95b3e72
tests/extmod_hardware/machine_pwm.py: Add alif pin config.
dpgeorge Feb 10, 2026
bfc69db
extmod,rp2: Keep LWIP timer running if lwip poll_sockets() is called.
projectgus Feb 11, 2026
716aae8
tests/basics/builtin_str_hex.py: Remove corresponding .exp file.
dpgeorge Feb 12, 2026
65ddc23
py/objstr: Factor code with a helper function to create empty str/bytes.
dpgeorge Feb 12, 2026
06bfefe
py/objstr: Fix b"".hex() so it returns an empty str object.
dpgeorge Feb 12, 2026
c3ca843
rp2/modules/rp2.py: Don't corrupt globals on asm_pio() exception.
arachsys Oct 19, 2025
61bbd78
mimxrt: Implement Quadrature Encoder and Counter classes.
robert-hh Sep 24, 2021
b1aba22
mimxrt/boards/make-pins.py: Add the XBAR tag to the AF names.
robert-hh Jan 8, 2026
655dc9f
docs: Add documentation for the mimxrt Encoder/Counter class.
robert-hh Apr 19, 2022
b64f4f9
tests/extmod_hardware/machine_encoder.py: Add a MIMXRT configuration.
robert-hh Aug 5, 2025
43d38d9
tests/extmod_hardware/machine_encoder.py: Separate the connection test.
dpgeorge Jan 2, 2026
2322d37
tests/extmod_hardware/machine_counter.py: Separate the connection test.
dpgeorge Jan 2, 2026
550b68f
mimxrt/boards: Add missing declarations of XBARA1 for two boards.
robert-hh Mar 9, 2026
6820e22
mimxrt/boards/ADAFRUIT_METRO_M7: Remove unused WiFi/BLE declarations.
robert-hh Mar 9, 2026
41d49b6
mimxrt/machine_encoder: Remove executable mode bit.
dpgeorge Mar 9, 2026
b343a36
ports: Don't pass -nostdlib in CFLAGS.
projectgus Mar 3, 2026
58436b2
py/lexer: Fix parsing of f'{{'.
dpgeorge Mar 4, 2026
d4751a1
py: Add support for PEP 750's t-strings.
dpgeorge Jan 6, 2026
a989585
mpy-cross: Enable t-strings.
dpgeorge Jan 6, 2026
bdef10a
tests: Add full feature and coverage tests for PEP 750 template strings.
koxudaxi Nov 10, 2025
68c2d4e
docs/library: Document string.templatelib module.
koxudaxi Nov 10, 2025
10af0a2
rp2/boards/CYTRON_NANOXRP_CONTROLLER: Add support for NanoXRP board.
SaintSampo Dec 24, 2025
3a24bdb
rp2/boards/CYTRON_MOTION_2350_PRO: Add Cytron Motion 2350 Pro board.
sync-on-luma Feb 20, 2026
20ffe6f
rp2/boards/WAVESHARE_RP2350B_CORE: Add Waveshare RP2350B Core board.
bikeNomad Dec 26, 2025
1968b96
rp2/boards/WAVESHARE_RP2040_LCD_0_96: Add Waveshare RP2040 LCD 0.96.
EngineerWill Oct 26, 2023
8cbd320
rp2/boards/WAVESHARE_RP2040_PLUS: Add Waveshare RP2040 Plus 4M and 16M.
EngineerWill Oct 26, 2023
ad054fc
rp2/boards/WAVESHARE_RP2040_ZERO: Add Waveshare RP2040 Zero board.
EngineerWill Oct 26, 2023
4319927
tests/run-tests.py: Ignore known-flaky test failures.
pi-anl Feb 25, 2026
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
25 changes: 20 additions & 5 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
others can review your Pull Request.

Before submitting, please read:
https://github.com/micropython/micropython/blob/master/CODEOFCONDUCT.md
https://github.com/micropython/micropython/wiki/ContributorGuidelines

Please check any CI failures that appear after your Pull Request is opened.
Expand All @@ -12,16 +11,15 @@
### Summary

<!-- Explain the reason for making this change. What problem does the pull request
solve, or what improvement does it add? Add links if relevant. -->

solve, or what improvement does it add? Add links if relevant,
especially links to open issues. -->

### Testing

<!-- Explain what testing you did, and on which boards/ports. If there are
boards or ports that you couldn't test, please mention this here as well.

If you leave this empty then your Pull Request may be closed. -->

If you leave this section empty then your Pull Request may be closed. -->

### Trade-offs and Alternatives

Expand All @@ -31,3 +29,20 @@

Delete this heading if not relevant (i.e. small fixes) -->


### Generative AI

<!-- Please delete the answer below which doesn't apply, or write your own
answer with more details. -->

I did not use generative AI tools when creating this PR.

I used generative AI tools when creating this PR, but a human has checked the
code and is responsible for the code and the description above.

<!-- We require everyone to answer this question. If you delete this section or
ignore it then your PR may be closed.

For more information, consult the MicroPython Generative AI Policy:
https://github.com/micropython/micropython/wiki/ContributorGuidelines#generative-ai-policy
-->
2 changes: 1 addition & 1 deletion .github/workflows/code_size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
run: echo $PR_NUMBER > pr_number
- name: Upload diff
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@v7
with:
name: code-size-report
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mpremote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Build mpremote wheel
run: cd tools/mpremote && python -m build --wheel
- name: Archive mpremote wheel
uses: actions/upload-artifact@v6
uses: actions/upload-artifact@v7
with:
name: mpremote
path: |
Expand Down
73 changes: 73 additions & 0 deletions docs/develop/writingtests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,76 @@ And to run only a certain set of tests (eg a directory):

$ ./run-tests.py -d basics
$ ./run-tests.py float/builtin*.py

Using run-tests.py
------------------

The ``run-tests.py`` script supports several parameters to customize test execution:

**Target and Device Selection:**

* ``-t, --test-instance``

The -t option accepts the following for the test instance:

- **unix** - use the unix port of MicroPython, specified by the MICROPY_MICROPYTHON
environment variable (which defaults to the standard variant of either the unix
or windows ports, depending on the host platform)
- **webassembly** - use the webassembly port of MicroPython, specified by the
MICROPY_MICROPYTHON_MJS environment variable (which defaults to the standard
variant of the webassembly port)
- **port:<device>** - connect to and use the given serial port device
- **a<n>** - connect to and use /dev/ttyACM<n>
- **u<n>** - connect to and use /dev/ttyUSB<n>
- **c<n>** - connect to and use COM<n>
- **exec:<command>** - execute a command and attach to it's stdin/stdout
- **execpty:<command>** - execute a command and attach to the printed /dev/pts/<n> device
- **<a>.<b>.<c>.<d>** - connect to the given IPv4 address
- anything else specifies a serial port

**Test Selection:**

* ``-d, --test-dirs`` - Specify one or more test directories to run
* ``-i, --include REGEX`` - Include tests matching regex pattern
* ``-e, --exclude REGEX`` - Exclude tests matching regex pattern
* ``files`` - Specific test files to run

**Execution Options:**

* ``--emit <EMITTER>`` - MicroPython emitter, EMITTER can be bytecode or native. Default: bytecode
* ``--via-mpy`` - Compile .py files to .mpy first
* ``--heapsize`` - Set heap size for tests
* ``-j, --jobs N`` - Number of tests to run simultaneously

Set the MICROPY_MPYCROSS environment variable to use a specific version of ``mpy-cross`` when using ``--via-mpy``.

**Result Management:**

* ``-r, --result-dir`` - Directory for test results. Default: results/
* ``--print-failures`` - Show diff of failed tests and exit
* ``--clean-failures`` - Delete .exp and .out files from prior failed tests
* ``--run-failures`` - Re-run only previously failed tests

**Examples:**

.. code-block:: bash

# Run only basic tests with native emitter
$ ./run-tests.py --emit native -d basics extmod

# Run tests excluding async functionality
$ ./run-tests.py -e async

# Run tests matching *_pep_*
$ ./run-tests.py -i *_pep_*

# Run specific test files in parallel
$ ./run-tests.py -j 4 basics/list*.py

# Test on connected ESP32 board
$ ./run-tests.py -t /dev/ttyUSB0
# or
$ ./run-tests.py -t u0

# Re-run only failed tests from previous run
$ ./run-tests.py --run-failures
1 change: 1 addition & 0 deletions docs/library/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ library.
select.rst
socket.rst
ssl.rst
string.templatelib.rst
struct.rst
sys.rst
time.rst
Expand Down
95 changes: 90 additions & 5 deletions docs/library/machine.Counter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ class Counter -- pulse counter
Counter implements pulse counting by monitoring an input signal and counting
rising or falling edges.

Minimal example usage::
Minimal ESP32 example usage::

from machine import Pin, Counter

counter = Counter(0, Pin(0, Pin.IN)) # create Counter for pin 0 and begin counting
value = counter.value() # retrieve current pulse count

Availability: **ESP32**
Availability: **ESP32, MIMXRT**

Constructors
------------
Expand Down Expand Up @@ -47,12 +47,49 @@ Methods
or ``Counter.FALLING``. *(Supported on ESP32)*

- *direction* specifies the direction to count. Either ``Counter.UP`` (the
default) or ``Counter.DOWN``. *(Supported on ESP32)*
default) or ``Counter.DOWN``. *(Supported on ESP32 and MIMXRT)*
A :ref:`machine.Pin <machine.Pin>` object as parameter argument specifies a
pin which controls the counting direction. Low: Count up, High: Count down.
*(Supported on MIMXRT)*

- *filter_ns* specifies a minimum period of time in nanoseconds that the
source signal needs to be stable for a pulse to be counted. Implementations
should use the longest filter supported by the hardware that is less than
or equal to this value. The default is 0 (no filter). *(Supported on ESP32)*
or equal to this value. The default is 0 (no filter). *(Supported on ESP32 and MIMXRT)*

- *max* Specify the upper counting range. The position counter will count up
from a *min* start value up to *max*, then roll over to the init value and
increase the cycles counter by one. When counting down, the cycles counter
decreases at the transition from *min* to *max*. The range is reset by defining
both *max* and *min* to 0. The default value is the hardware's counter range.
*(Supported by MIMXRT and the ESP32 PCNT module)*

- *min* Specify the lower counting range. The default value is 0.
*(Supported by MIMXRT and the ESP32 PCNT module)*

- *index* A Pin specifier telling to which pin the index pulse is connected.
At a rising slope of the index pulse the pulse counter is reset to the min value and
the cycles counter is increased or decreased by one, depending on the counting direction.
A *value* of *None* disables the index
input. *(Supported on MIMXRT)*

- *reset* A Pin specifier telling to which pin the reset pulse is connected.
At a rising slope of the reset pulse the counter is set to the init
value, but the cycles counter is not changed. A *value* of *None* disables the reset input.
*(Supported on MIMXRT)*

- *match* Set the counter value at which the interrupt IRQ_MATCH shall trigger.
The value is not checked for being in the bounds of the counter range. This option
if equivalent to the *threshold* options of the ESP32 PCNT module.
A *value* of *None* resets the match value and disables the IRQ_MATCH interrupt.
*(Supported on MIMXRT)*

- *match_pin* A Pin specifier telling to which pin the match output is connected.
This output will have a high level as long as the counter matches the
match value. The signal is generated by the encoder logic and requires no
further software support. The pulse width is defined by the input signal frequency
and can be very short, like 20ns, or stay, if the counter stops at the match value.
A *value* of *None* disables the match output. *(Supported on MIMXRT)*

.. method:: Counter.deinit()

Expand All @@ -79,15 +116,63 @@ Methods
the counter (i.e. to measure the counts since the last call), and this will
avoid this problem.

.. method:: Counter.cycles([value])

Get or set the current cycles counter of the counter as signed 16 bit integer.
The value represents the overflow or underflow events of the count range.
With no arguments the actual cycles counter value is returned.
With a single *value* argument the cycles counter is set to that value. The
base counter is not changed. The method returns the previous value.
*(Supported on MIMXRT)*

.. method:: Counter.irq(handler=None, trigger=0, hard=False)

Specifies, that the *handler* is called when the respective *event* happens.

*event* may be:
- Counter.IRQ_RESET Triggered with a transition at the *reset* input.
- Counter.IRQ_INDEX Triggered with a transition at the *index* input.
- Counter.IRQ_MATCH Triggered when the positions counter matches the match value. For fast signals,
the actual position counter value when retrieved in the callback may be different from the trigger value.
- Counter.IRQ_ROLL_OVER Triggered when the position counter rolls over from the highest
to the lowest value.
- Counter.IRQ_ROLL_UNDER Triggered when the position counter rolls under from the lowest
to the highest value.

The callback function *handler* receives a single argument, which is the Counter object. All
events share the same callback. The event which triggers the callback can be identified
with the irq.flags() method. The argument *hard* specifies, whether the callback is called
as a hard interrupt or as regular scheduled function. Hard interrupts have always a short latency,
but are limited in that they must not allocate memory. Regular scheduled functions are not limited
in what can be used, but depending on the load of the device execution may be delayed.
Under low load, the difference in latency is minor.

The default arguments values are handler=None, trigger=0, hard=False. The callback will be
disabled, when called with handler=None.

The position match event is triggered as long as the position and match value are identical.
Therefore the position match callback is run in a one-shot fashion, and has to be enabled
again when the position has changed. It will be enabled by re-defining the trigger with either
:meth:`Counter.irq()` or :meth:`irq().trigger()`. For ESP32, Counter interrupts are handled
by the :ref:`PCNT<esp32.PCNT>`. *(Supported on MIMXRT)*

Constants
---------

.. data:: Counter.RISING
Counter.FALLING

Select the pulse edge.
Select the pulse edge. *(Supported on ESP32)*

.. data:: Counter.UP
Counter.DOWN

Select the counting direction.

.. data:: Counter.IRQ_RESET
Counter.IRQ_INDEX
Counter.IRQ_MATCH
Counter.IRQ_ROLL_OVER
Counter.IRQ_ROLL_UNDER

Select the IRQ trigger event. *(Supported on MIMXRT)*
Loading
Loading