Skip to content

Commit

Permalink
Merge pull request adafruit#5466 from jepler/merge-1.17
Browse files Browse the repository at this point in the history
Merge 1.17
  • Loading branch information
dhalbert authored Oct 16, 2021
2 parents 23b2427 + 3b8af4c commit 23d2c96
Show file tree
Hide file tree
Showing 420 changed files with 3,317 additions and 1,139 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ jobs:
run: |
git describe --dirty --tags
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Install dependencies
run: |
brew install gettext
Expand Down
6 changes: 1 addition & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@

[submodule "lib/axtls"]
path = lib/axtls
url = https://github.com/pfalcon/axtls
branch = micropython
url = https://github.com/micropython/axtls.git
[submodule "lib/libffi"]
path = lib/libffi
url = https://github.com/atgreen/libffi
[submodule "lib/berkeley-db-1.xx"]
path = lib/berkeley-db-1.xx
url = https://github.com/pfalcon/berkeley-db-1.xx
[submodule "lib/uzlib"]
path = lib/uzlib
url = https://github.com/pfalcon/uzlib
[submodule "tools/uf2"]
path = tools/uf2
url = https://github.com/Microsoft/uf2.git
Expand Down
64 changes: 64 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,67 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

--------------------------------------------------------------------------------

Unless specified otherwise (see below), the above license and copyright applies
to all files in this repository.

Individual files may include additional copyright holders.

The various ports of MicroPython may include third-party software that is
licensed under different terms. These licenses are summarised in the tree
below, please refer to these files and directories for further license and
copyright information. Note that (L)GPL-licensed code listed below is only
used during the build process and is not part of the compiled source code.

/ (MIT)
/drivers
/cc3000 (BSD-3-clause)
/cc3100 (BSD-3-clause)
/wiznet5k (BSD-3-clause)
/lib
/asf4 (Apache-2.0)
/axtls (BSD-3-clause)
/config
/scripts
/config (GPL-2.0-or-later)
/Rules.mak (GPL-2.0)
/berkeley-db-1xx (BSD-4-clause)
/btstack (See btstack/LICENSE)
/cmsis (BSD-3-clause)
/crypto-algorithms (NONE)
/libhydrogen (ISC)
/littlefs (BSD-3-clause)
/lwip (BSD-3-clause)
/mynewt-nimble (Apache-2.0)
/nrfx (BSD-3-clause)
/nxp_driver (BSD-3-Clause)
/oofatfs (BSD-1-clause)
/pico-sdk (BSD-3-clause)
/re15 (BSD-3-clause)
/stm32lib (BSD-3-clause)
/tinytest (BSD-3-clause)
/tinyusb (MIT)
/uzlib (Zlib)
/logo (uses OFL-1.1)
/ports
/cc3200
/hal (BSD-3-clause)
/simplelink (BSD-3-clause)
/FreeRTOS (GPL-2.0 with FreeRTOS exception)
/stm32
/usbd*.c (MCD-ST Liberty SW License Agreement V2)
/stm32_it.* (MIT + BSD-3-clause)
/system_stm32*.c (MIT + BSD-3-clause)
/boards
/startup_stm32*.s (BSD-3-clause)
/*/stm32*.h (BSD-3-clause)
/usbdev (MCD-ST Liberty SW License Agreement V2)
/usbhost (MCD-ST Liberty SW License Agreement V2)
/teensy
/core (PJRC.COM)
/zephyr
/src (Apache-2.0)
/tools
/dfu.py (LGPL-3.0-only)
1 change: 1 addition & 0 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ def autoapi_prepare_jinja_env(jinja_env):
"ports/stm/ref",
"ports/unix",
"py",
"shared/*",
"shared-bindings/util.*",
"shared-module",
"supervisor",
Expand Down
2 changes: 1 addition & 1 deletion devices/ble_hci/common-hal/_bleio/CharacteristicBuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <string.h>
#include <stdio.h>

#include "lib/utils/interrupt_char.h"
#include "shared/runtime/interrupt_char.h"
#include "py/runtime.h"
#include "py/stream.h"

Expand Down
2 changes: 1 addition & 1 deletion devices/ble_hci/common-hal/_bleio/Connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <string.h>
#include <stdio.h>

#include "lib/utils/interrupt_char.h"
#include "shared/runtime/interrupt_char.h"
#include "py/gc.h"
#include "py/objlist.h"
#include "py/objstr.h"
Expand Down
2 changes: 1 addition & 1 deletion devices/ble_hci/common-hal/_bleio/PacketBuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <string.h>
#include <stdio.h>

#include "lib/utils/interrupt_char.h"
#include "shared/runtime/interrupt_char.h"
#include "py/runtime.h"
#include "py/stream.h"

Expand Down
8 changes: 8 additions & 0 deletions docs/library/uasyncio.rst → docs/library/asyncio.rst
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@ TCP stream connections

This is a coroutine, and a MicroPython extension.

.. method:: Stream.readexactly(n)

Read exactly *n* bytes and return them as a bytes object.

Raises an ``EOFError`` exception if the stream ends before reading *n* bytes.

This is a coroutine.

.. method:: Stream.readline()

Read a line and return it.
Expand Down
2 changes: 1 addition & 1 deletion docs/library/btree.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Example::

# First, we need to open a stream which holds a database
# This is usually a file, but can be in-memory database
# using uio.BytesIO, a raw flash partition, etc.
# using io.BytesIO, a raw flash partition, etc.
# Oftentimes, you want to create a database file if it doesn't
# exist and open if it exists. Idiom below takes care of this.
# DO NOT open database with "a+b" access mode.
Expand Down
4 changes: 2 additions & 2 deletions docs/library/builtins.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Builtin functions and exceptions
================================
:mod:`builtins` -- builtin functions and exceptions
===================================================

All builtin functions and exceptions are described here. They are also
available via ``builtins`` module.
Expand Down
2 changes: 0 additions & 2 deletions docs/library/uctypes.rst → docs/library/ctypes.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
:mod:`uctypes` -- access binary data in a structured way
========================================================

.. include:: ../templates/unsupported_in_circuitpython.inc

.. module:: uctypes
:synopsis: access binary data in a structured way

Expand Down
15 changes: 11 additions & 4 deletions docs/library/framebuf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,23 @@ Other methods
Shift the contents of the FrameBuffer by the given vector. This may
leave a footprint of the previous colors in the FrameBuffer.

.. method:: FrameBuffer.blit(fbuf, x, y[, key])
.. method:: FrameBuffer.blit(fbuf, x, y, key=-1, palette=None)

Draw another FrameBuffer on top of the current one at the given coordinates.
If *key* is specified then it should be a color integer and the
corresponding color will be considered transparent: all pixels with that
color value will not be drawn.

This method works between FrameBuffer instances utilising different formats,
but the resulting colors may be unexpected due to the mismatch in color
formats.
The *palette* argument enables blitting between FrameBuffers with differing
formats. Typical usage is to render a monochrome or grayscale glyph/icon to
a color display. The *palette* is a FrameBuffer instance whose format is
that of the current FrameBuffer. The *palette* height is one pixel and its
pixel width is the number of colors in the source FrameBuffer. The *palette*
for an N-bit source needs 2**N pixels; the *palette* for a monochrome source
would have 2 pixels representing background and foreground colors. The
application assigns a color to each pixel in the *palette*. The color of the
current pixel will be that of that *palette* pixel whose x position is the
color of the corresponding source pixel.

Constants
---------
Expand Down
6 changes: 3 additions & 3 deletions docs/library/uheapq.rst → docs/library/heapq.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
:mod:`uheapq` -- heap queue algorithm
=====================================
:mod:`heapq` -- heap queue algorithm
====================================

.. include:: ../templates/unsupported_in_circuitpython.inc

.. module:: uheapq
.. module:: heapq
:synopsis: heap queue algorithm

|see_cpython_module| :mod:`cpython:heapq`.
Expand Down
15 changes: 7 additions & 8 deletions docs/library/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ These libraries are not enabled on CircuitPython builds with
limited flash memory, usually on non-Express builds:
``binascii``, ``errno``, ``json``, ``re``.

These libraries are not currently enabled in any CircuitPython build, but may be in the future,
with the ``u`` prefix dropped:
``uctypes``, ``uhashlib``, ``uzlib``.
These libraries are not currently enabled in any CircuitPython build, but may be in the future:
``ctypes``, ``hashlib``, ``zlib``.

.. toctree::
:maxdepth: 1

builtins.rst
uheapq.rst
heapq.rst
array.rst
binascii.rst
collections.rst
Expand All @@ -37,10 +36,10 @@ with the ``u`` prefix dropped:
json.rst
re.rst
sys.rst
uasyncio.rst
uctypes.rst
uselect.rst
uzlib.rst
asyncio.rst
ctypes.rst
select.rst
zlib.rst

Omitted functions in the ``string`` library
-------------------------------------------
Expand Down
18 changes: 9 additions & 9 deletions docs/library/uselect.rst → docs/library/select.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
:mod:`uselect` -- wait for events on a set of streams
========================================================================
:mod:`select` -- wait for events on a set of streams
====================================================

.. include:: ../templates/unsupported_in_circuitpython.inc

.. module:: uselect
.. module:: select
:synopsis: wait for events on a set of streams

|see_cpython_module| :mod:`cpython:select`.
Expand Down Expand Up @@ -37,15 +37,15 @@ Methods

Register ``stream`` *obj* for polling. *eventmask* is logical OR of:

* ``uselect.POLLIN`` - data available for reading
* ``uselect.POLLOUT`` - more data can be written
* ``select.POLLIN`` - data available for reading
* ``select.POLLOUT`` - more data can be written

Note that flags like ``uselect.POLLHUP`` and ``uselect.POLLERR`` are
Note that flags like ``select.POLLHUP`` and ``select.POLLERR`` are
*not* valid as input eventmask (these are unsolicited events which
will be returned from `poll()` regardless of whether they are asked
for). This semantics is per POSIX.

*eventmask* defaults to ``uselect.POLLIN | uselect.POLLOUT``.
*eventmask* defaults to ``select.POLLIN | select.POLLOUT``.

It is OK to call this function multiple times for the same *obj*.
Successive calls will update *obj*'s eventmask to the value of
Expand All @@ -69,8 +69,8 @@ Methods
Returns list of (``obj``, ``event``, ...) tuples. There may be other elements in
tuple, depending on a platform and version, so don't assume that its size is 2.
The ``event`` element specifies which events happened with a stream and
is a combination of ``uselect.POLL*`` constants described above. Note that
flags ``uselect.POLLHUP`` and ``uselect.POLLERR`` can be returned at any time
is a combination of ``select.POLL*`` constants described above. Note that
flags ``select.POLLHUP`` and ``select.POLLERR`` can be returned at any time
(even if were not asked for), and must be acted on accordingly (the
corresponding stream unregistered from poll and likely closed), because
otherwise all further invocations of `poll()` may return immediately with
Expand Down
6 changes: 3 additions & 3 deletions docs/library/uzlib.rst → docs/library/zlib.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
:mod:`uzlib` -- zlib decompression
==================================
:mod:`zlib` -- zlib decompression
=================================

.. include:: ../templates/unsupported_in_circuitpython.inc

.. module:: uzlib
.. module:: zlib
:synopsis: zlib decompression

|see_cpython_module| :mod:`cpython:zlib`.
Expand Down
4 changes: 2 additions & 2 deletions examples/natmod/btree/btree_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ void *memmove(void *dest, const void *src, size_t n) {
}

void *malloc(size_t n) {
void *ptr = m_malloc(n, false);
void *ptr = m_malloc(n);
return ptr;
}
void *realloc(void *ptr, size_t n) {
mp_printf(&mp_plat_print, "UNDEF %d\n", __LINE__);
return NULL;
}
void *calloc(size_t n, size_t m) {
void *ptr = m_malloc(n * m, false);
void *ptr = m_malloc(n * m);
// memory already cleared by conservative GC
return ptr;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/natmod/features2/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(add_d_obj, add_d);
// to use but has access to the globals dict of the module via self->globals.
STATIC mp_obj_t productf(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {
// Check number of arguments is valid
mp_arg_check_num_mp(n_args, n_kw, 1, 1, false);
mp_arg_check_num(n_args, n_kw, 1, 1, false);

// Extract buffer pointer and verify typecode
mp_buffer_info_t bufinfo;
Expand Down
5 changes: 4 additions & 1 deletion examples/usercmodule/cexample/examplemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ const mp_obj_module_t example_user_cmodule = {
};

// Register the module to make it available in Python.
MP_REGISTER_MODULE(MP_QSTR_cexample, example_user_cmodule, MODULE_CEXAMPLE_ENABLED);
// Note: the "1" in the third argument means this module is always enabled.
// This "1" can be optionally replaced with a macro like MODULE_CEXAMPLE_ENABLED
// which can then be used to conditionally enable this module.
MP_REGISTER_MODULE(MP_QSTR_cexample, example_user_cmodule, 1);
15 changes: 15 additions & 0 deletions examples/usercmodule/cexample/micropython.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Create an INTERFACE library for our C module.
add_library(usermod_cexample INTERFACE)

# Add our source files to the lib
target_sources(usermod_cexample INTERFACE
${CMAKE_CURRENT_LIST_DIR}/examplemodule.c
)

# Add the current directory as an include directory.
target_include_directories(usermod_cexample INTERFACE
${CMAKE_CURRENT_LIST_DIR}
)

# Link our INTERFACE library to the usermod target.
target_link_libraries(usermod INTERFACE usermod_cexample)
5 changes: 4 additions & 1 deletion examples/usercmodule/cppexample/examplemodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ const mp_obj_module_t cppexample_user_cmodule = {
};

// Register the module to make it available in Python.
MP_REGISTER_MODULE(MP_QSTR_cppexample, cppexample_user_cmodule, MODULE_CPPEXAMPLE_ENABLED);
// Note: the "1" in the third argument means this module is always enabled.
// This "1" can be optionally replaced with a macro like MODULE_CPPEXAMPLE_ENABLED
// which can then be used to conditionally enable this module.
MP_REGISTER_MODULE(MP_QSTR_cppexample, cppexample_user_cmodule, 1);
16 changes: 16 additions & 0 deletions examples/usercmodule/cppexample/micropython.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Create an INTERFACE library for our CPP module.
add_library(usermod_cppexample INTERFACE)

# Add our source files to the library.
target_sources(usermod_cppexample INTERFACE
${CMAKE_CURRENT_LIST_DIR}/example.cpp
${CMAKE_CURRENT_LIST_DIR}/examplemodule.c
)

# Add the current directory as an include directory.
target_include_directories(usermod_cppexample INTERFACE
${CMAKE_CURRENT_LIST_DIR}
)

# Link our INTERFACE library to the usermod target.
target_link_libraries(usermod INTERFACE usermod_cppexample)
10 changes: 10 additions & 0 deletions examples/usercmodule/micropython.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This top-level micropython.cmake is responsible for listing
# the individual modules we want to include.
# Paths are absolute, and ${CMAKE_CURRENT_LIST_DIR} can be
# used to prefix subdirectories.

# Add the C example.
include(${CMAKE_CURRENT_LIST_DIR}/cexample/micropython.cmake)

# Add the CPP example.
include(${CMAKE_CURRENT_LIST_DIR}/cppexample/micropython.cmake)
Loading

0 comments on commit 23d2c96

Please sign in to comment.