Wykres commitów

195 Commity (6ae440a8a144233e6e703f6759b7e7a0afaa37a4)

Autor SHA1 Wiadomość Data
Damien George 6ae440a8a1 aioble/examples: Change variable name to _ADV_INTERVAL_US.
Following 28136d837a

Signed-off-by: Damien George <damien@micropython.org>
2025-12-08 11:20:11 +11:00
Jos Verlinde c266d3023e all: Fix spelling and typos in comments and docstring.
Spelling preferences based on codespell configuration.

Signed-off-by: Jos Verlinde <Jos.Verlinde@Microsoft.com>
2025-12-08 11:02:34 +11:00
Pedro Araoz 0d838c3a86 umqtt.simple: Add unsubscribe method.
Addresses issues #197 and #512.

Signed-off-by: Pedro Araoz <paraoz22@gmail.com>
2025-12-02 13:33:12 +11:00
Hyx 8a230a6ebc usb-device-hid: Use report protocol after report descriptor requested.
So HID device will exit boot protocol mode when entering normal OS.

Signed-off-by: Hyx <hyx0329@outlook.com>
2025-12-02 13:24:32 +11:00
Hyx 9031aa3120 usb-device-hid: Fix descriptor protocol config and set correct default.
Subclass in HID interface descriptor is a flag of boot protocol support.
Set it according to the interface protocol settings.

HID devices should come up in non-boot mode according to Device Class
Definition for Human Interface Devices (HID) v1.11 Appendix F.5. Set the
initial state of interface protocol to report protocol.

Signed-off-by: Hyx <hyx0329@outlook.com>
2025-12-02 13:21:34 +11:00
Breno RdV 7d0a1f86be lora: Fix import error detection for missing drivers.
Signed-off-by: Breno RdV <breno@raccoon.ninja>
2025-11-19 09:17:51 +11:00
Marcel Petrick b3125247bf all: Correct various typos in comments and docs.
Non-functional changes only:
- Fixed minor spelling mistakes in comments.
- Corrected typos in user-facing strings.
- No variables, logic, or functional code was modified.

Signed-off-by: Marcel Petrick <mail@marcelpetrick.it>
2025-11-19 00:43:18 +11:00
Jos Verlinde 2992784136 all: Fix formatting errors in docstrings.
No changes to versions as only comments and docstrings changed

Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-11-19 00:16:52 +11:00
Jos Verlinde 7b01b50bfb aioble: Fix typo in README in aioble.ADDR_PUBLIC.
Fixes issue #699.

Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-11-19 00:16:26 +11:00
Jos Verlinde 28136d837a aioble/examples: Change variable name to _ADV_INTERVAL_US.
Fixes issue #1055.

Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-11-19 00:16:05 +11:00
Jos Verlinde a7c805cc37 mip: Optimize _CHUNK_SIZE const for code size.
17 bytes reduced.

Signed-off-by: Jos Verlinde <Jos_Verlinde@hotmail.com>
2025-11-13 14:39:50 +11:00
Ben Wynn 200e8d13c9 sdcard: Updating sector calculation for SDXC.
The current code only calculates sectors for SDHC, with a max of 32G
The new code will calculate sectors for SDXC, with a max of 2T

C_SIZE is 22 bits[69:48] and the high 2 bits of csd[7] are required
to be 0, currently, so i'm not masking them off.

The max value for C_SIZE is 0x3FFEFF, so C_SIZE+1*1024 is a 32-bit number.

bumped version in manifest.py

Signed-off-by: Ben Wynn <bwynn@glowie.com>
2025-11-13 10:27:31 +11:00
Hyx bdc4706cc7 usb-device-hid: Return True after submit_xfer.
This tells the caller that no error has occurred. The child classes can
use this state to do double buffering correctly.

If any fundamental error occurs in submit_xfer, the underlying code will
raise an exception.

Signed-off-by: Hyx <hyx0329@outlook.com>
2025-08-05 21:50:53 +10:00
Hyx ea763cad8d usb-device: Raise RuntimeError when DCD error occurs.
So the behavior matches the comment.

Signed-off-by: Hyx <hyx0329@outlook.com>
2025-08-05 21:50:48 +10:00
Andrew Leech 34c4ee1647 aiorepl: Handle stream shutdown.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2025-08-01 00:59:51 +10:00
Andrew Leech 913498ef05 aioble-l2cap: Raise correct error if l2cap disconnects during send.
If BLE disconnects in the middle of a send process, this change makes the
code raise `L2CAPDisconnectedError` rather than `TypeError` due to `_cid`
being `None`.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2025-06-24 12:31:37 +10:00
Andrew Leech aad2e48098 aiorepl: Use blocking reads for raw REPL and raw paste.
Raw REPL mode is generally used as a command channel where all stdio
traffic is related directly to the raw commands and responses sent.

For this to work in aiorepl we need to ensure background tasks don't sent/
receive anything on stdio else the command channel will be corrupted.

The simplest way to achieve this is to make the raw commands blocking and
atomic rather than asyncio, assuming the user wont leave the device in raw
mode for too long at any one time.

Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2025-06-04 00:39:31 +10:00
Adam Lewis 96bd01ec04 urllib.urequest: Add support for headers to urequest.urlopen.
This is an extension to CPython, similar to the `method` argument.

Signed-off-by: Adam Lewis <dotdashnotdotsoftware@gmail.com>
2025-05-28 11:56:45 +10:00
Daniël van de Giessen 54d5f7cee2
utop: Print IDF heap details.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2025-05-15 17:38:39 +02:00
Daniël van de Giessen 08e09afbe3
utop: Print MicroPython memory info.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2025-05-15 17:38:38 +02:00
Daniël van de Giessen 0d60de65b7
utop: Add initial implementation for ESP32.
Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2025-05-15 17:38:37 +02:00
Angus Gratton 68e0dfce0a all: Apply Ruff 0.11.6 reformatting changes.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-04-24 16:54:10 +10:00
Angus Gratton d887a021e8 top: Bump the Ruff version to 0.11.6.
With small code fixes to match.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-04-24 16:53:59 +10:00
Angus Gratton f8c8875e25 lora: Fix SNR value in SX126x received packets.
Wasn't being treated as a signed value.

Fixes issue #999.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2025-04-24 16:20:47 +10:00
Matthias Urlichs 9307e21dfb usb-device-cdc: Optimise writing small data so it doesn't require alloc.
Only allocate a memoryview when the (first) write was partial.

Signed-off-by: Matthias Urlichs <matthias@urlichs.de>
2025-04-13 13:27:47 +10:00
Leonard Techel f72f3f1a39 lora-sx126x: Fix invert_iq_rx / invert_iq_tx behaviour.
This commit fixes a typo and changes a tuple that needs to be mutable to a
list (because other parts of the code change elements of this list).

Signed-off-by: Damien George <damien@micropython.org>
2025-04-10 22:39:40 +10:00
Damien George 221a877f8a nrf24l10: Bump minor version.
Due to the previous three commits.

Signed-off-by: Damien George <damien@micropython.org>
2025-04-10 22:33:53 +10:00
marcsello c7103bb464 nrf24l01: Optimize status reading.
The value of the STATUS register is always transmitted by the chip when
reading any command.  So a R_REGISTER command and the turnaround time can
be spared by issuing a NOP command instead.

This implementation suggested by the datasheet.

This operation is compatible with both nRF24L01 and nRF24L01+.

Signed-off-by: Marcell Pünkösd <punkosdmarcell@rocketmail.com>
2025-04-10 22:31:47 +10:00
marcsello bd1ab77324 nrf24l01: Properly handle timeout.
The timeout condition was not handled before.  Upon timeout, this caused
the chip to stay active until another send command changed it's state.

Sometimes when it was unable to transmit the data, it got stuck in the tx
fifo causing it to fill up over time, which set the TX_FULL flag in the
STATUS register.

Since there was no exceptions raised, the user code could not differentiate
a successful send or a timeout condition.

Signed-off-by: Marcell Pünkösd <punkosdmarcell@rocketmail.com>
2025-04-10 22:29:46 +10:00
marcsello 3e859d2118 nrf24l01: Increase startup delay.
According to the datasheet of the NRF240L1 chip, 150 μs startup time is
only acceptable when the chip is clocked externally.  Most modules use a
crystal, which require 1.5 ms to settle.  It should be okay to wait more in
both cases, for a reliable startup.

Signed-off-by: Marcell Pünkösd <punkosdmarcell@rocketmail.com>
2025-04-10 22:25:40 +10:00
Damien George 98d0a2b69a umqtt.simple: Restore legacy ssl/ssl_params arguments.
Commit 35d41dbb0e changed the API for using
SSL with umqtt, but only did a minor version increase.  This broke various
uses of this library, eg
https://github.com/aws-samples/aws-iot-core-getting-started-micropython

Reinstate the original API for specifying an SSL connection.  This library
now supports the following:
- default, ssl=None or ssl=False: no SSL
- ssl=True and optional ssl_params specified: use ssl.wrap_socket
- ssl=<SSLContext instance>: use provided SSL context to wrap socket

Signed-off-by: Damien George <damien@micropython.org>
2025-04-10 21:10:01 +10:00
Damien George 96e17b65d1 mip: Make mip.install() skip /rom*/lib directories.
If a ROMFS is mounted then "/rom/lib" is usually in `sys.path` before the
writable filesystem's "lib" entry.  The ROMFS directory cannot be installed
to, so skip it if found.

Signed-off-by: Damien George <damien@micropython.org>
2025-03-11 16:27:09 +11:00
Glenn Moloney b379e4fb4c mip: Allow relative URLs in package.json.
This allows to specify relative URLs in package.json, which are resolved
relative to the package.json URL. This mirrors the functionality added to
mpremote in https://github.com/micropython/micropython/pull/12477.

Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
2025-02-24 14:23:06 +11:00
Angus Gratton a0ceed8269 aioespnow,webrepl: Use recommended network.WLAN.IF_[AP|STA] constants.
Removes the deprecated network.[AP|STA]_IF form.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-11-07 12:48:55 +11:00
Prabhu Ullagaddi d6faaf8472 umqtt.simple: Add optional socket timeout to connect method.
If there are any network issues, mqtt will block on the socket
non-deterministically.  This commit introduces a `timeout` option which
can be used to set a finite timeout on the socket.  Upon any issue, mqtth
lib will throw exception.
2024-11-07 11:51:33 +11:00
Joris van der Wel 68e3e07bc7 aioble: Pass additional connection arguments to gap_connect.
This allows the following arguments to be passed to `device.connect()`:

* scan_duration_ms
* min_conn_interval_us
* max_conn_interval_us

These are passed as-is to `gap_connect()`.  The default value for all of
these is `None`, which causes gap_connect to use its own defaults.

Signed-off-by: Joris van der Wel <joris@jorisvanderwel.com>
2024-10-18 13:03:39 +11:00
Felix Dörre a7cd740b64 usb-device: Allow signaling capability of remote_wakeup.
To use this feature you need to create a usb device signaling remote wakeup
and then enable remote wakeup on the host (on linux write enabled to
/sys/bus/usb/devices/<device>/power/wakeup). Then you can wake up the host
when is on standby using USBDevice.remote_wakeup.

Signed-off-by: Felix Dörre <felix@dogcraft.de>
2024-10-18 12:54:48 +11:00
Jatty Andriean 7f5ac83865 lora-sx127x: Fix configuring the implicit header option in the _SX127x.
The `_reg_update` method must be called after updating the implicit header
option's bit.

Signed-off-by: Jatty Andriean <jandriea@outlook.com>
2024-10-18 12:33:23 +11:00
Angus Gratton c61ca51c67 usb: Tidy up the description of TinyUSB callbacks.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-09-17 11:20:00 +10:00
Angus Gratton 01f45c118f usb: Add a note about buffer thread safety.
This is to replace a commit which added locking here but caused some other
problems. The idea behind the Buffer class is that a single producer can
call pend_write() more than once and it's idempotent, however this is very
complex to extend across multiple threads.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-09-11 17:13:53 +10:00
Angus Gratton 1d3c722b7d usb: Fix race if transfers are submitted by a thread.
The USB pending transfer flag was cleared before calling the completion
callback, to allow the callback code to call submit_xfer() again.

Unfortunately this isn't safe in a multi-threaded environment, as another
thread may see the endpoint is available before the callback is done
executing and submit a new transfer.

Rather than adding extra locking, specifically treat the transfer as still
pending if checked from another thread while the callback is executing.

Closes #874

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-09-11 17:13:53 +10:00
Angus Gratton 27e4d73bc2 umqtt.robust: Remove reference to missing example.
It looks like this example file was not added to the original commit back
in 6190cec14a.

Fixes issue #320.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-09-08 22:48:33 +10:00
Max Holliday 60d137029f lora-sx126x: Change to class-level memoryview for _cmd buf.
Currently, the LoRa SX126x driver dynamically creates at least one,
sometimes two, memoryview objects with each call to `_cmd`.  This commit
simply provides the class with a long-lived memoryview object for `_cmd` to
easily slice as necessary.

Unlike the SX127x chips, Semtech unfortunately designed the SX126x modems
to be more command-centric (as opposed to directly setting registers).
Given the amount `_cmd` is called during normal device operation, even a
minor improvement here should have a decent impact.

Basic TX and RX tests pass on hardware.

Signed-off-by: Max Holliday <maholli@stanford.edu>
2024-07-23 15:12:50 +10:00
Damien George fbf7e120c6 usb-device-keyboard: Fix ; and ` keycode names.
They should be named as the un-shifted version.

Signed-off-by: Damien George <damien@micropython.org>
2024-07-03 17:21:55 +10:00
Angus Gratton 0a91a37563 usb-device-cdc: Fix lost data in read() path if short reads happened.
If the CDC receive buffer was full and some code read less than 64 bytes
(wMaxTransferSize), the CDC code would submit an OUT transfer with N<64
bytes length to fill the buffer back up.

However if the host had more than N bytes to send then it would still send
the full 64 bytes (correctly) in the transfer. The remaining (64-N) bytes
would be lost.

Adds the restriction that CDCInterface rxbuf has to be at least 64 bytes.

Fixes issue #885.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-07-03 17:17:38 +10:00
Damien George 2b3bd5b7e0 aioble/multitests: Store a reference to tasks and cancel when done.
Storing references to tasks is required by CPython, and enforced by Ruff
RUF006.  In this case it's also reasonable to cancel these tasks once the
test is finished.

Signed-off-by: Damien George <damien@micropython.org>
2024-06-14 10:35:06 +10:00
Damien George 84ba452113 all: Use non-u versions of built-in modules.
This changes almost all uses of "u-module" to just "module" for the
following built-in modules:
- binascii
- collections
- errno
- io
- json
- socket
- struct
- sys
- time

There are some remaining uses of "u-module" naming, for the cases where the
built-in module is extended in Python, eg `python-stdlib/os` uses `uos`.

Also, there are remaining uses of `utime` when non-standard (compared to
CPython) functions are used, like `utime.ticks_ms()`.

Signed-off-by: Damien George <damien@micropython.org>
2024-06-14 10:35:06 +10:00
Damien George 7271f1ddc7 all: Change use of "uasyncio" to "asyncio".
Signed-off-by: Damien George <damien@micropython.org>
2024-06-14 10:29:46 +10:00
Damien George 2c30a4e91b aioble/multitests: Use multitest.output_metric for perf results.
The perf multitests now "pass" when run.

Signed-off-by: Damien George <damien@micropython.org>
2024-05-25 20:51:51 +10:00
Damien George 1e792c39d3 aioble/multitests: Adjust expected output for write capture test.
Testing shows that the first two writes always go through and the rest are
dropped, so update the .exp file to match that.

Signed-off-by: Damien George <damien@micropython.org>
2024-05-25 20:51:51 +10:00