Wykres commitów

1241 Commity (master)

Autor SHA1 Wiadomość Data
Jim Mussared 263737ecfe tools/pyboard.py: Add "touch" filesystem command.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-18 22:24:25 +10:00
Jim Mussared a311e9e3d4 tools/mpremote: Allow + terminator for fs commands.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-08-18 22:22:36 +10:00
David Peake 454d969781 docs/esp32: Fix string quoting consistency in SDCard mount example.
It appears that strings in the documentation are typically single quoted.
2022-08-17 12:00:35 +10:00
Ned Konz 5543b2a9cc extmod/uasyncio: Add clear method to ThreadSafeFlag.
This is useful in situations where the ThreadSafeFlag is reused and needs
to be cleared of any previous, unwanted event.

For example, clear the flag at the start of an operation, trigger the
operation (eg an I2C write), then (a)wait for an external event to set the
flag (eg a pin IRQ).  Further events may trigger the flag again but these
are unwanted and should be cleared before the next cycle starts.
2022-08-12 17:06:28 +10:00
Nathan Hendler 9bcb2c0a20 docs/library/rp2: Fix pull_thresh docs to use pull instead of push. 2022-08-11 14:29:47 +10:00
David Lechner 888e831bf7 docs: Update links for Arm GCC toolchain.
The separate A and RM toolchains have been discontinued and replaced
by a single toolchain. This updates the links to the RM toolchain to
the new toolchain.

Signed-off-by: David Lechner <david@pybricks.com>
2022-08-11 14:27:06 +10:00
chrismas9 c038ea0cc6 docs/library/pyb.Timer: Document how to use BKIN pin with example.
Document how to connect the Timer block BRK_IN to a physical Pin alternate
function.

Add an example of PWM Motor drive using complementary outputs with dead
time and break input to kill the PWM and generate a callback.

Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
2022-07-29 12:22:23 +10:00
chrismas9 33ea400ce8 docs/library/pyb.Pin: Add Pin.ALT constant.
Some Pin alternate functions are inputs, for example, timer capture and
break inputs.  In Pyb.Pin the only way to set alt mode is with Pin.AF_PP or
Pin.AF_OD.  It is not intuitive to use an output mode to configure an
input.  Pin.ALT is used in the machine.Pin class and works in pyb.Pin.

The examples are changed to use Pin.ALT because TIM2_CH3 can be a capture
input or pulse output.

Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
2022-07-29 12:16:32 +10:00
chrismas9 e168d47424 docs/library/pyb.Pin: Fix out-of-context paragraphs, and AF_PP typo.
Remove out of context callback paragraph, it was part of the wipy docs.
And move the paragraph about PULL_UP/PULL_DOWN resistor values to within
the init() method docs.  Also fix pull-pull -> push-pull.

Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
2022-07-29 12:07:09 +10:00
Peter Hinch fe5598452d docs/library/time: Provide more info about which epoch is used.
Some embedded targets use 1970 epoch.
2022-07-29 11:27:16 +10:00
Andrew Scheller fa15aed0f7 docs/library/neopixel: Add note that neopixel is included in rp2 builds. 2022-07-23 23:27:04 +10:00
Carlosgg b41cfea02a extmod/modussl_mbedtls: Implement cert_reqs and cadata arguments.
Add cert_reqs and cadata keyword-args to ssl.wrap_socket() and
ssl.CERT_NONE, ssl.CERT_OPTIONAL, ssl.CERT_REQUIRED constants to allow
certificate validation.

CPython doesn't accept cadata in ssl.wrap_socket(), but it does in
SSLContext.load_verify_locations(), so we use this name to at least match
the same name in load_verify_locations().

Add docs for these new arguments, as well as docs for the existing
server_hostname argument which is important for certificate validation.

Tests are added as well.

Signed-off-by: Carlos Gil <carlosgilglez@gmail.com>
2022-07-20 16:46:04 +10:00
David Lechner 81dbea1ce3 shared/readline: Use MP_REGISTER_ROOT_POINTER().
This uses MP_REGISTER_ROOT_POINTER() to register the readline_history root
pointer array used by shared/readline.c and removes the registration from
all mpconfigport.h files.

This also required adding a new MICROPY_READLINE_HISTORY_SIZE config option
since not all ports used the same sized array.

Signed-off-by: David Lechner <david@pybricks.com>
2022-07-18 13:48:49 +10:00
IhorNehrutsa 1ea82b6dcc esp32,esp8266: Rename WLAN dhcp_hostname config to hostname.
But retain old name for backwards compatibility.
2022-07-05 23:40:32 +10:00
Jim Mussared 3ce21945b1 docs/library/bluetooth: Add link to aioble.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2022-06-24 18:05:39 +10:00
Damien George db7682e02d extmod/uasyncio: Implement stream read(-1) to read all data up to EOF.
Fixes issue #6355.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-24 17:04:57 +10:00
Christian Walther ba21f76f89 esp32/modesp32: Add wake_on_ulp() so ULP can wake CPU from deepsleep.
Add esp32.wake_on_ulp() to give access to esp_sleep_enable_ulp_wakeup(),
which is needed to allow the ULP co-processor to wake the main CPU from
deep sleep.
2022-06-23 17:31:01 +10:00
Luiz Brandao 7861eddd0f docs/library/uasyncio: Consistently use "uasyncio" instead of "asyncio". 2022-06-21 17:28:48 +10:00
Patrick Joy 3d58bb23c2 docs/library/machine: Add note on interrupts being critical to system. 2022-06-21 17:25:11 +10:00
Stewart C. Russell f12754af06 docs: Set LaTeX engine to XeLaTeX for PDF generation.
Also added to suggested packages list for PDF build.

See comment in Sphinx project for (some) details:
https://github.com/sphinx-doc/sphinx/pull/5693#pullrequestreview-180444650
2022-06-21 14:49:13 +10:00
Damien George 9175482f29 docs/library: Remove unnecessary "pyb." prefix on class names.
Otherwise these classes are refered to with a double prefix, like
pyb.pyb.ADC.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-21 14:33:23 +10:00
Howard Lovatt 89e1e67748 docs/library/pyb.Timer: Document `brk` argument and its constants. 2022-06-21 14:22:50 +10:00
David Lechner a565811f23 extmod/modbtree: Use buffer protocol for keys/values.
This changes the btree implementation to use the buffer protocol for
reading key/values in all methods.  `str` and `bytes` objects are not the
only bytes-like objects that could be used.

Documentation and tests are also updated.

Addresses issue #8748.

Signed-off-by: David Lechner <david@pybricks.com>
2022-06-21 00:44:49 +10:00
David Lechner c118b5d0e4 extmod/extmod.mk: Separate out extmod file list from py.mk to extmod.mk.
This separates extmod source files from `py.mk`.  Previously, `py.mk`
assumed that every consumer of the py/ directory also wanted to include
extmod/.  However, this is not the case.  For example, building mpy-cross
uses py/ but doesn't need extmod/.

This commit moves all extmod-specific items from `py.mk` to `extmod.mk` and
explicitly includes `extmod.mk` in ports that use it.

Signed-off-by: David Lechner <david@pybricks.com>
2022-06-21 00:14:34 +10:00
iabdalkader 6e868d47dc docs: Update to use new WLAN argument names for ssid/security/key.
Addresses issue #8083.
2022-06-17 21:43:44 +10:00
Maureen Helm bada8b3cad zephyr: Upgrade to Zephyr v3.1.0.
Updates the Zephyr port build instructions and CI to use the latest Zephyr
release tag.

Tested on frdm_k64f.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-06-17 16:51:34 +10:00
Damien George 9b486340da all: Bump version to 1.19.1.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-17 12:57:59 +10:00
Damien George d7919ea71e all: Bump version to 1.19.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-16 15:11:02 +10:00
Andrew Scheller cedb93c179 docs: Update Raspberry Pi URLs from .org to .com. 2022-06-14 11:41:13 +10:00
Damien George cf7d962cf3 docs/reference/mpyfiles: Update .mpy description to match latest format.
Signed-off-by: Damien George <damien@micropython.org>
2022-06-10 16:42:43 +10:00
Damien George 9670a156da all: Rename MICROPY_PY_WIZNET5K to MICROPY_PY_NETWORK_WIZNET5K.
To match MICROPY_PY_NETWORK_CYW43 and MICROPY_PY_NETWORK_NINAW10.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-07 16:55:18 +10:00
Damien George efe23aca71 all: Remove third argument to MP_REGISTER_MODULE.
It's no longer needed because this macro is now processed after
preprocessing the source code via cpp (in the qstr extraction stage), which
means unused MP_REGISTER_MODULE's are filtered out by the preprocessor.

Signed-off-by: Damien George <damien@micropython.org>
2022-06-02 16:31:37 +10:00
Andrew Leech ea9a904b72 docs/reference/manifest: Add link to details about opt-level for freeze. 2022-05-27 14:45:46 +10:00
robert-hh f795d5bc38 docs/mimxrt: Move the pinout tables to a separate document.
This shortens the quickref.  Also change the note about the hardware SPI
frequeny limits.
2022-05-27 12:48:16 +10:00
robert-hh eda52e4d73 docs/mimxrt: Add i.MX RT1015 to general.rst, and a few clarifications. 2022-05-27 12:47:54 +10:00
David Lechner c012318d74 unix: Implement `-X realtime` command-line option on macOS.
This adds a new command line option to the unix port `-X realtime` to
enable realtime priority on threads.  This enables high precision timers
for applications that need more accurate timers.

Related docs:
https://developer.apple.com/library/archive/technotes/tn2169/_index.html

Fixes issue #8621.

Signed-off-by: David Lechner <david@pybricks.com>
2022-05-24 00:51:47 +10:00
Damien George c1b9d2259e py/dynruntime.mk: Add basic support for armv6m architecture.
The examples/natmod features0 and features1 examples now build and run on
ARMv6-M platforms.  More complicated examples are not yet supported because
the compiler emits references to built-in functions like __aeabi_uidiv.

Signed-off-by: Damien George <damien@micropython.org>
2022-05-23 23:01:25 +10:00
Damien George 079f3e5e5b py/parse: Allow all constant objects to be used in "X = const(o)".
Now that constant tuples are supported in the parser, eg (1, True, "str"),
it's a small step to allow anything that is a constant to be used with the
pattern:

    from micropython import const

    X = const(obj)

This commit makes the required changes to allow the following types of
constants:

    from micropython import const

    _INT = const(123)
    _FLOAT = const(1.2)
    _COMPLEX = const(3.4j)
    _STR = const("str")
    _BYTES = const(b"bytes")
    _TUPLE = const((_INT, _STR, _BYTES))
    _TUPLE2 = const((None, False, True, ..., (), _TUPLE))

Prior to this, only integers could be used in const(...).

Signed-off-by: Damien George <damien@micropython.org>
2022-05-18 16:18:35 +10:00
Damien George 2a366e183e docs/reference/mpyfiles: Remove docs about mpy flags and qstr win size.
Signed-off-by: Damien George <damien@micropython.org>
2022-05-17 12:51:54 +10:00
Takeo Takahashi a21fd7cc21 docs/renesas-ra: Remove unused image files.
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-05-03 13:22:01 +10:00
Takeo Takahashi 52add7b45c docs: Update files for renesas-ra port.
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-29 12:29:08 +09:00
Takeo Takahashi 1b61800530 docs/renesas-ra: Add renesas-ra docs files.
Signed-off-by: Takeo Takahashi <takeo.takahashi.xv@renesas.com>
2022-04-29 12:29:08 +09:00
Damien George 402df833fe py/modsys: Introduce sys.implementation._machine constant.
This contains a string useful for identifying the underlying machine.  This
string is kept consistent with the second part of the REPL banner via the
new config option MICROPY_BANNER_MACHINE.

This makes os.uname() more or less redundant, as all the information in
os.uname() is now available in the sys module.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-28 17:23:03 +10:00
Damien George 59c5d41611 py/modsys: Rename sys.implementation.mpy to sys.implementation._mpy.
Per CPython docs, non-standard attributes must begin with an underscore.

Signed-off-by: Damien George <damien@micropython.org>
2022-04-28 17:23:03 +10:00
Damien George 2a08e38c60 docs/library/network.WLAN: Add "txpower" to list of known WLAN configs.
Signed-off-by: Damien George <damien@micropython.org>
2022-04-22 21:51:29 +10:00
Damien George 9ab66b50cb docs/reference: Update constrained docs now that tuples can be const.
Signed-off-by: Damien George <damien@micropython.org>
2022-04-15 00:17:08 +10:00
Damien George 1daeeb2430 docs/differences: Update Python 3.5 diff, with optional listen backlog.
Signed-off-by: Damien George <damien@micropython.org>
2022-04-11 15:28:56 +10:00
Rob Knegjens d3d862769a tools/mpremote: Add option to mount cmd to allow "unsafe" symlinks.
Specifying the option `--unsafe-links` (or `-l`) to `mpremote mount` will
allow symlinks to be followed in the local directory that point outside of
the base directory path.

For the unsafe case the `path_check()` method of `PyboardCommand` still
checks for a common path but without expanding symlinks.  While this check
is currently redundant, it makes the purpose of the method clearer for
possible future uses or extensions.
2022-04-11 15:15:04 +10:00
Andrew Leech 3b99b4d675 docs/reference/mpremote: Add details about mount usage over soft reboot. 2022-04-04 16:50:07 +10:00
robert-hh 56b331ace6 drivers/codec: Add driver for the WM8960 codec.
This codec is assembled for the MIMXRT1xxx_DEV boards and available for
WM8960 breakout boards as well.

The driver itself has been tested as working with the MIMXRT boards and a
Sparkfun WM6890 breakout board.  It implements the initialization, basic
methods and some enhanced methods like 3D, ALC, soft-mute and deemphasis.
2022-04-04 16:31:17 +10:00
robert-hh 7a447e08b2 docs: Add quickref and docs for mimxrt, including network.LAN docs. 2022-04-04 14:11:31 +10:00
iabdalkader 5cdf964571 docs/library/pyb.CAN: Update CAN docs to match revised API. 2022-04-02 22:46:07 +11:00
David Lechner 783b1a868f py/runtime: Allow multiple *args in a function call.
This is a partial implementation of PEP 448 to allow unpacking multiple
star args in a function or method call.

This is implemented by changing the emitted bytecodes so that both
positional args and star args are stored as positional args.  A bitmap is
added to indicate if an argument at a given position is a positional
argument or a star arg.

In the generated code, this new bitmap takes the place of the old star arg.
It is stored as a small int, so this means only the first N arguments can
be star args where N is the number of bits in a small int.

The runtime is modified to interpret this new bytecode format while still
trying to perform as few memory reallocations as possible.

Signed-off-by: David Lechner <david@pybricks.com>
2022-03-31 16:59:30 +11:00
MikeTeachman 1f6cb8f047 mixmrt/machine_i2s: Add I2S protocol support.
This commit adds support for machine.I2S on the mimxrt port.  The I2S API
is consistent with the existing stm32, esp32, and rp2 implementations.

I2S features:
- controller transmit and controller receive
- 16-bit and 32-bit sample sizes
- mono and stereo formats
- sampling frequencies from 8kHz to 48kHz
- 3 modes of operation:
  - blocking
  - non-blocking with callback
  - uasyncio
- configurable internal buffer
- optional MCK

Tested with the following development boards:
- MIMXRT1010_EVK, MIMXRT1015_EVK, MIMXRT1020_EVK, MIMXRT1050_EVK
- Teensy 4.0, Teensy 4.1
- Olimex RT1010
- Seeed ARCH MIX

Tested with the following I2S hardware peripherals:
- UDA1334
- GY-SPH0645LM4H
- WM8960 codec on board the MIMXRT boards and separate breakout board
- INMP441
- PCM5102
- SGTL5000 on the Teensy audio shield

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
2022-03-30 14:12:40 +11:00
Damien George 5e685a9c6f docs/library/machine.I2S: Clarify what rate refers to.
Signed-off-by: Damien George <damien@micropython.org>
2022-03-29 11:44:08 +11:00
Jonathan Hogg 21d0599bd1 esp32/modesp32: Add new gpio_deep_sleep_hold function.
Add a new function to control whether held pins will retain their function
through deep-sleep.

Also document this function and explain how to use this in quickref to
retain pin configuration during deep-sleep.
2022-03-21 23:59:07 +11:00
Jonathan Hogg 7684c996bc esp32/machine_pin: Add new hold keyword argument and remove PULL_HOLD.
The current pull=Pin.PULL_HOLD argument doesn't make a lot of sense in the
context of what it actually does vs what the ESP32 quickref document says
it does.

This commit removes PULL_HOLD and adds a new hold=True|False keyword
argument to Pin()/Pin.init().  Setting this to True will cause the ESP32 to
lock the configuration of the pin – including direction, output value,
drive strength, pull-up/-down – such that it can't be accidentally changed
and will be retained through a watchdog or internal reset.

Fixes issue #8283, and see also #8284.
2022-03-21 23:55:02 +11:00
Jonathan Hogg 5887dfeea6 docs/esp32/quickref: Refine deep-sleep power-saving notes.
This attempts to better explain how pull-ups and pull-downs operate in
deep-sleep mode.
2022-03-21 23:54:41 +11:00
Damien George ac2293161e py/modsys: Add optional mutable attributes sys.ps1/ps2 and use them.
This allows customising the REPL prompt strings.

Signed-off-by: Damien George <damien@micropython.org>
2022-03-10 10:58:33 +11:00
Damien George cac939ddc3 py/modsys: Add optional sys.tracebacklimit attribute.
With behaviour as per CPython.

Signed-off-by: Damien George <damien@micropython.org>
2022-03-10 10:43:21 +11:00
Jonathan Hogg 3ebc370344 docs/library/machine.Pin: Update to use preferred DRIVE_x constants.
Update documents with new common names for the drive strength constants.
2022-03-07 23:47:45 +11:00
Jonathan Hogg 4c7c80d626 docs/esp32/quickref: Document GPIO drive strength.
Add brief documentation of the new `drive` keyword argument.
2022-03-07 23:41:29 +11:00
Maureen Helm 474d288e55 zephyr: Upgrade to Zephyr v3.0.0.
Updates the Zephyr port build instructions and CI to use the latest
Zephyr release tag.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-03-07 16:48:35 +11:00
Damien George bb2bd071f7 docs/library/esp32.rst: Mark esp32.Partition as not taking kw args.
Fixes issue #8380.

Signed-off-by: Damien George <damien@micropython.org>
2022-03-07 15:15:45 +11:00
David Lechner eadc927baf docs/differences/python_35: Mark PEP 486 as not applicable.
This adds the "Not relevant" designation to PEP 486 since it has to do with
the Python Launcher for Windows and not the Python language itself.

Also fix a typo while we are touching this line.

Signed-off-by: David Lechner <david@pybricks.com>
2022-03-07 14:15:21 +11:00
Jan 5d9171b5cc docs/library/machine.UART.rst: Add details for `invert` parameter. 2022-03-07 14:12:50 +11:00
Damien George d6564a3159 tools/mpremote: Add "umount" command.
Signed-off-by: Damien George <damien@micropython.org>
2022-02-25 13:10:45 +11:00
Damien George ad1f523e7e tools/mpremote: Add "resume" and "soft-reset" commands.
This makes the auto soft-reset behaviour of mpremote more logical, and now
configurable via these new commands.

Signed-off-by: Damien George <damien@micropython.org>
2022-02-25 13:09:28 +11:00
Damien George 106a83de22 esp32/esp32_partition: Add support for specifying block_size.
To support filesystems that use a block size different from the native
erase-page size.

Signed-off-by: Damien George <damien@micropython.org>
2022-02-22 00:37:25 +11:00
Lars Kellogg-Stedman 8f6924c9fb docs/library/uasyncio.rst: Fix description of ThreadSafeFlag.wait.
When a task waits on a ThreadSafeFlag (and the wait method returns), the
flag is immediately reset.  This was not clear in the documentation, which
appeared to copy the description of the wait method from the Event class.

Signed-off-by: Lars Kellogg-Stedman <lars@oddbit.com>
2022-02-09 16:09:48 +11:00
Jos Verlinde 6653856b87 docs/library/machine.Pin.rst: Document defaults for Pin.init. 2022-02-09 15:55:10 +11:00
Jos Verlinde 7f67524031 docs/library/pyb.SPI.rst: Document default for prescaler argument.
To prevent "non-default argument follows default argument" errors.
2022-02-09 15:06:34 +11:00
Jos Verlinde 58cd2a8b0a docs/library/esp.rst: Document the osdebug function. 2022-02-09 15:06:19 +11:00
Jos Verlinde f99b679916 docs/library/machine.WDT.rst: Use correct case for WDT.feed. 2022-02-09 15:05:49 +11:00
Jos Verlinde 7621b17636 docs/library/machine.SPI.rst: Add class constant SoftSPI.MSB and .LSB. 2022-02-09 15:05:38 +11:00
Jos Verlinde 8715ad9ccf docs/library/pyb.DAC.rst: Add DAC class constants. 2022-02-09 15:05:26 +11:00
Jos Verlinde ba4f6f5fdf docs/library/pyb.rst: Add pyb.hid_mouse and pyb.hid_keyboard constants. 2022-02-09 15:04:57 +11:00
Jos Verlinde 50b172023f docs/library/pyb.Timer.rst: Add pyb.Timer class constants. 2022-02-09 15:04:24 +11:00
Jos Verlinde 2c30ac7aeb docs/library/socket.rst: Document socket as a class.
Following CPython: https://bugs.python.org/issue45772
2022-02-09 15:03:26 +11:00
Jos Verlinde cd0531c533 docs: Use the correct * keyword-only notation. 2022-02-09 15:01:00 +11:00
Jos Verlinde a41abd94dc docs/library/collections.rst: Use class for deque and OrderedDict. 2022-02-09 15:00:00 +11:00
Peter Hinch 80b81acea5 docs/reference/isr_rules.rst: Describe uasyncio-IRQ interface. 2022-02-04 12:27:16 +11:00
Jonathan Hogg a43764e654 docs/esp32/quickref: Update ADC documentation.
Update ADC documentation now that the new API is described in the main
docs.
2022-02-04 12:05:15 +11:00
Luiz Brandao ddda959e57 docs/reference/isr_rules.rst: Fix inconsistent variable name in example.
Fixed to be conistent with the code example above it.
2022-02-04 11:20:15 +11:00
Cem Eliguzel 5943a2ec79 docs/develop/porting.rst: Fix build and import problems in the example. 2022-02-04 11:15:46 +11:00
Damien George 326b2c79df docs: Remove reference to obsolete neopixel_write function.
It has been replaced by machine.bitstream.

Signed-off-by: Damien George <damien@micropython.org>
2022-02-02 16:27:10 +11:00
Damien George 79a3158de6 stm32/pin: Change remaining uses of "af" to "alt".
The keyword "af" has been deprecated for some time and "alt" should be used
instead (but "af" still works).

Signed-off-by: Damien George <damien@micropython.org>
2022-01-27 16:44:13 +11:00
Damien George c153bfd311 docs/differences: Update python_36 now that b2a_base64 accepts newline.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-23 10:23:30 +11:00
Christian Decker 2e3a2785cd extmod/modubinascii: Add newline keyword to b2a_base64 function.
This allows encoding things (eg a Basic-Auth header for a request) without
slicing the \n from the string, which allocates additional memory.

Co-authored-by: David Lechner <david@lechnology.com>
2022-01-23 10:18:01 +11:00
Damien George aafd8859e9 docs/differences: Update differences now that math.tau/inf/nan exist.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-23 09:33:19 +11:00
Jonathan Hogg 3300d6d337 docs/esp32: Document expanded ADC API in quickref.
Document read_u16(), read_uv() and ADCBlock(). Mark old read(), atten() 
and width() methods as legacy.
2022-01-21 22:40:37 +11:00
Damien George 4d2f487ee1 docs/library: Specify additional ADC methods and new ADCBlock class.
The new ADC methods are: init(), read_uv() and block().

The new ADCBlock class has methods: init() and connect().

See related discussions in #3943, #4213.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-21 22:35:23 +11:00
Damien George 7d71ae25ed extmod/machine_i2c: Increase default SoftI2C timeout to 50ms.
Some devices, eg BNO055, can stretch SCL for a long time, so make the
default large to accommodate them.  50ms matches the current default for
stm32 hardware I2C .

Signed-off-by: Damien George <damien@micropython.org>
2022-01-21 15:10:30 +11:00
Damien George da4b38e756 all: Bump version to 1.18.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-17 09:50:31 +11:00
Damien George a3bbd5332b esp32/machine_bitstream: Reinstate bitstream bit-bang implementation.
The bit-bang implementation was replaced with the RMT implementation in
599b61c086.  This commit brings back that
bit-bang code, and allows it to be selected via the new static method:

    esp32.RMT.bitstream_channel(None)

The bit-bang implementation may be useful if the RMT needs to be used for
something else, or if bit-banging is more stable in certain applications.

Signed-off-by: Damien George <damien@micropython.org>
2022-01-14 16:40:01 +11:00
Damien George 8957386250 docs/esp32: Update RMT quickref example to match latest code.
The start keyword was removed in 18e48a71ee

Signed-off-by: Damien George <damien@micropython.org>
2022-01-13 22:39:58 +11:00
Damien George 8ac5613419 LICENSE,docs: Update copyright year range to include 2022.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-06 15:50:14 +11:00
Maureen Helm c6d26bc524 zephyr: Upgrade to Zephyr v2.7.0.
Updates the Zephyr port build instructions and CI to use the latest
Zephyr release tag.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-01-06 14:09:39 +11:00
NitiKaur 01953f2964 docs/differences: Document details of new PEPs/features in Python 3.5+.
And how they relate to MicroPython.  As these features are implemented (or
the decision is made to not implement them) the tables can be updated to
document the differences between MicroPython and standard Python.
2022-01-05 22:49:20 +11:00
IhorNehrutsa 09fe80d091 esp32/machine_pwm: Keep duty constant when changing frequency.
Save and restore the same duty cycle when the frequency (or frequency
resolution) is changed.  This allows a smooth frequency change.

Also update the esp32 PWM quickref to be clearer.
2021-12-22 00:05:58 +11:00
Damien George de43b500bd py/runtime: Allow initialising sys.path/argv with defaults.
If MICROPY_PY_SYS_PATH_ARGV_DEFAULTS is enabled (which it is by default)
then sys.path and sys.argv will be initialised and populated with default
values.  This keeps all bare-metal ports aligned.

Signed-off-by: Damien George <damien@micropython.org>
2021-12-18 00:08:07 +11:00
Jim Mussared 86394f70fc docs/library/sys.rst: Add note about '.frozen' as an entry in sys.path.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-12-18 00:08:07 +11:00
Damien George d9d67adef1 docs: Remove trailing spaces and convert tabs to spaces.
Signed-off-by: Damien George <damien@micropython.org>
2021-12-15 11:49:22 +11:00
IhorNehrutsa b491967bbd esp32/machine_pwm: Implement duty_u16() and duty_ns() PWM methods.
The methods duty_u16() and duty_ns() are implemented to match the existing
docs.  The duty will remain the same when the frequency is changed.
Standard ESP32 as well as S2, S3 and C3 are supported.

Thanks to @kdschlosser for the fix for rounding in resolution calculation.

Documentation is updated and examples expanded for esp32, including the
quickref and tutorial.  Additional notes are added to the machine.PWM docs
regarding limitations of hardware PWM.
2021-12-03 23:58:52 +11:00
Jonathan Hogg 851ecb2da1 extmod/modbluetooth: Support gap_connect(None) to cancel a connection.
Allow cancellation of in-progress peripheral connections.
2021-12-01 11:56:37 +11:00
Scott Armitage de7e3cd792 docs/library/machine.Pin.rst: Add Pin.ANALOG mode constant. 2021-11-30 22:33:18 +11:00
Michael Buesch 68d1245f42 docs/library/machine.Timer.rst: Document `period` and `callback` args.
Signed-off-by: Michael Buesch <m@bues.ch>
2021-11-30 22:29:03 +11:00
Michael Buesch 1e7c8f2b0b docs/library/machine.SPI.rst: Add example SPI usage.
Signed-off-by: Michael Buesch <m@bues.ch>
2021-11-30 22:28:19 +11:00
Michael Buesch e7900351bf docs/library/machine.Timer.rst: Document 'id' as positional-only arg.
Signed-off-by: Michael Buesch <m@bues.ch>
2021-11-30 22:27:58 +11:00
Peter Hinch d94ac4333f docs/library/uasyncio.rst: Detail exception behaviour in cancel/timeout. 2021-11-30 21:43:06 +11:00
gibbonsc de8dc4bad2 docs/esp8266/tutorial: Fix comments of FrameBuffer examples.
The third and fourth parameters in display.rect() and display.fill_rect()
are not x,y coordinates, but are instead width,height values.  Update the
comment after the example to show the correct x,y coordinates of the bottom
right corner of each rectangle, respectively.
2021-11-25 23:34:19 +11:00
NitiKaur b851950c26 docs/library/sys.rst: Add docs for sys.settrace. 2021-11-19 15:30:34 +11:00
NitiKaur e538d8a5a6 docs/rp2/quickref.rst: Add section on PIO. 2021-11-19 15:30:14 +11:00
Damien George 01f1c3aac2 docs/reference/filesystem.rst: Add detail on how to use littlefs fuse.
Without the --block_count option the fuse will fail.

Signed-off-by: Damien George <damien@micropython.org>
2021-11-19 15:13:05 +11:00
oli f72b49756d docs/library/rp2.rst: Update function asm_pio_encode to add sideset_opt. 2021-11-19 13:38:56 +11:00
Sebastian Wicki 8f3510799d docs/library/framebuf.rst: Adjust dimensions in example.
This commit swaps the dimensions of the `framebuffer.FrameBuffer` in the
docs example from 10x100 to 100x10 pixels to avoid clipping.

This is done to better fit the subsequent example code, which writes
text of size 96x8 followed by a 96x1 horizontal line.

The y coordinate of the horizontal line is also adjusted such that it is
drawn inside of the new canvas bounds.
2021-11-17 14:36:33 +11:00
Mike Teachman b6dbbbe82f rp2/machine_i2s: Add I2S protocol support.
This commit adds I2S protocol support for the rp2 port:
- I2S API is consistent with STM32 and ESP32 ports
- I2S configurations supported:
  - master transmit and master receive
  - 16-bit and 32-bit sample sizes
  - mono and stereo formats
  - sampling frequency
  - 3 modes of operation:
    - blocking
    - non-blocking with callback
    - uasyncio
  - internal ring buffer size can be tuned
- DMA IRQs are managed on an I2S object basis, allowing other
  RP2 entities to use DMA IRQs when I2S is not being used
- MicroPython documentation
- tested on Raspberry Pi Pico development board
- build metric changes for this commit: text(+4552), data(0), bss(+8)

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
2021-11-13 12:27:42 +11:00
Andrew Scheller 0adea40716 docs/rp2/general.rst: Fix typo with missing spaces. 2021-11-01 15:41:50 +11:00
Jim Mussared 43467b9c71 extmod/modbluetooth: Add connection interval to gap_connect.
This forwards through directly to the NimBLE and BTStack connect functions.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-10-26 00:16:53 +11:00
NitiKaur 4c9e17e0a1 docs/esp32/tutorial: Add an example of peripheral control via regs. 2021-10-14 23:31:45 +11:00
NitiKaur 763042a287 docs/library/stm.rst: Document the stm module. 2021-10-14 23:19:08 +11:00
NitiKaur e87b2e8bfa docs/reference/manifest.rst: Add docs for manifest.py files. 2021-10-14 14:03:03 +11:00
NitiKaur 135339ce3a docs/reference/mpremote.rst: Add docs for mpremote. 2021-10-14 13:09:51 +11:00
NitiKaur c42c1c8718 docs/library/random.rst: Document the random module. 2021-10-13 16:56:37 +11:00
NitiKaur baa5a76fc0 docs/rp2: Add reference for PIO assembly instructions, and PIO tutorial. 2021-10-13 15:54:49 +11:00
IhorNehrutsa 71111cffba docs/esp32: Explain ESP32 PWM modes, timers, and channels. 2021-09-21 23:28:16 +10:00
Jim Mussared b326edf68c all: Remove MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE.
This commit removes all parts of code associated with the existing
MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE optimisation option, including the
-mcache-lookup-bc option to mpy-cross.

This feature originally provided a significant performance boost for Unix,
but wasn't able to be enabled for MCU targets (due to frozen bytecode), and
added significant extra complexity to generating and distributing .mpy
files.

The equivalent performance gain is now provided by the combination of
MICROPY_OPT_LOAD_ATTR_FAST_PATH and MICROPY_OPT_MAP_LOOKUP_CACHE (which has
been enabled on the unix port in the previous commit).

It's hard to provide precise performance numbers, but tests have been run
on a wide variety of architectures (x86-64, ARM Cortex, Aarch64, RISC-V,
xtensa) and they all generally agree on the qualitative improvements seen
by the combination of MICROPY_OPT_LOAD_ATTR_FAST_PATH and
MICROPY_OPT_MAP_LOOKUP_CACHE.

For example, on a "quiet" Linux x64 environment (i3-5010U @ 2.10GHz) the
change from CACHE_MAP_LOOKUP_IN_BYTECODE, to LOAD_ATTR_FAST_PATH combined
with MAP_LOOKUP_CACHE is:

diff of scores (higher is better)
N=2000 M=2000       bccache -> attrmapcache      diff      diff% (error%)
bm_chaos.py        13742.56 ->   13905.67 :   +163.11 =  +1.187% (+/-3.75%)
bm_fannkuch.py        60.13 ->      61.34 :     +1.21 =  +2.012% (+/-2.11%)
bm_fft.py         113083.20 ->  114793.68 :  +1710.48 =  +1.513% (+/-1.57%)
bm_float.py       256552.80 ->  243908.29 : -12644.51 =  -4.929% (+/-1.90%)
bm_hexiom.py         521.93 ->     625.41 :   +103.48 = +19.826% (+/-0.40%)
bm_nqueens.py     197544.25 ->  217713.12 : +20168.87 = +10.210% (+/-3.01%)
bm_pidigits.py      8072.98 ->    8198.75 :   +125.77 =  +1.558% (+/-3.22%)
misc_aes.py        17283.45 ->   16480.52 :   -802.93 =  -4.646% (+/-0.82%)
misc_mandel.py     99083.99 ->  128939.84 : +29855.85 = +30.132% (+/-5.88%)
misc_pystone.py    83860.10 ->   82592.56 :  -1267.54 =  -1.511% (+/-2.27%)
misc_raytrace.py   21490.40 ->   22227.23 :   +736.83 =  +3.429% (+/-1.88%)

This shows that the new optimisations are at least as good as the existing
inline-bytecode-caching, and are sometimes much better (because the new
ones apply caching to a wider variety of map lookups).

The new optimisations can also benefit code generated by the native
emitter, because they apply to the runtime rather than the generated code.
The improvement for the native emitter when LOAD_ATTR_FAST_PATH and
MAP_LOOKUP_CACHE are enabled is (same Linux environment as above):

diff of scores (higher is better)
N=2000 M=2000        native -> nat-attrmapcache  diff      diff% (error%)
bm_chaos.py        14130.62 ->   15464.68 :  +1334.06 =  +9.441% (+/-7.11%)
bm_fannkuch.py        74.96 ->      76.16 :     +1.20 =  +1.601% (+/-1.80%)
bm_fft.py         166682.99 ->  168221.86 :  +1538.87 =  +0.923% (+/-4.20%)
bm_float.py       233415.23 ->  265524.90 : +32109.67 = +13.756% (+/-2.57%)
bm_hexiom.py         628.59 ->     734.17 :   +105.58 = +16.796% (+/-1.39%)
bm_nqueens.py     225418.44 ->  232926.45 :  +7508.01 =  +3.331% (+/-3.10%)
bm_pidigits.py      6322.00 ->    6379.52 :    +57.52 =  +0.910% (+/-5.62%)
misc_aes.py        20670.10 ->   27223.18 :  +6553.08 = +31.703% (+/-1.56%)
misc_mandel.py    138221.11 ->  152014.01 : +13792.90 =  +9.979% (+/-2.46%)
misc_pystone.py    85032.14 ->  105681.44 : +20649.30 = +24.284% (+/-2.25%)
misc_raytrace.py   19800.01 ->   23350.73 :  +3550.72 = +17.933% (+/-2.79%)

In summary, compared to MICROPY_OPT_CACHE_MAP_LOOKUP_IN_BYTECODE, the new
MICROPY_OPT_LOAD_ATTR_FAST_PATH and MICROPY_OPT_MAP_LOOKUP_CACHE options:
- are simpler;
- take less code size;
- are faster (generally);
- work with code generated by the native emitter;
- can be used on embedded targets with a small and constant RAM overhead;
- allow the same .mpy bytecode to run on all targets.

See #7680 for further discussion.  And see also #7653 for a discussion
about simplifying mpy-cross options.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16 16:04:03 +10:00
Jim Mussared e3eebc329f stm32: Suggest putting code in main.py not boot.py.
Don't want users to accidentally use boot.py (because recovering requires
knowing how to activate safe mode).

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-09-16 12:40:05 +10:00
Peter Hinch 4552f1816b docs/library/machine.I2S.rst: Specify that I2S.shift args are kw-only. 2021-09-13 18:21:46 +10:00
Ihor Nehrutsa c7842f4798 docs/make.bat: Change Windows output dir from '_build' to 'build'.
To match the output file used by Makefile.
2021-09-13 18:15:38 +10:00
Matt Trentini 60d3a3c3a0 docs/library/bluetooth.rst: Update incorrect link to gatts_write. 2021-09-10 15:24:02 +10:00
Peter Hinch cc0884bb4f docs/library/os.rst: Clarify littlefs requirements for block erase. 2021-09-10 15:21:12 +10:00
Damien George 7c54b64280 all: Bump version to 1.17.
Signed-off-by: Damien George <damien@micropython.org>
2021-09-02 00:07:13 +10:00
Peter Hinch 3720a570f2 docs/reference: Mention that slicing a memoryview causes allocation. 2021-08-30 23:55:29 +10:00
Fernando 4954290e86 docs/esp8266: Use monospace for software tools.
Signed-off-by: Fernando <fepegar@gmail.com>
2021-08-30 23:51:27 +10:00
Fernando 577a3c4192 docs/library: Fix usage of :term: for frozen module reference.
Signed-off-by: Fernando <fepegar@gmail.com>
2021-08-30 23:51:18 +10:00
Peter Hinch 2296df0a32 extmod/modframebuf: Enable blit between different formats via a palette.
This achieves a substantial performance improvement when rendering glyphs
to color displays, the benefit increasing proportional to the number of
pixels in the glyph.
2021-08-25 15:31:23 +10:00
Jim Mussared 53145c4c5f docs: Add docs for machine.bitstream and neopixel module.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-19 22:50:32 +10:00
Jim Mussared 44818d1a35 docs/library/network.rst: Simplify socket import.
Replace `import socket as socket` with `import socket`.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-17 11:26:24 +10:00
Jim Mussared af162257d3 docs/library/builtins.rst: Add module title.
This fixes the rendering on library/index.rst.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-17 11:26:24 +10:00
Jim Mussared 1d9e489af3 extmod/modbluetooth: Add send_update arg to gatts_write.
This allows the write to trigger a notification or indication, but only to
subscribed clients. This is different to gatts_notify/gatts_indicate,
which will unconditionally notify/indicate.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-14 22:21:55 +10:00
Jim Mussared d7fbc755dc docs/library/index.rst: Clarify module naming and purpose.
Adds section about extending built-in modules from Python.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-13 23:14:08 +10:00
Jim Mussared c737cde947 docs: Replace ufoo with foo in all docs.
Anywhere a module is mentioned, use its "non-u" name for consistency.

The "import module" vs "import umodule" is something of a FAQ, and this
commit intends to help clear that up.  As a first approximation MicroPython
is Python, and so imports should work the same as Python and use the same
name, to a first approximation.  The u-version of a module is a detail that
can be learned later on, when the user wants to understand more and have
finer control over importing.

Existing Python code should just work, as much as it is possible to do that
within the constraints of embedded systems, and the MicroPython
documentation should match the idiomatic way to write Python code.

With universal weak links for modules (via MICROPY_MODULE_WEAK_LINKS) users
can consistently use "import foo" across all ports (with the exception of
the minimal ports).  And the ability to override/extend via "foo.py"
continues to work well.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-13 22:53:29 +10:00
Jim Mussared 218606351c docs: Rename ufoo.rst to foo.rst.
This is a simple rename of the files, no content changes
(other than updating index.rst to use the new paths)

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-08-13 20:31:32 +10:00
Damien George 671f012306 docs/templates: Add unix and zephyr quickref links to top-index.
Signed-off-by: Damien George <damien@micropython.org>
2021-08-13 20:21:21 +10:00
Julia Hathaway 6ed6990625 docs/library/zephyr: Add libraries specific to the Zephyr port.
Includes documentation for Zephyr specific modules (zephyr and zsensor),
classes (DiskAccess and FlashArea), and functions.

Signed-off-by: Julia Hathaway <julia.hathaway@nxp.com>
2021-08-13 20:21:14 +10:00
Julia Hathaway 333e16521b docs/zephyr: Add quick reference for the Zephyr port.
Includes an introduction to using the Zephyr port on MicroPython.  The
quickref details examples of how to use each module the port currently
supports.  The tutorial provides additional details for Zephyr specific
modules.

Signed-off-by: Julia Hathaway <julia.hathaway@nxp.com>
2021-08-13 20:20:57 +10:00
Damien George 45f9a38451 docs/library/machine.I2S.rst: Fix use of sd pin in examples.
Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 20:40:54 +10:00
Peter Züger ffc854f17f extmod/modujson: Add support for dump/dumps separators keyword-argument.
Optionally enabled via MICROPY_PY_UJSON_SEPARATORS.  Enabled by default.

For dump, make sure mp_get_stream_raise is called after
mod_ujson_separators since CPython does it in this order (if both
separators and stream are invalid, separators will raise an exception
first).

Add separators argument in the docs as well.

Signed-off-by: Peter Züger <zueger.peter@icloud.com>
Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 13:52:16 +10:00
Damien George 8616129f2e esp8266,esp32: Include hidden networks in WLAN.scan results.
Addresses issues #2697 and #5329.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 13:28:34 +10:00
Will Sowerbutts a3675294ae esp32/machine_uart: Add flow kw-arg to enable hardware flow control.
This enables optional support for the hardware UART to use the RTS and/or
CTS pins for flow control.

The new "flow" constructor keyword specifies a bitmask of RTS and/or CTS.
This matches the interface used by machine.UART on stm32 and rp2.

Previously on ESP32 it was possible to specify which pins to use for the
RTS and CTS signals, but hardware flow control was never functional: CTS
was not checked before transmitting bytes, and RTS was always driven high
(signalling no buffer space available).  With this patch, CTS and RTS both
operate as expected.

This also includes an update to the machine.UART documentation.

Signed-off-by: Will Sowerbutts <will@sowerbutts.com>
2021-08-04 13:52:15 +10:00
Damien George 7f69246895 docs/library/uasyncio.rst: Document stream readexactly() method.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-22 22:39:04 +10:00
Damien George a5221c47eb docs/library/utime.rst: Clarify behaviour and precision of sleep ms/us.
This description is based on the existing bare-metal ports implementations.

Signed-off-by: Damien George <damien@micropython.org>
2021-07-22 00:07:37 +10:00
NitiKaur 6a9133a8b5 docs/rp2: Update general section to give a brief technical overview. 2021-07-20 00:26:37 +10:00
NitiKaur da74ef6615 docs/rp2: Enhance quickref and change image to Pico pinout. 2021-07-20 00:21:06 +10:00
David P fdd5b18133 docs: Replace master/slave with controller/peripheral in I2C and SPI.
See https://www.oshwa.org/a-resolution-to-redefine-spi-signal-names
2021-07-18 11:19:44 +10:00
Damien George 136369d72f all: Update to point to files in new shared/ directory.
Signed-off-by: Damien George <damien@micropython.org>
2021-07-12 17:08:10 +10:00
finefoot e10a044d7c docs/esp8266/tutorial: Change flash mode from dio to dout.
For some boards, even -fm dio is too fast and they require -fm dout.  This
commit links to the esptool wiki about available flash modes and changes
dio to dout.
2021-07-07 21:15:58 +10:00
Tom McDermott c1f74b3005 docs/library: Warn that ustruct doesn't handle spaces in format strings.
And also add a test to capture the CPython difference.
2021-07-06 14:59:50 +10:00
Mike Teachman 8a5bfe44a5 esp32,stm32: Add new machine.I2S class for I2S protocol support.
This commit adds I2S protocol support for the esp32 and stm32 ports, via
a new machine.I2S class.  It builds on the stm32 work of blmorris, #1361.

Features include:
- a consistent I2S API across the esp32 and stm32 ports
- I2S configurations supported:
  - master transmit and master receive
  - 16-bit and 32-bit sample sizes
  - mono and stereo formats
  - sampling frequency
  - 3 modes of operation:
    - blocking
    - non-blocking with callback
    - uasyncio
  - internal ring buffer size can be tuned
- documentation for Pyboards and esp32-based boards
- tested on the following development boards:
  - Pyboard D SF2W
  - Pyboard V1.1
  - ESP32 with SPIRAM
  - ESP32

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
2021-07-05 23:42:25 +10:00
Jonathan Hogg 0b3332c8e1 docs/library: Document new esp32.RMT features and fix wait_done.
Add new API for specifying the idle level and TX carrier output level, and
new write_pulses modes of operation.  Also fix wait_done documentation
which was inverted and wrong about timing.
2021-07-01 14:44:41 +10:00
Krzysztof Adamski 35b1359a3a rp2: Use 0=Monday datetime convention in RTC.
The RTC in rp2 can store any, even wrong, number as a weekday in RTC.  It
was, however, discussed in #7394 that we would like to unify all ports and
use 0 as Monday, not Sunday in the machine.RTC implementation.

This patch makes sure that the default date set in RTC is adheres to this
convention.  It also fixes the example in quickref to use proper weekday to
avoid confusion.

Signed-off-by: Krzysztof Adamski <k@japko.eu>
2021-06-25 10:29:12 +10:00
Damien George 63b8b79610 stm32/usb: Make irq's default trigger enable all events.
Following how other .irq() methods work on other objects.

Signed-off-by: Damien George <damien@micropython.org>
2021-06-23 16:11:37 +10:00
Jim Mussared 2fa975c264 LICENSE: Reference third-party licenses.
This is to provide a summary of the licenses used by MicroPython.

- Add SPDX identifier for every directory that includes
  non-MIT-licensed content.
- Add brief summary.
- Update docs license to be more explicit.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-06-22 15:50:47 +10:00
Damien George 7c51cb2307 all: Bump version to 1.16.
Signed-off-by: Damien George <damien@micropython.org>
2021-06-18 16:38:06 +10:00
Thomas Wenrich 364670ecf1 docs/esp32: Document WLAN "reconnects" config option. 2021-06-17 18:48:17 +10:00
Mike Teachman b0b8ebc4f6 extmod/uasyncio: Add readinto() method to Stream class.
With docs and a multi-test using TCP server/client.

This method is a MicroPython extension, although there is discussion of
adding it to CPython: https://bugs.python.org/issue41305

Signed-off-by: Mike Teachman <mike.teachman@gmail.com>
2021-06-15 13:13:35 +10:00
Peter Hinch c0499bc2b9 docs/library/machine.RTC.rst: Document datetime method and fix ex code.
This is the minimum change to fix the example code so it actually runs on
the majority of ports.
2021-06-12 22:53:49 +10:00
Damien George 71e3538a32 stm32/usb: Add USB_VCP.irq method, to set a callback on USB data RX.
Usage:

    usb = pyb.USB_VCP()
    usb.irq(lambda u:print(u, u.read()), usb.IRQ_RX)

Signed-off-by: Damien George <damien@micropython.org>
2021-06-10 15:26:21 +10:00
Matt Trentini a6a8941d84 docs/rp2: Add skeleton docs for the rp2 port. 2021-05-30 22:31:34 +10:00
Mike Causer 47b778332a all: Replace busses with buses.
"buses" is the widely accepted plural form of "bus".
2021-05-20 23:22:03 +10:00
Andrew Leech 9d58d46e0a docs/library/pyb.Pin.rst: Update the arguments for Pin.init().
Add details for Pin.init() value and alt arguments.
2021-05-20 23:08:43 +10:00
Brett Cannon 452fa3f8d4 docs/library: Add a blank line to fix formatting for ussl docs. 2021-05-18 12:27:57 +10:00
Brett Cannon 07528d1f85 docs/library: Clarify what type of algorithm is implemented in heapq. 2021-05-18 12:24:21 +10:00
Mike Causer 97fee47716 docs/esp8266: Add SSD1306 to quickref and tutorial. 2021-05-14 12:04:21 +10:00
Mike Causer d43ed087ae docs/esp8266: Mention Signal in GPIO section of quickref. 2021-05-14 12:02:01 +10:00
Mike Causer 85c51a548f docs/esp32: Mention Signal in GPIO section of quickref. 2021-05-14 11:43:47 +10:00
Mike Causer 30cbcf881d docs/esp32: Add APA106 to quickref. 2021-05-14 11:41:42 +10:00
Damien George 87e38b3cc8 docs/library/rp2.rst: Fix typo overriden->overridden.
Signed-off-by: Damien George <damien@micropython.org>
2021-05-12 00:05:55 +10:00
Tim Radvan fd24e649fd docs/library: Add initial API reference for rp2 module and its classes.
All the method signatures from rp2_pio.c and friends have been taken and
converted to RST format, then explanatory notes added for each signature.

Signed-off-by: Tim Radvan <tim@tjvr.org>
2021-05-08 18:02:04 +10:00
Mike Causer 64aebed70e docs/esp8266: Add WDT to quickref. 2021-05-06 15:50:42 +10:00
Mike Causer a111889705 docs/esp32: Add SDCard to quickref. 2021-05-06 15:48:09 +10:00
Mike Causer a65942a41d docs/esp32: Add WDT to quickref. 2021-05-06 15:46:28 +10:00
Mike Causer b98197f950 docs/esp32: Add UART to quickref. 2021-05-06 15:44:53 +10:00
Gabriel M Schuyler 0054fff840 docs/pyboard: Fix typo in pyb.Switch tutorial. 2021-05-04 23:05:35 +10:00
Mike Causer 31ac410a4f docs: Fix some spelling mistakes. 2021-05-04 22:58:00 +10:00
Mordy Ovits d70ab87b2b docs/esp8266: Clarify limitations of SSL in esp8266 and fix typos. 2021-05-04 15:15:34 +10:00
Damien George 2bf1beef5c docs/esp8266: Add instructions on entering programming mode manually.
This adds to the ESP8266 tutorial instructions explaining which pins to
pull low to enter programming mode.

Commit made originally by @ARF1 in #2910.

Signed-off-by: Damien George <damien@micropython.org>
2021-05-04 14:24:40 +10:00
Chris Liechti 4154ffbcba docs/esp8266: Add note about simultaneous use of STA_IF and AP_IF.
See also https://github.com/esp8266/Arduino/issues/1624
2021-05-04 13:48:53 +10:00
Damien George dd5c831a0b docs/library/machine: Add machine.bootloader docs.
This is provide by a few ports now, and is very useful.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 16:55:55 +10:00
Damien George 9e1b25a99e docs/library/machine: Specify initial machine.PWM class.
This adds an initial specification of the machine.PWM class, to provide a
way to generate PWM output that is portable across the different ports.
Such functionality may already be available in one way or another (eg
through a Timer object), but because configuring PWM via a Timer is very
port-specific, and because it's a common thing to do, it's beneficial to
have a top-level construct for it.

The specification in this commit aims to provide core functionality in a
minimal way.  It also somewhat matches most existing ad-hoc implementations
of machine.PWM.

See discussion in #2283 and #4237.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-30 16:42:51 +10:00
Damien George 3c4bfd1dec py/objexcept: Support errno attribute on OSError exceptions.
This commit adds the errno attribute to exceptions, so code can retrieve
errno codes from an OSError using exc.errno.

The implementation here simply lets `errno` (and the existing `value`)
attributes work on any exception instance (they both alias args[0]).  This
is for efficiency and to keep code size down.  The pros and cons of this
are:

Pros:
- more compatible with CPython, less difference to document and learn
- OSError().errno will correctly return None, whereas the current way of
  doing it via OSError().args[0] will raise an IndexError
- it reduces code size on most bare-metal ports (because they already have
  the errno qstr)
- for Python code that uses exc.errno the generated bytecode is 2 bytes
  smaller and more efficient to execute (compared with exc.args[0]); so
  bytecode loaded to RAM saves 2 bytes RAM for each use of this attribute,
  and bytecode that is frozen saves 2 bytes flash/ROM for each use
- it's easier/shorter to type, and saves 2 bytes of space in .py files that
  use it (for each use)

Cons:
- increases code size by 4-8 bytes on minimal ports that don't already have
  the `errno` qstr
- all exceptions now have .errno and .value attributes (a cpydiff test is
  added to address this)

See also #2407.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-23 22:03:46 +10:00
Damien George 321d1897c3 all: Bump version to 1.15.
Signed-off-by: Damien George <damien@micropython.org>
2021-04-19 00:11:51 +10:00
Damien George f541b3673d docs/develop: Improve user C modules to properly describe how to build.
Make and CMake builds are slightly different and these changes help make it
clear what to do in each case.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-02 17:07:20 +11:00
Damien George d87f42b0e5 examples/usercmodules: Simplify user C module enabling.
It's a bit of a pitfall with user C modules that including them in the
build does not automatically enable them.  This commit changes the docs and
examples for user C modules to encourage writers of user C modules to
enable them unconditionally.  This makes things simpler and covers most use
cases.

See discussion in issue #6960, and also #7086.

Signed-off-by: Damien George <damien@micropython.org>
2021-04-01 16:27:38 +11:00
Phil Howard 8e5756e2b6 docs/develop/cmodules.rst: Document C-modules and micropython.cmake.
Documents the micropython.cmake file required to make user C modules
compatible with the CMake build system.

Signed-off-by: Phil Howard <phil@pimoroni.com>
2021-03-31 00:28:21 +11:00
stijn 914380cb89 all: Add .git-blame-ignore-revs for fixing up git blame output.
Add most formatting-only commits to this file so that when used with
git blame, these commits are excluded and the output shows only the
interesting bits.
2021-03-15 11:07:29 +01:00
Damien George 6129b8e401 tests: Rename run-tests to run-tests.py for consistency.
Signed-off-by: Damien George <damien@micropython.org>
2021-03-12 19:56:09 +11:00
Damien George b24fcd7aec esp32/machine_hw_spi: Use default pins when making SPI if none given.
The default pins can be optionally configured by a board.

Fixes issue #6974.

Signed-off-by: Damien George <damien@micropython.org>
2021-03-12 10:56:25 +11:00
Thorsten von Eicken c10d431819 esp32: Add basic support for Non-Volatile-Storage in esp32 module.
This commit implements basic NVS support for the esp32.  It follows the
pattern of the esp32.Partition class and exposes an NVS object per NVS
namespace.  The initial support provided is only for signed 32-bit integers
and binary blobs.  It's easy (albeit a bit tedious) to add support for
more types.

See discussions in: #4436, #4707, #6780
2021-02-19 15:05:19 +11:00