Skip to content

Commit e170e03

Browse files
committed
Merge remote-tracking branch 'adafruit/master' into bleio2
2 parents 62df7ab + 9e8d182 commit e170e03

File tree

127 files changed

+3962
-2115
lines changed

Some content is hidden

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

127 files changed

+3962
-2115
lines changed

.travis.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ 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 particle_boron particle_argon particle_xenon sparkfun_nrf52840_mini" TRAVIS_SDK=arm:nrf
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" TRAVIS_SDK=arm:nrf
2525
- TRAVIS_BOARDS="metro_m0_express metro_m4_express pirkey_m0 trellis_m4_express trinket_m0" TRAVIS_SDK=arm
2626
- TRAVIS_BOARDS="feather_radiofruit_zigbee gemma_m0 hallowing_m0_express itsybitsy_m0_express itsybitsy_m4_express meowmeow" TRAVIS_SDK=arm
2727
- TRAVIS_BOARDS="feather_m0_express_crickit feather_m0_rfm69 feather_m0_rfm9x feather_m4_express arduino_zero arduino_mkr1300 arduino_mkrzero" TRAVIS_SDK=arm
@@ -86,7 +86,7 @@ before_script:
8686
script:
8787
# Build mpy-cross first because other builds depend on it.
8888
- echo 'Building mpy-cross' && echo 'travis_fold:start:mpy-cross'
89-
- make -C mpy-cross -j2 ; echo $? > status
89+
- make -C mpy-cross -j2 ; S=$? ; echo $S > status ; (exit $S)
9090
- echo 'travis_fold:end:mpy-cross' && tools/print_status.py status
9191

9292
# Use unbuffered output because building all the releases can take a long time.
@@ -95,7 +95,7 @@ script:
9595
- cd ..
9696

9797
- echo 'Building unix' && echo 'travis_fold:start:unix'
98-
- (! var_search "${TRAVIS_TESTS-}" unix || (make -C ports/unix deplibs -j2 && make -C ports/unix -j2 && make -C ports/unix coverage -j2)) ; echo $? > status
98+
- (! var_search "${TRAVIS_TESTS-}" unix || (make -C ports/unix deplibs -j2 && make -C ports/unix -j2 && make -C ports/unix coverage -j2)) ; S=$? ; echo $S > status ; (exit $S)
9999
- echo 'travis_fold:end:unix' && tools/print_status.py status
100100

101101
# run tests without coverage info
@@ -104,27 +104,27 @@ script:
104104

105105
# run tests with coverage info
106106
- echo 'Test all' && echo 'travis_fold:start:test_all'
107-
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1)) ; echo $? > status
107+
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1)) ; S=$? ; echo $S > status ; (exit $S)
108108
- echo 'travis_fold:end:test_all' && tools/print_status.py status
109109

110110
- echo 'Test threads' && echo 'travis_fold:start:test_threads'
111-
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 -d thread)) ; echo $? >status
111+
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 -d thread)) ; S=$? ; echo $S > status ; (exit $S)
112112
- echo 'travis_fold:end:test_threads' && tools/print_status.py status
113113

114114
- echo 'Testing with native' && echo 'travis_fold:start:test_native'
115-
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native)) ; echo $? >status
115+
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --emit native)) ; S=$? ; echo $S > status ; (exit $S)
116116
- echo 'travis_fold:end:test_native' && tools/print_status.py status
117117

118118
- (echo 'Testing with mpy' && echo 'travis_fold:start:test_mpy')
119-
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float)) ; echo $? >status
119+
- (! var_search "${TRAVIS_TESTS-}" unix || (cd tests && MICROPY_CPYTHON3=python3.5 MICROPY_MICROPYTHON=../ports/unix/micropython_coverage ./run-tests -j1 --via-mpy -d basics float)) ; S=$? ; echo $S > status ; (exit $S)
120120
- echo 'travis_fold:end:test_mpy' && tools/print_status.py status
121121

122122
- (echo 'Building docs' && echo 'travis_fold:start:build_docs')
123-
- (! var_search "${TRAVIS_TESTS-}" docs || sphinx-build -E -W -b html . _build/html) ; echo $? >status
123+
- (! var_search "${TRAVIS_TESTS-}" docs || sphinx-build -E -W -b html . _build/html) ; S=$? ; echo $S > status ; (exit $S)
124124
- echo 'travis_fold:end:build_docs' && tools/print_status.py status
125125

126126
- (echo 'Building translations' && echo 'travis_fold:start:build_translations')
127-
- (! var_search "${TRAVIS_TESTS-}" translations || make check-translate) ; echo $? >status
127+
- (! var_search "${TRAVIS_TESTS-}" translations || make check-translate) ; S=$? ; echo $S > status ; (exit $S)
128128
- echo 'travis_fold:end:build_translations' && tools/print_status.py status
129129

130130
# run coveralls coverage analysis (try to, even if some builds/tests failed)

extmod/machine_i2c.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,14 +287,14 @@ STATIC void machine_i2c_obj_init_helper(machine_i2c_obj_t *self, size_t n_args,
287287
mp_hal_i2c_init(self, args[ARG_freq].u_int);
288288
}
289289

290-
STATIC mp_obj_t machine_i2c_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
290+
STATIC mp_obj_t machine_i2c_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
291291
// check the id argument, if given
292292
if (n_args > 0) {
293293
if (args[0] != MP_OBJ_NEW_SMALL_INT(-1)) {
294294
#if defined(MICROPY_PY_MACHINE_I2C_MAKE_NEW)
295295
// dispatch to port-specific constructor
296-
extern mp_obj_t MICROPY_PY_MACHINE_I2C_MAKE_NEW(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args);
297-
return MICROPY_PY_MACHINE_I2C_MAKE_NEW(type, n_args, n_kw, args);
296+
extern mp_obj_t MICROPY_PY_MACHINE_I2C_MAKE_NEW(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *all_args, mp_map_t *kw_args);
297+
return MICROPY_PY_MACHINE_I2C_MAKE_NEW(type, n_args, args, kw_args);
298298
#else
299299
mp_raise_ValueError(translate("invalid I2C peripheral"));
300300
#endif
@@ -306,9 +306,7 @@ STATIC mp_obj_t machine_i2c_make_new(const mp_obj_type_t *type, size_t n_args, s
306306
// create new soft I2C object
307307
machine_i2c_obj_t *self = m_new_obj(machine_i2c_obj_t);
308308
self->base.type = &machine_i2c_type;
309-
mp_map_t kw_args;
310-
mp_map_init_fixed_table(&kw_args, n_kw, args + n_args);
311-
machine_i2c_obj_init_helper(self, n_args, args, &kw_args);
309+
machine_i2c_obj_init_helper(self, n_args, args, kw_args);
312310
return (mp_obj_t)self;
313311
}
314312

extmod/machine_pinbase.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ STATIC const mp_pinbase_t pinbase_singleton = {
4545
.base = { &machine_pinbase_type },
4646
};
4747

48-
STATIC mp_obj_t pinbase_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
48+
STATIC mp_obj_t pinbase_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
4949
(void)type;
5050
(void)n_args;
51-
(void)n_kw;
5251
(void)args;
52+
(void)kw_args;
5353
return MP_OBJ_FROM_PTR(&pinbase_singleton);
5454
}
5555

extmod/machine_signal.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ typedef struct _machine_signal_t {
4242
bool invert;
4343
} machine_signal_t;
4444

45-
STATIC mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
45+
STATIC mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
4646
mp_obj_t pin = args[0];
4747
bool invert = false;
4848

@@ -96,9 +96,9 @@ STATIC mp_obj_t signal_make_new(const mp_obj_type_t *type, size_t n_args, size_t
9696
// Otherwise there should be 1 or 2 args
9797
{
9898
if (n_args == 1) {
99-
if (n_kw == 0) {
100-
} else if (n_kw == 1 && args[1] == MP_OBJ_NEW_QSTR(MP_QSTR_invert)) {
101-
invert = mp_obj_is_true(args[2]);
99+
if (kw_args == NULL || kw_args->used == 0) {
100+
} else if (kw_args->used == 1 && kw_args->table[0].key == MP_OBJ_NEW_QSTR(MP_QSTR_invert)) {
101+
invert = mp_obj_is_true(kw_args->table[0].value);
102102
} else {
103103
goto error;
104104
}
@@ -133,7 +133,7 @@ STATIC mp_uint_t signal_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_t arg
133133

134134
// fast method for getting/setting signal value
135135
STATIC mp_obj_t signal_call(mp_obj_t self_in, size_t n_args, size_t n_kw, const mp_obj_t *args) {
136-
mp_arg_check_num(n_args, n_kw, 0, 1, false);
136+
mp_arg_check_num_kw_array(n_args, n_kw, 0, 1, false);
137137
if (n_args == 0) {
138138
// get pin
139139
return MP_OBJ_NEW_SMALL_INT(mp_virtual_pin_read(self_in));

extmod/machine_spi.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@
4343
/******************************************************************************/
4444
// MicroPython bindings for generic machine.SPI
4545

46-
STATIC mp_obj_t mp_machine_soft_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args);
46+
STATIC mp_obj_t mp_machine_soft_spi_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
4747

48-
mp_obj_t mp_machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
48+
mp_obj_t mp_machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
4949
// check the id argument, if given
5050
if (n_args > 0) {
5151
if (args[0] != MP_OBJ_NEW_SMALL_INT(-1)) {
5252
#if defined(MICROPY_PY_MACHINE_SPI_MAKE_NEW)
5353
// dispatch to port-specific constructor
54-
extern mp_obj_t MICROPY_PY_MACHINE_SPI_MAKE_NEW(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args);
55-
return MICROPY_PY_MACHINE_SPI_MAKE_NEW(type, n_args, n_kw, args);
54+
extern mp_obj_t MICROPY_PY_MACHINE_SPI_MAKE_NEW(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
55+
return MICROPY_PY_MACHINE_SPI_MAKE_NEW(type, n_args, args, kw_args);
5656
#else
5757
mp_raise_ValueError(translate("invalid SPI peripheral"));
5858
#endif
@@ -62,7 +62,7 @@ mp_obj_t mp_machine_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_
6262
}
6363

6464
// software SPI
65-
return mp_machine_soft_spi_make_new(type, n_args, n_kw, args);
65+
return mp_machine_soft_spi_make_new(type, n_args, args, kw_args);
6666
}
6767

6868
STATIC mp_obj_t machine_spi_init(size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
@@ -180,7 +180,7 @@ STATIC void mp_machine_soft_spi_print(const mp_print_t *print, mp_obj_t self_in,
180180
mp_hal_pin_name(self->spi.sck), mp_hal_pin_name(self->spi.mosi), mp_hal_pin_name(self->spi.miso));
181181
}
182182

183-
STATIC mp_obj_t mp_machine_soft_spi_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *all_args) {
183+
STATIC mp_obj_t mp_machine_soft_spi_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *all_args, mp_map_t *kw_args) {
184184
enum { ARG_baudrate, ARG_polarity, ARG_phase, ARG_bits, ARG_firstbit, ARG_sck, ARG_mosi, ARG_miso };
185185
static const mp_arg_t allowed_args[] = {
186186
{ MP_QSTR_baudrate, MP_ARG_INT, {.u_int = 500000} },
@@ -193,7 +193,7 @@ STATIC mp_obj_t mp_machine_soft_spi_make_new(const mp_obj_type_t *type, size_t n
193193
{ MP_QSTR_miso, MP_ARG_KW_ONLY | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} },
194194
};
195195
mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)];
196-
mp_arg_parse_all_kw_array(n_args, n_kw, all_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
196+
mp_arg_parse_all(n_args, all_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
197197

198198
// create new object
199199
mp_machine_soft_spi_obj_t *self = m_new_obj(mp_machine_soft_spi_obj_t);

extmod/modframebuf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ STATIC void fill_rect(const mp_obj_framebuf_t *fb, int x, int y, int w, int h, u
259259
formats[fb->format].fill_rect(fb, x, y, xend - x, yend - y, col);
260260
}
261261

262-
STATIC mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
263-
mp_arg_check_num(n_args, n_kw, 4, 5, false);
262+
STATIC mp_obj_t framebuf_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
263+
mp_arg_check_num(n_args, kw_args, 4, 5, false);
264264

265265
mp_obj_framebuf_t *o = m_new_obj(mp_obj_framebuf_t);
266266
o->base.type = type;

extmod/moductypes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ STATIC NORETURN void syntax_error(void) {
122122
mp_raise_TypeError(translate("syntax error in uctypes descriptor"));
123123
}
124124

125-
STATIC mp_obj_t uctypes_struct_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
126-
mp_arg_check_num(n_args, n_kw, 2, 3, false);
125+
STATIC mp_obj_t uctypes_struct_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
126+
mp_arg_check_num(n_args, kw_args, 2, 3, false);
127127
mp_obj_uctypes_struct_t *o = m_new_obj(mp_obj_uctypes_struct_t);
128128
o->base.type = type;
129129
o->addr = (void*)(uintptr_t)mp_obj_int_get_truncated(args[0]);

extmod/modutimeq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ STATIC bool time_less_than(struct qentry *item, struct qentry *parent) {
7676
return res && res < (MODULO / 2);
7777
}
7878

79-
STATIC mp_obj_t utimeq_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
80-
mp_arg_check_num(n_args, n_kw, 1, 1, false);
79+
STATIC mp_obj_t utimeq_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
80+
mp_arg_check_num(n_args, kw_args, 1, 1, false);
8181
mp_uint_t alloc = mp_obj_get_int(args[0]);
8282
mp_obj_utimeq_t *o = m_new_obj_var(mp_obj_utimeq_t, struct qentry, alloc);
8383
o->base.type = type;

extmod/moduzlib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ STATIC int read_src_stream(TINF_DATA *data) {
6969
return c;
7070
}
7171

72-
STATIC mp_obj_t decompio_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
73-
mp_arg_check_num(n_args, n_kw, 1, 2, false);
72+
STATIC mp_obj_t decompio_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
73+
mp_arg_check_num(n_args, kw_args, 1, 2, false);
7474
mp_get_stream_raise(args[0], MP_STREAM_OP_READ);
7575
mp_obj_decompio_t *o = m_new_obj(mp_obj_decompio_t);
7676
o->base.type = type;

extmod/modwebsocket.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ typedef struct _mp_obj_websocket_t {
5757

5858
STATIC mp_uint_t websocket_write(mp_obj_t self_in, const void *buf, mp_uint_t size, int *errcode);
5959

60-
STATIC mp_obj_t websocket_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
61-
mp_arg_check_num(n_args, n_kw, 1, 2, false);
60+
STATIC mp_obj_t websocket_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
61+
mp_arg_check_num(n_args, kw_args, 1, 2, false);
6262
mp_get_stream_raise(args[0], MP_STREAM_OP_READ | MP_STREAM_OP_WRITE | MP_STREAM_OP_IOCTL);
6363
mp_obj_websocket_t *o = m_new_obj(mp_obj_websocket_t);
6464
o->base.type = type;

extmod/vfs_posix.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ STATIC mp_import_stat_t mp_vfs_posix_import_stat(void *self_in, const char *path
9090
return MP_IMPORT_STAT_NO_EXIST;
9191
}
9292

93-
STATIC mp_obj_t vfs_posix_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
94-
mp_arg_check_num(n_args, n_kw, 0, 1, false);
93+
STATIC mp_obj_t vfs_posix_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
94+
mp_arg_check_num(n_args, kw_args, 0, 1, false);
9595

9696
mp_obj_vfs_posix_t *vfs = m_new_obj(mp_obj_vfs_posix_t);
9797
vfs->base.type = type;

extmod/vfs_posix_file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ mp_obj_t mp_vfs_posix_file_open(const mp_obj_type_t *type, mp_obj_t file_in, mp_
109109
return MP_OBJ_FROM_PTR(o);
110110
}
111111

112-
STATIC mp_obj_t vfs_posix_file_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
112+
STATIC mp_obj_t vfs_posix_file_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) {
113113
static const mp_arg_t allowed_args[] = {
114114
{ MP_QSTR_file, MP_ARG_OBJ | MP_ARG_REQUIRED, {.u_rom_obj = MP_ROM_PTR(&mp_const_none_obj)} },
115115
{ MP_QSTR_mode, MP_ARG_OBJ, {.u_rom_obj = MP_ROM_QSTR(MP_QSTR_r)} },
116116
};
117117

118118
mp_arg_val_t arg_vals[MP_ARRAY_SIZE(allowed_args)];
119-
mp_arg_parse_all_kw_array(n_args, n_kw, args, MP_ARRAY_SIZE(allowed_args), allowed_args, arg_vals);
119+
mp_arg_parse_all(n_args, args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, arg_vals);
120120
return mp_vfs_posix_file_open(type, arg_vals[0].u_obj, arg_vals[1].u_obj);
121121
}
122122

0 commit comments

Comments
 (0)