summaryrefslogtreecommitdiff
path: root/docs/library
AgeCommit message (Collapse)Author
2024-09-19docs/library: Document machine.Pin.toggle() method.Angus Gratton
Original commit was by @millosolomillo from 2022, but CI no longer accepts their auto-generated GitHub commit email... Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-09-17docs/library: Document math.log with two arguments.Damien George
The functionality is there but was not documented. Signed-off-by: Damien George <damien@micropython.org>
2024-08-29docs/library: Document the network.PPP class.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-08-29docs/library/machine.UART: Extend the documentation for UART.irq.robert-hh
For more ports and trigger options, based on the current state of the code. Signed-off-by: robert-hh <robert@hammelrath.com>
2024-08-29docs/library/machine.UART: Fix UART.irq docs to match current code.Damien George
These docs now match the code in `extmod/machine_uart.c`. IRQ trigger support still need to be updated for each port (to be done in a follow-up commit). Signed-off-by: Damien George <damien@micropython.org>
2024-08-01docs/library/neopixel: Mention bitstream timing tuple.Tim Weber
Signed-off-by: Tim Weber <scy@scy.name>
2024-07-23docs: Specify that machine.idle() returns at least every 1ms.Angus Gratton
A lot of existing code (i.e. micropython-lib lps22h, lcd160cr sensor drivers, lora sync_modem driver, usb-device-hid) calls machine.idle() inside a tight loop that is polling some condition. This reduces the power usage compared to constantly looping, but can be faster than calling a sleep function. However on a tickless port there's not always an interrupt before the condition they are polling for, so it's difficult to restructure this code if machine.idle() doesn't have any upper limit on execution time. This commit specifies an upper limit of 1ms before machine.idle() resumes execution. This is already the case for all ports except rp2. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-07-05docs: Update docs to replace ifconfig with ipconfig.Felix Dörre
Follow up to 1c6012b0b5c62f18130217f30e73ad3ce4c8c9e6 Signed-off-by: Felix Dörre <felix@dogcraft.de>
2024-07-02extmod/machine_usb_device: Add USBDevice.remote_wakeup method.Felix Dörre
This simply exposes the TinyUSB function. Signed-off-by: Felix Dörre <felix@dogcraft.de>
2024-06-24py/objint: Fix int.to_bytes() buffer size checks.Angus Gratton
Fixes and improvements to `int.to_bytes()` are: - No longer overflows if byte size is 0 (closes #13041). - Raises OverflowError in any case where number won't fit into byte length (now matches CPython, previously MicroPython would return a truncated bytes object). - Document that `micropython int.to_bytes()` doesn't implement the optional signed kwarg, but will behave as if `signed=True` when the integer is negative (this is the current behaviour). Add tests for this also. Requires changes for small ints, MPZ large ints, and "long long" large ints. Adds a new set of unit tests for ints between 32 and 64 bits to increase coverage of "long long" large ints, which are otherwise untested. Tested on unix port (64 bit small ints, MPZ long ints) and Zephyr STM32WB board (32 bit small ints, long long large ints). This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-05-15docs/library/asyncio: Document that ThreadSafeFlag now works on unix.Damien George
ThreadSafeFlag works on the unix port since commit df08c38c286561c08d5ac354428074817eb0c163. Signed-off-by: Damien George <damien@micropython.org>
2024-05-09docs/library/machine.USBDevice: Update note about packages in mp-lib.Angus Gratton
Also fix a small typo. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-04-17shared/tinyusb: Fix dynamic USB control callbacks for wLength==0.Angus Gratton
In the case where an OUT control transfer triggers with wLength==0 (i.e. all data sent in the SETUP phase, and no additional data phase) the callbacks were previously implemented to return b"" (i.e. an empty buffer for the data phase). However this didn't actually work as intended because b"" can't provide a RW buffer (needed for OUT transfers with a data phase to write data into), so actually the endpoint would stall. The symptom was often that the device process the request (if processing it in the SETUP phase when all information was already available), but the host sees the endpoint stall and eventually returns an error. This commit changes the behaviour so returning True from the SETUP phase of a control transfer queues a zero length status response. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-03-26docs/library/machine.RTC: Add docs for RTC.memory() method.Amirreza Hamzavi
Co-Authored-By: glenn20 <glenn20@users.noreply.github.com> Signed-off-by: Amirreza Hamzavi <amirrezahamzavi2000@gmail.com>
2024-03-20py/binary: Support half-float 'e' format in struct pack/unpack.Matthias Urlichs
This commit implements the 'e' half-float format: 10-bit mantissa, 5-bit exponent. It uses native _Float16 if supported by the compiler, otherwise uses custom bitshifting encoding/decoding routines. Signed-off-by: Matthias Urlichs <matthias@urlichs.de> Signed-off-by: Damien George <damien@micropython.org>
2024-03-19docs/library/rp2.DMA: Add documentation for rp2 DMA support.Nicko van Someren
Signed-off-by: Nicko van Someren <nicko@nicko.org>
2024-03-19docs/library/collections: Update deque docs to describe new features.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-03-15docs/library/openamp: Document the new openamp module.iabdalkader
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
2024-03-15extmod/machine_usb_device: Add support for Python USB devices.Angus Gratton
This new machine-module driver provides a "USBDevice" singleton object and a shim TinyUSB "runtime" driver that delegates the descriptors and all of the TinyUSB callbacks to Python functions. This allows writing arbitrary USB devices in pure Python. It's also possible to have a base built-in USB device implemented in C (eg CDC, or CDC+MSC) and a Python USB device added on top of that. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2024-03-07all: Prune trailing whitespace.Phil Howard
Prune trailing whitespace across the whole project (almost), done automatically with: grep -IUrl --color "[[:blank:]]$" --exclude-dir=.git --exclude=*.exp |\ xargs sed -i 's/[[:space:]]*$//' Exceptions: - Skip third-party code in lib/ and drivers/cc3100/ - Skip generated code in bluetooth_init_cc2564C_1.5.c - Preserve command output whitespace in docs, eg: docs/esp8266/tutorial/repl.rst Signed-off-by: Phil Howard <phil@gadgetoid.com>
2024-02-29docs/library/bluetooth: Add note that ESP32 supports pairing/bonding.Daniël van de Giessen
Pairing and bonding was fixed for the ESP32 in the two previous commits. Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
2024-02-07docs/library/sys.rst: Document implementation.version.releaselevel.Jos Verlinde
Signed-off-by: Jos Verlinde <jos_verlinde@hotmail.com>
2024-02-07docs: Use vfs module instead of os.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-02-07docs/library: Move vfs functions and classes from os to vfs module docs.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2024-02-05docs/library/ssl: Change wrap_socket args keyfile/certfile to key/cert.Damien George
So they match the code in extmod/modssl_*.c. Signed-off-by: Damien George <damien@micropython.org>
2024-01-05all: Fix "reuse" and "overridden" spelling mistakes.Damien George
Codespell doesn't pick up "re-used" or "re-uses", and ignores the tests/ directory, so fix these manually. Signed-off-by: Damien George <damien@micropython.org>
2023-12-14docs/library: Document SSLContext cert methods and asyncio support.Carlosgg
Add `load_cert_chain`, `load_verify_locations`, `get_ciphers` and `set_ciphers` SSLContext methods in ssl library, and update asyncio `open_connection` and `start_server` methods with ssl support. Signed-off-by: Carlos Gil <carlosgilglez@gmail.com>
2023-11-22docs/library/esp: Correct the description of esp.osdebug().Angus Gratton
The behaviour described in the docs was not correct for either port. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-11-09esp32/esp32_rmt: Add RMT.PULSE_MAX constant.Mark Blakeney
If you have a variable frequency and pulse width, and you want to optimize pulse resolution, then you must do a calculation beforehand to ensure you normalize the array to keep all list values within bound. That calculation requires RMT.source_freq(), RMT.clock_div(), and this 32767 constant. Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
2023-11-09esp32/esp32_rmt: Change RMT.source_freq() to class method.Mark Blakeney
To create an esp32.RMT() instance with an optimum (i.e. highest resolution) clock_div is currently awkward because you need to know the source clock frequency to calculate the best clock_div, but unfortunately that is only currently available as an source_freq() method on the instance after you have already created it. So RMT.source_freq() should really be a class method, not an instance method. This change is backwards compatible for existing code because you can still reference that function from an instance, or now also, from the class. Signed-off-by: Mark Blakeney <mark.blakeney@bullet-systems.net>
2023-11-07extmod/machine_adc_block: Factor esp32 ADCBlock bindings to common code.Damien George
This is a code factoring to have the Python bindings in one location, and all the ports use those same bindings. At this stage only esp32 implements this class, so the code for the bindings comes from that port. The documentation is also updated to reflect the esp32's behaviour of ADCBlock.connect(). Signed-off-by: Damien George <damien@micropython.org>
2023-10-16docs/library/io: Remove io.FileIO and io.TextIOWrapper.Thomas Ackermann
FileIO and TextIOWrapper were removed in e65d1e69e88268145ff0e7e73240f028885915be. Remove them also from the documentation. Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
2023-10-04extmod/modnetwork: Increase max hostname length to 32.Jim Mussared
This changes from the previous limit of 15 characters. Although DHCP and mDNS allow for up to 63, ESP32 and ESP8266 only allow 32, so this seems like a reasonable limit to enforce across all ports (and avoids wasting the additional memory). Also clarifies that `MICROPY_PY_NETWORK_HOSTNAME_MAX_LEN` does not include the null terminator (which was unclear before). This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-10-03all: Fix various spelling mistakes found by codespell 2.2.6.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-09-15docs/library/gc: Clarify mem_alloc and mem_free only for Python heap.Angus Gratton
As raised in discussions of the ESP32 memory management changes. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-09-15docs/library/esp32: Update ESP32 idf_heap_info docs to match behaviour.Angus Gratton
Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-09-05esp32: Skip validation of image on boot from deepsleep.Glenn Moloney
sdkconfig.base: Add CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP=y. This reduces time to boot from deepsleep by at least 200ms and can provide significant power savings for deepsleep-based battery applications. docs/library/esp32.rst: Add note cautioning not to enter deepsleep after changing the boot partition, without first performing a hard reset. Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
2023-09-04docs/library/network: Clarify network.hostname() behaviour.Jim Mussared
This must be called before the interface connects. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-09-04docs/library/platform: Add docs for the platform library.Francis Dela Cruz
Signed-off-by: Francis Dela Cruz <rainyworlds1@outlook.com>
2023-09-01docs/library/neopixel: Change link to a micropython-lib reference.Andy Piper
Signed-off-by: Andy Piper <andypiperuk@gmail.com>
2023-09-01extmod/moddeflate: Change default window size.Jim Mussared
The primary purpose of this commit is to make decompress default to wbits=15 when the format is gzip (or auto format with gzip detected). The idea is that someone decompressing a gzip stream should be able to use the default `deflate.DeflateIO(f)` and it will "just work" for any input stream, even though it uses a lot of memory. This is done by making uzlib report gzip files as having wbits set to 15 in their header (where it previously only set the wbits out parameter for zlib files), and then fixing up the logic in `deflateio_init_read`. Updates the documentation to match. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-08-23stm32/subghz: Add STM32WL55 subghz radio interface to stm module.Angus Gratton
This is the minimum C interface to allow a modem driver to be built in Python. Interface is simple, with the intention that the micropython-lib driver is the main (only) consumer of it. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-15esp32: Enable automatic Python heap growth.Angus Gratton
Via MICROPY_GC_SPLIT_HEAP_AUTO feature flag added in previous commit. Tested on ESP32 GENERIC_SPIRAM and GENERIC_S3 configurations, with some worst-case allocation patterns and the standard test suite. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-07-21docs/library/deflate: Add docs for deflate.DeflateIO.Jim Mussared
Also update zlib & gzip docs to describe the micropython-lib modules. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-26docs/library/ssl: Add documentation for SSLContext.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-06-23docs/esp32: Update esp32 docs based on IDF v5 changes.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2023-06-19docs: Rename uasyncio to asyncio.Jim Mussared
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08docs/library/index: Update docs after umodule rename.Jim Mussared
- Update guide for extending built-in modules. - Remove any last trace of umodule in other docs. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08all: Rename UMODULE to MODULE in preprocessor/Makefile vars.Jim Mussared
This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-01docs/library/index: Update built-in extension docs.Jim Mussared
- Make the docs match the new behavior which only allows certain modules to be extended. - List the modules that currently have the u-prefix. - Add a note about the sys.path method for forcing a built-in import. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>