Skip to content

Commit 295103b

Browse files
committed
Merge remote-tracking branch 'upstream/main' into sleep-revamp
2 parents 7eeea86 + 35ee4ad commit 295103b

File tree

1,703 files changed

+91752
-44576
lines changed

Some content is hidden

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

1,703 files changed

+91752
-44576
lines changed

.git-blame-ignore-revs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# tests/run-tests.py: Reformat with Black.
2+
2a38d7103672580882fb621a5b76e8d26805d593
3+
4+
# all: Update Python code to conform to latest black formatting.
5+
06659077a81b85882254cf0953c33b27614e018e
6+
7+
# tools/uncrustify: Enable more opts to remove space between func and '('.
8+
77ed6f69ac35c1663a5633a8ee1d8a2446542204
9+
10+
# tools/codeformat.py: Include extmod/{btstack,nimble} in code formatting.
11+
026fda605e03113d6e753290d65fed774418bc53
12+
13+
# all: Format code to add space after C++-style comment start.
14+
84fa3312cfa7d2237d4b56952f2cd6e3591210c4
15+
16+
# tests: Format all Python code with black, except tests in basics subdir.
17+
3dc324d3f1312e40d3a8ed87e7244966bb756f26
18+
19+
# all: Remove spaces inside and around parenthesis.
20+
1a3e386c67e03a79eb768cb6e9f6777e002d6660
21+
22+
# all: Remove spaces between nested paren and inside function arg paren.
23+
feb25775851ba0c04b8d1013716f442258879d9c
24+
25+
# all: Reformat C and Python source code with tools/codeformat.py.
26+
69661f3343bedf86e514337cff63d96cc42f8859
27+
28+
# stm32/usbdev: Convert files to unix line endings.
29+
abde0fa2267f9062b28c3c015d7662a550125cc6
30+
31+
# all: Remove trailing spaces, per coding conventions.
32+
761e4c7ff62896c7d8f8c3dfc3cc98a4cc4f2f6f

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*.bat text eol=crlf
1212

1313
# These are binary so should never be modified by git.
14+
*.a binary
1415
*.png binary
1516
*.jpg binary
1617
*.dxf binary

.github/workflows/build.yml

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
run: |
3838
sudo apt-get update
3939
sudo apt-get install -y eatmydata
40-
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra
40+
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra gcc-aarch64-linux-gnu
4141
pip install -r requirements-dev.txt
4242
- name: Versions
4343
run: |
@@ -71,28 +71,25 @@ jobs:
7171
run: make -C mpy-cross -j2
7272
- name: Build unix port
7373
run: |
74-
make -C ports/unix deplibs -j2
75-
make -C ports/unix -j2
76-
make -C ports/unix coverage -j2
74+
make -C ports/unix VARIANT=coverage -j2
7775
- name: Test all
78-
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1
76+
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1
7977
working-directory: tests
80-
- name: Print failure info
81-
run: |
82-
shopt -s nullglob;
83-
for exp in *.exp;
84-
do testbase=$(basename $exp .exp);
85-
echo -e "\nFAILURE $testbase";
86-
diff -u $testbase.exp $testbase.out;
87-
done
88-
working-directory: tests
89-
if: failure()
9078
- name: Native Tests
91-
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native
79+
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --emit native
9280
working-directory: tests
9381
- name: mpy Tests
94-
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float
82+
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --mpy-cross-flags='-mcache-lookup-bc' --via-mpy -d basics float micropython
83+
working-directory: tests
84+
- name: Native mpy Tests
85+
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython-coverage ./run-tests.py -j1 --mpy-cross-flags='-mcache-lookup-bc' --via-mpy --emit native -d basics float micropython
9586
working-directory: tests
87+
- name: Build mpy-cross.static-aarch64
88+
run: make -C mpy-cross -j2 -f Makefile.static-aarch64
89+
- uses: actions/upload-artifact@v2
90+
with:
91+
name: mpy-cross.static-aarch64
92+
path: mpy-cross/mpy-cross.static-aarch64
9693
- name: Build mpy-cross.static-raspbian
9794
run: make -C mpy-cross -j2 -f Makefile.static-raspbian
9895
- uses: actions/upload-artifact@v2
@@ -113,6 +110,7 @@ jobs:
113110
path: mpy-cross/mpy-cross.static.exe
114111
- name: Upload stubs and mpy-cross builds to S3
115112
run: |
113+
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-aarch64 s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-aarch64-${{ env.CP_VERSION }} --no-progress --region us-east-1
116114
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1
117115
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1
118116
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1
@@ -180,10 +178,12 @@ jobs:
180178
- "adafruit_itsybitsy_rp2040"
181179
- "adafruit_neokey_trinkey_m0"
182180
- "adafruit_proxlight_trinkey_m0"
181+
- "adafruit_qt2040_trinkey"
183182
- "adafruit_qtpy_rp2040"
184183
- "adafruit_rotary_trinkey_m0"
185184
- "adafruit_slide_trinkey_m0"
186185
- "aloriumtech_evo_m51"
186+
- "aramcon2_badge"
187187
- "aramcon_badge_2019"
188188
- "arduino_mkr1300"
189189
- "arduino_mkrzero"
@@ -208,6 +208,7 @@ jobs:
208208
- "clue_nrf52840_express"
209209
- "cp32-m4"
210210
- "cp_sapling_m0"
211+
- "cp_sapling_m0_revb"
211212
- "cp_sapling_m0_spiflash"
212213
- "datalore_ip_m4"
213214
- "datum_distance"
@@ -236,7 +237,6 @@ jobs:
236237
- "feather_mimxrt1011"
237238
- "feather_mimxrt1062"
238239
- "feather_nrf52840_express"
239-
- "feather_radiofruit_zigbee"
240240
- "feather_stm32f405_express"
241241
- "fluff_m0"
242242
- "gemma_m0"
@@ -289,6 +289,8 @@ jobs:
289289
- "pewpew_m4"
290290
- "picoplanet"
291291
- "pimoroni_keybow2040"
292+
- "pimoroni_picolipo_16mb"
293+
- "pimoroni_picolipo_4mb"
292294
- "pimoroni_picosystem"
293295
- "pimoroni_tiny2040"
294296
- "pirkey_m0"
@@ -320,6 +322,7 @@ jobs:
320322
- "simmel"
321323
- "snekboard"
322324
- "sparkfun_lumidrive"
325+
- "sparkfun_micromod_rp2040"
323326
- "sparkfun_nrf52840_micromod"
324327
- "sparkfun_nrf52840_mini"
325328
- "sparkfun_pro_micro_rp2040"
@@ -379,6 +382,8 @@ jobs:
379382
python3 --version
380383
- name: mpy-cross
381384
run: make -C mpy-cross -j2
385+
- name: Setup build failure matcher
386+
run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json"
382387
- name: build
383388
run: python3 -u build_release_files.py
384389
working-directory: tools
@@ -428,6 +433,8 @@ jobs:
428433
python3 --version
429434
- name: mpy-cross
430435
run: make -C mpy-cross -j2
436+
- name: Setup build failure matcher
437+
run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json"
431438
- name: build
432439
run: python3 -u build_release_files.py
433440
working-directory: tools
@@ -457,6 +464,7 @@ jobs:
457464
- "adafruit_magtag_2.9_grayscale"
458465
- "adafruit_metro_esp32s2"
459466
- "artisense_rd00"
467+
- "atmegazero_esp32s2"
460468
- "electroniccats_bastwifi"
461469
- "espressif_kaluga_1"
462470
- "espressif_saola_1_wroom"
@@ -489,7 +497,7 @@ jobs:
489497
id: idf-cache
490498
with:
491499
path: ${{ github.workspace }}/.idf_tools
492-
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210304
500+
key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210506
493501
- name: Clone IDF submodules
494502
run: |
495503
(cd $IDF_PATH && git submodule update --init)
@@ -526,6 +534,8 @@ jobs:
526534
IDF_TOOLS_PATH: ${{ github.workspace }}/.idf_tools
527535
- name: mpy-cross
528536
run: make -C mpy-cross -j2
537+
- name: Setup build failure matcher
538+
run: echo "::add-matcher::$GITHUB_WORKSPACE/.github/workflows/match-build-fail.json"
529539
- name: build
530540
run: |
531541
source $IDF_PATH/export.sh
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"severity": "error",
5+
"pattern": [
6+
{
7+
"regexp": "^(Build .+ and \\x1b\\[31mfailed\\x1b\\[0m)$",
8+
"message": 1
9+
}
10+
],
11+
"owner": "build-failed"
12+
}
13+
]
14+
}

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@ dist/
2828
######################
2929
*.swp
3030

31-
# Build directory
31+
# Build directories
3232
######################
3333
build/
3434
bin/
3535
circuitpython-stubs/
36+
build-*/
3637

3738
# Test failure outputs
3839
######################
39-
tests/*.exp
40-
tests/*.out
40+
tests/results/*
4141

4242
# Python cache files
4343
######################

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
url = https://github.com/adafruit/Adafruit_CircuitPython_Register.git
114114
[submodule "extmod/ulab"]
115115
path = extmod/ulab
116-
url = https://github.com/v923z/micropython-ulab
116+
url = https://github.com/adafruit/circuitpython-ulab
117117
[submodule "frozen/Adafruit_CircuitPython_ESP32SPI"]
118118
path = frozen/Adafruit_CircuitPython_ESP32SPI
119119
url = https://github.com/adafruit/Adafruit_CircuitPython_ESP32SPI

ACKNOWLEDGEMENTS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,6 @@ today. The names appear in order of pledging.
762762
1642 Udine
763763
1643 Simon Critchley
764764
1644 Sven Haiges, Germany
765-
1645 Yi Qing Sim
766765
1646 "silicium" ("silicium_one", if "silicium" is busy)
767766
1648 Andy O'Malia, @andyomalia
768767
1650 RedCamelApps.com

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2013, 2014 Damien P. George
3+
Copyright (c) 2013-2021 Damien P. George
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# You can set these variables from the command line.
99
PYTHON = python3
10-
SPHINXOPTS =
10+
SPHINXOPTS = -W --keep-going
1111
SPHINXBUILD = sphinx-build
1212
PAPER =
1313
# path to build the generated docs
@@ -223,7 +223,7 @@ pseudoxml:
223223
all-source:
224224

225225
locale/circuitpython.pot: all-source
226-
find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o - | sed -e '/"POT-Creation-Date: /d' > $@
226+
find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate --keyword=MP_ERROR_TEXT -o - | sed -e '/"POT-Creation-Date: /d' > $@
227227

228228
# Historically, `make translate` updated the .pot file and ran msgmerge.
229229
# However, this was a frequent source of merge conflicts. Weblate can perform
@@ -248,7 +248,7 @@ merge-translate:
248248

249249
.PHONY: check-translate
250250
check-translate:
251-
find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o circuitpython.pot.tmp -p locale
251+
find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate --keyword=MP_ERROR_TEXT -o circuitpython.pot.tmp -p locale
252252
$(PYTHON) tools/check_translations.py locale/circuitpython.pot.tmp locale/circuitpython.pot; status=$$?; rm -f locale/circuitpython.pot.tmp; exit $$status
253253

254254
stubs:

WEBUSB_README.md

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -62,33 +62,4 @@ The tinyusb examples already include a "WebUSB serial" example.
6262
Basically, this feature was ported into CircuitPython by pulling code snippets out of the
6363
tinyusb example, and putting them where they best belonged in the CircuitPython codebase.
6464

65-
There was one complication:
66-
67-
tinyusb uses C preprocessor macros to define things like USB descriptors.
68-
69-
CircuitPython uses a Python program (tools/gen_usb_descriptor.py) to create USB descriptors (etc.)
70-
using "helper objects" from another repo (adafruit_usb_descriptor). This means some of the example
71-
code had to be adapted to the new programing model, and gen_usb_descriptor gained new command-line
72-
options to control the generated code.
73-
74-
The generated files go into the "build" directory, look for autogen_usb_descriptor.c and
75-
genhdr/autogen_usb_descriptor.h.
76-
77-
78-
Also worth pointing out - the re-use of the CDC connect/disconnect mechanism is not actually part
79-
of the WebUSB standard, it's more of "common idiom". We make use of it here because we need to know
80-
when we should be paying attention to the WebUSB serial interface, and when we should ignore it..
81-
82-
## Possible future work areas
83-
84-
The current code uses the existing Python infrastructure to create the Interface descriptor, but
85-
simply outputs the code snippets from the original tinyusb demo code to create the WEBUSB_URL,
86-
BOS, and MS_OS_20 descriptors. I suppose additional work could be done to add these to the
87-
adafruit_usb_descriptor project, and then gen_usb_descriptor.py could be modified to make use
88-
of them.
89-
90-
Program gen_usb_descriptor.py creates objects for most interface types, regardless of whether or
91-
not they are actually enabled. This increases the size of a generated string table. I made the
92-
new vendor-interface-related code not do this (because some of the ARM platforms would no longer
93-
build), but I did not go back and do this for the other interface types (CDC, MIDI, HID, etc.)
94-
Some FLASH savings are probably possible if this is done.
65+
### TODO: This needs to be reworked for dynamic USB descriptors.

conf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import urllib.parse
2626
import time
2727

28-
import recommonmark
2928
from sphinx.transforms import SphinxTransform
3029
from docutils import nodes
3130
from sphinx import addnodes
@@ -68,8 +67,9 @@
6867
'sphinx.ext.intersphinx',
6968
'sphinx.ext.todo',
7069
'sphinx.ext.coverage',
70+
'sphinx_search.extension',
7171
'rstjinja',
72-
'recommonmark',
72+
'myst_parser',
7373
]
7474

7575
# Add any paths that contain templates here, relative to this directory.
@@ -489,6 +489,8 @@ def apply(self, **kwargs):
489489

490490
def setup(app):
491491
app.add_css_file("customstyle.css")
492+
app.add_css_file("filter.css")
493+
app.add_js_file("filter.js")
492494
app.add_config_value('redirects_file', 'redirects', 'env')
493495
app.connect('builder-inited', generate_redirects)
494496
app.add_transform(CoreModuleTransform)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,10 +886,10 @@ uint16_t bleio_adapter_add_attribute(bleio_adapter_obj_t *adapter, mp_obj_t *att
886886
uint16_t handle = (uint16_t)adapter->attributes->len;
887887
mp_obj_list_append(adapter->attributes, attribute);
888888

889-
if (MP_OBJ_IS_TYPE(attribute, &bleio_service_type)) {
889+
if (mp_obj_is_type(attribute, &bleio_service_type)) {
890890
adapter->last_added_service_handle = handle;
891891
}
892-
if (MP_OBJ_IS_TYPE(attribute, &bleio_characteristic_type)) {
892+
if (mp_obj_is_type(attribute, &bleio_characteristic_type)) {
893893
adapter->last_added_characteristic_handle = handle;
894894
}
895895

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@
3333

3434

3535
bleio_uuid_obj_t *bleio_attribute_get_uuid(mp_obj_t *attribute) {
36-
if (MP_OBJ_IS_TYPE(attribute, &bleio_characteristic_type)) {
36+
if (mp_obj_is_type(attribute, &bleio_characteristic_type)) {
3737
bleio_characteristic_obj_t *characteristic = MP_OBJ_TO_PTR(attribute);
3838
return characteristic->uuid;
3939
}
40-
if (MP_OBJ_IS_TYPE(attribute, &bleio_descriptor_type)) {
40+
if (mp_obj_is_type(attribute, &bleio_descriptor_type)) {
4141
bleio_descriptor_obj_t *descriptor = MP_OBJ_TO_PTR(attribute);
4242
return descriptor->uuid;
4343
}
44-
if (MP_OBJ_IS_TYPE(attribute, &bleio_service_type)) {
44+
if (mp_obj_is_type(attribute, &bleio_service_type)) {
4545
bleio_service_obj_t *service = MP_OBJ_TO_PTR(attribute);
4646
return service->uuid;
4747
}

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ bleio_service_obj_t *common_hal_bleio_characteristic_get_service(bleio_character
7878
return self->service;
7979
}
8080

81+
size_t common_hal_bleio_characteristic_get_max_length(bleio_characteristic_obj_t *self) {
82+
return self->max_length;
83+
}
84+
8185
size_t common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *self, uint8_t *buf, size_t len) {
8286
// Do GATT operations only if this characteristic has been added to a registered service.
8387
if (self->handle != BLE_GATT_HANDLE_INVALID) {
@@ -209,9 +213,9 @@ bool bleio_characteristic_set_local_value(bleio_characteristic_obj_t *self, mp_b
209213

210214
self->value = mp_obj_new_bytes(bufinfo->buf, bufinfo->len);
211215

212-
if (MP_OBJ_IS_TYPE(self->observer, &bleio_characteristic_buffer_type)) {
216+
if (mp_obj_is_type(self->observer, &bleio_characteristic_buffer_type)) {
213217
bleio_characteristic_buffer_update(MP_OBJ_FROM_PTR(self->observer), bufinfo);
214-
} else if (MP_OBJ_IS_TYPE(self->observer, &bleio_packet_buffer_type)) {
218+
} else if (mp_obj_is_type(self->observer, &bleio_packet_buffer_type)) {
215219
bleio_packet_buffer_update(MP_OBJ_FROM_PTR(self->observer), bufinfo);
216220
} else {
217221
return false;

0 commit comments

Comments
 (0)