Skip to content

Commit

Permalink
Merge pull request #6 from atsign-foundation/cpswan-catchup-upstream
Browse files Browse the repository at this point in the history
chore: catchup upstream
  • Loading branch information
cpswan authored Jun 6, 2023
2 parents 63a59ee + fde2c0c commit 3faded3
Show file tree
Hide file tree
Showing 826 changed files with 15,388 additions and 10,234 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# all: Fix spelling mistakes based on codespell check.
b1229efbd1509654dec6053865ab828d769e29db

# top: Update Python formatting to black "2023 stable style".
8b2748269244304854b3462cb8902952b4dcb892

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/security.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Security report
about: Report a security issue or vunerability in MicroPython
about: Report a security issue or vulnerability in MicroPython
title: ''
labels: security
assignees: ''
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/code_formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ concurrency:
cancel-in-progress: true

jobs:
build:
code-formatting:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
Expand All @@ -18,3 +18,13 @@ jobs:
run: source tools/ci.sh && ci_code_formatting_run
- name: Check code formatting
run: git diff --exit-code

code-spelling:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Install packages
run: source tools/ci.sh && ci_code_spell_setup
- name: Run spell checker
run: source tools/ci.sh && ci_code_spell_run
8 changes: 3 additions & 5 deletions .github/workflows/mpremote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
# Version is determined from git,
# should be deep enough to get to latest tag
fetch-depth: '1000'
- run: |
git fetch --prune --unshallow --tags
# Setting this to zero means fetch all history and tags,
# which hatch-vcs can use to discover the version tag.
fetch-depth: 0
- uses: actions/setup-python@v4
- name: Install build tools
run: pip install build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ports_unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
run: tests/run-tests.py --print-failures

coverage_32bit:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04 # use 20.04 to get libffi-dev:i386
steps:
- uses: actions/checkout@v3
- name: Install packages
Expand All @@ -103,7 +103,7 @@ jobs:
run: tests/run-tests.py --print-failures

nanbox:
runs-on: ubuntu-20.04 # use 20.04 to get python2
runs-on: ubuntu-20.04 # use 20.04 to get python2, and libffi-dev:i386
steps:
- uses: actions/checkout@v3
- name: Install packages
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python code lint with ruff
on: [push, pull_request]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: pip install --user ruff
- run: ruff --format=github .
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ repos:
language: python
verbose: true
stages: [commit-msg]
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.265
hooks:
- id: ruff
20 changes: 8 additions & 12 deletions CODECONVENTIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ It's also ok to drop file extensions.

Besides prefix, first line of a commit message should describe a
change clearly and to the point, and be a grammatical sentence with
final full stop. First line should fit within 72 characters. Examples
final full stop. First line must fit within 72 characters. Examples
of good first line of commit messages:

py/objstr: Add splitlines() method.
Expand All @@ -27,12 +27,9 @@ change beyond 5 lines would likely require such detailed description.
To get good practical examples of good commits and their messages, browse
the `git log` of the project.

When committing you are encouraged to sign-off your commit by adding
"Signed-off-by" lines and similar, eg using "git commit -s". If you don't
explicitly sign-off in this way then the commit message, which includes your
name and email address in the "Author" line, implies your sign-off. In either
case, of explicit or implicit sign-off, you are certifying and signing off
against the following:
When committing you must sign-off your commit by adding "Signed-off-by:"
line(s) at the end of the commit message, e.g. using `git commit -s`. You
are then certifying and signing off against the following:

* That you wrote the change yourself, or took it from a project with
a compatible license (in the latter case the commit message, and possibly
Expand All @@ -49,10 +46,9 @@ against the following:
* Your contribution including commit message will be publicly and
indefinitely available for anyone to access, including redistribution
under the terms of the project's license.
* Your signature for all of the above, which is the "Signed-off-by" line
or the "Author" line in the commit message, includes your full real name and
a valid and active email address by which you can be contacted in the
foreseeable future.
* Your signature for all of the above, which is the "Signed-off-by" line,
includes your full real name and a valid and active email address by
which you can be contacted in the foreseeable future.

Code auto-formatting
====================
Expand Down Expand Up @@ -255,7 +251,7 @@ Documentation conventions
=========================

MicroPython generally follows CPython in documentation process and
conventions. reStructuredText syntax is used for the documention.
conventions. reStructuredText syntax is used for the documentation.

Specific conventions/suggestions:

Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013-2022 Damien P. George
Copyright (c) 2013-2023 Damien P. George

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -36,7 +36,6 @@ used during the build process and is not part of the compiled source code.
/ (MIT)
/drivers
/cc3100 (BSD-3-clause)
/wiznet5k (BSD-3-clause)
/lib
/asf4 (Apache-2.0)
/axtls (BSD-3-clause)
Expand All @@ -61,6 +60,7 @@ used during the build process and is not part of the compiled source code.
/tinytest (BSD-3-clause)
/tinyusb (MIT)
/uzlib (Zlib)
/wiznet5k (MIT)
/logo (uses OFL-1.1)
/ports
/cc3200
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

# General information about the project.
project = 'MicroPython'
copyright = '- The MicroPython Documentation is Copyright © 2014-2022, Damien P. George, Paul Sokolovsky, and contributors'
copyright = '- The MicroPython Documentation is Copyright © 2014-2023, Damien P. George, Paul Sokolovsky, and contributors'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -233,7 +233,7 @@
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Include 3 levels of headers in PDF ToC
'preamble': '\setcounter{tocdepth}{2}',
'preamble': r'\setcounter{tocdepth}{2}',
}

# Grouping the document tree into LaTeX files. List of tuples
Expand Down
2 changes: 1 addition & 1 deletion docs/develop/cmodules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ A MicroPython user C module is a directory with the following files:
``SRC_USERMOD_C`` or ``SRC_USERMOD_LIB_C`` variables. The former will be
processed for ``MP_QSTR_`` and ``MP_REGISTER_MODULE`` definitions, the latter
will not (e.g. helpers and library code that isn't MicroPython-specific).
These paths should include your expaned copy of ``$(USERMOD_DIR)``, e.g.::
These paths should include your expanded copy of ``$(USERMOD_DIR)``, e.g.::

SRC_USERMOD_C += $(EXAMPLE_MOD_DIR)/modexample.c
SRC_USERMOD_LIB_C += $(EXAMPLE_MOD_DIR)/utils/algorithm.c
Expand Down
4 changes: 4 additions & 0 deletions docs/develop/porting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ The basic MicroPython firmware is implemented in the main port file, e.g ``main.

.. code-block:: c
#include "py/builtin.h"
#include "py/compile.h"
#include "py/gc.h"
#include "py/mperrno.h"
Expand Down Expand Up @@ -110,6 +111,9 @@ We also need a Makefile at this point for the port:
shared/runtime/pyexec.c \
shared/runtime/stdout_helpers.c \
# Define source files containung qstrs.
SRC_QSTR += shared/readline/readline.c shared/runtime/pyexec.c
# Define the required object files.
OBJ = $(PY_CORE_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
Expand Down
4 changes: 2 additions & 2 deletions docs/esp32/quickref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ Use the :ref:`machine.PWM <machine.PWM>` class::

from machine import Pin, PWM

pwm0 = PWM(Pin(0)) # create PWM object from a pin
freq = pwm0.freq() # get current frequency (default 5kHz)
pwm0 = PWM(Pin(0), freq=5000, duty_u16=32768) # create PWM object from a pin
freq = pwm0.freq() # get current frequency
pwm0.freq(1000) # set PWM frequency from 1Hz to 40MHz

duty = pwm0.duty() # get current duty cycle, range 0-1023 (default 512, 50%)
Expand Down
8 changes: 4 additions & 4 deletions docs/esp32/tutorial/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Requirements
The first thing you need is a board with an ESP32 chip. The MicroPython
software supports the ESP32 chip itself and any board should work. The main
characteristic of a board is how the GPIO pins are connected to the outside
world, and whether it includes a built-in USB-serial convertor to make the
world, and whether it includes a built-in USB-serial converter to make the
UART available to your PC.

Names of pins will be given in this tutorial using the chip names (eg GPIO2)
Expand Down Expand Up @@ -59,7 +59,7 @@ bootloader mode, and second you need to copy across the firmware. The exact
procedure for these steps is highly dependent on the particular board and you will
need to refer to its documentation for details.

Fortunately, most boards have a USB connector, a USB-serial convertor, and the DTR
Fortunately, most boards have a USB connector, a USB-serial converter, and the DTR
and RTS pins wired in a special way then deploying the firmware should be easy as
all steps can be done automatically. Boards that have such features
include the Adafruit Feather HUZZAH32, M5Stack, Wemos LOLIN32, and TinyPICO
Expand Down Expand Up @@ -104,7 +104,7 @@ Serial prompt

Once you have the firmware on the device you can access the REPL (Python prompt)
over UART0 (GPIO1=TX, GPIO3=RX), which might be connected to a USB-serial
convertor, depending on your board. The baudrate is 115200.
converter, depending on your board. The baudrate is 115200.

From here you can now follow the ESP8266 tutorial, because these two Espressif chips
are very similar when it comes to using MicroPython on them. The ESP8266 tutorial
Expand All @@ -124,7 +124,7 @@ after it, here are troubleshooting recommendations:

* The flashing instructions above use flashing speed of 460800 baud, which is
good compromise between speed and stability. However, depending on your
module/board, USB-UART convertor, cables, host OS, etc., the above baud
module/board, USB-UART converter, cables, host OS, etc., the above baud
rate may be too high and lead to errors. Try a more common 115200 baud
rate instead in such cases.

Expand Down
10 changes: 5 additions & 5 deletions docs/esp8266/tutorial/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The first thing you need is a board with an ESP8266 chip. The MicroPython
software supports the ESP8266 chip itself and any board should work. The main
characteristic of a board is how much flash it has, how the GPIO pins are
connected to the outside world, and whether it includes a built-in USB-serial
convertor to make the UART available to your PC.
converter to make the UART available to your PC.

The minimum requirement for flash size is 1Mbyte. There is also a special
build for boards with 512KB, but it is highly limited comparing to the
Expand Down Expand Up @@ -70,7 +70,7 @@ need to put your device in boot-loader mode, and second you need to copy across
the firmware. The exact procedure for these steps is highly dependent on the
particular board and you will need to refer to its documentation for details.

If you have a board that has a USB connector, a USB-serial convertor, and has
If you have a board that has a USB connector, a USB-serial converter, and has
the DTR and RTS pins wired in a special way then deploying the firmware should
be easy as all steps can be done automatically. Boards that have such features
include the Adafruit Feather HUZZAH and NodeMCU boards.
Expand Down Expand Up @@ -128,7 +128,7 @@ Serial prompt

Once you have the firmware on the device you can access the REPL (Python prompt)
over UART0 (GPIO1=TX, GPIO3=RX), which might be connected to a USB-serial
convertor, depending on your board. The baudrate is 115200. The next part of
converter, depending on your board. The baudrate is 115200. The next part of
the tutorial will discuss the prompt in more detail.

WiFi
Expand All @@ -137,7 +137,7 @@ WiFi
After a fresh install and boot the device configures itself as a WiFi access
point (AP) that you can connect to. The ESSID is of the form MicroPython-xxxxxx
where the x's are replaced with part of the MAC address of your device (so will
be the same everytime, and most likely different for all ESP8266 chips). The
be the same every time, and most likely different for all ESP8266 chips). The
password for the WiFi is micropythoN (note the upper-case N). Its IP address
will be 192.168.4.1 once you connect to its network. WiFi configuration will
be discussed in more detail later in the tutorial.
Expand Down Expand Up @@ -169,7 +169,7 @@ after it, here are troubleshooting recommendations:

* The flashing instructions above use flashing speed of 460800 baud, which is
good compromise between speed and stability. However, depending on your
module/board, USB-UART convertor, cables, host OS, etc., the above baud
module/board, USB-UART converter, cables, host OS, etc., the above baud
rate may be too high and lead to errors. Try a more common 115200 baud
rate instead in such cases.

Expand Down
2 changes: 1 addition & 1 deletion docs/esp8266/tutorial/repl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ REPL over the serial port

The REPL is always available on the UART0 serial peripheral, which is connected
to the pins GPIO1 for TX and GPIO3 for RX. The baudrate of the REPL is 115200.
If your board has a USB-serial convertor on it then you should be able to access
If your board has a USB-serial converter on it then you should be able to access
the REPL directly from your PC. Otherwise you will need to have a way of
communicating with the UART.

Expand Down
2 changes: 1 addition & 1 deletion docs/library/array.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Classes
Returns the string representation of the array, called as ``str(a)`` or ``repr(a)```
(where ``a`` is an ``array``). Returns the string ``"array(<type>, [<elements>])"``,
where ``<type>`` is the type code letter for the array and ``<elements>`` is a comma
seperated list of the elements of the array.
separated list of the elements of the array.

**Note:** ``__repr__`` cannot be called directly (``a.__repr__()`` fails) and
is not present in ``__dict__``, however ``str(a)`` and ``repr(a)`` both work.
23 changes: 13 additions & 10 deletions docs/library/bluetooth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Configuration
Get or set configuration values of the BLE interface. To get a value the
parameter name should be quoted as a string, and just one parameter is
queried at a time. To set values use the keyword syntax, and one ore more
queried at a time. To set values use the keyword syntax, and one or more
parameter can be set at a time.

Currently supported values are:
Expand Down Expand Up @@ -183,12 +183,10 @@ Event Handling
conn_handle, value_handle, char_data = data
elif event == _IRQ_GATTC_READ_DONE:
# A gattc_read() has completed.
# Note: The value_handle will be zero on btstack (but present on NimBLE).
# Note: Status will be zero on success, implementation-specific value otherwise.
conn_handle, value_handle, status = data
elif event == _IRQ_GATTC_WRITE_DONE:
# A gattc_write() has completed.
# Note: The value_handle will be zero on btstack (but present on NimBLE).
# Note: Status will be zero on success, implementation-specific value otherwise.
conn_handle, value_handle, status = data
elif event == _IRQ_GATTC_NOTIFY:
Expand Down Expand Up @@ -514,19 +512,24 @@ writes from a client to a given characteristic, use

Sends a notification request to a connected client.

If *data* is not ``None``, then that value is sent to the client as part of
the notification. The local value will not be modified.
If *data* is ``None`` (the default), then the current local value (as set
with :meth:`gatts_write <BLE.gatts_write>`) will be sent.

Otherwise, if *data* is ``None``, then the current local value (as
set with :meth:`gatts_write <BLE.gatts_write>`) will be sent.
Otherwise, if *data* is not ``None``, then that value is sent to the client
as part of the notification. The local value will not be modified.

**Note:** The notification will be sent regardless of the subscription
status of the client to this characteristic.

.. method:: BLE.gatts_indicate(conn_handle, value_handle, /)
.. method:: BLE.gatts_indicate(conn_handle, value_handle, data=None, /)

Sends an indication request containing the characteristic's current value to
a connected client.
Sends a indication request to a connected client.

If *data* is ``None`` (the default), then the current local value (as set
with :meth:`gatts_write <BLE.gatts_write>`) will be sent.

Otherwise, if *data* is not ``None``, then that value is sent to the client
as part of the indication. The local value will not be modified.

On acknowledgment (or failure, e.g. timeout), the
``_IRQ_GATTS_INDICATE_DONE`` event will be raised.
Expand Down
10 changes: 9 additions & 1 deletion docs/library/esp32.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ methods to enable over-the-air (OTA) updates.
and an ``OSError(-261)`` is raised if called on firmware that doesn't have the
feature enabled.
It is OK to call ``mark_app_valid_cancel_rollback`` on every boot and it is not
necessary when booting firmare that was loaded using esptool.
necessary when booting firmware that was loaded using esptool.

Constants
~~~~~~~~~
Expand Down Expand Up @@ -279,6 +279,14 @@ For more details see Espressif's `ESP-IDF RMT documentation.
Ultra-Low-Power co-processor
----------------------------

This class gives access to the Ultra Low Power (ULP) co-processor on the ESP32,
ESP32-S2 and ESP32-S3 chips.

.. warning::

This class does not provide access to the RISCV ULP co-processor available
on the ESP32-S2 and ESP32-S3 chips.

.. class:: ULP()

This class provides access to the Ultra-Low-Power co-processor.
Expand Down
Loading

0 comments on commit 3faded3

Please sign in to comment.