Commit Graph

1318 Commits

Author SHA1 Message Date
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
Scott Shawcroft 973a90f2aa
Rename esp32s2 port to espressif
This is in preparation for ESP32-S3 support and potentially others.

Related to #4363
2021-09-13 16:44:55 -07: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
Jeff Epler f4bb3cc2c8 Fix stubs & doc redirects 2021-08-29 11:43:51 -05: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
Kattni c87d90ec4b
Merge pull request #5090 from WarriorOfWire/draw_protocol
Draw protocol
2021-08-09 15:04:36 -04: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
Kenny 6be952d3ba found more documentation dependencies that needed updating 2021-08-05 00:13:10 -07: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
Jeff Epler ac4b10bcd9 It's "shared-module", not "shared-modules" 2021-08-03 10:37:47 -05:00
Dan Halbert 84ddb17c78
Merge pull request #5054 from jepler/rmatrix
docs: Add list of supported board to each module's page
2021-07-27 15:05:47 -04:00
Jeff Epler 94a4090542 Make summary more helpful; use a html list 2021-07-27 12:01:18 -05:00
Dan Halbert 901a6c27c0 remove gamepad; deprecate gamepadshift 2021-07-26 22:15:09 -04:00
Jeff Epler f2b9e98a21 docs: Add list of supported board to module page 2021-07-24 14:11:04 -05: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
Scott Shawcroft f84cb94819
Remove OSError(0) and old network modules
The newer modules are `socketpool` and `ssl`.

Fixes #3924, related to #2021, closes #1880, closes #2273, closes #2274
2021-07-21 17:33:40 -07: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
Kattni Rembor dc2907ac1b Rename _pixelbuf to adafruit_pixelbuf, alias. 2021-07-16 13:31:40 -04: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
Jeff Epler a703561402 remove docs added in merge 2021-06-18 16:02:44 -05:00
Jeff Epler 7b46187024 Fix trailing whitespace 2021-06-18 10:58:30 -05:00
Jeff Epler 87d3740c64 Merge tag 'v1.16' 2021-06-18 10:54:19 -05: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
James Carr c665eb9bb5
Incompatible .mpy file
Update the *ValueError: Incompatible .mpy file* section for the upcoming 6 to 7 transition.
2021-05-23 08:51:35 +01: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
jposada202020 82677dd966 adding parameter documentation explanation. 2021-05-15 12:06:08 -04: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
Scott Shawcroft 966d25c6a5
Merge MicroPython v1.15 into CircuitPython 2021-05-12 17:51:42 -07:00
Scott Shawcroft e02a26453c
Merge MicroPython 1.14 into CircuitPython 2021-05-11 15:07:40 -07: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
Jeff Epler 446169e078
Merge pull request #4720 from tannewt/merge_1.13
Merge in MicroPython 1.13
2021-05-08 08:46:03 -05: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
jposada202020 bba0afa464 adding_string_format_explanation 2021-05-07 15:15:05 -04:00
Scott Shawcroft cebb10ddae
Fixes from review 2021-05-07 09:31:59 -07:00
Scott Shawcroft 42f4065c8a
Merge remote-tracking branch 'adafruit/main' into merge_1.13 2021-05-06 11:17:53 -07:00
Dan Halbert ebf9dcb47a
Merge pull request #4689 from dhalbert/dynamic-usb-descriptors
Dynamic USB descriptors
2021-05-06 13:51:38 -04: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
Scott Shawcroft c34ddf14d6
Switch from recommonmark to myst-parser
It's the *future* and fixes a doc build error.

Related to https://github.com/readthedocs/recommonmark/issues/221
2021-05-05 15:25:37 -07:00
jposada202020 0f60a3b997 Better_phrasing 2021-05-05 12:18:26 -04:00
jposada202020 0fa6f4ed76 adding_usage_template 2021-05-04 22:14:06 -04:00
Scott Shawcroft f0bb26d70f
Merge MicroPython 1.13 into CircuitPython 2021-05-04 18:06:33 -07:00
Dan Halbert 8bb3c6fd79 handle := defs in shared_bindings_matrix.py; update adafruit_hid 2021-05-04 18:07:01 -04: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
Scott Shawcroft b35fa44c8a
Merge MicroPython 1.12 into CircuitPython 2021-05-03 14:01:18 -07: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
Jeff Epler 5fa7186396 Merge remote-tracking branch 'origin/main' into defining_parameters 2021-04-29 08:18:39 -05:00
Jeff Epler d035a68c74
Merge pull request #4652 from jposada202020/design_guide_changes
Referencing_documentation_other_libraries
2021-04-29 08:10:13 -05:00
jposada202020 9c12b180c8 title change 2021-04-28 13:21:18 -04:00
jposada202020 71d575f0c4
Update docs/design_guide.rst
Co-authored-by: Kattni <kattni@adafruit.com>
2021-04-28 13:16:33 -04:00
jposada202020 e33bc9f57b
Update docs/design_guide.rst
Co-authored-by: Kattni <kattni@adafruit.com>
2021-04-28 13:16:21 -04:00
jposada202020 8ff29f68db
Update docs/design_guide.rst
Co-authored-by: Kattni <kattni@adafruit.com>
2021-04-28 13:16:11 -04:00
jposada202020 ed2980b967
Update docs/design_guide.rst
Co-authored-by: Kattni <kattni@adafruit.com>
2021-04-28 13:16:02 -04:00
jposada202020 1950cf6666
Update docs/design_guide.rst
Co-authored-by: Kattni <kattni@adafruit.com>
2021-04-28 13:15:55 -04:00
jposada202020 aa9114254a
Update docs/design_guide.rst
Co-authored-by: Kattni <kattni@adafruit.com>
2021-04-28 13:15:45 -04:00
jposada202020 129df1b3f7
Update docs/design_guide.rst
Co-authored-by: Kattni <kattni@adafruit.com>
2021-04-28 13:15:37 -04:00
jposada202020 9fe1751f01
Update docs/design_guide.rst
Co-authored-by: Kattni <kattni@adafruit.com>
2021-04-28 13:15:28 -04:00
jposada202020 69a510edc1
Update docs/design_guide.rst
Co-authored-by: Kattni <kattni@adafruit.com>
2021-04-28 13:15:17 -04:00
jposada202020 3c49bd6bde
Update docs/design_guide.rst
Co-authored-by: Kattni <kattni@adafruit.com>
2021-04-28 13:15:09 -04:00
jposada202020 4e931697c6 adding_backticks, typos 2021-04-28 06:07:45 -04:00
jposada202020 0c23c73510 defining_parameters 2021-04-28 05:36:37 -04:00
jposada202020 cb42acea53 better_phrasing 2021-04-27 17:43:25 -04:00
jposada202020 a512dd230d word_order_better_phrasing 2021-04-27 17:34:45 -04:00
jposada202020 4d0e183ae1 Module_description_changes 2021-04-27 17:18:14 -04:00
jposada202020 2d80f6b872 Module_description_changes 2021-04-27 17:11:42 -04:00
Scott Shawcroft 76033d5115
Merge MicroPython v1.11 into CircuitPython 2021-04-26 15:47:41 -07:00
jposada202020 901e6ab5b0 Referencing_documentation_other_libraries 2021-04-23 10:02:24 -04: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
Dan Halbert 8f73270f2b
Merge pull request #4646 from tannewt/merge_mp1.10
Merge in MicroPython v1.10
2021-04-22 13:16:27 -04:00
Scott Shawcroft 09f7b43c64
Merge MicroPython 1.10 into CircuitPython 2021-04-21 15:59:17 -07:00
jposada202020 b8253680bf Small corrections, adding examples requirements in the design guide. SI units corrections and clarifications. Using const and Defaults to in class documentation. Building reference change. 2021-04-20 18:55:50 -04: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
Neradoc 827f67813f add a filter text field to the support matrix 2021-04-15 19:05:50 +02:00
Dan Halbert ddca91020e
Revert "add robots.txt to specify doc versions to appear in search engines" 2021-04-09 09:28:20 -04:00
Neradoc 12b0ee0a3e add alias boards and bus_device to the support matrix
add list with manual brand names for aliases
the new info in the support_matrix is used in build_board_info.py
2021-04-02 13:36:06 +02: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
Thorsten von Eicken 2c1299b007 extmod/modussl: Fix ussl read/recv/send/write errors when non-blocking.
Also fix related problems with socket on esp32, improve docs for
wrap_socket, and add more tests.
2021-02-17 11:50:54 +11:00
Jim Mussared cdf9c8648f docs/library/uasyncio.rst: Add docs for ThreadSafeFlag.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-02-16 16:35:37 +11:00
Jim Mussared 7ed99544e4 extmod/uasyncio: Add asyncio.current_task().
Matches CPython behavior.

Fixes #6686
2021-02-13 15:11:17 +11:00
Brianna Laugher d128999938 tools: Add filesystem action examples to pyboard.py help.
Signed-off-by: Brianna Laugher <brianna.laugher@gmail.com>
2021-02-13 14:37:28 +11:00
caternuson ac6695faba update design guide 2021-02-11 14:28:58 -08:00
Kevin Banks 87fe58fea5 Added WEBUSB_README to the table of contents (required by CI) 2021-02-04 08:56:51 -06:00
Damien George 78b23c3a1f all: Bump version to 1.14.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-03 00:59:07 +11:00
Damien George 0e44587076 docs/library/machine.Pin.rst: Make it clear which methods are not core.
Signed-off-by: Damien George <damien@micropython.org>
2021-02-03 00:54:18 +11:00
Damien George ef9fde7339 LICENSE,docs: Update copyright year range to include 2021.
Signed-off-by: Damien George <damien@micropython.org>
2021-01-31 23:17:42 +11:00
Samuelson 407df82f81 docs/develop/natmod: Fix a small typo, con->can. 2021-01-30 15:20:44 +11:00
Christopher Tse ddb53c9458 docs/esp8266/quickref: Add warning block about NeoPixel timing. 2021-01-30 14:36:30 +11:00
Andrew Scheller 499e199add docs,stm32: Fix minor typos in RTC docs, and->an. 2021-01-30 14:13:30 +11:00
nanjekyejoannah 4eaebc1988 docs/develop: Add MicroPython Internals chapter.
This commit adds many new sections to the existing "Developing and building
MicroPython" chapter to make it all about the internals of MicroPython.

This work was done as part of Google's Season of Docs 2020.
2021-01-27 16:59:58 +11:00
Dan Halbert d116ad042f
Merge pull request #4070 from rpavlik/patch-1
Update design_guide.rst
2021-01-26 15:25:10 -05:00
Ryan A. Pavlik 365fafb32b
Update design_guide.rst
Add CO2 as a member name, and clarify the description of eCO2.
2021-01-26 10:36:40 -06:00
Dan Halbert 5b4249e365 fix doc typos 2021-01-25 23:06:47 -05:00
Dan Halbert a9f339b461 typo in circuitpy_mpconfig.h; forgot cxd56 port 2021-01-25 22:40:31 -05:00
Dan Halbert 34d63debd5 Remove obsolete esp.rst, network.rst 2021-01-25 09:29:16 -05:00
Dan Halbert 69869e1439 CIRCUITPY_* switches for JSON, RE, etc. Doc cleanup 2021-01-24 23:10:20 -05:00