Wykres commitów

137 Commity (master)

Autor SHA1 Wiadomość Data
Angus Gratton 00fc3fd37b all: Enable ruff E401 and E402 import lints.
Mostly small cleanups to put each top-level import on its own line.  But
explicitly disable the lint for examples/tests which insert the current
directory into the path before importing.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-05-17 17:06:33 +10:00
Angus Gratton 992eecfed4 all: Enable Ruff lint F541 'f-string without any placeholders'.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-05-15 18:11:46 +10:00
Angus Gratton 6c6fab1db1 all: Enable ruff F841 'Local variable is assigned to but never used'.
Most of these look like they were used for print debugging and then kept in
when the print statements were removed or commented.

Some look like missing or incomplete functionality, these have been marked
with comments where possible.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-05-15 18:05:21 +10:00
Jon Foster cb281a4177 ntptime: Fix Year 2036 bug.
Fix NTP client - it would report the wrong time after 7 Feb 2036.

Signed-off-by: Jon Foster <jon@jon-foster.co.uk>
2024-05-15 15:36:02 +10:00
Damien George 7206da4645 mip: Bump minor version.
The previous commit added a new feature (ability to install from GitLab).

Signed-off-by: Damien George <damien@micropython.org>
2024-05-15 13:53:01 +10:00
Olivier Lenoir 57cbc34840 mip: Add support to mip install from GitLab.
Modify _rewrite_url() to allow mip install from `gitlab:` repository.

Signed-off-by: Olivier Lenoir <olivier.len02@gmail.com>
2024-05-15 13:43:06 +10:00
Angus Gratton 583bc0da70 usb: Add USB device support packages.
These packages build on top of machine.USBDevice() to provide high level
and flexible support for implementing USB devices in Python code.

Additional credits, as per included copyright notices:

- CDC support based on initial implementation by @hoihu with fixes by
  @linted.

- MIDI support based on initial implementation by @paulhamsh.

- HID keypad example based on work by @turmoni.

- Everyone who tested and provided feedback on early versions of these
  packages.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-04-30 15:57:50 +10:00
iabdalkader 661efa48f0 senml: Use the updated cbor2 API.
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-19 17:29:22 +11:00
Angus Gratton 224246531e lora-sx126x: Clean up some struct formatting.
Changes are cosmetic - and maybe very minor code size - but not functional.
_reg_read() was calling struct.packinto() with an incorrect number of
arguments but it seems like MicroPython didn't mind, as result is correct
for both versions.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:58:38 +11:00
Angus Gratton 35bb7952ba lora-sx126x: Fix syncword setting.
Fixes issue #796.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:58:08 +11:00
Angus Gratton 546284817a lora-sx127x: Implement missing syncword support.
This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:58:06 +11:00
Angus Gratton ad6ab5a78c lora-sync: Fix race with fast or failed send().
If send completes before the first call to poll_send(), the driver could
get stuck in _sync_wait(). This had much less impact before rp2 port went
tickless, as _sync_wait(will_irq=True) calls machine.idle() which may not
wake very frequently on a tickless port.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:57:50 +11:00
Angus Gratton b712103519 lora-sx126x: Fix invalid default configuration after reset.
According to the docs, only freq_khz was needed for working output.
However:

- Without output_power setting, no output from SX1262 antenna (theory:
  output routed to the SX1261 antenna).

- SF,BW,etc. settings were different from the SX127x power on defaults, so
  modems with an identical configuration were unable to communicate.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-02-20 16:44:57 +11:00
Felix Dörre 35d41dbb0e ssl: Restructure micropython SSL interface to a new tls module.
MicroPython now supplies SSL/TLS functionality in a new built-in `tls`
module.  The `ssl` module is now implemented purely in Python, in this
repository.  Other libraries are updated to work with this scheme.

Signed-off-by: Felix Dörre <felix@dogcraft.de>
2024-02-07 12:12:13 +11:00
Felix Dörre 803452a1ac umqtt.simple: Simplify check for user being unused.
There don't seem to be any MQTT implementations that expect an empty
username (instead of the field missing), so the check for unused `user` can
be simplified.

Signed-off-by: Felix Dörre <felix@dogcraft.de>
2024-02-07 12:12:09 +11:00
Bhavesh Kakwani 57ce3ba95c aioble: Fix advertising variable name to use us not ms. 2023-12-20 15:22:21 +11:00
Mark Blakeney 9ceda53180 uaiohttpclient: Update example client code.
Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
2023-12-20 14:56:09 +11:00
Mark Blakeney 05efdd03a7 uaiohttpclient: Update "yield from" to "await".
Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
2023-12-20 14:56:04 +11:00
Mark Blakeney 9d09cdd4af uaiohttpclient: Make flake8 inspired improvements.
Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
2023-12-20 14:56:00 +11:00
Mark Blakeney 149226d3f7 uaiohttpclient: Fix hard coded port 80.
Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
2023-12-20 14:55:51 +11:00
Andrew Leech f672baa92b aiorepl: Add support for raw mode (ctrl-a).
Provides support for mpremote features like cp and mount.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-12-20 12:35:40 +11:00
Andrew Leech 10c9281dad aiorepl: Add cursor left/right support.
Allows modifying current line, adding/deleting characters in the middle
etc.  Includes home/end keys to move to start/end of current line.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-12-20 12:33:43 +11:00
Andrew Leech d41851ca72 aiorepl: Add support for paste mode (ctrl-e).
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-12-20 12:33:19 +11:00
Andrew Leech e051a120bc aiorepl: Update import of asyncio.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-12-20 12:33:16 +11:00
Jim Mussared 83f3991f41 lcd160cr: Remove support for options in manifest.
This is the last remaining use of the "options" feature. Nothing in the
main repo which `require()`'s this package sets it.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-12-20 12:01:22 +11:00
Jim Mussared cee0945f1c all: Replace "black" with "ruff format".
- Add config for [tool.ruff.format] to pyproject.toml.
- Update pre-commit to run both ruff and ruff-format.
- Update a small number of files that change with ruff's rules.
- Update CI.
- Simplify codeformat.py just forward directly to "ruff format"

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-12-20 11:56:24 +11:00
Jim Mussared 46748d2817 aioble/server.py: Allow BufferedCharacteristic to support all ops.
Previously a BufferedCharacteristic could only be read by the client, where
it should have been writeable. This makes it support all ops (read / write
/ write-with-response, etc).

Adds a test to check the max_len and append functionality of
BufferedCharacteristic.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-04 14:47:38 +11:00
Jim Mussared e5ba864470 aioble/server.py: Add data arg for indicate.
In micropython/micropython#11239 we added support for passing data to
gatts_indicate (to make it match gatts_notify).

This adds the same to aioble.

Also update the documentation to mention this (and fix some mistakes and
add a few more examples).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-04 14:37:26 +11:00
Damien George e6b89eafa3 all: Remove unnecessary start argument in range.
To satisfy Ruff.

Signed-off-by: Damien George <damien@micropython.org>
2023-09-01 00:17:28 +10:00
Angus Gratton 7fcc728db2 lora/sx126x: Fix busy timeout handling.
- If no reset pin was set, calling standby() in the constructor
  would enable the TCXO (XOSC) before the timeout was correctly set.

- This manifested as a BUSY timeout on the STM32WL5, first time after power
on reset.

- Clean up the general handling of BUSY timeouts, but also add some safety
margin to the base timeout just in case (not an issue, is only a stop-gap
to prevent the modem blocking indefinitely.)

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-26 18:16:37 +10:00
Angus Gratton 0bdecbcba1 lora: Note known issue with STM32WL5 HP antenna.
For unknown reason, power output in this configuration is lower than it
should be (including when compared to the STM32Cube C libraries running on
the same board.

Suspect either the Nucleo board antenna switch or the power amplifier
registers are being set wrong, but the actual root cause remains elusive...

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-26 18:16:25 +10:00
Angus Gratton ed688cf019 lora: Add STM32WL55 subghz LoRa modem class.
Support depends on hardware support in MicroPython.

Also includes some tweaks in the SX126x base class, to deal with slightly
different platform configuration on STM32WL55, longer timeouts, tx_ant
options, etc.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-26 18:16:04 +10:00
Angus Gratton 93bf707d6f lora: Remove the pin parameter from IRQ callback.
It's not necessary to know which pin triggered the IRQ, and it saves some
code size.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-23 11:42:59 +10:00
Damien George dc765ad822 wm8960: Bump patch version.
For changes in 1f3002b537.

Signed-off-by: Damien George <damien@micropython.org>
2023-08-23 11:42:00 +10:00
Damien George 1b557eee5c lsm6dsox: Bump patch version.
For changes in 2d16f210b9.

Signed-off-by: Damien George <damien@micropython.org>
2023-08-23 11:41:22 +10:00
Angus Gratton b46306cc5a uaiohttpclient: Fix missing name in unreachable example code.
As-written this code is unreachable (return statement two line above),
so this change is really just to make the linter happy.

Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:51 +10:00
Angus Gratton 786c0ea895 all: Add missing const imports
Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:18 +10:00
Angus Gratton 1f3002b537 wm8960: Add missing self reference for sample table.
Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:12 +10:00
Angus Gratton 2d16f210b9 lsm6dsox: Add missing time import.
Driver calls time.sleep_ms() in one place.

Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:43:04 +10:00
Angus Gratton 86050c3d7a bmm150: Remove broken reset function.
Looks like copy-pasta from bmi270 driver.

There is a soft reset capability documented in the BMM150 datasheet, but it
uses different register bits and I don't have a BMM150 at hand to test it.

Found by Ruff checking F821.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-22 22:42:48 +10:00
Angus Gratton 674e734a1c drivers/display/lcd160cr: Use isinstance() for type checking.
Fixes linter warning E721, expanded in Ruff 823 to include
direct comparison against built-in types.
2023-08-09 18:59:03 +10:00
Christian Clauss 4da6e6f1b2 all: Lint Python code with ruff.
Signed-off-by: Christian Clauss <cclauss@me.com>
2023-07-24 07:51:33 +02:00
Jim Mussared 8fc9edabf3 all: Standardise x.y.z versioning for all packages.
- For packages that were just x.y, update to x.y.0.
- For that were x.y.z-n, update to x.y.(z+1)

From now on we'll apply semver rules:
- MAJOR version when you make incompatible API changes
- MINOR version when you add functionality in a backward compatible manner
- PATCH version when you make backward compatible bug fixes

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:48:57 +10:00
Jim Mussared 97b7a30ab9 xmltok: Bump patch version.
For changes in 66924d9fa1.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:48:25 +10:00
Jim Mussared 87b4cdae2f aiorepl: Bump patch version.
For changes in ff842310de.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:48:14 +10:00
Jim Mussared 8513bfbe9d requests: Rename urequests to requests.
This module implements a subset of the Python requests module, and so
it should have the same name.

Added a backwards-compatibility wrapper to allow people to continue to use
`import urequests`. This lives in micropython/urequests.

Changed requests to be a package, so that we can implement extension
packages in the future for optional functionality.

Added a basic README.md to both.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:41:44 +10:00
Jim Mussared 5004436164 tarfile: Rename from utarfile.
This is compatible with the CPython module, so should
be named tarfile.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-23 11:41:44 +10:00
Jim Mussared ff842310de aiorepl: Replace f-string with str.format.
f-strings aren't enabled on all builds (e.g. low-flash ESP8266).

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-21 17:10:41 +10:00
Jim Mussared c48b17dd17 aiorepl/README.md: More info about globals.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-07-21 16:06:49 +10:00
ThunderEX 66924d9fa1 xmltok: Change StopIteration to EOFError due to PEP-479.
Due to changes in MicroPython to support PEP-479, StopIteration has been
deprecated for return.  This results in xmltok to raise RuntimeError every
time.  This commit is a simple fix to just change from StopIteration to
EOFError and then return it in the generator.
2023-07-21 15:59:10 +10:00