Skip to content

Commit 525262c

Browse files
authored
Merge branch 'main' into main
2 parents e3896be + f975c97 commit 525262c

File tree

94 files changed

+1317
-225
lines changed

Some content is hidden

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

94 files changed

+1317
-225
lines changed

.gitmodules

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +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
289292
[submodule "ports/espressif/boards/mixgo_ce_udisk/cp_lib"]
290293
path = ports/espressif/boards/mixgo_ce_udisk/cp_lib
291-
url = https://github.com/dahanzimin/circuitpython_lib.git
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"

conf.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,13 @@
5353
modules_support_matrix = shared_bindings_matrix.support_matrix_by_board()
5454
modules_support_matrix_reverse = defaultdict(list)
5555
for board, modules in modules_support_matrix.items():
56-
for module in modules:
56+
for module in modules[0]:
5757
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())
58+
59+
modules_support_matrix_reverse = dict(
60+
(module, sorted(boards))
61+
for module, boards in modules_support_matrix_reverse.items()
62+
)
5963

6064
html_context = {
6165
'support_matrix': modules_support_matrix,

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.

docs/library/builtins.rst

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,18 @@
44
All builtin functions and exceptions are described here. They are also
55
available via ``builtins`` module.
66

7+
For more information about built-ins, see the following CPython documentation:
8+
9+
* `Builtin CPython Functions <https://docs.python.org/3/library/functions.html>`_
10+
* `Builtin CPython Exceptions <https://docs.python.org/3/library/exceptions.html>`_
11+
* `Builtin CPython Constants <https://docs.python.org/3/library/constants.html>`_
12+
13+
.. note:: Not all of these functions, types, exceptions, and constants are turned
14+
on in all CircuitPython ports, for space reasons.
15+
716
Functions and types
817
-------------------
918

10-
Not all of these functions and types are turned on in all CircuitPython ports, for space reasons.
11-
1219
.. function:: abs()
1320

1421
.. function:: all()
@@ -160,46 +167,77 @@ Not all of these functions and types are turned on in all CircuitPython ports, f
160167
Exceptions
161168
----------
162169

170+
.. exception:: ArithmeticError
171+
163172
.. exception:: AssertionError
164173

165174
.. exception:: AttributeError
166175

176+
.. exception:: BaseException
177+
178+
.. exception:: BrokenPipeError
179+
180+
.. exception:: ConnectionError
181+
182+
.. exception:: EOFError
183+
167184
.. exception:: Exception
168185

169186
.. exception:: ImportError
170187

188+
.. exception:: IndentationError
189+
171190
.. exception:: IndexError
172191

173192
.. exception:: KeyboardInterrupt
174193

175194
.. exception:: KeyError
176195

196+
.. exception:: LookupError
197+
177198
.. exception:: MemoryError
178199

200+
.. exception:: MpyError
201+
202+
Not a part of the CPython standard library
203+
179204
.. exception:: NameError
180205

181206
.. exception:: NotImplementedError
182207

183208
.. exception:: OSError
184209

210+
.. exception:: OverflowError
211+
185212
.. exception:: RuntimeError
186213

187214
.. exception:: ReloadException
188215

189216
`ReloadException` is used internally to deal with soft restarts.
190217

218+
Not a part of the CPython standard library
219+
220+
.. exception:: StopAsyncIteration
221+
191222
.. exception:: StopIteration
192223

193224
.. exception:: SyntaxError
194225

195226
.. exception:: SystemExit
196227

197-
|see_cpython| :py:class:`cpython:SystemExit`.
228+
.. exception:: TimeoutError
198229

199230
.. exception:: TypeError
200231

201-
|see_cpython| :py:class:`cpython:TypeError`.
232+
.. exception:: UnicodeError
202233

203234
.. exception:: ValueError
204235

205236
.. exception:: ZeroDivisionError
237+
238+
Constants
239+
---------
240+
241+
.. data:: Ellipsis
242+
243+
.. data:: NotImplemented

docs/shared_bindings_matrix.py

Lines changed: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,17 @@
6262
"fontio": "CIRCUITPY_DISPLAYIO",
6363
"terminalio": "CIRCUITPY_DISPLAYIO",
6464
"adafruit_bus_device": "CIRCUITPY_BUSDEVICE",
65-
"adafruit_pixelbuf": "CIRCUITPY_PIXELBUF"
65+
"adafruit_pixelbuf": "CIRCUITPY_PIXELBUF",
66+
"usb": "CIRCUITPY_USB_HOST",
6667
}
6768

69+
frozen_excludes = ["examples", "docs", "tests", "utils", "conf.py", "setup.py"]
70+
"""Files and dirs at the root of a frozen directory that should be ignored.
71+
This is the same list as in the preprocess_frozen_modules script."""
72+
73+
repository_urls = {}
74+
"""Cache of repository URLs for frozen modules."""
75+
6876
def get_circuitpython_root_dir():
6977
""" The path to the root './circuitpython' directory
7078
"""
@@ -162,6 +170,63 @@ def get_settings_from_makefile(port_dir, board_name):
162170

163171
return settings
164172

173+
def get_repository_url(directory):
174+
if directory in repository_urls:
175+
return repository_urls[directory]
176+
readme = None
177+
for readme_path in (
178+
os.path.join(directory, "README.rst"),
179+
os.path.join(os.path.dirname(directory), "README.rst")
180+
):
181+
if os.path.exists(readme_path):
182+
readme = readme_path
183+
break
184+
path = None
185+
if readme:
186+
with open(readme, "r") as fp:
187+
for line in fp.readlines():
188+
if m := re.match("\s+:target:\s+(http\S+(docs.circuitpython|readthedocs)\S+)\s*", line):
189+
path = m.group(1)
190+
break
191+
if m := re.search("<(http[^>]+)>", line):
192+
path = m.group(1)
193+
break
194+
if path is None:
195+
contents = subprocess.run(
196+
["git", "remote", "get-url", "origin"],
197+
encoding="utf-8",
198+
errors="replace",
199+
stdout=subprocess.PIPE,
200+
stderr=subprocess.PIPE,
201+
cwd=directory
202+
)
203+
path = contents.stdout.strip()
204+
repository_urls[directory] = path
205+
return path
206+
207+
def frozen_modules_from_dirs(frozen_mpy_dirs):
208+
"""
209+
Go through the list of frozen directories and extract the python modules.
210+
Paths are of the type:
211+
$(TOP)/frozen/Adafruit_CircuitPython_CircuitPlayground
212+
$(TOP)/frozen/circuitpython-stage/meowbit
213+
Python modules are at the root of the path, and are python files or directories
214+
containing python files. Except the ones in the frozen_excludes list.
215+
"""
216+
frozen_modules = []
217+
for frozen_path in filter(lambda x: x, frozen_mpy_dirs.split(" ")):
218+
source_dir = get_circuitpython_root_dir() / frozen_path[7:]
219+
url_repository = get_repository_url(source_dir)
220+
for sub in source_dir.glob("*"):
221+
if sub.name in frozen_excludes:
222+
continue
223+
if sub.name.endswith(".py"):
224+
frozen_modules.append((sub.name[:-3], url_repository))
225+
continue
226+
if next(sub.glob("**/*.py"), None): # tests if not empty
227+
frozen_modules.append((sub.name, url_repository))
228+
return frozen_modules
229+
165230
def lookup_setting(settings, key, default=''):
166231
while True:
167232
value = settings.get(key, default)
@@ -207,16 +272,22 @@ def support_matrix(arg):
207272
board_modules.append(base[module]['name'])
208273
board_modules.sort()
209274

275+
frozen_modules = []
276+
if "FROZEN_MPY_DIRS" in settings:
277+
frozen_modules = frozen_modules_from_dirs(settings["FROZEN_MPY_DIRS"])
278+
if frozen_modules:
279+
frozen_modules.sort()
280+
210281
# generate alias boards too
211-
board_matrix = [(board_name, board_modules)]
282+
board_matrix = [(board_name, (board_modules, frozen_modules))]
212283
if entry.name in aliases_by_board:
213284
for alias in aliases_by_board[entry.name]:
214285
if use_branded_name:
215286
if alias in aliases_brand_names:
216287
alias = aliases_brand_names[alias]
217288
else:
218289
alias = alias.replace("_"," ").title()
219-
board_matrix.append( (alias, board_modules) )
290+
board_matrix.append( (alias, (board_modules, frozen_modules)) )
220291

221292
return board_matrix # this is now a list of (board,modules)
222293

@@ -225,7 +296,6 @@ def support_matrix(arg):
225296
# flatmap with comprehensions
226297
boards = dict(sorted([board for matrix in mapped_exec for board in matrix]))
227298

228-
# print(json.dumps(boards, indent=2))
229299
return boards
230300

231301
if __name__ == '__main__':

docs/static/filter.css

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,21 @@
77
right: 10px;
88
top: 4px;
99
}
10-
.support-matrix-table .this_module code,
11-
.support-matrix-table .this_module span {
10+
11+
.support-matrix-table .reference.external {
12+
box-sizing: border-box;
13+
font-weight: 700;
14+
color: #404040;
15+
font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", Courier, monospace;
16+
padding: 2px 5px;
17+
background: white;
18+
border: 1px solid #e1e4e5;
19+
font-size: 75%;
20+
}
21+
22+
.support-matrix-table .this_module,
23+
.support-matrix-table .this_module.reference.external,
24+
.support-matrix-table .this_module * {
1225
background: black;
1326
color: white;
1427
}

docs/static/filter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ $(() => {
4444
var nvisible = 0;
4545
$(".support-matrix-table tbody tr").each( (index,item) => {
4646
var name = $(item).find("td:first-child p").html();
47-
var modules = $(item).find("a.reference.internal");
47+
var modules = $(item).find("code, a.reference.external");
4848
var matching_all = true;
4949
//
5050
list_search.forEach((sstring) => {
5151
var matching = (sstring[0] == "-");
5252
for(var modi = 0; modi < modules.length; ++modi) {
5353
module = modules[modi];
54-
var mod_name = module.firstChild.firstChild.textContent;
54+
var mod_name = module.firstChild.textContent;
5555
if(sstring[0] == "-") {
5656
if(mod_name.match(sstring.substr(1))) {
5757
matching = false;

0 commit comments

Comments
 (0)