Skip to content

Commit 0b80c62

Browse files
authored
Merge branch 'adafruit:main' into rp2040-shim
2 parents ad56a16 + 562c73b commit 0b80c62

File tree

584 files changed

+13435
-13082
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

584 files changed

+13435
-13082
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,8 @@ jobs:
382382
if: ${{ needs.test.outputs.boards-espressif != '[]' }}
383383
steps:
384384
- name: Set up Python 3
385-
uses: actions/setup-python@v2
385+
id: py3
386+
uses: actions/setup-python@v4
386387
with:
387388
python-version: "3.x"
388389
- uses: actions/[email protected]
@@ -400,7 +401,7 @@ jobs:
400401
id: idf-cache
401402
with:
402403
path: ${{ github.workspace }}/.idf_tools
403-
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/espressif/esp-idf/HEAD') }}-20220404
404+
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/espressif/esp-idf/HEAD') }}-${{ steps.py3.outputs.python-path }}-20220404
404405
- name: Clone IDF submodules
405406
run: |
406407
(cd $IDF_PATH && git submodule update --init)

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,9 @@
286286
[submodule "frozen/Adafruit_CircuitPython_FakeRequests"]
287287
path = frozen/Adafruit_CircuitPython_FakeRequests
288288
url = https://github.com/adafruit/Adafruit_CircuitPython_FakeRequests.git
289+
[submodule "frozen/pew-pewpew-lcd"]
290+
path = frozen/pew-pewpew-lcd
291+
url = https://github.com/pypewpew/pew-pewpew-lcd.git
292+
[submodule "frozen/mixgo_cp_lib"]
293+
path = frozen/mixgo_cp_lib
294+
url = https://github.com/dahanzimin/circuitpython_lib.git

.readthedocs.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,15 @@
99
version: 2
1010

1111
build:
12-
os: ubuntu-20.04
13-
tools:
14-
python: "3"
15-
16-
submodules:
17-
include:
18-
- extmod/ulab
12+
os: ubuntu-20.04
13+
tools:
14+
python: "3"
15+
jobs:
16+
post_install:
17+
- python tools/ci_fetch_deps.py docs HEAD
1918

2019
formats:
21-
- pdf
20+
- pdf
2221

2322
python:
2423
install:

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ TRANSLATE_SOURCES_EXC = -path "ports/*/build-*" \
6161

6262
help:
6363
@echo "Please use \`make <target>' where <target> is one of"
64+
@echo " fetch-submodules to fetch dependencies from submodules, run this right after you clone the repo"
6465
@echo " html to make standalone HTML files"
6566
@echo " dirhtml to make HTML files named index.html in directories"
6667
@echo " singlehtml to make a single large HTML file"

README.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ Behavior
120120
make each file independent from each other.
121121

122122
- ``boot.py`` runs only once on start up before
123-
USB is initialized. This lays the ground work for configuring USB at
123+
workflows are initialized. This lays the ground work for configuring USB at
124124
startup rather than it being fixed. Since serial is not available,
125125
output is written to ``boot_out.txt``.
126126
- ``code.py`` (or ``main.py``) is run after every reload until it
@@ -135,7 +135,10 @@ Behavior
135135
possible to fix code that causes nasty crashes by making it available through mass storage after
136136
the crash. A reset (the button) is needed after it's fixed to get back into normal mode.
137137
- RGB status LED indicating CircuitPython state.
138-
- Re-runs ``code.py`` or other main file after file system writes over USB mass storage. (Disable with
138+
- One green flash - code completed without error.
139+
- Two red flashes - code ended due to an exception.
140+
- Three yellow flashes - safe mode. May be due to CircuitPython internal error.
141+
- Re-runs ``code.py`` or other main file after file system writes by a workflow. (Disable with
139142
``supervisor.disable_autoreload()``)
140143
- Autoreload is disabled while the REPL is active.
141144
- Main is one of these: ``code.txt``, ``code.py``, ``main.py``,

conf.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,25 @@
3333

3434
tools_describe = str(pathlib.Path(__file__).parent / "tools/describe")
3535

36+
# Monkeypatch autoapi
37+
def _format_args(args_info, include_annotations=True, ignore_self=None):
38+
result = []
39+
40+
for i, (prefix, name, annotation, default) in enumerate(args_info):
41+
if i == 0 and ignore_self is not None and name == ignore_self:
42+
continue
43+
formatted = "{}{}{}{}".format(
44+
prefix or "",
45+
name or "",
46+
": {}".format(annotation) if annotation and include_annotations else "",
47+
(" = {}" if annotation else "={}").format(default) if default else "",
48+
)
49+
result.append(formatted)
50+
return ", ".join(result)
51+
52+
import autoapi.mappers.python.objects as objects
53+
objects._format_args = _format_args
54+
3655
# If extensions (or modules to document with autodoc) are in another directory,
3756
# add these directories to sys.path here. If the directory is relative to the
3857
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -53,9 +72,13 @@
5372
modules_support_matrix = shared_bindings_matrix.support_matrix_by_board()
5473
modules_support_matrix_reverse = defaultdict(list)
5574
for board, modules in modules_support_matrix.items():
56-
for module in modules:
75+
for module in modules[0]:
5776
modules_support_matrix_reverse[module].append(board)
58-
modules_support_matrix_reverse = dict((module, sorted(boards)) for module, boards in modules_support_matrix_reverse.items())
77+
78+
modules_support_matrix_reverse = dict(
79+
(module, sorted(boards))
80+
for module, boards in modules_support_matrix_reverse.items()
81+
)
5982

6083
html_context = {
6184
'support_matrix': modules_support_matrix,

devices/ble_hci/common-hal/_bleio/Characteristic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ void common_hal_bleio_characteristic_construct(bleio_characteristic_obj_t *self,
5757
self->value = mp_obj_new_bytes(initial_value_bufinfo->buf, initial_value_bufinfo->len);
5858

5959
const mp_int_t max_length_max = 512;
60-
if (max_length < 0 || max_length > max_length_max) {
61-
mp_raise_ValueError(translate("max_length must be <= 512"));
62-
}
60+
61+
mp_arg_validate_int_range(max_length, 0, max_length_max, MP_QSTR_max_length);
62+
6363
self->max_length = max_length;
6464
self->fixed_length = fixed_length;
6565

devices/ble_hci/common-hal/_bleio/__init__.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ bool vm_used_ble;
5757
// }
5858
// }
5959

60+
void bleio_user_reset() {
61+
// HCI doesn't support the BLE workflow so just do a full reset.
62+
bleio_reset();
63+
}
64+
6065
// Turn off BLE on a reset or reload.
6166
void bleio_reset() {
6267
// Create a UUID object for all CCCD's.

devices/ble_hci/common-hal/_bleio/att.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "shared-bindings/_bleio/Service.h"
4545
#include "shared-bindings/_bleio/UUID.h"
4646
#include "supervisor/shared/tick.h"
47+
#include "supervisor/shared/translate/translate.h"
4748

4849
STATIC uint16_t max_mtu = BT_ATT_DEFAULT_LE_MTU; // 23
4950
STATIC unsigned long timeout = 5000;

docs/environment.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Environment Variables
2+
=====================
3+
4+
CircuitPython 8.0.0 introduces support for environment variables. Environment
5+
variables are commonly used to store "secrets" such as Wi-Fi passwords and API
6+
keys. This method *does not* make them secure. It only separates them from the
7+
code.
8+
9+
CircuitPython supports these by mimicking the `dotenv <https://github.com/theskumar/python-dotenv>`_
10+
CPython library. Other languages such as Javascript, PHP and Ruby also have
11+
dotenv libraries.
12+
13+
These libraries store environment variables in a ``.env`` file. Here is a simple
14+
example:
15+
16+
.. code-block:: bash
17+
18+
KEY1='value1'
19+
# Comment
20+
KEY2='value2
21+
is multiple lines'
22+
23+
CircuitPython uses the ``.env`` at the drive root (no folder) as the environment.
24+
User code can access the values from the file using `os.getenv()`. It is
25+
recommended to save any values used repeatedly in a variable because `os.getenv()`
26+
will parse the ``/.env`` on every access.
27+
28+
CircuitPython behavior
29+
----------------------
30+
31+
CircuitPython will also read the environment to configure its behavior. Other
32+
keys are ignored by CircuitPython. Here are the keys it uses:
33+
34+
CIRCUITPY_WIFI_PASSWORD
35+
~~~~~~~~~~~~~~~~~~~~~~~
36+
Wi-Fi password used to auto connect to CIRCUITPY_WIFI_SSID
37+
38+
CIRCUITPY_WIFI_SSID
39+
~~~~~~~~~~~~~~~~~~~
40+
Wi-Fi SSID to auto-connect to even if user code is not running.

0 commit comments

Comments
 (0)