Skip to content

Commit cf21c4d

Browse files
authored
Merge pull request #1 from adafruit/main
merge from adafruit
2 parents 7611e71 + eec9821 commit cf21c4d

File tree

473 files changed

+34633
-3227
lines changed

Some content is hidden

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

473 files changed

+34633
-3227
lines changed

.github/workflows/build.yml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: CircuitPython version
2929
run: |
3030
git describe --dirty --tags
31-
echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)"
31+
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
3232
- name: Set up Python 3.8
3333
uses: actions/setup-python@v1
3434
with:
@@ -37,7 +37,7 @@ jobs:
3737
run: |
3838
sudo apt-get install -y eatmydata
3939
sudo eatmydata apt-get install -y gettext librsvg2-bin mingw-w64 latexmk texlive-fonts-recommended texlive-latex-recommended texlive-latex-extra
40-
pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli
40+
pip install requests sh click setuptools cpp-coveralls "Sphinx<4" sphinx-rtd-theme recommonmark sphinx-autoapi sphinxcontrib-svg2pdfconverter polib pyyaml astroid isort black awscli mypy
4141
- name: Versions
4242
run: |
4343
gcc --version
@@ -67,8 +67,8 @@ jobs:
6767
- name: mpy Tests
6868
run: MICROPY_CPYTHON3=python3.8 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float
6969
working-directory: tests
70-
- name: Stubs
71-
run: make stubs -j2
70+
- name: Build and Validate Stubs
71+
run: make check-stubs -j2
7272
- uses: actions/upload-artifact@v2
7373
with:
7474
name: stubs
@@ -91,6 +91,8 @@ jobs:
9191
- name: New boards check
9292
run: python3 -u ci_new_boards_check.py
9393
working-directory: tools
94+
- name: Duplicate USB VID/PID Check
95+
run: python3 -u -m tools.ci_check_duplicate_usb_vid_pid
9496
- name: Build mpy-cross.static-raspbian
9597
run: make -C mpy-cross -j2 -f Makefile.static-raspbian
9698
- uses: actions/upload-artifact@v2
@@ -109,11 +111,13 @@ jobs:
109111
with:
110112
name: mpy-cross.static-x64-windows
111113
path: mpy-cross/mpy-cross.static.exe
112-
- name: Upload mpy-cross builds to S3
114+
- name: Upload stubs and mpy-cross builds to S3
113115
run: |
114116
[ -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
115117
[ -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
116118
[ -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
119+
zip -9r circuitpython-stubs.zip circuitpython-stubs
120+
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1
117121
env:
118122
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
119123
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
@@ -129,8 +133,8 @@ jobs:
129133
run: echo "$GITHUB_CONTEXT"
130134
- name: Install dependencies
131135
run: |
132-
brew install gettext awscli
133-
echo "::set-env name=PATH::/usr/local/opt/gettext/bin:$PATH"
136+
brew install gettext
137+
echo >>$GITHUB_PATH /usr/local/opt/gettext/bin
134138
- name: Versions
135139
run: |
136140
gcc --version
@@ -144,7 +148,7 @@ jobs:
144148
- name: CircuitPython version
145149
run: |
146150
git describe --dirty --tags
147-
echo "::set-env name=CP_VERSION::$(git describe --dirty --tags)"
151+
echo >>$GITHUB_ENV CP_VERSION=$(git describe --dirty --tags)
148152
- name: Build mpy-cross
149153
run: make -C mpy-cross -j2
150154
- uses: actions/upload-artifact@v2
@@ -168,6 +172,7 @@ jobs:
168172
matrix:
169173
board:
170174
- "8086_commander"
175+
- "ADM_B_NRF52840_1"
171176
- "TG-Watch02A"
172177
- "aloriumtech_evo_m51"
173178
- "aramcon_badge_2019"
@@ -177,7 +182,8 @@ jobs:
177182
- "arduino_nano_33_iot"
178183
- "arduino_zero"
179184
- "bast_pro_mini_m0"
180-
- "bdmicro_vina_m0"
185+
- "bdmicro_vina_d21"
186+
- "bdmicro_vina_d51"
181187
- "bless_dev_board_multi_sensor"
182188
- "blm_badge"
183189
- "capablerobot_usbhub"
@@ -195,6 +201,8 @@ jobs:
195201
- "datum_imu"
196202
- "datum_light"
197203
- "datum_weather"
204+
- "dynossat_edu_eps"
205+
- "dynossat_edu_obc"
198206
- "electronut_labs_blip"
199207
- "electronut_labs_papyr"
200208
- "escornabot_makech"
@@ -208,6 +216,7 @@ jobs:
208216
- "feather_m0_rfm69"
209217
- "feather_m0_rfm9x"
210218
- "feather_m0_supersized"
219+
- "feather_m4_can"
211220
- "feather_m4_express"
212221
- "feather_m7_1011"
213222
- "feather_mimxrt1011"
@@ -240,6 +249,7 @@ jobs:
240249
- "metro_m0_express"
241250
- "metro_m4_airlift_lite"
242251
- "metro_m4_express"
252+
- "metro_m7_1011"
243253
- "metro_nrf52840_express"
244254
- "mini_sam_m4"
245255
- "monster_m4sk"
@@ -275,6 +285,8 @@ jobs:
275285
- "pyportal"
276286
- "pyportal_titano"
277287
- "pyruler"
288+
- "qtpy_m0"
289+
- "qtpy_m0_haxpress"
278290
- "raytac_mdbt50q-db-40"
279291
- "robohatmm1_m4"
280292
- "sam32"
@@ -409,12 +421,18 @@ jobs:
409421
fail-fast: false
410422
matrix:
411423
board:
424+
- "adafruit_esp32s2_eink_portal"
425+
- "adafruit_metro_esp32s2"
412426
- "electroniccats_bastwifi"
413427
- "espressif_kaluga_1"
414428
- "espressif_saola_1_wroom"
415429
- "espressif_saola_1_wrover"
416430
- "microdev_micro_s2"
431+
- "muselab_nanoesp32_s2"
432+
- "targett_module_clip_wroom"
433+
- "targett_module_clip_wrover"
417434
- "unexpectedmaker_feathers2"
435+
- "unexpectedmaker_feathers2_prerelease"
418436

419437
steps:
420438
- name: Set up Python 3.8

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/checkout@v1
1717
- uses: actions/setup-python@v1
1818
- name: set PY
19-
run: echo "::set-env name=PY::$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
19+
run: echo >>$GITHUB_ENV PY="$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')"
2020
- uses: actions/cache@v1
2121
with:
2222
path: ~/.cache/pre-commit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ TAGS
8080
*.mo
8181

8282
.vscode
83+
.idea
8384

8485
# Python Virtual Environments
8586
####################

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@
144144
[submodule "frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center"]
145145
path = frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center
146146
url = https://github.com/adafruit/Adafruit_CircuitPython_BLE_Apple_Notification_Center
147-
[submodule "ports/esp32s2/esp-idf"]
148-
path = ports/esp32s2/esp-idf
149-
url = https://github.com/tannewt/esp-idf.git
150147
[submodule "frozen/Adafruit_CircuitPython_RFM9x"]
151148
path = frozen/Adafruit_CircuitPython_RFM9x
152149
url = https://github.com/adafruit/Adafruit_CircuitPython_RFM9x.git
153150
[submodule "frozen/Adafruit_CircuitPython_RFM69"]
154151
path = frozen/Adafruit_CircuitPython_RFM69
155152
url = https://github.com/adafruit/Adafruit_CircuitPython_RFM69.git
153+
[submodule "ports/esp32s2/esp-idf"]
154+
path = ports/esp32s2/esp-idf
155+
url = https://github.com/espressif/esp-idf.git

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ repos:
88
hooks:
99
- id: check-yaml
1010
- id: end-of-file-fixer
11-
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)'
11+
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/esp32s2/esp-idf-config/.*|ports/esp32s2/boards/.*/sdkconfig)'
1212
- id: trailing-whitespace
1313
exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)'

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ SPDX-License-Identifier: MIT
66

77
# Contributing
88
Please note that this project is released with a
9-
[Contributor Code of Conduct](https://github.com/adafruit/circuitpython/blob/main/CODE_OF_CONDUCT.md).
9+
[Contributor Code of Conduct](CODE_OF_CONDUCT.md).
1010
By participating in this project you agree to abide by its terms. Participation
1111
covers any forum used to converse about CircuitPython including unofficial and official spaces. Failure to do
1212
so will result in corrective actions such as time out or ban from the project.

Makefile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,19 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(BASEOPTS)
4040
# the i18n builder cannot share the environment and doctrees with the others
4141
I18NSPHINXOPTS = $(BASEOPTS)
4242

43-
TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/cxd56 ports/mimxrt10xx ports/nrf ports/stm py shared-bindings shared-module supervisor
43+
TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/cxd56 ports/esp32s2 ports/mimxrt10xx ports/nrf ports/stm py shared-bindings shared-module supervisor
44+
# Paths to exclude from TRANSLATE_SOURCES
45+
# Each must be preceded by "-path"; if any wildcards, enclose in quotes.
46+
# Separate by "-o" (Find's "or" operand)
47+
TRANSLATE_SOURCES_EXC = -path "ports/*/build-*" \
48+
-o -path "ports/*/build" \
49+
-o -path ports/esp32s2/esp-idf \
50+
-o -path ports/cxd56/spresense-exported-sdk \
51+
-o -path ports/stm/st_driver \
52+
-o -path ports/atmel-samd/asf4 \
53+
-o -path ports/mimxrt10xx/sdk \
54+
-o -path lib/tinyusb \
55+
-o -path lib/lwip \
4456

4557
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext stubs
4658

@@ -210,7 +222,7 @@ pseudoxml:
210222
all-source:
211223

212224
locale/circuitpython.pot: all-source
213-
find $(TRANSLATE_SOURCES) -iname "*.c" -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o circuitpython.pot -p locale
225+
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 -p locale
214226

215227
# Historically, `make translate` updated the .pot file and ran msgmerge.
216228
# However, this was a frequent source of merge conflicts. Weblate can perform
@@ -235,7 +247,7 @@ merge-translate:
235247

236248
.PHONY: check-translate
237249
check-translate:
238-
find $(TRANSLATE_SOURCES) -iname "*.c" -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o circuitpython.pot.tmp -p locale
250+
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
239251
$(PYTHON) tools/check_translations.py locale/circuitpython.pot.tmp locale/circuitpython.pot; status=$$?; rm -f locale/circuitpython.pot.tmp; exit $$status
240252

241253
stubs:

README.rst

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ Differences from `MicroPython <https://github.com/micropython/micropython>`__
9595
CircuitPython:
9696

9797
- Supports native USB on all boards, allowing file editing without special tools.
98-
- Supports only SAMD21, SAMD51, nRF52840, CXD56, STM32F4 and i.MX RT ports.
9998
- Floats (aka decimals) are enabled for all builds.
10099
- Error messages are translated into 10+ languages.
101100
- Does not support concurrency within Python (including interrupts and threading). Some concurrency
@@ -137,8 +136,8 @@ Behavior
137136
API
138137
~~~
139138

140-
- Unified hardware APIs. Documented
141-
`on ReadTheDocs <https://circuitpython.readthedocs.io/en/latest/shared-bindings/index.html>`_.
139+
- Unified hardware APIs. Documented on
140+
`ReadTheDocs <https://circuitpython.readthedocs.io/en/latest/shared-bindings/index.html>`_.
142141
- API docs are rST within the C files in ``shared-bindings``.
143142
- No ``machine`` API.
144143

@@ -201,14 +200,27 @@ Ports
201200
Ports include the code unique to a microcontroller line and also
202201
variations based on the board.
203202

204-
- ``atmel-samd`` Support for SAMD21 and SAMD51 based boards.
205-
- ``nrf`` Support for the nRF52840 based boards.
206-
- ``unix`` Support for UNIX. Only used for automated testing.
203+
================ ============================================================
204+
Supported Support status
205+
================ ============================================================
206+
atmel-samd ``SAMD21`` stable | ``SAMD51`` stable
207+
cxd56 stable
208+
esp32s2 beta
209+
litex alpha
210+
mimxrt10xx alpha
211+
nrf stable
212+
stm ``F4`` stable | ``others`` beta
213+
unix alpha
214+
================ ============================================================
215+
216+
- ``stable`` Highly unlikely to have bugs or missing functionality.
217+
- ``beta`` Being actively improved but may be missing functionality and have bugs.
218+
- ``alpha`` Will have bugs and missing functionality.
207219

208220
The remaining port directories not listed above are in the repo to maintain compatibility with the
209221
`MicroPython <https://github.com/micropython/micropython>`__ parent project.
210222

211-
`back to top <#circuitpython>`__
223+
`Back to Top <#circuitpython>`__
212224

213225
.. |Build Status| image:: https://github.com/adafruit/circuitpython/workflows/Build%20CI/badge.svg
214226
:target: https://github.com/adafruit/circuitpython/actions?query=branch%3Amain

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
#include "shared-bindings/_bleio/Address.h"
4646
#include "shared-bindings/_bleio/Characteristic.h"
4747
#include "shared-bindings/_bleio/Service.h"
48-
#include "shared-bindings/nvm/ByteArray.h"
4948
#include "shared-bindings/_bleio/Connection.h"
5049
#include "shared-bindings/_bleio/ScanEntry.h"
5150
#include "shared-bindings/time/__init__.h"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ bleio_adapter_obj_t *common_hal_bleio_allocate_adapter_or_raise(void) {
9898

9999
void common_hal_bleio_check_connected(uint16_t conn_handle) {
100100
if (conn_handle == BLE_CONN_HANDLE_INVALID) {
101-
mp_raise_bleio_ConnectionError(translate("Not connected"));
101+
mp_raise_ConnectionError(translate("Not connected"));
102102
}
103103
}
104104

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,6 +1748,7 @@ void check_att_err(uint8_t err) {
17481748
break;
17491749
case BT_ATT_ERR_ENCRYPTION_KEY_SIZE:
17501750
msg = translate("Encryption key size");
1751+
break;
17511752
case BT_ATT_ERR_INVALID_ATTRIBUTE_LEN:
17521753
msg = translate("Invalid attribute length");
17531754
break;

devices/ble_hci/common-hal/_bleio/hci_include/att_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include <stdbool.h>
1313
// for __packed
14-
#include <string.h>
14+
#include <sys/cdefs.h>
1515

1616
#define BT_EATT_PSM 0x27
1717
#define BT_ATT_DEFAULT_LE_MTU 23

devices/ble_hci/common-hal/_bleio/hci_include/hci.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,15 @@
1212
#define ZEPHYR_INCLUDE_BLUETOOTH_HCI_H_
1313

1414
#include <stdbool.h>
15-
#include <string.h>
15+
// for __packed
16+
#include <sys/cdefs.h>
17+
1618
#include "addr.h"
1719

20+
// ESP32S2 build environment defines this already.
21+
#ifndef BIT
1822
#define BIT(n) (1UL << (n))
23+
#endif
1924

2025
/* Special own address types for LL privacy (used in adv & scan parameters) */
2126
#define BT_HCI_OWN_ADDR_RPA_OR_PUBLIC 0x02

docs/design_guide.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,19 @@ struct.pack
485485

486486
Use `struct.pack_into` instead of `struct.pack`.
487487

488+
Use of MicroPython ``const()``
489+
--------------------------------------------------------------------------------
490+
The MicroPython ``const()`` feature, as discussed in `this forum post
491+
<https://forum.micropython.org/viewtopic.php?t=450>`_, and in `this issue thread
492+
<https://github.com/micropython/micropython/issues/573>`_, provides some
493+
optimizations that can be useful on smaller, memory constrained devices. However,
494+
when using ``const()``, keep in mind these general guide lines:
495+
496+
- Always use via an import, ex: ``from micropython import const``
497+
- Limit use to global (module level) variables only.
498+
- If user will not need access to variable, prefix name with a leading
499+
underscore, ex: ``_SOME_CONST``.
500+
488501
Sensor properties and units
489502
--------------------------------------------------------------------------------
490503

docs/supported_ports.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ is limited.
1717
../ports/mimxrt10xx/README
1818
../ports/nrf/README
1919
../ports/stm/README
20+
../ports/esp32s2/README

extmod/re1.5/recursiveloop.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ recursiveloop(char *pc, const char *sp, Subject *input, const char **subp, int n
2222
case Char:
2323
if(*sp != *pc++)
2424
return 0;
25+
/* FALLTHROUGH */
2526
case Any:
2627
sp++;
2728
continue;

0 commit comments

Comments
 (0)