Skip to content

Commit 8d2299e

Browse files
committed
Merge remote-tracking branch 'upstream/main' into stm32-meowbit-fix
2 parents de9fd4a + 58a7419 commit 8d2299e

File tree

89 files changed

+876
-391
lines changed

Some content is hidden

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

89 files changed

+876
-391
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ jobs:
410410
board:
411411
- "espressif_saola_1_wroom"
412412
- "espressif_saola_1_wrover"
413+
- "microdev_micro_s2"
413414
- "unexpectedmaker_feathers2"
414415

415416
steps:

docs/shared_bindings_matrix.py

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import subprocess
2929
import sys
3030

31+
from concurrent.futures import ThreadPoolExecutor
3132

3233
SUPPORTED_PORTS = ['atmel-samd', 'esp32s2', 'litex', 'mimxrt10xx', 'nrf', 'stm']
3334

@@ -42,7 +43,7 @@ def get_circuitpython_root_dir():
4243
def get_shared_bindings():
4344
""" Get a list of modules in shared-bindings based on folder names
4445
"""
45-
shared_bindings_dir = get_circuitpython_root_dir() / "shared-bindings"
46+
shared_bindings_dir = get_circuitpython_root_dir() / "circuitpython-stubs"
4647
return [item.name for item in shared_bindings_dir.iterdir()]
4748

4849

@@ -131,38 +132,44 @@ def lookup_setting(settings, key, default=''):
131132
key = value[2:-1]
132133
return value
133134

135+
def all_ports_all_boards(ports=SUPPORTED_PORTS):
136+
for port in ports:
137+
138+
port_dir = get_circuitpython_root_dir() / "ports" / port
139+
for entry in (port_dir / "boards").iterdir():
140+
if not entry.is_dir():
141+
continue
142+
yield (port, entry)
143+
134144
def support_matrix_by_board(use_branded_name=True):
135145
""" Compiles a list of the available core modules available for each
136146
board.
137147
"""
138148
base = build_module_map()
139149

140-
boards = dict()
141-
for port in SUPPORTED_PORTS:
142-
150+
def support_matrix(arg):
151+
port, entry = arg
143152
port_dir = get_circuitpython_root_dir() / "ports" / port
144-
for entry in (port_dir / "boards").iterdir():
145-
if not entry.is_dir():
146-
continue
147-
board_modules = []
148-
board_name = entry.name
149-
150-
settings = get_settings_from_makefile(str(port_dir), entry.name)
151-
152-
if use_branded_name:
153-
with open(entry / "mpconfigboard.h") as get_name:
154-
board_contents = get_name.read()
155-
board_name_re = re.search(r"(?<=MICROPY_HW_BOARD_NAME)\s+(.+)",
156-
board_contents)
157-
if board_name_re:
158-
board_name = board_name_re.group(1).strip('"')
159-
160-
board_modules = []
161-
for module in base:
162-
key = f'CIRCUITPY_{module.upper()}'
163-
if int(lookup_setting(settings, key, '0')):
164-
board_modules.append(base[module]['name'])
165-
boards[board_name] = sorted(board_modules)
153+
settings = get_settings_from_makefile(str(port_dir), entry.name)
154+
155+
if use_branded_name:
156+
with open(entry / "mpconfigboard.h") as get_name:
157+
board_contents = get_name.read()
158+
board_name_re = re.search(r"(?<=MICROPY_HW_BOARD_NAME)\s+(.+)",
159+
board_contents)
160+
if board_name_re:
161+
board_name = board_name_re.group(1).strip('"')
162+
163+
board_modules = []
164+
for module in base:
165+
key = f'CIRCUITPY_{module.upper()}'
166+
if int(lookup_setting(settings, key, '0')):
167+
board_modules.append(base[module]['name'])
168+
169+
return (board_name, sorted(board_modules))
170+
171+
executor = ThreadPoolExecutor(max_workers=os.cpu_count())
172+
boards = dict(sorted(executor.map(support_matrix, all_ports_all_boards())))
166173

167174
#print(json.dumps(boards, indent=2))
168175
return boards

lib/utils/pyexec.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ STATIC int parse_compile_execute(const void *source, mp_parse_input_kind_t input
113113
start = mp_hal_ticks_ms();
114114
mp_call_function_0(module_fun);
115115
mp_hal_set_interrupt_char(-1); // disable interrupt
116+
// Handle any ctrl-c interrupt that arrived just in time
117+
mp_handle_pending();
116118
nlr_pop();
117119
ret = 0;
118120
if (exec_flags & EXEC_FLAG_PRINT_EOF) {

locale/circuitpython.pot

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: PACKAGE VERSION\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2020-08-18 11:19-0400\n"
11+
"POT-Creation-Date: 2020-08-21 21:39-0500\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -1349,10 +1349,6 @@ msgstr ""
13491349
msgid "Pull not used when direction is output."
13501350
msgstr ""
13511351

1352-
#: ports/stm/ref/pulseout-pre-timeralloc.c
1353-
msgid "PulseOut not supported on this chip"
1354-
msgstr ""
1355-
13561352
#: ports/stm/common-hal/os/__init__.c
13571353
msgid "RNG DeInit Error"
13581354
msgstr ""
@@ -2879,6 +2875,14 @@ msgstr ""
28792875
msgid "ord() expected a character, but string of length %d found"
28802876
msgstr ""
28812877

2878+
#: shared-bindings/displayio/Bitmap.c
2879+
msgid "out of range of source"
2880+
msgstr ""
2881+
2882+
#: shared-bindings/displayio/Bitmap.c
2883+
msgid "out of range of target"
2884+
msgstr ""
2885+
28822886
#: py/objint_mpz.c
28832887
msgid "overflow converting long int to machine word"
28842888
msgstr ""
@@ -3056,6 +3060,10 @@ msgstr ""
30563060
msgid "sosfilt requires iterable arguments"
30573061
msgstr ""
30583062

3063+
#: shared-bindings/displayio/Bitmap.c
3064+
msgid "source palette too large"
3065+
msgstr ""
3066+
30593067
#: py/objstr.c
30603068
msgid "start/end indices"
30613069
msgstr ""

locale/pt_BR.po

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ msgstr ""
66
"Project-Id-Version: PACKAGE VERSION\n"
77
"Report-Msgid-Bugs-To: \n"
88
"POT-Creation-Date: 2020-08-18 11:19-0400\n"
9-
"PO-Revision-Date: 2020-08-16 02:25+0000\n"
9+
"PO-Revision-Date: 2020-08-21 18:19+0000\n"
1010
"Last-Translator: Wellington Terumi Uemura <[email protected]>\n"
1111
"Language-Team: \n"
1212
"Language: pt_BR\n"
1313
"MIME-Version: 1.0\n"
1414
"Content-Type: text/plain; charset=UTF-8\n"
1515
"Content-Transfer-Encoding: 8bit\n"
1616
"Plural-Forms: nplurals=2; plural=n > 1;\n"
17-
"X-Generator: Weblate 4.2-dev\n"
17+
"X-Generator: Weblate 4.2.1-dev\n"
1818

1919
#: main.c
2020
msgid ""
@@ -1375,6 +1375,8 @@ msgid ""
13751375
"Port does not accept pins or frequency. "
13761376
"Construct and pass a PWMOut Carrier instead"
13771377
msgstr ""
1378+
"A porta não aceita pinos ou frequência. "
1379+
"Em vez disso, Construa e encaminhe um PWMOut Carrier"
13781380

13791381
#: shared-bindings/_bleio/Adapter.c
13801382
msgid "Prefix buffer must be on the heap"

ports/atmel-samd/boards/pycubed/board.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "shared-bindings/nvm/ByteArray.h"
3333
#include "common-hal/microcontroller/Pin.h"
3434
#include "hal/include/hal_gpio.h"
35-
#include "shared-bindings/pulseio/PWMOut.h"
35+
#include "shared-bindings/pwmio/PWMOut.h"
3636

3737
nvm_bytearray_obj_t bootcnt = {
3838
.base = {
@@ -44,9 +44,9 @@ nvm_bytearray_obj_t bootcnt = {
4444

4545

4646
void board_init(void) {
47-
pulseio_pwmout_obj_t pwm;
48-
common_hal_pulseio_pwmout_construct(&pwm, &pin_PA23, 4096, 2, false);
49-
common_hal_pulseio_pwmout_never_reset(&pwm);
47+
pwmio_pwmout_obj_t pwm;
48+
common_hal_pwmio_pwmout_construct(&pwm, &pin_PA23, 4096, 2, false);
49+
common_hal_pwmio_pwmout_never_reset(&pwm);
5050
}
5151

5252
bool board_requests_safe_mode(void) {

ports/atmel-samd/boards/pycubed_mram/board.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "shared-bindings/nvm/ByteArray.h"
3333
#include "common-hal/microcontroller/Pin.h"
3434
#include "hal/include/hal_gpio.h"
35-
#include "shared-bindings/pulseio/PWMOut.h"
35+
#include "shared-bindings/pwmio/PWMOut.h"
3636

3737
nvm_bytearray_obj_t bootcnt = {
3838
.base = {
@@ -44,9 +44,9 @@ nvm_bytearray_obj_t bootcnt = {
4444

4545

4646
void board_init(void) {
47-
pulseio_pwmout_obj_t pwm;
48-
common_hal_pulseio_pwmout_construct(&pwm, &pin_PA23, 4096, 2, false);
49-
common_hal_pulseio_pwmout_never_reset(&pwm);
47+
pwmio_pwmout_obj_t pwm;
48+
common_hal_pwmio_pwmout_construct(&pwm, &pin_PA23, 4096, 2, false);
49+
common_hal_pwmio_pwmout_never_reset(&pwm);
5050
}
5151

5252
bool board_requests_safe_mode(void) {

ports/atmel-samd/common-hal/pulseio/PulseOut.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void pulseout_reset() {
9696
}
9797

9898
void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
99-
const pulseio_pwmout_obj_t* carrier,
99+
const pwmio_pwmout_obj_t* carrier,
100100
const mcu_pin_obj_t* pin,
101101
uint32_t frequency,
102102
uint16_t duty_cycle) {

ports/atmel-samd/common-hal/pulseio/PWMOut.c renamed to ports/atmel-samd/common-hal/pwmio/PWMOut.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
#include <stdint.h>
2929

3030
#include "py/runtime.h"
31-
#include "common-hal/pulseio/PWMOut.h"
32-
#include "shared-bindings/pulseio/PWMOut.h"
31+
#include "common-hal/pwmio/PWMOut.h"
32+
#include "shared-bindings/pwmio/PWMOut.h"
3333
#include "shared-bindings/microcontroller/Processor.h"
3434
#include "timer_handler.h"
3535

@@ -78,13 +78,13 @@ void timer_reset_ok(int index, bool is_tc) {
7878
}
7979

8080

81-
void common_hal_pulseio_pwmout_never_reset(pulseio_pwmout_obj_t *self) {
81+
void common_hal_pwmio_pwmout_never_reset(pwmio_pwmout_obj_t *self) {
8282
timer_never_reset(self->timer->index, self->timer->is_tc);
8383

8484
never_reset_pin_number(self->pin->number);
8585
}
8686

87-
void common_hal_pulseio_pwmout_reset_ok(pulseio_pwmout_obj_t *self) {
87+
void common_hal_pwmio_pwmout_reset_ok(pwmio_pwmout_obj_t *self) {
8888
timer_reset_ok(self->timer->index, self->timer->is_tc);
8989
}
9090

@@ -137,7 +137,7 @@ bool channel_ok(const pin_timer_t* t) {
137137
t->is_tc;
138138
}
139139

140-
pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
140+
pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t* self,
141141
const mcu_pin_obj_t* pin,
142142
uint16_t duty,
143143
uint32_t frequency,
@@ -296,16 +296,16 @@ pwmout_result_t common_hal_pulseio_pwmout_construct(pulseio_pwmout_obj_t* self,
296296

297297
gpio_set_pin_function(pin->number, GPIO_PIN_FUNCTION_E + mux_position);
298298

299-
common_hal_pulseio_pwmout_set_duty_cycle(self, duty);
299+
common_hal_pwmio_pwmout_set_duty_cycle(self, duty);
300300
return PWMOUT_OK;
301301
}
302302

303-
bool common_hal_pulseio_pwmout_deinited(pulseio_pwmout_obj_t* self) {
303+
bool common_hal_pwmio_pwmout_deinited(pwmio_pwmout_obj_t* self) {
304304
return self->pin == NULL;
305305
}
306306

307-
void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) {
308-
if (common_hal_pulseio_pwmout_deinited(self)) {
307+
void common_hal_pwmio_pwmout_deinit(pwmio_pwmout_obj_t* self) {
308+
if (common_hal_pwmio_pwmout_deinited(self)) {
309309
return;
310310
}
311311
const pin_timer_t* t = self->timer;
@@ -331,7 +331,7 @@ void common_hal_pulseio_pwmout_deinit(pulseio_pwmout_obj_t* self) {
331331
self->pin = NULL;
332332
}
333333

334-
extern void common_hal_pulseio_pwmout_set_duty_cycle(pulseio_pwmout_obj_t* self, uint16_t duty) {
334+
extern void common_hal_pwmio_pwmout_set_duty_cycle(pwmio_pwmout_obj_t* self, uint16_t duty) {
335335
// Store the unadjusted duty cycle. It turns out the the process of adjusting and calculating
336336
// the duty cycle here and reading it back is lossy - the value will decay over time.
337337
// Track it here so that if frequency is changed we can use this value to recalculate the
@@ -373,7 +373,7 @@ extern void common_hal_pulseio_pwmout_set_duty_cycle(pulseio_pwmout_obj_t* self,
373373
}
374374
}
375375

376-
uint16_t common_hal_pulseio_pwmout_get_duty_cycle(pulseio_pwmout_obj_t* self) {
376+
uint16_t common_hal_pwmio_pwmout_get_duty_cycle(pwmio_pwmout_obj_t* self) {
377377
const pin_timer_t* t = self->timer;
378378
if (t->is_tc) {
379379
Tc* tc = tc_insts[t->index];
@@ -411,7 +411,7 @@ uint16_t common_hal_pulseio_pwmout_get_duty_cycle(pulseio_pwmout_obj_t* self) {
411411
}
412412

413413

414-
void common_hal_pulseio_pwmout_set_frequency(pulseio_pwmout_obj_t* self,
414+
void common_hal_pwmio_pwmout_set_frequency(pwmio_pwmout_obj_t* self,
415415
uint32_t frequency) {
416416
if (frequency == 0 || frequency > 6000000) {
417417
mp_raise_ValueError(translate("Invalid PWM frequency"));
@@ -466,10 +466,10 @@ void common_hal_pulseio_pwmout_set_frequency(pulseio_pwmout_obj_t* self,
466466
#endif
467467
}
468468

469-
common_hal_pulseio_pwmout_set_duty_cycle(self, self->duty_cycle);
469+
common_hal_pwmio_pwmout_set_duty_cycle(self, self->duty_cycle);
470470
}
471471

472-
uint32_t common_hal_pulseio_pwmout_get_frequency(pulseio_pwmout_obj_t* self) {
472+
uint32_t common_hal_pwmio_pwmout_get_frequency(pwmio_pwmout_obj_t* self) {
473473
uint32_t system_clock = common_hal_mcu_processor_get_frequency();
474474
const pin_timer_t* t = self->timer;
475475
uint8_t divisor;
@@ -484,6 +484,6 @@ uint32_t common_hal_pulseio_pwmout_get_frequency(pulseio_pwmout_obj_t* self) {
484484
return (system_clock / prescaler[divisor]) / (top + 1);
485485
}
486486

487-
bool common_hal_pulseio_pwmout_get_variable_frequency(pulseio_pwmout_obj_t* self) {
487+
bool common_hal_pwmio_pwmout_get_variable_frequency(pwmio_pwmout_obj_t* self) {
488488
return self->variable_frequency;
489489
}

ports/atmel-samd/common-hal/pulseio/PWMOut.h renamed to ports/atmel-samd/common-hal/pwmio/PWMOut.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
* THE SOFTWARE.
2525
*/
2626

27-
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PULSEIO_PWMOUT_H
28-
#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PULSEIO_PWMOUT_H
27+
#ifndef MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PWMIO_PWMOUT_H
28+
#define MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PWMIO_PWMOUT_H
2929

3030
#include "common-hal/microcontroller/Pin.h"
3131

@@ -37,8 +37,8 @@ typedef struct {
3737
const pin_timer_t* timer;
3838
bool variable_frequency;
3939
uint16_t duty_cycle;
40-
} pulseio_pwmout_obj_t;
40+
} pwmio_pwmout_obj_t;
4141

4242
void pwmout_reset(void);
4343

44-
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PULSEIO_PWMOUT_H
44+
#endif // MICROPY_INCLUDED_ATMEL_SAMD_COMMON_HAL_PWMIO_PWMOUT_H
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// No pwmio module functions.

ports/atmel-samd/supervisor/port.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
#include "common-hal/microcontroller/Pin.h"
6060
#include "common-hal/pulseio/PulseIn.h"
6161
#include "common-hal/pulseio/PulseOut.h"
62-
#include "common-hal/pulseio/PWMOut.h"
62+
#include "common-hal/pwmio/PWMOut.h"
6363
#include "common-hal/ps2io/Ps2.h"
6464
#include "common-hal/rtc/RTC.h"
6565

@@ -335,6 +335,8 @@ void reset_port(void) {
335335
#if CIRCUITPY_PULSEIO
336336
pulsein_reset();
337337
pulseout_reset();
338+
#endif
339+
#if CIRCUITPY_PWMIO
338340
pwmout_reset();
339341
#endif
340342

ports/cxd56/common-hal/microcontroller/Processor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ typedef struct {
3535
mp_obj_base_t base;
3636
} mcu_processor_obj_t;
3737

38-
const mp_obj_type_t mcu_processor_type;
38+
extern const mp_obj_type_t mcu_processor_type;
3939

4040
#endif // MICROPY_INCLUDED_CXD56_COMMON_HAL_MICROCONTROLLER_PROCESSOR_H

ports/cxd56/common-hal/pulseio/PulseOut.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static bool pulseout_timer_handler(unsigned int *next_interval_us, void *arg)
5959
}
6060

6161
void common_hal_pulseio_pulseout_construct(pulseio_pulseout_obj_t* self,
62-
const pulseio_pwmout_obj_t* carrier,
62+
const pwmio_pwmout_obj_t* carrier,
6363
const mcu_pin_obj_t* pin,
6464
uint32_t frequency,
6565
uint16_t duty_cycle) {

0 commit comments

Comments
 (0)