summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-05-11docs/reference/mpyfiles: Add release info on v6.1.David Lechner
This documents when MPY v6.1 was released. Also add some clarification on how the version is encoded in the header. Signed-off-by: David Lechner <david@pybricks.com>
2023-05-10top: Add ruff to pre-commit.Christian Clauss
This does not align with the other pre-commit jobs with are local custom code but it should run accurately and quickly. Signed-off-by: Christian Clauss <cclauss@me.com>
2023-05-09tools/pyboard.py: Import errno to fix undefined name in PyboardError.Christian Clauss
This will keep line 96 from raising a NameError. Signed-off-by: Christian Clauss <cclauss@me.com>
2023-05-09mimxrt/machine_pin: Perform full configuration in machine_pin_set_mode.robert-hh
machine_pin_set_mode() is used by the internal mp_hal_pin_xxx() set of functions to configure pins.
2023-05-09mimxrt/machine_spi: Ignore transfers with len=0.robert-hh
It was treated as an error before. The error surfaced when using the NINAW10 drivers for WiFi support. Even if this is a bad behavior of the NINA driver, machine_spi can be forgiving in that situation.
2023-05-09mimxrt: Add missing UART defintion and remove obsolete config.robert-hh
Changes in this commit: - Add a missing UART defintion for MIMXRT1010_EVK. - Remove an obsolete line from mpconfigport.h.
2023-05-09mimxrt/mpconfigport: Add back lost uos.urandom().robert-hh
It got lost in a clean-up session recently.
2023-05-09mimxrt/flash: Separate low level driver code from flash object.Philipp Ebensberger
Separate low level flash access from mimxrt flash driver object. Allows better abstraction from hardware for testing and reuse in other areas (e.g. bootloader). Signed-off-by: Philipp Ebensberger <philipp.ebensberger@3bricks-software.de>
2023-05-09stm32/boards/ARDUINO_PORTENTA_H7: Enable FDCAN.Jim Lipsey
Add pin definitions to enable FDCAN support using the pyb.CAN() class.
2023-05-09py/gc: Make improvements to MICROPY_GC_HOOK_LOOP.David Lechner
Changes in this commit: - Add MICROPY_GC_HOOK_LOOP to gc_info() and gc_alloc(). Both of these can be long running (many milliseconds) which is too long to be blocking in some applications. - Pass loop variable to MICROPY_GC_HOOK_LOOP(i) macro so that implementers can use it, e.g. to improve performance by only calling a function every X number of iterations. - Drop outer call to MICROPY_GC_HOOK_LOOP in gc_mark_subtree().
2023-05-08CODECONVENTIONS: Require that commits be signed-off by the author.Damien George
And use "must" instead of "should" where appropriate in related text. Signed-off-by: Damien George <damien@micropython.org>
2023-05-08extmod/network_cyw43: Add power management constants.Damien George
And allow querying the current power management mode. Signed-off-by: Damien George <damien@micropython.org>
2023-05-06esp32,esp8266: Add support to set/get power saving mode of WLAN.glenn20
For esp32 and esp8266 this commit adds: - a 'pm' option to WLAN.config() to set/get the wifi power saving mode; and - PM_NONE, PM_PERFORMANCE and PM_POWERSAVE constants to the WLAN class. This API should be general enough to use with all WLAN drivers. Documentation is also added.
2023-05-04docs/samd: Make use of pin names more consistent in examples.robert-hh
This keeps up with the changed Pin naming scheme.
2023-05-04extmod/machine_pwm: Remove PWM_INIT and PWM_DUTY_U16_NS config options.Damien George
All ports that enable MICROPY_PY_MACHINE_PWM now enable these two sub-options, so remove these sub-options altogether to force consistency in new ports that implement machine.PWM. Signed-off-by: Damien George <damien@micropython.org>
2023-05-04rp2/machine_pwm: Add duty_x() checks and return 0 if PWM is not started.robert-hh
Changes in this commit: - Limit duty_u16() to 65535 and duty_ns() to the period duration. - Return 0 for pwm.freq() if the frequency has not been set yet. - Return 0 for pwm.duty_us16() and duty_ns() unless both frequency and duty cycle have been set. - Initialize the pin to PWM at the very end of the constructor, to avoid possible glitches on the pin when setting up the PWM.
2023-05-04rp2/machine_pwm: Add support for inverting a PWM channel output.robert-hh
Using the invert=True|False keyword option with the constructor or init().
2023-05-04esp8266/machine_pwm: Implement duty_u16() and duty_ns() for consistency.robert-hh
Also adds these keyword arguments to the constructor and init method.
2023-05-04docs: Update the PWM examples based on recent API improvements.robert-hh
This adds the freq and duty_u16 keyword settings to the constructor, and sometimes other details in the PWM section. For mimxrt a clarification regarding the PWM invert argument was added, and for rp2 a few words were spent on PWM output pairs of a channel/slice.
2023-05-04rp2/machine_pwm: Enable keyword args in constructor and add init method.robert-hh
This adds support for freq/duty_u16/duty_ns keyword arguments in the PWM constructor, and adds the PWM.init() method. Using init() without arguments enables a previously deinit-ed PWM again. Further changes in this commit: - Do not start PWM output if only duty was set. - Stop all PWM slices on soft-reset. - Fix a bug when changing the freq on a channel pair with duty_ns set.
2023-05-04samd/machine_pwm: Add init() method to PWM and simplify the PWM code.robert-hh
The PWM.init() method has been added. Calling init() without arguments restarts a PWM channel stopped with deinit(). Otherwise single parameters except for "device=n" can be changed again. The device can only be specified once, either in the constructor or the first init() call. Also simplify get_pwm_config() and get_adc_config(), and shrink the PWM object.
2023-05-04mimxrt/machine_pwm: Start PWM only if freq and duty are set.robert-hh
And also fix/improve the following: - Simplify the duty handling a little bit. - Allow duty_u16(65536), which sets the output high. - Rename machine_pwm_start() to mp_machine_pwm_start(), in preparation for a possible start/stop method pair.
2023-05-04tools/pyboard.py: Import serial.tools.list_ports.Damien George
This import is needed by newer versions of pyserial. Signed-off-by: Damien George <damien@micropython.org>
2023-05-04py/stackctrl: Add gcc pragmas to ignore dangling-pointer warning.Damien George
This warning became apparent in gcc 13. Signed-off-by: Damien George <damien@micropython.org>
2023-05-03lib/mbedtls: Update to mbedtls v2.28.3.Carlosgg
This is the latest release in the 2.28 long-time support branch. Signed-off-by: Carlos Gil <carlosgilglez@gmail.com>
2023-05-03py/compile: Remove over-eager optimisation of tuples as if condition.Damien George
When a tuple is the condition of an if statement, it's only possible to optimise that tuple away when it is a constant tuple (ie all its elements are constants), because if it's not constant then the elements must be evaluated in case they have side effects (even though the resulting tuple will always be "true"). The code before this change handled the empty tuple OK (because it doesn't need to be evaluated), but it discarded non-empty tuples without evaluating them, which is incorrect behaviour (as show by the updated test). This optimisation is anyway rarely applied because it's not common Python coding practice to write things like `if (): ...` and `if (1, 2): ...`, so removing this optimisation completely won't affect much code, if any. Furthermore, when MICROPY_COMP_CONST_TUPLE is enabled, constant tuples are already optimised by the parser, so expression with constant tuples like `if (): ...` and `if (1, 2): ...` will continue to be optimised properly (and so when this option is enabled the code that's deleted in this commit is actually unreachable when the if condition is a constant tuple). Signed-off-by: Damien George <damien@micropython.org>
2023-05-03py/parse: Fix build when COMP_CONST_FOLDING=0 and COMP_MODULE_CONST=1.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-05-02github/workflows: Add GitHub Action to lint Python code with ruff.Christian Clauss
Signed-off-by: Damien George <damien@micropython.org>
2023-05-02all: Fix cases of Python variable assigned but never used.Christian Clauss
This fixes ruff rule F841.
2023-05-02all: Fix various Python coding inconsistencies found by ruff.Christian Clauss
This fixes: - type-comparison (E721): do not compare types, use isinstance(). - string-dot-format-missing-arguments (F524): .format call is missing argument(s) for placeholder(s): {message}. - f-string-missing-placeholders (F541). - is-literal (F632): Use != to compare constant literals. The last one is fixed by just comparing for truthfulness of `state`.
2023-05-02all: Fix strings with backslash by using raw string literals.Christian Clauss
2023-05-02tools/mpremote: Remove unused import of serial.Christian Clauss
2023-05-01esp32,esp8266: Add support for the Espressif ESP-NOW protocol.Glenn Moloney
ESP-NOW is a proprietary wireless communication protocol which supports connectionless communication between ESP32 and ESP8266 devices, using vendor specific WiFi frames. This commit adds support for this protocol through a new `espnow` module. This commit builds on original work done by @nickzoic, @shawwwn and with contributions from @zoland. Features include: - Use of (extended) ring buffers in py/ringbuf.[ch] for robust IO. - Signal strength (RSSI) monitoring. - Core support in `_espnow` C module, extended by `espnow.py` module. - Asyncio support via `aioespnow.py` module (separate to this commit). - Docs provided at `docs/library/espnow.rst`. Methods available in espnow.ESPNow class are: - active(True/False) - config(): set rx buffer size, read timeout and tx rate - recv()/irecv()/recvinto() to read incoming messages from peers - send() to send messages to peer devices - any() to test if a message is ready to read - irq() to set callback for received messages - stats() returns transfer stats: (tx_pkts, tx_pkt_responses, tx_failures, rx_pkts, lost_rx_pkts) - add_peer(mac, ...) registers a peer before sending messages - get_peer(mac) returns peer info: (mac, lmk, channel, ifidx, encrypt) - mod_peer(mac, ...) changes peer info parameters - get_peers() returns all peer info tuples - peers_table supports RSSI signal monitoring for received messages: {peer1: [rssi, time_ms], peer2: [rssi, time_ms], ...} ESP8266 is a pared down version of the ESP32 ESPNow support due to code size restrictions and differences in the low-level API. See docs for details. Also included is a test suite in tests/multi_espnow. This tests basic espnow data transfer, multiple transfers, various message sizes, encrypted messages (pmk and lmk), and asyncio support. Initial work is from https://github.com/micropython/micropython/pull/4115. Initial import of code is from: https://github.com/nickzoic/micropython/tree/espnow-4115.
2023-05-01py/ringbuf: Implement put_bytes/get_bytes functions.glenn20
2023-05-01docs/reference: Remove double 'are' in glossary.algonell
2023-05-01lib/mbedtls_errors: Update patch and error list for new mbedtls.Damien George
Running `./do-mp.sh` now generates this mp_mbedtls_errors.c with mbedTLS v2.28.1. Signed-off-by: Damien George <damien@micropython.org>
2023-05-01lib/mbedtls_errors: Add esp32-specific mbedtls error file.Carlosgg
This allows updating mp_mbedtls_errors.c for the other mbedtls based ports based on mbedTLS v2.28.1. This esp32-specific file will not be required after updating IDF support to >= v4.4.1. Signed-off-by: Carlos Gil <carlosgilglez@gmail.com>
2023-04-30lib/mbedtls: Update to mbedtls v2.28.1.Carlosgg
Signed-off-by: Carlos Gil <carlosgilglez@gmail.com>
2023-04-30lib/mbedtls_errors: Update error list for current version of mbedtls.Damien George
This should have been updated as part of commit 7d73b9ff9975261bd2ff3544b09e9ec494775435, when mbedtls was changed to the LTS branch v2.16. Signed-off-by: Damien George <damien@micropython.org>
2023-04-27top: Add Black configuration section to pyproject.toml.Damien George
For convenience, eg for IDEs. Signed-off-by: Damien George <damien@micropython.org>
2023-04-27top: Update .git-blame-ignore-revs for latest spelling fix commit.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-04-27all: Fix spelling mistakes based on codespell check.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-04-27tools/pyboard.py: Rename ProcessPtyToTerminal member "ser" to "serial".Damien George
So that this file doesn't need to be excluded from codespell. Signed-off-by: Damien George <damien@micropython.org>
2023-04-27github/workflows: Add spell check to code formatting workflow.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-04-27tools/ci.sh: Add functions to check code spelling using codespell.Damien George
Signed-off-by: Damien George <damien@micropython.org> tools/ci.sh: Explicitly specify pyproject.toml. Signed-off-by: Damien George <damien@micropython.org> tools/ci.sh: Import tomli. Signed-off-by: Damien George <damien@micropython.org>
2023-04-27tools/ci.sh: Build both SAMD21 and SAMD51 boards as part of samd CI.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-04-27zephyr/modutime: Use extmod version of time module.Damien George
API change: time.time_ns() is added, but it just returns 0. No API or functional change to existing time functions. Signed-off-by: Damien George <damien@micropython.org>
2023-04-27webassembly/modutime: Use extmod version of time module.Damien George
No API or functional change. Signed-off-by: Damien George <damien@micropython.org>
2023-04-27unix/modutime: Use extmod version of time module.Damien George
No API or functional change. Signed-off-by: Damien George <damien@micropython.org>
2023-04-27stm32/modutime: Use extmod version of time module.Damien George
No API or functional change. Signed-off-by: Damien George <damien@micropython.org>