Skip to content

Commit fb27124

Browse files
committed
Merge branch 'master' into capablerobot-usbhub
2 parents 97e7fea + 47a0b7c commit fb27124

File tree

473 files changed

+22314
-5659
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

+22314
-5659
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
# Packages
1414
############
15+
dist/
16+
*.egg-info
1517

1618
# Logs and Databases
1719
######################
@@ -25,6 +27,7 @@
2527
######################
2628
build/
2729
bin/
30+
circuitpython-stubs/
2831

2932
# Test failure outputs
3033
######################

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,6 @@
9595
[submodule "frozen/circuitpython-stage"]
9696
path = frozen/circuitpython-stage
9797
url = https://github.com/python-ugame/circuitpython-stage.git
98+
[submodule "ports/stm32f4/stm32f4"]
99+
path = ports/stm32f4/stm32f4
100+
url = https://github.com/adafruit/stm32f4.git

.travis.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,28 @@ git:
2121
# that SDK is shortest and add it there. In the case of major re-organizations,
2222
# just try to make the builds "about equal in run time"
2323
env:
24-
- TRAVIS_TESTS="unix docs translations website" TRAVIS_BOARDS="circuitplayground_express mini_sam_m4 grandcentral_m4_express pca10056 pca10059 feather_nrf52840_express makerdiary_nrf52840_mdk makerdiary_nrf52840_mdk_usb_dongle particle_boron particle_argon particle_xenon sparkfun_nrf52840_mini electronut_labs_papyr" TRAVIS_SDK=arm:nrf
25-
- TRAVIS_BOARDS="metro_m0_express metro_m4_express metro_m4_airlift_lite pirkey_m0 trellis_m4_express trinket_m0 sparkfun_lumidrive sparkfun_redboard_turbo bast_pro_mini_m0" TRAVIS_SDK=arm
26-
- TRAVIS_BOARDS="feather_radiofruit_zigbee gemma_m0 hallowing_m0_express itsybitsy_m0_express itsybitsy_m4_express meowmeow sam32 uchip escornabot_makech" TRAVIS_SDK=arm
27-
- TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero pewpew10 kicksat-sprite ugame10 robohatmm1" TRAVIS_SDK=arm
28-
- TRAVIS_BOARDS="circuitplayground_express_crickit feather_m0_adalogger feather_m0_basic feather_m0_express catwan_usbstick pyportal sparkfun_samd21_mini sparkfun_samd21_dev pybadge" TRAVIS_SDK=arm
24+
- TRAVIS_TESTS="unix docs translations website" TRAVIS_BOARDS="trinket_m0_haxpress circuitplayground_express mini_sam_m4 grandcentral_m4_express capablerobot_usbhub pygamer pca10056 pca10059 feather_nrf52840_express metro_nrf52840_express makerdiary_nrf52840_mdk makerdiary_nrf52840_mdk_usb_dongle particle_boron particle_argon particle_xenon sparkfun_nrf52840_mini electronut_labs_papyr electronut_labs_blip" TRAVIS_SDK=arm:nrf
25+
- TRAVIS_BOARDS="metro_m0_express metro_m4_express metro_m4_airlift_lite pirkey_m0 trellis_m4_express trinket_m0 sparkfun_lumidrive sparkfun_redboard_turbo bast_pro_mini_m0 datum_distance pyruler" TRAVIS_SDK=arm
26+
- TRAVIS_BOARDS="cp32-m4 feather_radiofruit_zigbee gemma_m0 hallowing_m0_express itsybitsy_m0_express itsybitsy_m4_express meowmeow sam32 uchip escornabot_makech pygamer_advance datum_imu snekboard" TRAVIS_SDK=arm
27+
- TRAVIS_BOARDS="feather_m0_supersized feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero pewpew10 kicksat-sprite ugame10 robohatmm1_m0 robohatmm1_m4 datum_light" TRAVIS_SDK=arm
28+
- TRAVIS_BOARDS="datalore_ip_m4 circuitplayground_express_crickit feather_m0_adalogger feather_m0_basic feather_m0_express catwan_usbstick pyportal sparkfun_samd21_mini sparkfun_samd21_dev pybadge pybadge_airlift datum_weather" TRAVIS_SDK=arm
2929

3030
addons:
3131
artifacts:
3232
paths:
3333
- $(ls -d1 bin/*/*/* | tr "\n" ":")
3434
target_paths: /
3535

36+
# Some deploy jobs take over 10 minutes so use this keep alive hack to make sure Travis doesn't kill us.
37+
before_deploy: |
38+
function keep_alive() {
39+
while true; do
40+
echo -en "\a"
41+
sleep 5
42+
done
43+
}
44+
keep_alive &
45+
3646
deploy:
3747
provider: releases
3848
api_key:
@@ -61,7 +71,6 @@ before_script:
6171
- function var_search () { case "$1" in *$2*) true;; *) false;; esac; }
6272
- sudo dpkg --add-architecture i386
6373

64-
6574
- (! var_search "${TRAVIS_SDK-}" arm || (wget https://s3.amazonaws.com/adafruit-circuit-python/gcc-arm-embedded_7-2018q2-1~xenial1_amd64.deb && sudo dpkg -i gcc-arm-embedded*_amd64.deb))
6675

6776
# For huzzah builds
@@ -70,12 +79,16 @@ before_script:
7079

7180
# For coverage testing (upgrade is used to get latest urllib3 version)
7281
- sudo apt-get install -y python3-pip
73-
- pip3 install --user sh click
82+
- pip3 install --user sh click setuptools
7483
- ([[ -z "$TRAVIS_TESTS" ]] || sudo pip install --upgrade cpp-coveralls)
7584
- (! var_search "${TRAVIS_TESTS-}" docs || sudo apt-get install -y librsvg2-bin)
76-
- (! var_search "${TRAVIS_TESTS-}" docs || pip install --user Sphinx sphinx-rtd-theme recommonmark sphinxcontrib-svg2pdfconverter)
85+
- (! var_search "${TRAVIS_TESTS-}" docs || pip3 install --user Sphinx sphinx-rtd-theme recommonmark sphinxcontrib-svg2pdfconverter)
7786
- (! var_search "${TRAVIS_TESTS-}" translations || pip3 install --user polib)
7887

88+
# Check if there's any board missing in TRAVIS_BOARDS
89+
- cd tools && python3 -u travis_new_boards_check.py
90+
- cd ..
91+
7992
# report some good version numbers to the build
8093
- gcc --version
8194
- (! var_search "${TRAVIS_SDK-}" arm || arm-none-eabi-gcc --version)

Makefile

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Makefile for Sphinx documentation
1+
# Top-level Makefile for documentation builds and miscellaneous tasks.
22
#
33

44
# You can set these variables from the command line.
@@ -17,6 +17,13 @@ CONFDIR = .
1717
FORCE = -E
1818
VERBOSE = -v
1919

20+
# path to generated type stubs
21+
STUBDIR = circuitpython-stubs
22+
# Run "make VALIDATE= stubs" to avoid validating generated stub files
23+
VALIDATE = -v
24+
# path to pypi source distributions
25+
DISTDIR = dist
26+
2027
# Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the
2128
# full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the
2229
# executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
@@ -31,7 +38,7 @@ I18NSPHINXOPTS = $(BASEOPTS)
3138

3239
TRANSLATE_SOURCES = extmod lib main.c ports/atmel-samd ports/nrf py shared-bindings shared-module supervisor
3340

34-
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
41+
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext stubs
3542

3643
help:
3744
@echo "Please use \`make <target>' where <target> is one of"
@@ -60,6 +67,7 @@ help:
6067

6168
clean:
6269
rm -rf $(BUILDDIR)/*
70+
rm -rf $(STUBDIR) $(DISTDIR) *.egg-info
6371

6472
html:
6573
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@@ -196,10 +204,18 @@ pseudoxml:
196204
all-source:
197205

198206
locale/circuitpython.pot: all-source
199-
find $(TRANSLATE_SOURCES) -iname "*.c" | xargs xgettext -L C -s --add-location=file --keyword=translate -o circuitpython.pot -p locale
207+
find $(TRANSLATE_SOURCES) -iname "*.c" -print0 | (LC_ALL=C sort -z) | xargs -0 xgettext -L C -s --add-location=file --keyword=translate -o circuitpython.pot -p locale
200208

201209
translate: locale/circuitpython.pot
202210
for po in $(shell ls locale/*.po); do msgmerge -U $$po -s --no-fuzzy-matching --add-location=file locale/circuitpython.pot; done
203211

204212
check-translate: locale/circuitpython.pot $(wildcard locale/*.po)
205213
$(PYTHON) tools/check_translations.py $^
214+
215+
stubs:
216+
rst2pyi $(VALIDATE) shared-bindings/ $(STUBDIR)
217+
python setup.py sdist
218+
219+
update-frozen-libraries:
220+
@echo "Updating all frozen libraries to latest tagged version."
221+
cd frozen; for library in *; do cd $$library; ../../tools/git-checkout-latest-tag.sh; cd ..; done

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ Behavior
115115
output is written to ``boot_out.txt``.
116116
- ``code.py`` (or ``main.py``) is run after every reload until it
117117
finishes or is interrupted. After it is done running, the vm and
118-
hardware is reinitialized. **This means you cannot read state from
119-
``code.py`` in the REPL anymore.** CircuitPython's goal for this
118+
hardware is reinitialized. **This means you cannot read state from**
119+
``code.py`` **in the REPL anymore.** CircuitPython's goal for this
120120
change includes reduce confusion about pins and memory being used.
121121
- After ``code.py`` the REPL can be entered by pressing any key. It no
122122
longer shares state with ``code.py`` so it is a fresh vm.
@@ -131,9 +131,9 @@ Behavior
131131
``samd.disable_autoreload()``)
132132
- Entering the REPL after the main code is finished requires a key press which enters the REPL and
133133
disables autoreload.
134-
- Main is one of these: ``code.txt``, **``code.py``**, ``main.py``,
134+
- Main is one of these: ``code.txt``, ``code.py``, ``main.py``,
135135
``main.txt``
136-
- Boot is one of these: ``settings.txt``, ``settings.py``, **``boot.py``**,
136+
- Boot is one of these: ``settings.txt``, ``settings.py``, ``boot.py``,
137137
``boot.txt``
138138

139139
API

conf.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# All configuration values have a default; values that are commented out
1414
# serve to show the default.
1515

16+
import json
1617
import sys
1718
import os
1819

@@ -24,8 +25,20 @@
2425
sys.path.insert(0, os.path.abspath('docs'))
2526
sys.path.insert(0, os.path.abspath('.'))
2627

28+
import shared_bindings_matrix
29+
2730
master_doc = 'docs/index'
2831

32+
# Grab the JSON values to use while building the module support matrix
33+
# in 'shared-bindings/index.rst'
34+
35+
#modules_support_matrix = shared_bindings_matrix.support_matrix_excluded_boards()
36+
modules_support_matrix = shared_bindings_matrix.support_matrix_by_board()
37+
38+
html_context = {
39+
'support_matrix': modules_support_matrix
40+
}
41+
2942
# -- General configuration ------------------------------------------------
3043

3144
# If your documentation needs a minimal Sphinx version, state it here.
@@ -40,7 +53,9 @@
4053
'sphinxcontrib.rsvgconverter',
4154
'sphinx.ext.intersphinx',
4255
'sphinx.ext.todo',
43-
'sphinx.ext.coverage'
56+
'sphinx.ext.coverage',
57+
'rstjinja',
58+
'c2rst'
4459
]
4560

4661
# Add any paths that contain templates here, relative to this directory.
@@ -49,8 +64,7 @@
4964
# The suffix of source filenames.
5065
source_suffix = ['.rst', '.md', '.c', '.h']
5166

52-
source_parsers = {'.md': CommonMarkParser,
53-
'.c': "c2rst.CStrip", '.h': "c2rst.CStrip"}
67+
source_parsers = {'.md': CommonMarkParser}
5468

5569
# The encoding of source files.
5670
#source_encoding = 'utf-8-sig'
@@ -84,6 +98,7 @@
8498
# List of patterns, relative to source directory, that match files and
8599
# directories to ignore when looking for source files.
86100
exclude_patterns = ["**/build*",
101+
".git",
87102
".venv",
88103
".direnv",
89104
"docs/README.md",
@@ -121,6 +136,10 @@
121136
"ports/nrf/nrfx",
122137
"ports/nrf/peripherals",
123138
"ports/nrf/usb",
139+
"ports/stm32f4/stm32f4",
140+
"ports/stm32f4/peripherals",
141+
"ports/stm32f4/ref",
142+
"ports/stm32f4/README.md",
124143
"ports/pic16bit",
125144
"ports/qemu-arm",
126145
"ports/stm32",

docs/c2rst.py

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
1-
import sphinx.parsers
1+
def c2rst(app, docname, source):
2+
""" Pre-parse '.c' & '.h' files that contain rST source.
3+
"""
4+
# Make sure we're outputting HTML
5+
if app.builder.format != 'html':
6+
return
27

3-
class CStrip(sphinx.parsers.Parser):
4-
def __init__(self):
5-
self.rst_parser = sphinx.parsers.RSTParser()
8+
fname = app.env.doc2path(docname)
9+
if (not fname.endswith(".c") and
10+
not fname.endswith(".h")):
11+
#print("skipping:", fname)
12+
return
613

7-
def parse(self, inputstring, document):
8-
# This setting is missing starting with Sphinx 1.7.1 so we set it ourself.
9-
document.settings.tab_width = 4
10-
document.settings.character_level_inline_markup = False
11-
stripped = []
12-
for line in inputstring.split("\n"):
13-
line = line.strip()
14-
if line == "//|":
15-
stripped.append("")
16-
elif line.startswith("//| "):
17-
stripped.append(line[len("//| "):])
18-
stripped = "\r\n".join(stripped)
19-
self.rst_parser.parse(stripped, document)
14+
src = source[0]
15+
16+
stripped = []
17+
for line in src.split("\n"):
18+
line = line.strip()
19+
if line == "//|":
20+
stripped.append("")
21+
elif line.startswith("//| "):
22+
stripped.append(line[len("//| "):])
23+
stripped = "\r\n".join(stripped)
24+
25+
rendered = app.builder.templates.render_string(
26+
stripped, app.config.html_context
27+
)
28+
source[0] = rendered
29+
30+
def setup(app):
31+
app.connect("source-read", c2rst)

docs/design_guide.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ For example, a user can then use ``deinit()```::
6060

6161
import digitalio
6262
import board
63+
import time
6364

6465
led = digitalio.DigitalInOut(board.D13)
6566
led.direction = digitalio.Direction.OUTPUT
@@ -79,6 +80,7 @@ Alternatively, using a ``with`` statement ensures that the hardware is deinitial
7980

8081
import digitalio
8182
import board
83+
import time
8284

8385
with digitalio.DigitalInOut(board.D13) as led:
8486
led.direction = digitalio.Direction.OUTPUT

docs/library/builtins.rst

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

183183
.. exception:: OSError
184184

185-
|see_cpython| `OSError`. CircuitPython doesn't implement the ``errno``
185+
|see_cpython| :py:class:`cpython:OSError`. CircuitPython doesn't implement the ``errno``
186186
attribute, instead use the standard way to access exception arguments:
187187
``exc.args[0]``.
188188

@@ -198,11 +198,11 @@ Exceptions
198198

199199
.. exception:: SystemExit
200200

201-
|see_cpython| :py:class:`python:SystemExit`.
201+
|see_cpython| :py:class:`cpython:SystemExit`.
202202

203203
.. exception:: TypeError
204204

205-
|see_cpython| :py:class:`python:TypeError`.
205+
|see_cpython| :py:class:`cpython:TypeError`.
206206

207207
.. exception:: ValueError
208208

docs/library/network.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
.. include:: ../templates/unsupported_in_circuitpython.inc
66

77
.. module:: network
8+
:noindex:
89
:synopsis: network configuration
910

1011
This module provides network drivers and routing configuration. To use this

0 commit comments

Comments
 (0)