Skip to content

Commit c6ee471

Browse files
committed
Merge branch 'main' of https://github.com/adafruit/circuitpython into patch-3
2 parents 8056af8 + 37887c4 commit c6ee471

File tree

162 files changed

+6334
-4123
lines changed

Some content is hidden

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

162 files changed

+6334
-4123
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,3 @@ TimeoutError: Clock stretch too long
5252

5353
<!-- Optionally, add any other information like hardware connection, scope output etc.
5454
If you have already done some debugging, mention it here. -->
55-
56-
Removing [this](url) line resolves the issue.

.github/workflows/build.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,11 @@ jobs:
178178
- "TG-Watch"
179179
- "adafruit_feather_rp2040"
180180
- "adafruit_itsybitsy_rp2040"
181+
- "adafruit_neokey_trinkey_m0"
182+
- "adafruit_proxlight_trinkey_m0"
181183
- "adafruit_qtpy_rp2040"
184+
- "adafruit_rotary_trinkey_m0"
185+
- "adafruit_slide_trinkey_m0"
182186
- "aloriumtech_evo_m51"
183187
- "aramcon_badge_2019"
184188
- "arduino_mkr1300"
@@ -190,6 +194,7 @@ jobs:
190194
- "bastble"
191195
- "bdmicro_vina_d21"
192196
- "bdmicro_vina_d51"
197+
- "bdmicro_vina_d51_pcb7"
193198
- "bless_dev_board_multi_sensor"
194199
- "blm_badge"
195200
- "capablerobot_usbhub"
@@ -239,6 +244,7 @@ jobs:
239244
- "hallowing_m0_express"
240245
- "hallowing_m4_express"
241246
- "hiibot_bluefi"
247+
- "huntercat_nfc"
242248
- "ikigaisense_vita"
243249
- "imxrt1010_evk"
244250
- "imxrt1020_evk"
@@ -303,11 +309,11 @@ jobs:
303309
- "raspberry_pi_pico"
304310
- "raytac_mdbt50q-db-40"
305311
- "robohatmm1_m4"
306-
- "rotary_trinkey_m0"
307312
- "sam32"
308313
- "same54_xplained"
309314
- "seeeduino_wio_terminal"
310315
- "seeeduino_xiao"
316+
- "sensebox_mcu"
311317
- "serpente"
312318
- "shirtty"
313319
- "silicognition-m4-shim"
@@ -450,6 +456,7 @@ jobs:
450456
- "adafruit_funhouse"
451457
- "adafruit_magtag_2.9_grayscale"
452458
- "adafruit_metro_esp32s2"
459+
- "artisense_rd00"
453460
- "electroniccats_bastwifi"
454461
- "espressif_kaluga_1"
455462
- "espressif_saola_1_wroom"

.github/workflows/create_website_pr.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ jobs:
1616
env:
1717
GITHUB_CONTEXT: ${{ toJson(github) }}
1818
run: echo "$GITHUB_CONTEXT"
19+
- uses: actions/[email protected]
20+
with:
21+
submodules: true
22+
fetch-depth: 0
1923
- name: Set up Python 3.8
2024
uses: actions/setup-python@v1
2125
with:
@@ -27,10 +31,6 @@ jobs:
2731
run: |
2832
gcc --version
2933
python3 --version
30-
- uses: actions/[email protected]
31-
with:
32-
submodules: true
33-
fetch-depth: 0
3434
- run: git fetch --recurse-submodules=no https://github.com/adafruit/circuitpython refs/tags/*:refs/tags/*
3535
- name: CircuitPython version
3636
run: git describe --dirty --tags

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,16 @@
171171
[submodule "frozen/Adafruit_CircuitPython_LC709203F"]
172172
path = frozen/Adafruit_CircuitPython_LC709203F
173173
url = https://github.com/adafruit/Adafruit_CircuitPython_LC709203F
174+
[submodule "frozen/Adafruit_CircuitPython_SimpleMath"]
175+
path = frozen/Adafruit_CircuitPython_SimpleMath
176+
url = https://github.com/adafruit/Adafruit_CircuitPython_SimpleMath
174177
[submodule "ports/raspberrypi/sdk"]
175178
path = ports/raspberrypi/sdk
176179
url = https://github.com/adafruit/pico-sdk.git
177180
[submodule "data/nvm.toml"]
178181
path = data/nvm.toml
179182
url = https://github.com/adafruit/nvm.toml.git
180183
branch = main
184+
[submodule "frozen/Adafruit_CircuitPython_MIDI"]
185+
path = frozen/Adafruit_CircuitPython_MIDI
186+
url = https://github.com/adafruit/Adafruit_CircuitPython_MIDI

conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@
284284
# Add any extra paths that contain custom files (such as robots.txt or
285285
# .htaccess) here, relative to this directory. These files are copied
286286
# directly to the root of the documentation.
287-
html_extra_path = ["docs/robots.txt"]
287+
#html_extra_path = []
288288

289289
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
290290
# using the given strftime format.

docs/robots.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/shared_bindings_matrix.py

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,39 @@
3232

3333
SUPPORTED_PORTS = ['atmel-samd', 'cxd56', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'raspberrypi', 'stm']
3434

35+
aliases_by_board = {
36+
"circuitplayground_express": [
37+
"circuitplayground_express_4h",
38+
"circuitplayground_express_digikey_pycon2019",
39+
],
40+
"pybadge": ["edgebadge"],
41+
"pyportal": ["pyportal_pynt"],
42+
"gemma_m0": ["gemma_m0_pycon2018"],
43+
"pewpew10": ["pewpew13"],
44+
}
45+
46+
aliases_brand_names = {
47+
"circuitplayground_express_4h":
48+
"Adafruit Circuit Playground Express 4-H",
49+
"circuitplayground_express_digikey_pycon2019":
50+
"Circuit Playground Express Digi-Key PyCon 2019",
51+
"edgebadge":
52+
"Adafruit EdgeBadge",
53+
"pyportal_pynt":
54+
"Adafruit PyPortal Pynt",
55+
"gemma_m0_pycon2018":
56+
"Adafruit Gemma M0 PyCon 2018",
57+
"pewpew13":
58+
"PewPew 13",
59+
}
60+
61+
additional_modules = {
62+
"fontio": "CIRCUITPY_DISPLAYIO",
63+
"terminalio": "CIRCUITPY_DISPLAYIO",
64+
# "socket": "CIRCUITPY_NETWORK",
65+
"adafruit_bus_device": "CIRCUITPY_BUSDEVICE",
66+
}
67+
3568
def get_circuitpython_root_dir():
3669
""" The path to the root './circuitpython' directory
3770
"""
@@ -71,8 +104,11 @@ def build_module_map():
71104
full_build = False
72105
for module in modules:
73106
full_name = module
74-
search_name = module.lstrip("_")
75-
re_pattern = "CIRCUITPY_{}\s*\??=\s*(.+)".format(search_name.upper())
107+
if module in additional_modules:
108+
search_identifier = additional_modules[module]
109+
else:
110+
search_identifier = 'CIRCUITPY_'+module.lstrip("_").upper()
111+
re_pattern = f"{re.escape(search_identifier)}\s*\??=\s*(.+)"
76112
find_config = re.findall(re_pattern, configs)
77113
if not find_config:
78114
continue
@@ -84,11 +120,12 @@ def build_module_map():
84120
else:
85121
default_val = "None"
86122

87-
base[search_name] = {
123+
base[module] = {
88124
"name": full_name,
89125
"full_build": str(full_build),
90126
"default_value": default_val,
91-
"excluded": {}
127+
"excluded": {},
128+
"key": search_identifier,
92129
}
93130

94131
return base
@@ -164,14 +201,28 @@ def support_matrix(arg):
164201

165202
board_modules = []
166203
for module in base:
167-
key = f'CIRCUITPY_{module.upper()}'
204+
key = base[module]['key']
168205
if int(lookup_setting(settings, key, '0')):
169206
board_modules.append(base[module]['name'])
207+
board_modules.sort()
208+
209+
# generate alias boards too
210+
board_matrix = [(board_name, board_modules)]
211+
if entry.name in aliases_by_board:
212+
for alias in aliases_by_board[entry.name]:
213+
if use_branded_name:
214+
if alias in aliases_brand_names:
215+
alias = aliases_brand_names[alias]
216+
else:
217+
alias = alias.replace("_"," ").title()
218+
board_matrix.append( (alias, board_modules) )
170219

171-
return (board_name, sorted(board_modules))
220+
return board_matrix # this is now a list of (board,modules)
172221

173222
executor = ThreadPoolExecutor(max_workers=os.cpu_count())
174-
boards = dict(sorted(executor.map(support_matrix, all_ports_all_boards())))
223+
mapped_exec = executor.map(support_matrix, all_ports_all_boards())
224+
# flatmap with comprehensions
225+
boards = dict(sorted([board for matrix in mapped_exec for board in matrix]))
175226

176227
#print(json.dumps(boards, indent=2))
177228
return boards

extmod/modure.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
#include "re1.5/re1.5.h"
2020

21+
#if CIRCUITPY_RE_DEBUG
2122
#define FLAG_DEBUG 0x1000
23+
#endif
2224

2325
typedef struct _mp_obj_re_t {
2426
mp_obj_base_t base;
@@ -401,18 +403,24 @@ STATIC mp_obj_t mod_re_compile(size_t n_args, const mp_obj_t *args) {
401403
}
402404
mp_obj_re_t *o = m_new_obj_var(mp_obj_re_t, char, size);
403405
o->base.type = &re_type;
406+
#if CIRCUITPY_RE_DEBUG
404407
int flags = 0;
405408
if (n_args > 1) {
406409
flags = mp_obj_get_int(args[1]);
407410
}
411+
#else
412+
(void)n_args;
413+
#endif
408414
int error = re1_5_compilecode(&o->re, re_str);
409415
if (error != 0) {
410416
error:
411417
mp_raise_ValueError(translate("Error in regex"));
412418
}
419+
#if CIRCUITPY_RE_DEBUG
413420
if (flags & FLAG_DEBUG) {
414421
re1_5_dumpcode(&o->re);
415422
}
423+
#endif
416424
return MP_OBJ_FROM_PTR(o);
417425
}
418426
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_re_compile_obj, 1, 2, mod_re_compile);
@@ -456,7 +464,9 @@ STATIC const mp_rom_map_elem_t mp_module_re_globals_table[] = {
456464
#if MICROPY_PY_URE_SUB
457465
{ MP_ROM_QSTR(MP_QSTR_sub), MP_ROM_PTR(&mod_re_sub_obj) },
458466
#endif
467+
#if CIRCUITPY_RE_DEBUG
459468
{ MP_ROM_QSTR(MP_QSTR_DEBUG), MP_ROM_INT(FLAG_DEBUG) },
469+
#endif
460470
};
461471

462472
STATIC MP_DEFINE_CONST_DICT(mp_module_re_globals, mp_module_re_globals_table);
@@ -471,7 +481,9 @@ const mp_obj_module_t mp_module_ure = {
471481

472482
#define re1_5_fatal(x) assert(!x)
473483
#include "re1.5/compilecode.c"
484+
#if CIRCUITPY_RE_DEBUG
474485
#include "re1.5/dumpcode.c"
486+
#endif
475487
#include "re1.5/recursiveloop.c"
476488
#include "re1.5/charclass.c"
477489

extmod/re1.5/compilecode.c

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
((code ? memmove(code + at + num, code + at, pc - at) : 0), pc += num)
99
#define REL(at, to) (to - at - 2)
1010
#define EMIT(at, byte) (code ? (code[at] = byte) : (at))
11+
#define EMIT_CHECKED(at, byte) (_emit_checked(at, code, byte, &err))
1112
#define PC (prog->bytelen)
1213

13-
1414
static char unescape(char c) {
1515
switch (c) {
1616
case 'a':
@@ -33,9 +33,17 @@ static char unescape(char c) {
3333
}
3434

3535

36+
static void _emit_checked(int at, char *code, int val, bool *err) {
37+
*err |= val != (int8_t)val;
38+
if (code) {
39+
code[at] = val;
40+
}
41+
}
42+
3643
static const char *_compilecode(const char *re, ByteProg *prog, int sizecode)
3744
{
3845
char *code = sizecode ? NULL : prog->insts;
46+
bool err = false;
3947
int start = PC;
4048
int term = PC;
4149
int alt_label = 0;
@@ -96,7 +104,7 @@ static const char *_compilecode(const char *re, ByteProg *prog, int sizecode)
96104
EMIT(PC++, *re);
97105
}
98106
}
99-
EMIT(term + 1, cnt);
107+
EMIT_CHECKED(term + 1, cnt);
100108
break;
101109
}
102110
case '(': {
@@ -107,7 +115,7 @@ static const char *_compilecode(const char *re, ByteProg *prog, int sizecode)
107115
if (capture) {
108116
sub = ++prog->sub;
109117
EMIT(PC++, Save);
110-
EMIT(PC++, 2 * sub);
118+
EMIT_CHECKED(PC++, 2 * sub);
111119
prog->len++;
112120
} else {
113121
re += 2;
@@ -118,7 +126,7 @@ static const char *_compilecode(const char *re, ByteProg *prog, int sizecode)
118126

119127
if (capture) {
120128
EMIT(PC++, Save);
121-
EMIT(PC++, 2 * sub + 1);
129+
EMIT_CHECKED(PC++, 2 * sub + 1);
122130
prog->len++;
123131
}
124132

@@ -133,23 +141,23 @@ static const char *_compilecode(const char *re, ByteProg *prog, int sizecode)
133141
} else {
134142
EMIT(term, Split);
135143
}
136-
EMIT(term + 1, REL(term, PC));
144+
EMIT_CHECKED(term + 1, REL(term, PC));
137145
prog->len++;
138146
term = PC;
139147
break;
140148
case '*':
141149
if (PC == term) return NULL; // nothing to repeat
142150
INSERT_CODE(term, 2, PC);
143151
EMIT(PC, Jmp);
144-
EMIT(PC + 1, REL(PC, term));
152+
EMIT_CHECKED(PC + 1, REL(PC, term));
145153
PC += 2;
146154
if (re[1] == '?') {
147155
EMIT(term, RSplit);
148156
re++;
149157
} else {
150158
EMIT(term, Split);
151159
}
152-
EMIT(term + 1, REL(term, PC));
160+
EMIT_CHECKED(term + 1, REL(term, PC));
153161
prog->len += 2;
154162
term = PC;
155163
break;
@@ -161,20 +169,20 @@ static const char *_compilecode(const char *re, ByteProg *prog, int sizecode)
161169
} else {
162170
EMIT(PC, RSplit);
163171
}
164-
EMIT(PC + 1, REL(PC, term));
172+
EMIT_CHECKED(PC + 1, REL(PC, term));
165173
PC += 2;
166174
prog->len++;
167175
term = PC;
168176
break;
169177
case '|':
170178
if (alt_label) {
171-
EMIT(alt_label, REL(alt_label, PC) + 1);
179+
EMIT_CHECKED(alt_label, REL(alt_label, PC) + 1);
172180
}
173181
INSERT_CODE(start, 2, PC);
174182
EMIT(PC++, Jmp);
175183
alt_label = PC++;
176184
EMIT(start, Split);
177-
EMIT(start + 1, REL(start, PC));
185+
EMIT_CHECKED(start + 1, REL(start, PC));
178186
prog->len += 2;
179187
term = PC;
180188
break;
@@ -192,9 +200,9 @@ static const char *_compilecode(const char *re, ByteProg *prog, int sizecode)
192200
}
193201

194202
if (alt_label) {
195-
EMIT(alt_label, REL(alt_label, PC) + 1);
203+
EMIT_CHECKED(alt_label, REL(alt_label, PC) + 1);
196204
}
197-
return re;
205+
return err ? NULL : re;
198206
}
199207

200208
int re1_5_sizecode(const char *re)

extmod/ulab

Submodule ulab updated 162 files

0 commit comments

Comments
 (0)