From e1a843878e4272334869b1db4a8222ae344f5cb8 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 17 Aug 2020 09:48:17 -0400 Subject: add robots.txt to specify doc versions to appear in search engines --- conf.py | 2 +- docs/robots.txt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 docs/robots.txt diff --git a/conf.py b/conf.py index 4a8b72584..f7d028c19 100644 --- a/conf.py +++ b/conf.py @@ -272,7 +272,7 @@ html_static_path = ['docs/static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. -#html_extra_path = [] +html_extra_path = ["docs/robots.txt"] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. diff --git a/docs/robots.txt b/docs/robots.txt new file mode 100644 index 000000000..39a4eaeed --- /dev/null +++ b/docs/robots.txt @@ -0,0 +1,6 @@ +User-agent: * +Allow: /*/latest/ +Allow: /en/latest/ # Fallback for bots that don't understand wildcards +Allow: /*/5.3.x/ +Allow: /en/5.3.x/ # Fallback for bots that don't understand wildcards +Disallow: / -- cgit v1.2.3 From 90c203a3dd0c25b39909e98ec64dcdd0fc73054c Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Sun, 8 Nov 2020 18:39:20 -0800 Subject: add module msgpack --- ports/nrf/mpconfigport.mk | 2 + py/circuitpy_defns.mk | 4 + py/circuitpy_mpconfig.h | 8 + py/circuitpy_mpconfig.mk | 4 + shared-bindings/msgpack/__init__.c | 391 +++++++++++++++++++++++++++++++++++++ shared-bindings/msgpack/__init__.h | 34 ++++ 6 files changed, 443 insertions(+) create mode 100644 shared-bindings/msgpack/__init__.c create mode 100644 shared-bindings/msgpack/__init__.h diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk index 9560064fb..2ee182b7d 100644 --- a/ports/nrf/mpconfigport.mk +++ b/ports/nrf/mpconfigport.mk @@ -52,6 +52,8 @@ MCU_SUB_VARIANT = nrf52840 # Fits on nrf52840 but space is tight on nrf52833. CIRCUITPY_AESIO ?= 1 +CIRCUITPY_MSGPACK ?= 1 + SD ?= s140 SOFTDEV_VERSION ?= 6.1.0 diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index ccdf973e9..144168c79 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -283,6 +283,9 @@ endif ifeq ($(CIRCUITPY_PEW),1) SRC_PATTERNS += _pew/% endif +ifeq ($(CIRCUITPY_MSGPACK),1) +SRC_PATTERNS += msgpack/% +endif # All possible sources are listed here, and are filtered by SRC_PATTERNS in SRC_COMMON_HAL SRC_COMMON_HAL_ALL = \ @@ -396,6 +399,7 @@ $(filter $(SRC_PATTERNS), \ fontio/Glyph.c \ math/__init__.c \ microcontroller/RunMode.c \ + msgpack/__init__.c \ ) SRC_BINDINGS_ENUMS += \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index bffab4f30..3c4e5c290 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -754,6 +754,13 @@ extern const struct _mp_obj_module_t wifi_module; #define WIFI_MODULE #endif +#if CIRCUITPY_MSGPACK +extern const struct _mp_obj_module_t msgpack_module; +#define MSGPACK_MODULE { MP_ROM_QSTR(MP_QSTR_msgpack), MP_ROM_PTR(&msgpack_module) }, +#else +#define MSGPACK_MODULE +#endif + // Define certain native modules with weak links so they can be replaced with Python // implementations. This list may grow over time. #define MICROPY_PORT_BUILTIN_MODULE_WEAK_LINKS \ @@ -839,6 +846,7 @@ extern const struct _mp_obj_module_t wifi_module; USTACK_MODULE \ WATCHDOG_MODULE \ WIFI_MODULE \ + MSGPACK_MODULE \ // If weak links are enabled, just include strong links in the main list of modules, // and also include the underscore alternate names. diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 08e773718..38ca79584 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -296,3 +296,7 @@ CFLAGS += -DCIRCUITPY_WIFI=$(CIRCUITPY_WIFI) # Enabled micropython.native decorator (experimental) CIRCUITPY_ENABLE_MPY_NATIVE ?= 0 CFLAGS += -DCIRCUITPY_ENABLE_MPY_NATIVE=$(CIRCUITPY_ENABLE_MPY_NATIVE) + +CIRCUITPY_MSGPACK ?= 0 +CFLAGS += -DCIRCUITPY_MSGPACK=$(CIRCUITPY_MSGPACK) + diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c new file mode 100644 index 000000000..74ab64470 --- /dev/null +++ b/shared-bindings/msgpack/__init__.c @@ -0,0 +1,391 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Bernhard Boser + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/binary.h" +#include "py/objarray.h" +#include "py/objlist.h" +#include "py/objstringio.h" +#include "py/parsenum.h" +#include "py/runtime.h" +#include "py/stream.h" + +#include "supervisor/shared/translate.h" + +//////////////////////////////////////////////////////////////// +// stream management + +typedef struct _msgpack_stream_t { + mp_obj_t stream_obj; + mp_uint_t (*read)(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode); + mp_uint_t (*write)(mp_obj_t obj, const void *buf, mp_uint_t size, int *errcode); + int errcode; +} msgpack_stream_t; + +STATIC msgpack_stream_t get_stream(mp_obj_t stream_obj, int flags) { + const mp_stream_p_t *stream_p = mp_get_stream_raise(stream_obj, flags); + msgpack_stream_t s = {stream_obj, stream_p->read, stream_p->write, 0}; + return s; +} + +//////////////////////////////////////////////////////////////// +// readers + +STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { + if (size == 0) return; + mp_uint_t ret = s->read(s->stream_obj, buf, size, &s->errcode); + if (s->errcode != 0) { + mp_raise_OSError(s->errcode); + } + if (ret == 0) { + mp_raise_msg(&mp_type_EOFError, NULL); + } +} + +STATIC uint32_t read_bytes(msgpack_stream_t *s, mp_uint_t n_bytes) { + uint32_t res = 0; + read(s, &res, n_bytes); + return res; +} + +size_t read_size(msgpack_stream_t *s, uint8_t len_index) { + size_t n_bytes = 4; + switch (len_index) { + case 0: n_bytes = 1; break; + case 1: n_bytes = 2; break; + case 2: n_bytes = 4; break; + } + size_t res = 0; + read(s, &res, n_bytes); + return res; +} + +//////////////////////////////////////////////////////////////// +// writers + +STATIC void write(msgpack_stream_t *s, const void *buf, mp_uint_t size) { + mp_uint_t ret = s->write(s->stream_obj, buf, size, &s->errcode); + if (s->errcode != 0) { + mp_raise_OSError(s->errcode); + } + if (ret == 0) { + mp_raise_msg(&mp_type_EOFError, NULL); + } +} + +STATIC void write_bytes(msgpack_stream_t *s, mp_uint_t n_bytes, uint32_t obj) { + write(s, &obj, n_bytes); +} + +void write_size(msgpack_stream_t *s, uint8_t code, size_t size) { + if ((uint8_t)size == size) { + write_bytes(s, 1, code); + write_bytes(s, 1, size); + } else if ((uint16_t)size == size) { + write_bytes(s, 1, code+1); + write_bytes(s, 2, size); + } else { + write_bytes(s, 1, code+2); + write_bytes(s, 4, size); + } +} + +//////////////////////////////////////////////////////////////// +// packers + +// This is a helper function to iterate through a dictionary. The state of +// the iteration is held in *cur and should be initialised with zero for the +// first call. Will return NULL when no more elements are available. +STATIC mp_map_elem_t *dict_iter_next(mp_obj_dict_t *dict, size_t *cur) { + size_t max = dict->map.alloc; + mp_map_t *map = &dict->map; + + for (size_t i = *cur; i < max; i++) { + if (MP_MAP_SLOT_IS_FILLED(map, i)) { + *cur = i + 1; + return &(map->table[i]); + } + } + + return NULL; +} + + +STATIC void pack_int(msgpack_stream_t *s, int32_t x) { + if (x > -32 && x < 128) { + write_bytes(s, 1, x); + } else if ((int8_t)x == x) { + write_bytes(s, 1, 0xd0); + write_bytes(s, 1, x); + } else if ((int16_t)x == x) { + write_bytes(s, 1, 0xd1); + write_bytes(s, 2, x); + } else { + write_bytes(s, 1, 0xd2); + write_bytes(s, 4, x); + } +} + +void pack_bin(msgpack_stream_t *s, const uint8_t* data, size_t len) { + write_size(s, 0xc4, len); + for (size_t i=0; ilen); + for (size_t i=0; ilen; i++) { + _pack(self->items[i], s); + } + } else if (MP_OBJ_IS_TYPE(obj, &mp_type_list)) { + // list (layout differs from tuple) + mp_obj_list_t *self = MP_OBJ_TO_PTR(obj); + pack_array(s, self->len); + for (size_t i=0; ilen; i++) { + _pack(self->items[i], s); + } + } else if (MP_OBJ_IS_TYPE(obj, &mp_type_dict)) { + // dict + mp_obj_dict_t *self = MP_OBJ_TO_PTR(obj); + pack_dict(s, self->map.used); + size_t cur = 0; + mp_map_elem_t *next = NULL; + while ((next = dict_iter_next(self, &cur)) != NULL) { + _pack(next->key, s); + _pack(next->value, s); + } + } else if (mp_obj_is_float(obj)) { + mp_float_t f = mp_obj_float_get(obj); + write_bytes(s, 1, 0xca); + write(s, &f, 4); + } else if (obj == mp_const_none) { + write_bytes(s, 1, 0xc0); + } else if (obj == mp_const_false) { + write_bytes(s, 1, 0xc2); + } else if (obj == mp_const_true) { + write_bytes(s, 1, 0xc3); + } else { + mp_raise_ValueError(translate("no packer")); + } +} + +// Write obj to stream in msgpack format +STATIC mp_obj_t mod_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj) { + msgpack_stream_t s = get_stream(stream_obj, MP_STREAM_OP_WRITE); + _pack(obj, &s); + return mp_const_none; +} +STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_msgpack_pack_obj, mod_msgpack_pack); + +//////////////////////////////////////////////////////////////// +// un-packers + +STATIC mp_obj_t _unpack(msgpack_stream_t *s) { + uint8_t code = read_bytes(s, 1); + if (((code & 0b10000000) == 0) || ((code & 0b11100000) == 0b11100000)) { + // int + return MP_OBJ_NEW_SMALL_INT((int8_t)code); + } + if ((code & 0b11100000) == 0b10100000) { + // str + size_t len = code & 0b11111; + // allocate on stack; len < 32 + char str[len]; + read(s, &str, len); + return mp_obj_new_str(str, len); + } + if ((code & 0b11110000) == 0b10010000) { + // array (tuple) + size_t len = code & 0b1111; + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(len, NULL)); + for (size_t i=0; iitems[i] = _unpack(s); + } + return MP_OBJ_FROM_PTR(t); + } + if ((code & 0b11110000) == 0b10000000) { + // map (dict) + size_t len = code & 0b1111; + mp_obj_dict_t *d = MP_OBJ_TO_PTR(mp_obj_new_dict(len)); + for (size_t i=0; iitems[i] = _unpack(s); + } + return MP_OBJ_FROM_PTR(t); + } + case 0xc1: // never used + case 0xc7: // ext 8 + case 0xc8: // ext 16 + case 0xc9: // ext 32 + case 0xcb: // float 64 + case 0xcc: // uint 8 + case 0xcd: // uint 16 + case 0xce: // uint 32 + case 0xcf: // uint 64 + case 0xd3: // int 64 + case 0xd4: // fixenxt 1 + case 0xd5: // fixenxt 2 + case 0xd6: // fixenxt 4 + case 0xd7: // fixenxt 8 + case 0xd8: // fixenxt 16 + default: + mp_raise_ValueError(translate("no unpacker found")); + } +} + +// Read msgpack encoded object from stream +STATIC mp_obj_t mod_msgpack_unpack(mp_obj_t stream_obj) { + msgpack_stream_t s = get_stream(stream_obj, MP_STREAM_OP_READ); + return _unpack(&s); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_msgpack_unpack_obj, mod_msgpack_unpack); + +STATIC const mp_rom_map_elem_t msgpack_module_globals_table[] = { + { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_msgpack) }, + { MP_ROM_QSTR(MP_QSTR_pack), MP_ROM_PTR(&mod_msgpack_pack_obj) }, + { MP_ROM_QSTR(MP_QSTR_unpack), MP_ROM_PTR(&mod_msgpack_unpack_obj) }, +}; + +STATIC MP_DEFINE_CONST_DICT(msgpack_module_globals, msgpack_module_globals_table); + +const mp_obj_module_t msgpack_module = { + .base = { &mp_type_module }, + .globals = (mp_obj_dict_t*)&msgpack_module_globals, +}; diff --git a/shared-bindings/msgpack/__init__.h b/shared-bindings/msgpack/__init__.h new file mode 100644 index 000000000..4836cc62e --- /dev/null +++ b/shared-bindings/msgpack/__init__.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MSGPACK___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_MSGPACK___INIT___H + +#include "py/obj.h" + +// Nothing now. + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MSGPACK___INIT___H -- cgit v1.2.3 From 748472de7a0c2b18d88d868b1037252d57ab1bfb Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Sun, 8 Nov 2020 18:52:33 -0800 Subject: removed empty line at end of py/circuitpy_mpconfig.mk --- py/circuitpy_mpconfig.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 38ca79584..4b6f4eb96 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -299,4 +299,3 @@ CFLAGS += -DCIRCUITPY_ENABLE_MPY_NATIVE=$(CIRCUITPY_ENABLE_MPY_NATIVE) CIRCUITPY_MSGPACK ?= 0 CFLAGS += -DCIRCUITPY_MSGPACK=$(CIRCUITPY_MSGPACK) - -- cgit v1.2.3 From 513253bc3f22e5afa67155f7b4ca29a770929a3e Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 9 Nov 2020 18:09:56 -0800 Subject: moved logic to shared-module and added documentation --- ports/nrf/mpconfigport.mk | 2 - py/circuitpy_defns.mk | 1 + py/circuitpy_mpconfig.h | 2 +- py/circuitpy_mpconfig.mk | 2 +- shared-bindings/msgpack/__init__.c | 371 +++--------------------------------- shared-module/msgpack/__init__.c | 372 +++++++++++++++++++++++++++++++++++++ shared-module/msgpack/__init__.h | 34 ++++ 7 files changed, 439 insertions(+), 345 deletions(-) create mode 100644 shared-module/msgpack/__init__.c create mode 100644 shared-module/msgpack/__init__.h diff --git a/ports/nrf/mpconfigport.mk b/ports/nrf/mpconfigport.mk index 2ee182b7d..9560064fb 100644 --- a/ports/nrf/mpconfigport.mk +++ b/ports/nrf/mpconfigport.mk @@ -52,8 +52,6 @@ MCU_SUB_VARIANT = nrf52840 # Fits on nrf52840 but space is tight on nrf52833. CIRCUITPY_AESIO ?= 1 -CIRCUITPY_MSGPACK ?= 1 - SD ?= s140 SOFTDEV_VERSION ?= 6.1.0 diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index 144168c79..8c452c2b0 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -465,6 +465,7 @@ SRC_SHARED_MODULE_ALL = \ memorymonitor/AllocationAlarm.c \ memorymonitor/AllocationSize.c \ network/__init__.c \ + msgpack/__init__.c \ os/__init__.c \ random/__init__.c \ rgbmatrix/RGBMatrix.c \ diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 3c4e5c290..64fedd506 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -815,6 +815,7 @@ extern const struct _mp_obj_module_t msgpack_module; _EVE_MODULE \ MEMORYMONITOR_MODULE \ MICROCONTROLLER_MODULE \ + MSGPACK_MODULE \ NEOPIXEL_WRITE_MODULE \ NETWORK_MODULE \ SOCKET_MODULE \ @@ -846,7 +847,6 @@ extern const struct _mp_obj_module_t msgpack_module; USTACK_MODULE \ WATCHDOG_MODULE \ WIFI_MODULE \ - MSGPACK_MODULE \ // If weak links are enabled, just include strong links in the main list of modules, // and also include the underscore alternate names. diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 4b6f4eb96..348a22cd4 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -297,5 +297,5 @@ CFLAGS += -DCIRCUITPY_WIFI=$(CIRCUITPY_WIFI) CIRCUITPY_ENABLE_MPY_NATIVE ?= 0 CFLAGS += -DCIRCUITPY_ENABLE_MPY_NATIVE=$(CIRCUITPY_ENABLE_MPY_NATIVE) -CIRCUITPY_MSGPACK ?= 0 +CIRCUITPY_MSGPACK ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_MSGPACK=$(CIRCUITPY_MSGPACK) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 74ab64470..6329c5026 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -24,359 +24,48 @@ * THE SOFTWARE. */ -#include +#include "shared-bindings/msgpack/__init__.h" +#include "shared-module/msgpack/__init__.h" + +//| """Pack object in msgpack format +//| +//| The msgpack format is similar to json, except that the encoded data is binary. +//| See https://msgpack.org for details. +//| +//| Example: +//| import msgpack +//| from io import StringIO +//| +//| s = StringIO() +//| msgpack.pack({'list': [True, False, None, 1, 'abc'], 'str': 'blah'}, s) +//| s.seek(0) +//| print(msgpack.unpack(s))""" +//| + +//| def pack(obj, stream): +//| """Pack obj to stream.""" +//| ... +//| -#include "py/binary.h" -#include "py/objarray.h" -#include "py/objlist.h" -#include "py/objstringio.h" -#include "py/parsenum.h" -#include "py/runtime.h" -#include "py/stream.h" - -#include "supervisor/shared/translate.h" - -//////////////////////////////////////////////////////////////// -// stream management - -typedef struct _msgpack_stream_t { - mp_obj_t stream_obj; - mp_uint_t (*read)(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode); - mp_uint_t (*write)(mp_obj_t obj, const void *buf, mp_uint_t size, int *errcode); - int errcode; -} msgpack_stream_t; - -STATIC msgpack_stream_t get_stream(mp_obj_t stream_obj, int flags) { - const mp_stream_p_t *stream_p = mp_get_stream_raise(stream_obj, flags); - msgpack_stream_t s = {stream_obj, stream_p->read, stream_p->write, 0}; - return s; -} - -//////////////////////////////////////////////////////////////// -// readers - -STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { - if (size == 0) return; - mp_uint_t ret = s->read(s->stream_obj, buf, size, &s->errcode); - if (s->errcode != 0) { - mp_raise_OSError(s->errcode); - } - if (ret == 0) { - mp_raise_msg(&mp_type_EOFError, NULL); - } -} - -STATIC uint32_t read_bytes(msgpack_stream_t *s, mp_uint_t n_bytes) { - uint32_t res = 0; - read(s, &res, n_bytes); - return res; -} - -size_t read_size(msgpack_stream_t *s, uint8_t len_index) { - size_t n_bytes = 4; - switch (len_index) { - case 0: n_bytes = 1; break; - case 1: n_bytes = 2; break; - case 2: n_bytes = 4; break; - } - size_t res = 0; - read(s, &res, n_bytes); - return res; -} - -//////////////////////////////////////////////////////////////// -// writers - -STATIC void write(msgpack_stream_t *s, const void *buf, mp_uint_t size) { - mp_uint_t ret = s->write(s->stream_obj, buf, size, &s->errcode); - if (s->errcode != 0) { - mp_raise_OSError(s->errcode); - } - if (ret == 0) { - mp_raise_msg(&mp_type_EOFError, NULL); - } -} - -STATIC void write_bytes(msgpack_stream_t *s, mp_uint_t n_bytes, uint32_t obj) { - write(s, &obj, n_bytes); -} - -void write_size(msgpack_stream_t *s, uint8_t code, size_t size) { - if ((uint8_t)size == size) { - write_bytes(s, 1, code); - write_bytes(s, 1, size); - } else if ((uint16_t)size == size) { - write_bytes(s, 1, code+1); - write_bytes(s, 2, size); - } else { - write_bytes(s, 1, code+2); - write_bytes(s, 4, size); - } -} - -//////////////////////////////////////////////////////////////// -// packers - -// This is a helper function to iterate through a dictionary. The state of -// the iteration is held in *cur and should be initialised with zero for the -// first call. Will return NULL when no more elements are available. -STATIC mp_map_elem_t *dict_iter_next(mp_obj_dict_t *dict, size_t *cur) { - size_t max = dict->map.alloc; - mp_map_t *map = &dict->map; - - for (size_t i = *cur; i < max; i++) { - if (MP_MAP_SLOT_IS_FILLED(map, i)) { - *cur = i + 1; - return &(map->table[i]); - } - } - - return NULL; -} - - -STATIC void pack_int(msgpack_stream_t *s, int32_t x) { - if (x > -32 && x < 128) { - write_bytes(s, 1, x); - } else if ((int8_t)x == x) { - write_bytes(s, 1, 0xd0); - write_bytes(s, 1, x); - } else if ((int16_t)x == x) { - write_bytes(s, 1, 0xd1); - write_bytes(s, 2, x); - } else { - write_bytes(s, 1, 0xd2); - write_bytes(s, 4, x); - } -} - -void pack_bin(msgpack_stream_t *s, const uint8_t* data, size_t len) { - write_size(s, 0xc4, len); - for (size_t i=0; ilen); - for (size_t i=0; ilen; i++) { - _pack(self->items[i], s); - } - } else if (MP_OBJ_IS_TYPE(obj, &mp_type_list)) { - // list (layout differs from tuple) - mp_obj_list_t *self = MP_OBJ_TO_PTR(obj); - pack_array(s, self->len); - for (size_t i=0; ilen; i++) { - _pack(self->items[i], s); - } - } else if (MP_OBJ_IS_TYPE(obj, &mp_type_dict)) { - // dict - mp_obj_dict_t *self = MP_OBJ_TO_PTR(obj); - pack_dict(s, self->map.used); - size_t cur = 0; - mp_map_elem_t *next = NULL; - while ((next = dict_iter_next(self, &cur)) != NULL) { - _pack(next->key, s); - _pack(next->value, s); - } - } else if (mp_obj_is_float(obj)) { - mp_float_t f = mp_obj_float_get(obj); - write_bytes(s, 1, 0xca); - write(s, &f, 4); - } else if (obj == mp_const_none) { - write_bytes(s, 1, 0xc0); - } else if (obj == mp_const_false) { - write_bytes(s, 1, 0xc2); - } else if (obj == mp_const_true) { - write_bytes(s, 1, 0xc3); - } else { - mp_raise_ValueError(translate("no packer")); - } -} - -// Write obj to stream in msgpack format STATIC mp_obj_t mod_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj) { - msgpack_stream_t s = get_stream(stream_obj, MP_STREAM_OP_WRITE); - _pack(obj, &s); + common_hal_msgpack_pack(obj, stream_obj); return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_msgpack_pack_obj, mod_msgpack_pack); -//////////////////////////////////////////////////////////////// -// un-packers -STATIC mp_obj_t _unpack(msgpack_stream_t *s) { - uint8_t code = read_bytes(s, 1); - if (((code & 0b10000000) == 0) || ((code & 0b11100000) == 0b11100000)) { - // int - return MP_OBJ_NEW_SMALL_INT((int8_t)code); - } - if ((code & 0b11100000) == 0b10100000) { - // str - size_t len = code & 0b11111; - // allocate on stack; len < 32 - char str[len]; - read(s, &str, len); - return mp_obj_new_str(str, len); - } - if ((code & 0b11110000) == 0b10010000) { - // array (tuple) - size_t len = code & 0b1111; - mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(len, NULL)); - for (size_t i=0; iitems[i] = _unpack(s); - } - return MP_OBJ_FROM_PTR(t); - } - if ((code & 0b11110000) == 0b10000000) { - // map (dict) - size_t len = code & 0b1111; - mp_obj_dict_t *d = MP_OBJ_TO_PTR(mp_obj_new_dict(len)); - for (size_t i=0; iitems[i] = _unpack(s); - } - return MP_OBJ_FROM_PTR(t); - } - case 0xc1: // never used - case 0xc7: // ext 8 - case 0xc8: // ext 16 - case 0xc9: // ext 32 - case 0xcb: // float 64 - case 0xcc: // uint 8 - case 0xcd: // uint 16 - case 0xce: // uint 32 - case 0xcf: // uint 64 - case 0xd3: // int 64 - case 0xd4: // fixenxt 1 - case 0xd5: // fixenxt 2 - case 0xd6: // fixenxt 4 - case 0xd7: // fixenxt 8 - case 0xd8: // fixenxt 16 - default: - mp_raise_ValueError(translate("no unpacker found")); - } -} +//| def pack(obj, stream) -> obj: +//| """Unpack and return one object (in msgpack format) from stream. +//| Call repeatedly to read multiple objects from the stream.""" +//| ... +//| -// Read msgpack encoded object from stream STATIC mp_obj_t mod_msgpack_unpack(mp_obj_t stream_obj) { - msgpack_stream_t s = get_stream(stream_obj, MP_STREAM_OP_READ); - return _unpack(&s); + return common_hal_msgpack_unpack(stream_obj); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_msgpack_unpack_obj, mod_msgpack_unpack); + STATIC const mp_rom_map_elem_t msgpack_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_msgpack) }, { MP_ROM_QSTR(MP_QSTR_pack), MP_ROM_PTR(&mod_msgpack_pack_obj) }, diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c new file mode 100644 index 000000000..4a969901d --- /dev/null +++ b/shared-module/msgpack/__init__.c @@ -0,0 +1,372 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Bernhard Boser + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/binary.h" +#include "py/objarray.h" +#include "py/objlist.h" +#include "py/objstringio.h" +#include "py/parsenum.h" +#include "py/runtime.h" +#include "py/stream.h" + +#include "supervisor/shared/translate.h" + +//////////////////////////////////////////////////////////////// +// stream management + +typedef struct _msgpack_stream_t { + mp_obj_t stream_obj; + mp_uint_t (*read)(mp_obj_t obj, void *buf, mp_uint_t size, int *errcode); + mp_uint_t (*write)(mp_obj_t obj, const void *buf, mp_uint_t size, int *errcode); + int errcode; +} msgpack_stream_t; + +STATIC msgpack_stream_t get_stream(mp_obj_t stream_obj, int flags) { + const mp_stream_p_t *stream_p = mp_get_stream_raise(stream_obj, flags); + msgpack_stream_t s = {stream_obj, stream_p->read, stream_p->write, 0}; + return s; +} + +//////////////////////////////////////////////////////////////// +// readers + +STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { + if (size == 0) return; + mp_uint_t ret = s->read(s->stream_obj, buf, size, &s->errcode); + if (s->errcode != 0) { + mp_raise_OSError(s->errcode); + } + if (ret == 0) { + mp_raise_msg(&mp_type_EOFError, NULL); + } +} + +STATIC uint32_t read_bytes(msgpack_stream_t *s, mp_uint_t n_bytes) { + uint32_t res = 0; + read(s, &res, n_bytes); + return res; +} + +size_t read_size(msgpack_stream_t *s, uint8_t len_index) { + size_t n_bytes = 4; + switch (len_index) { + case 0: n_bytes = 1; break; + case 1: n_bytes = 2; break; + case 2: n_bytes = 4; break; + } + size_t res = 0; + read(s, &res, n_bytes); + return res; +} + +//////////////////////////////////////////////////////////////// +// writers + +STATIC void write(msgpack_stream_t *s, const void *buf, mp_uint_t size) { + mp_uint_t ret = s->write(s->stream_obj, buf, size, &s->errcode); + if (s->errcode != 0) { + mp_raise_OSError(s->errcode); + } + if (ret == 0) { + mp_raise_msg(&mp_type_EOFError, NULL); + } +} + +STATIC void write_bytes(msgpack_stream_t *s, mp_uint_t n_bytes, uint32_t obj) { + write(s, &obj, n_bytes); +} + +void write_size(msgpack_stream_t *s, uint8_t code, size_t size) { + if ((uint8_t)size == size) { + write_bytes(s, 1, code); + write_bytes(s, 1, size); + } else if ((uint16_t)size == size) { + write_bytes(s, 1, code+1); + write_bytes(s, 2, size); + } else { + write_bytes(s, 1, code+2); + write_bytes(s, 4, size); + } +} + +//////////////////////////////////////////////////////////////// +// packers + +// This is a helper function to iterate through a dictionary. The state of +// the iteration is held in *cur and should be initialised with zero for the +// first call. Will return NULL when no more elements are available. +STATIC mp_map_elem_t *dict_iter_next(mp_obj_dict_t *dict, size_t *cur) { + size_t max = dict->map.alloc; + mp_map_t *map = &dict->map; + + for (size_t i = *cur; i < max; i++) { + if (MP_MAP_SLOT_IS_FILLED(map, i)) { + *cur = i + 1; + return &(map->table[i]); + } + } + + return NULL; +} + +STATIC void pack_int(msgpack_stream_t *s, int32_t x) { + if (x > -32 && x < 128) { + write_bytes(s, 1, x); + } else if ((int8_t)x == x) { + write_bytes(s, 1, 0xd0); + write_bytes(s, 1, x); + } else if ((int16_t)x == x) { + write_bytes(s, 1, 0xd1); + write_bytes(s, 2, x); + } else { + write_bytes(s, 1, 0xd2); + write_bytes(s, 4, x); + } +} + +void pack_bin(msgpack_stream_t *s, const uint8_t* data, size_t len) { + write_size(s, 0xc4, len); + for (size_t i=0; ilen); + for (size_t i=0; ilen; i++) { + pack(self->items[i], s); + } + } else if (MP_OBJ_IS_TYPE(obj, &mp_type_list)) { + // list (layout differs from tuple) + mp_obj_list_t *self = MP_OBJ_TO_PTR(obj); + pack_array(s, self->len); + for (size_t i=0; ilen; i++) { + pack(self->items[i], s); + } + } else if (MP_OBJ_IS_TYPE(obj, &mp_type_dict)) { + // dict + mp_obj_dict_t *self = MP_OBJ_TO_PTR(obj); + pack_dict(s, self->map.used); + size_t cur = 0; + mp_map_elem_t *next = NULL; + while ((next = dict_iter_next(self, &cur)) != NULL) { + pack(next->key, s); + pack(next->value, s); + } + } else if (mp_obj_is_float(obj)) { + mp_float_t f = mp_obj_float_get(obj); + write_bytes(s, 1, 0xca); + write(s, &f, 4); + } else if (obj == mp_const_none) { + write_bytes(s, 1, 0xc0); + } else if (obj == mp_const_false) { + write_bytes(s, 1, 0xc2); + } else if (obj == mp_const_true) { + write_bytes(s, 1, 0xc3); + } else { + mp_raise_ValueError(translate("no packer")); + } +} + +//////////////////////////////////////////////////////////////// +// unpacker + +mp_obj_t unpack(msgpack_stream_t *s) { + uint8_t code = read_bytes(s, 1); + if (((code & 0b10000000) == 0) || ((code & 0b11100000) == 0b11100000)) { + // int + return MP_OBJ_NEW_SMALL_INT((int8_t)code); + } + if ((code & 0b11100000) == 0b10100000) { + // str + size_t len = code & 0b11111; + // allocate on stack; len < 32 + char str[len]; + read(s, &str, len); + return mp_obj_new_str(str, len); + } + if ((code & 0b11110000) == 0b10010000) { + // array (tuple) + size_t len = code & 0b1111; + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(len, NULL)); + for (size_t i=0; iitems[i] = unpack(s); + } + return MP_OBJ_FROM_PTR(t); + } + if ((code & 0b11110000) == 0b10000000) { + // map (dict) + size_t len = code & 0b1111; + mp_obj_dict_t *d = MP_OBJ_TO_PTR(mp_obj_new_dict(len)); + for (size_t i=0; iitems[i] = unpack(s); + } + return MP_OBJ_FROM_PTR(t); + } + case 0xc1: // never used + case 0xc7: // ext 8 + case 0xc8: // ext 16 + case 0xc9: // ext 32 + case 0xcb: // float 64 + case 0xcc: // uint 8 + case 0xcd: // uint 16 + case 0xce: // uint 32 + case 0xcf: // uint 64 + case 0xd3: // int 64 + case 0xd4: // fixenxt 1 + case 0xd5: // fixenxt 2 + case 0xd6: // fixenxt 4 + case 0xd7: // fixenxt 8 + case 0xd8: // fixenxt 16 + default: + mp_raise_ValueError(translate("no unpacker found")); + } +} + +void common_hal_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj) { + msgpack_stream_t stream = get_stream(stream_obj, MP_STREAM_OP_WRITE); + pack(obj, &stream); +} + +mp_obj_t common_hal_msgpack_unpack(mp_obj_t stream_obj) { + msgpack_stream_t stream = get_stream(stream_obj, MP_STREAM_OP_WRITE); + return unpack(&stream); +} + diff --git a/shared-module/msgpack/__init__.h b/shared-module/msgpack/__init__.h new file mode 100644 index 000000000..0a5e7852a --- /dev/null +++ b/shared-module/msgpack/__init__.h @@ -0,0 +1,34 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +#ifndef MICROPY_INCLUDED_SHARED_MODULE_MSGPACK___INIT___H +#define MICROPY_INCLUDED_SHARED_MODULE_MSGPACK___INIT___H + +#include "py/stream.h" + +void common_hal_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj); +mp_obj_t common_hal_msgpack_unpack(mp_obj_t stream_obj); + +#endif -- cgit v1.2.3 From e19782633a88ac5b076119d506ddef1d35728e4d Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 9 Nov 2020 18:12:55 -0800 Subject: removed blanks to make pre-commit check happy --- shared-bindings/msgpack/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 6329c5026..b53fb9399 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -35,12 +35,12 @@ //| Example: //| import msgpack //| from io import StringIO -//| +//| //| s = StringIO() //| msgpack.pack({'list': [True, False, None, 1, 'abc'], 'str': 'blah'}, s) //| s.seek(0) //| print(msgpack.unpack(s))""" -//| +//| //| def pack(obj, stream): //| """Pack obj to stream.""" -- cgit v1.2.3 From 912691e0d28ecbef563610dc328f6b08c61b31b0 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 9 Nov 2020 18:16:22 -0800 Subject: removed blanks line at end of file --- shared-module/msgpack/__init__.c | 1 - 1 file changed, 1 deletion(-) diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 4a969901d..437469978 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -369,4 +369,3 @@ mp_obj_t common_hal_msgpack_unpack(mp_obj_t stream_obj) { msgpack_stream_t stream = get_stream(stream_obj, MP_STREAM_OP_WRITE); return unpack(&stream); } - -- cgit v1.2.3 From f38bd59c6bbf3cb2f5e4417c676a12444e39f11b Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 9 Nov 2020 18:29:31 -0800 Subject: added signatures to documenation --- shared-bindings/msgpack/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index b53fb9399..720d88109 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -42,7 +42,7 @@ //| print(msgpack.unpack(s))""" //| -//| def pack(obj, stream): +//| def pack(obj: Any, buffer: WriteableBuffer) -> None: //| """Pack obj to stream.""" //| ... //| @@ -54,7 +54,7 @@ STATIC mp_obj_t mod_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj) { STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_msgpack_pack_obj, mod_msgpack_pack); -//| def pack(obj, stream) -> obj: +//| def unpack(buffer: ReadableBuffer) -> Any: //| """Unpack and return one object (in msgpack format) from stream. //| Call repeatedly to read multiple objects from the stream.""" //| ... -- cgit v1.2.3 From f91932d78374bec0fe6225f53a487919a956b76f Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Wed, 11 Nov 2020 16:37:15 -0800 Subject: make translate --- locale/circuitpython.pot | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 274d92168..51feb16c3 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-11-24 15:40-0500\n" +"POT-Creation-Date: 2020-12-01 18:38-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3050,6 +3050,10 @@ msgstr "" msgid "no module named '%q'" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "no packer" +msgstr "" + #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c #: shared-bindings/displayio/ParallelBus.c msgid "no reset pin available" @@ -3063,6 +3067,10 @@ msgstr "" msgid "no such attribute" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "no unpacker found" +msgstr "" + #: ports/nrf/common-hal/_bleio/Connection.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" -- cgit v1.2.3 From 44bc75af37a464eb6e5ba26bab19f2150d58044d Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Thu, 12 Nov 2020 12:28:40 -0800 Subject: output little endian; update example --- shared-bindings/msgpack/__init__.c | 10 +-- shared-module/msgpack/__init__.c | 147 +++++++++++++++++++++++++------------ 2 files changed, 106 insertions(+), 51 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 720d88109..a222177f7 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -34,12 +34,12 @@ //| //| Example: //| import msgpack -//| from io import StringIO +//| from io import BytesIO //| -//| s = StringIO() -//| msgpack.pack({'list': [True, False, None, 1, 'abc'], 'str': 'blah'}, s) -//| s.seek(0) -//| print(msgpack.unpack(s))""" +//| b = BytesIO() +//| msgpack.pack({'list': [True, False, None, 1, 'abc'], 'str': 'blah'}, b) +//| b.seek(0) +//| print(msgpack.unpack(b))""" //| //| def pack(obj: Any, buffer: WriteableBuffer) -> None: diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 437469978..505c1c969 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -25,6 +25,7 @@ */ #include +#include #include "py/binary.h" #include "py/objarray.h" @@ -66,13 +67,37 @@ STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { } } +/* STATIC uint32_t read_bytes(msgpack_stream_t *s, mp_uint_t n_bytes) { uint32_t res = 0; read(s, &res, n_bytes); return res; } +*/ +STATIC uint8_t read1(msgpack_stream_t *s) { + uint8_t res = 0; + read(s, &res, 1); + return res; +} + +STATIC uint16_t read2(msgpack_stream_t *s) { + uint16_t res = 0; + read(s, &res, 2); + int n = 1; + if (*(char *)&n == 1) res = __builtin_bswap16(res); + return res; +} + +STATIC uint32_t read4(msgpack_stream_t *s) { + uint32_t res = 0; + read(s, &res, 4); + int n = 1; + if (*(char *)&n == 1) res = __builtin_bswap32(res); + return res; +} -size_t read_size(msgpack_stream_t *s, uint8_t len_index) { +/* +STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { size_t n_bytes = 4; switch (len_index) { case 0: n_bytes = 1; break; @@ -83,6 +108,17 @@ size_t read_size(msgpack_stream_t *s, uint8_t len_index) { read(s, &res, n_bytes); return res; } +*/ + +STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { + size_t res; + switch (len_index) { + case 0: res = (size_t)read1(s); break; + case 1: res = (size_t)read2(s); break; + case 2: res = (size_t)read4(s); break; + } + return res; +} //////////////////////////////////////////////////////////////// // writers @@ -97,20 +133,33 @@ STATIC void write(msgpack_stream_t *s, const void *buf, mp_uint_t size) { } } -STATIC void write_bytes(msgpack_stream_t *s, mp_uint_t n_bytes, uint32_t obj) { - write(s, &obj, n_bytes); +STATIC void write1(msgpack_stream_t *s, uint8_t obj) { + write(s, &obj, 1); +} + +STATIC void write2(msgpack_stream_t *s, uint16_t obj) { + int n = 1; + if (*(char *)&n == 1) obj = __builtin_bswap16(obj); + write(s, &obj, 2); +} + +STATIC void write4(msgpack_stream_t *s, uint32_t obj) { + int n = 1; + if (*(char *)&n == 1) obj = __builtin_bswap32(obj); + write(s, &obj, 4); } -void write_size(msgpack_stream_t *s, uint8_t code, size_t size) { +// compute and write msgpack size code (array structures) +STATIC void write_size(msgpack_stream_t *s, uint8_t code, size_t size) { if ((uint8_t)size == size) { - write_bytes(s, 1, code); - write_bytes(s, 1, size); + write1(s, code); + write1(s, size); } else if ((uint16_t)size == size) { - write_bytes(s, 1, code+1); - write_bytes(s, 2, size); + write1(s, code+1); + write2(s, size); } else { - write_bytes(s, 1, code+2); - write_bytes(s, 4, size); + write1(s, code+2); + write4(s, size); } } @@ -136,61 +185,61 @@ STATIC mp_map_elem_t *dict_iter_next(mp_obj_dict_t *dict, size_t *cur) { STATIC void pack_int(msgpack_stream_t *s, int32_t x) { if (x > -32 && x < 128) { - write_bytes(s, 1, x); + write1(s, x); } else if ((int8_t)x == x) { - write_bytes(s, 1, 0xd0); - write_bytes(s, 1, x); + write1(s, 0xd0); + write1(s, x); } else if ((int16_t)x == x) { - write_bytes(s, 1, 0xd1); - write_bytes(s, 2, x); + write1(s, 0xd1); + write2(s, x); } else { - write_bytes(s, 1, 0xd2); - write_bytes(s, 4, x); + write1(s, 0xd2); + write4(s, x); } } void pack_bin(msgpack_stream_t *s, const uint8_t* data, size_t len) { write_size(s, 0xc4, len); for (size_t i=0; ivalue, s); } } else if (mp_obj_is_float(obj)) { - mp_float_t f = mp_obj_float_get(obj); - write_bytes(s, 1, 0xca); - write(s, &f, 4); + union Float { mp_float_t f; uint32_t u; }; + union Float data; + data.f = mp_obj_float_get(obj); + write1(s, 0xca); + write4(s, data.u); } else if (obj == mp_const_none) { - write_bytes(s, 1, 0xc0); + write1(s, 0xc0); } else if (obj == mp_const_false) { - write_bytes(s, 1, 0xc2); + write1(s, 0xc2); } else if (obj == mp_const_true) { - write_bytes(s, 1, 0xc3); + write1(s, 0xc3); } else { mp_raise_ValueError(translate("no packer")); } @@ -252,7 +303,7 @@ void pack(mp_obj_t obj, msgpack_stream_t *s) { // unpacker mp_obj_t unpack(msgpack_stream_t *s) { - uint8_t code = read_bytes(s, 1); + uint8_t code = read1(s); if (((code & 0b10000000) == 0) || ((code & 0b11100000) == 0b11100000)) { // int return MP_OBJ_NEW_SMALL_INT((int8_t)code); @@ -298,17 +349,24 @@ mp_obj_t unpack(msgpack_stream_t *s) { read(s, p, size); return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); } + case 0xcc: + return MP_OBJ_NEW_SMALL_INT(read1(s)); + case 0xcd: + return MP_OBJ_NEW_SMALL_INT(read2(s)); + case 0xce: + return MP_OBJ_NEW_SMALL_INT(read4(s)); case 0xca: { - float f; - read(s, &f, 4); - return mp_obj_new_float(f); + union Float { mp_float_t f; uint32_t u; }; + union Float data; + data.u = read4(s); + return mp_obj_new_float(data.f); } case 0xd0: - return MP_OBJ_NEW_SMALL_INT((int8_t)read_bytes(s, 1)); + return MP_OBJ_NEW_SMALL_INT((int8_t)read1(s)); case 0xd1: - return MP_OBJ_NEW_SMALL_INT((int16_t)read_bytes(s, 2)); + return MP_OBJ_NEW_SMALL_INT((int16_t)read2(s)); case 0xd2: - return MP_OBJ_NEW_SMALL_INT((int32_t)read_bytes(s, 4)); + return MP_OBJ_NEW_SMALL_INT((int32_t)read4(s)); case 0xd9: case 0xda: case 0xdb: { @@ -345,9 +403,6 @@ mp_obj_t unpack(msgpack_stream_t *s) { case 0xc8: // ext 16 case 0xc9: // ext 32 case 0xcb: // float 64 - case 0xcc: // uint 8 - case 0xcd: // uint 16 - case 0xce: // uint 32 case 0xcf: // uint 64 case 0xd3: // int 64 case 0xd4: // fixenxt 1 -- cgit v1.2.3 From b805bf8a6293ff4c6f8550946403e509a0aa9e37 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Thu, 12 Nov 2020 13:21:59 -0800 Subject: cleanup --- shared-module/msgpack/__init__.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 505c1c969..a825bb0f3 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -67,13 +67,6 @@ STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { } } -/* -STATIC uint32_t read_bytes(msgpack_stream_t *s, mp_uint_t n_bytes) { - uint32_t res = 0; - read(s, &res, n_bytes); - return res; -} -*/ STATIC uint8_t read1(msgpack_stream_t *s) { uint8_t res = 0; read(s, &res, 1); @@ -96,20 +89,6 @@ STATIC uint32_t read4(msgpack_stream_t *s) { return res; } -/* -STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { - size_t n_bytes = 4; - switch (len_index) { - case 0: n_bytes = 1; break; - case 1: n_bytes = 2; break; - case 2: n_bytes = 4; break; - } - size_t res = 0; - read(s, &res, n_bytes); - return res; -} -*/ - STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { size_t res; switch (len_index) { -- cgit v1.2.3 From a310cde8c10878d83128c1a96b1dc4ecdf4b721a Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Thu, 12 Nov 2020 17:43:40 -0800 Subject: fixed res may not be initialized in read_size --- shared-module/msgpack/__init__.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index a825bb0f3..3508755e0 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -90,11 +90,12 @@ STATIC uint32_t read4(msgpack_stream_t *s) { } STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { - size_t res; + size_t res = 0; switch (len_index) { case 0: res = (size_t)read1(s); break; case 1: res = (size_t)read2(s); break; case 2: res = (size_t)read4(s); break; + default: mp_raise_ValueError(translate("too big")); } return res; } -- cgit v1.2.3 From 4b710796289756cb43275f19bafa9ff806e1011e Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Fri, 13 Nov 2020 17:00:32 -0800 Subject: update translations --- locale/circuitpython.pot | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 51feb16c3..163d59428 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-01 18:38-0800\n" +"POT-Creation-Date: 2020-12-01 18:39-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3528,6 +3528,10 @@ msgstr "" msgid "tobytes can be invoked for dense arrays only" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "too big" +msgstr "" + #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" -- cgit v1.2.3 From 59c3e25168fde52939948f5c1ffce13557bf4f4b Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Tue, 17 Nov 2020 11:56:36 -0800 Subject: disable on boards tight on memory. add stddef.h to imports (not actually needed). --- ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk | 1 + ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk | 1 + .../boards/circuitplayground_express_crickit/mpconfigboard.mk | 1 + .../boards/circuitplayground_express_displayio/mpconfigboard.mk | 1 + ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk | 1 + ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk | 1 + ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk | 1 + ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk | 1 + ports/atmel-samd/boards/snekboard/mpconfigboard.mk | 1 + ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk | 1 + ports/cxd56/boards/spresense/mpconfigboard.mk | 2 ++ shared-module/msgpack/__init__.c | 1 + 12 files changed, 13 insertions(+) diff --git a/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk b/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk index a9885d064..4e2314b8d 100644 --- a/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk +++ b/ports/atmel-samd/boards/bdmicro_vina_d21/mpconfigboard.mk @@ -14,6 +14,7 @@ LONGINT_IMPL = MPZ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_VECTORIO = 0 CFLAGS_INLINE_LIMIT = 60 diff --git a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk index 13ec9e861..505f5c145 100644 --- a/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express/mpconfigboard.mk @@ -15,6 +15,7 @@ LONGINT_IMPL = MPZ CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 MICROPY_PY_ASYNC_AWAIT = 0 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk index 7aa45eb39..c3be33134 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_crickit/mpconfigboard.mk @@ -16,6 +16,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_PIXELBUF = 1 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 diff --git a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk index 3a43093a9..51e9b05af 100644 --- a/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk +++ b/ports/atmel-samd/boards/circuitplayground_express_displayio/mpconfigboard.mk @@ -16,6 +16,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_PIXELBUF = 0 CIRCUITPY_ROTARYIO = 0 CIRCUITPY_RTC = 0 diff --git a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk index dc02e1f60..73ce47199 100644 --- a/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_express/mpconfigboard.mk @@ -15,6 +15,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_VECTORIO = 0 CFLAGS_INLINE_LIMIT = 60 diff --git a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk index 5624144e8..f06163b84 100644 --- a/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_express_crickit/mpconfigboard.mk @@ -18,6 +18,7 @@ CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 CIRCUITPY_GAMEPAD = 0 CFLAGS_INLINE_LIMIT = 50 +CIRCUITPY_MSGPACK = 0 # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice diff --git a/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk b/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk index 6f7f2d8b6..0f1972abc 100644 --- a/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk +++ b/ports/atmel-samd/boards/feather_m0_supersized/mpconfigboard.mk @@ -15,6 +15,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 # supersized, not ultra-supersized CIRCUITPY_VECTORIO = 0 diff --git a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk index 7dd965000..0e9361a44 100644 --- a/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk +++ b/ports/atmel-samd/boards/metro_m0_express/mpconfigboard.mk @@ -14,6 +14,7 @@ LONGINT_IMPL = MPZ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_VECTORIO = 0 CFLAGS_INLINE_LIMIT = 60 diff --git a/ports/atmel-samd/boards/snekboard/mpconfigboard.mk b/ports/atmel-samd/boards/snekboard/mpconfigboard.mk index e0262b6b2..d7540fe64 100644 --- a/ports/atmel-samd/boards/snekboard/mpconfigboard.mk +++ b/ports/atmel-samd/boards/snekboard/mpconfigboard.mk @@ -14,6 +14,7 @@ LONGINT_IMPL = MPZ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_GAMEPAD = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_VECTORIO = 0 CFLAGS_INLINE_LIMIT = 60 diff --git a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk index 5170f8a23..ddf7246df 100755 --- a/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk +++ b/ports/atmel-samd/boards/sparkfun_redboard_turbo/mpconfigboard.mk @@ -15,6 +15,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_GAMEPAD = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_VECTORIO = 0 CFLAGS_INLINE_LIMIT = 60 diff --git a/ports/cxd56/boards/spresense/mpconfigboard.mk b/ports/cxd56/boards/spresense/mpconfigboard.mk index 7b8ac6ff6..80c6e4b69 100644 --- a/ports/cxd56/boards/spresense/mpconfigboard.mk +++ b/ports/cxd56/boards/spresense/mpconfigboard.mk @@ -4,3 +4,5 @@ USB_PRODUCT = "Spresense" USB_MANUFACTURER = "Sony" INTERNAL_FLASH_FILESYSTEM = 1 + +CIRCUITPY_MSGPACK = 0 diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 3508755e0..e550b01af 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -24,6 +24,7 @@ * THE SOFTWARE. */ +#include #include #include -- cgit v1.2.3 From 582a47d71a5d047abc7ee9a17b0940d1a1ed4b31 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Tue, 17 Nov 2020 16:26:09 -0800 Subject: rename read, write to read_bytes, write_bytes --- ports/cxd56/boards/spresense/mpconfigboard.mk | 2 -- shared-module/msgpack/__init__.c | 23 +++++++++++------------ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/ports/cxd56/boards/spresense/mpconfigboard.mk b/ports/cxd56/boards/spresense/mpconfigboard.mk index 80c6e4b69..7b8ac6ff6 100644 --- a/ports/cxd56/boards/spresense/mpconfigboard.mk +++ b/ports/cxd56/boards/spresense/mpconfigboard.mk @@ -4,5 +4,3 @@ USB_PRODUCT = "Spresense" USB_MANUFACTURER = "Sony" INTERNAL_FLASH_FILESYSTEM = 1 - -CIRCUITPY_MSGPACK = 0 diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index e550b01af..5bc7d1f61 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -24,7 +24,6 @@ * THE SOFTWARE. */ -#include #include #include @@ -57,7 +56,7 @@ STATIC msgpack_stream_t get_stream(mp_obj_t stream_obj, int flags) { //////////////////////////////////////////////////////////////// // readers -STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { +STATIC void read_bytes(msgpack_stream_t *s, void *buf, mp_uint_t size) { if (size == 0) return; mp_uint_t ret = s->read(s->stream_obj, buf, size, &s->errcode); if (s->errcode != 0) { @@ -70,13 +69,13 @@ STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { STATIC uint8_t read1(msgpack_stream_t *s) { uint8_t res = 0; - read(s, &res, 1); + read_bytes(s, &res, 1); return res; } STATIC uint16_t read2(msgpack_stream_t *s) { uint16_t res = 0; - read(s, &res, 2); + read_bytes(s, &res, 2); int n = 1; if (*(char *)&n == 1) res = __builtin_bswap16(res); return res; @@ -84,7 +83,7 @@ STATIC uint16_t read2(msgpack_stream_t *s) { STATIC uint32_t read4(msgpack_stream_t *s) { uint32_t res = 0; - read(s, &res, 4); + read_bytes(s, &res, 4); int n = 1; if (*(char *)&n == 1) res = __builtin_bswap32(res); return res; @@ -104,7 +103,7 @@ STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { //////////////////////////////////////////////////////////////// // writers -STATIC void write(msgpack_stream_t *s, const void *buf, mp_uint_t size) { +STATIC void write_bytes(msgpack_stream_t *s, const void *buf, mp_uint_t size) { mp_uint_t ret = s->write(s->stream_obj, buf, size, &s->errcode); if (s->errcode != 0) { mp_raise_OSError(s->errcode); @@ -115,19 +114,19 @@ STATIC void write(msgpack_stream_t *s, const void *buf, mp_uint_t size) { } STATIC void write1(msgpack_stream_t *s, uint8_t obj) { - write(s, &obj, 1); + write_bytes(s, &obj, 1); } STATIC void write2(msgpack_stream_t *s, uint16_t obj) { int n = 1; if (*(char *)&n == 1) obj = __builtin_bswap16(obj); - write(s, &obj, 2); + write_bytes(s, &obj, 2); } STATIC void write4(msgpack_stream_t *s, uint32_t obj) { int n = 1; if (*(char *)&n == 1) obj = __builtin_bswap32(obj); - write(s, &obj, 4); + write_bytes(s, &obj, 4); } // compute and write msgpack size code (array structures) @@ -294,7 +293,7 @@ mp_obj_t unpack(msgpack_stream_t *s) { size_t len = code & 0b11111; // allocate on stack; len < 32 char str[len]; - read(s, &str, len); + read_bytes(s, &str, len); return mp_obj_new_str(str, len); } if ((code & 0b11110000) == 0b10010000) { @@ -327,7 +326,7 @@ mp_obj_t unpack(msgpack_stream_t *s) { vstr_t vstr; vstr_init_len(&vstr, size); byte *p = (byte*)vstr.buf; - read(s, p, size); + read_bytes(s, p, size); return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); } case 0xcc: @@ -356,7 +355,7 @@ mp_obj_t unpack(msgpack_stream_t *s) { vstr_t vstr; vstr_init_len(&vstr, size); byte *p = (byte*)vstr.buf; - read(s, p, size); + read_bytes(s, p, size); return mp_obj_new_str_from_vstr(&mp_type_str, &vstr); } case 0xde: -- cgit v1.2.3 From 87d4184dd5e143494b77daa8d43bbc997f727095 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Wed, 18 Nov 2020 08:38:48 -0800 Subject: exclude spresense --- ports/cxd56/boards/spresense/mpconfigboard.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/cxd56/boards/spresense/mpconfigboard.mk b/ports/cxd56/boards/spresense/mpconfigboard.mk index 7b8ac6ff6..1e81c4683 100644 --- a/ports/cxd56/boards/spresense/mpconfigboard.mk +++ b/ports/cxd56/boards/spresense/mpconfigboard.mk @@ -4,3 +4,5 @@ USB_PRODUCT = "Spresense" USB_MANUFACTURER = "Sony" INTERNAL_FLASH_FILESYSTEM = 1 + +CIRCUITPY_MSGPACK = 0 \ No newline at end of file -- cgit v1.2.3 From 546b15bf1abb66174c77eca4d21af71aa55384db Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Wed, 18 Nov 2020 08:53:55 -0800 Subject: add trailing newline --- ports/cxd56/boards/spresense/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/cxd56/boards/spresense/mpconfigboard.mk b/ports/cxd56/boards/spresense/mpconfigboard.mk index 1e81c4683..80c6e4b69 100644 --- a/ports/cxd56/boards/spresense/mpconfigboard.mk +++ b/ports/cxd56/boards/spresense/mpconfigboard.mk @@ -5,4 +5,4 @@ USB_MANUFACTURER = "Sony" INTERNAL_FLASH_FILESYSTEM = 1 -CIRCUITPY_MSGPACK = 0 \ No newline at end of file +CIRCUITPY_MSGPACK = 0 -- cgit v1.2.3 From 34bbcc4910014c3b4646d8005baf8244bac51f03 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Wed, 2 Dec 2020 11:52:29 -0800 Subject: exclude nrf/simmel due to lack of flash --- ports/nrf/boards/simmel/mpconfigboard.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/nrf/boards/simmel/mpconfigboard.mk b/ports/nrf/boards/simmel/mpconfigboard.mk index e34739c0f..f702a336f 100644 --- a/ports/nrf/boards/simmel/mpconfigboard.mk +++ b/ports/nrf/boards/simmel/mpconfigboard.mk @@ -16,6 +16,7 @@ CIRCUITPY_AUDIOMP3 = 0 CIRCUITPY_BUSIO = 1 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_NVM = 0 CIRCUITPY_PIXELBUF = 0 -- cgit v1.2.3 From b5b6b6d0f2fe669e0304521d663b16388c63b15e Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 7 Dec 2020 15:16:16 -0800 Subject: add ExtType, update doc, add a test --- locale/circuitpython.pot | 34 ++++--- shared-bindings/msgpack/ExtType.c | 127 +++++++++++++++++++++++ shared-bindings/msgpack/ExtType.h | 40 ++++++++ shared-bindings/msgpack/__init__.c | 108 ++++++++++++++++---- shared-bindings/msgpack/__init__.h | 2 +- shared-module/msgpack/__init__.c | 199 ++++++++++++++++++++++++------------- shared-module/msgpack/__init__.h | 4 +- tests/extmod/umsgpack_pack.py | 30 ++++++ tests/extmod/umsgpack_pack.py.ext | 5 + 9 files changed, 447 insertions(+), 102 deletions(-) create mode 100644 shared-bindings/msgpack/ExtType.c create mode 100644 shared-bindings/msgpack/ExtType.h create mode 100644 tests/extmod/umsgpack_pack.py create mode 100644 tests/extmod/umsgpack_pack.py.ext diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index e0b839ed3..979f62466 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-01 18:39-0800\n" +"POT-Creation-Date: 2020-12-07 15:35-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -270,6 +270,10 @@ msgstr "" msgid "3-arg pow() not supported" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2371,6 +2375,10 @@ msgstr "" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2451,6 +2459,10 @@ msgstr "" msgid "default 'except' must be last" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2550,6 +2562,10 @@ msgstr "" msgid "expecting key:value for dict" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "" @@ -3078,12 +3094,12 @@ msgstr "" msgid "no binding for nonlocal found" msgstr "" -#: py/builtinimport.c -msgid "no module named '%q'" +#: shared-module/msgpack/__init__.c +msgid "no default packer" msgstr "" -#: shared-module/msgpack/__init__.c -msgid "no packer" +#: py/builtinimport.c +msgid "no module named '%q'" msgstr "" #: shared-bindings/displayio/FourWire.c shared-bindings/displayio/I2CDisplay.c @@ -3099,10 +3115,6 @@ msgstr "" msgid "no such attribute" msgstr "" -#: shared-module/msgpack/__init__.c -msgid "no unpacker found" -msgstr "" - #: ports/nrf/common-hal/_bleio/Connection.c msgid "non-UUID found in service_uuids_whitelist" msgstr "" @@ -3560,10 +3572,6 @@ msgstr "" msgid "tobytes can be invoked for dense arrays only" msgstr "" -#: shared-module/msgpack/__init__.c -msgid "too big" -msgstr "" - #: shared-module/struct/__init__.c msgid "too many arguments provided with the given format" msgstr "" diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c new file mode 100644 index 000000000..3a4eee388 --- /dev/null +++ b/shared-bindings/msgpack/ExtType.c @@ -0,0 +1,127 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Bernhard Boser + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "py/runtime.h" +#include "py/smallint.h" +#include "py/objproperty.h" +#include "shared-bindings/msgpack/ExtType.h" + +//| class ExtType: +//| """ExtType represents ext type in msgpack.""" +//| def __init__(self, code: int, data: bytes) -> None: +//| """Constructor""" +//| +//| :param int code: type code in range 0~127. +//| :param bytes data: representation. + +STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + mod_msgpack_extype_obj_t *self = m_new_obj(mod_msgpack_extype_obj_t); + self->base.type = &mod_msgpack_exttype_type; + enum { ARG_code, ARG_data }; + static const mp_arg_t allowed_args[] = { + { MP_QSTR_code, MP_ARG_INT | MP_ARG_REQUIRED }, + { MP_QSTR_data, MP_ARG_OBJ | MP_ARG_REQUIRED }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + int code = args[ARG_code].u_int; + if (code < 0 || code > 127) { + mp_raise_AttributeError(translate("code outside range 0~127")); + } + self->code = code; + + mp_obj_t data = args[ARG_data].u_obj; + self->data = data; + return MP_OBJ_FROM_PTR(self); +} + + +//| code: int +//| """The type code, in range 0~127.""" +//| + +STATIC mp_obj_t mod_msgpack_exttype_get_code(mp_obj_t self_in) { + mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); + return MP_OBJ_NEW_SMALL_INT(self->code); +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_msgpack_exttype_get_code_obj, mod_msgpack_exttype_get_code); + +STATIC mp_obj_t mod_msgpack_exttype_set_code(mp_obj_t self_in, mp_obj_t code_in) { + mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); + int code = mp_obj_get_int(code_in); + if (code < 0 || code > 127) { + mp_raise_AttributeError(translate("code outside range 0~127")); + } + self->code = code; + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(mod_msgpack_exttype_set_code_obj, mod_msgpack_exttype_set_code); + +const mp_obj_property_t mod_msgpack_exttype_code_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&mod_msgpack_exttype_get_code_obj, + (mp_obj_t)&mod_msgpack_exttype_set_code_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +//| data: bytes +//| """Data.""" +//| + +STATIC mp_obj_t mod_msgpack_exttype_get_data(mp_obj_t self_in) { + mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); + return self->data; +} +MP_DEFINE_CONST_FUN_OBJ_1(mod_msgpack_exttype_get_data_obj, mod_msgpack_exttype_get_data); + +STATIC mp_obj_t mod_msgpack_exttype_set_data(mp_obj_t self_in, mp_obj_t data_in) { + mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); + self->data = data_in; + return mp_const_none; +} +MP_DEFINE_CONST_FUN_OBJ_2(mod_msgpack_exttype_set_data_obj, mod_msgpack_exttype_set_data); + +const mp_obj_property_t mod_msgpack_exttype_data_obj = { + .base.type = &mp_type_property, + .proxy = {(mp_obj_t)&mod_msgpack_exttype_get_data_obj, + (mp_obj_t)&mod_msgpack_exttype_set_data_obj, + (mp_obj_t)&mp_const_none_obj}, +}; + +STATIC mp_rom_map_elem_t mod_msgpack_exttype_locals_dict_table[] = { + // Properties + { MP_ROM_QSTR(MP_QSTR_code), MP_ROM_PTR(&mod_msgpack_exttype_code_obj) }, + { MP_ROM_QSTR(MP_QSTR_data), MP_ROM_PTR(&mod_msgpack_exttype_data_obj) }, +}; +STATIC MP_DEFINE_CONST_DICT(mod_msgpack_exttype_locals_dict, mod_msgpack_exttype_locals_dict_table); + +const mp_obj_type_t mod_msgpack_exttype_type = { + { &mp_type_type }, + .name = MP_QSTR_ExtType, + .make_new = mod_msgpack_exttype_make_new, + .locals_dict = (mp_obj_dict_t*)&mod_msgpack_exttype_locals_dict, +}; diff --git a/shared-bindings/msgpack/ExtType.h b/shared-bindings/msgpack/ExtType.h new file mode 100644 index 000000000..64173b221 --- /dev/null +++ b/shared-bindings/msgpack/ExtType.h @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Bernhard Boser + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#ifndef MICROPY_INCLUDED_SHARED_BINDINGS_MSGPACK_EXTTYPE___INIT___H +#define MICROPY_INCLUDED_SHARED_BINDINGS_MSGPACK_EXTTYPE___INIT___H + +#include "py/obj.h" + +typedef struct { + mp_obj_base_t base; + int32_t code; + mp_obj_t data; +} mod_msgpack_extype_obj_t; + +extern const mp_obj_type_t mod_msgpack_exttype_type; + +#endif // MICROPY_INCLUDED_SHARED_BINDINGS_MSGPACK_EXTTYPE___INIT___H diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index a222177f7..fcb86ac6c 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -24,15 +24,24 @@ * THE SOFTWARE. */ +#include +#include "py/obj.h" +#include "py/runtime.h" #include "shared-bindings/msgpack/__init__.h" #include "shared-module/msgpack/__init__.h" +#include "shared-bindings/msgpack/ExtType.h" + +#define MP_OBJ_IS_METH(o) (MP_OBJ_IS_OBJ(o) && (((mp_obj_base_t*)MP_OBJ_TO_PTR(o))->type->name == MP_QSTR_bound_method)) //| """Pack object in msgpack format //| //| The msgpack format is similar to json, except that the encoded data is binary. -//| See https://msgpack.org for details. +//| See https://msgpack.org for details. The module implements a subset of the cpython +//| module msgpack-python. +//| +//| Not implemented: 64-bit int, uint, float. //| -//| Example: +//| Example 1: //| import msgpack //| from io import BytesIO //| @@ -41,33 +50,98 @@ //| b.seek(0) //| print(msgpack.unpack(b))""" //| - -//| def pack(obj: Any, buffer: WriteableBuffer) -> None: -//| """Pack obj to stream.""" -//| ... +//| Example 2: handling objects +//| +//| from msgpack import pack, unpack, ExtType +//| from io import BytesIO +//| +//| class MyClass: +//| def __init__(self, val): +//| self.value = val +//| def __str__(self): +//| return str(self.value) +//| +//| data = MyClass(b'my_value') +//| +//| def encoder(obj): +//| if isinstance(obj, MyClass): +//| return ExtType(1, obj.value) +//| return f"no encoder for {obj}" //| +//| def decoder(code, data): +//| if code == 1: +//| return MyClass(data) +//| return f"no decoder for type {code}" +//| +//| buffer = BytesIO() +//| pack(data, buffer, default=encoder) +//| buffer.seek(0) +//| decoded = unpack(buffer, ext_hook=decoder) +//| print(f"{data} -> {buffer.getvalue()} -> {decoded}") +//| """ + + +//| def pack(obj: object, buffer: WriteableBuffer, *, default: Function=None) -> None: +//| """Ouput object to buffer in msgpack format. +//| :param object obj: Object to convert to msgpack format. +//| :param ~_typing.WriteableBuffer buffer: buffer to write into +//| :param Optional[~_typing.Function] default: +//| function called for python objects that do not have +//| a representation in msgpack format. +//| """ + +STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_obj, ARG_buffer, ARG_default }; + STATIC const mp_arg_t allowed_args[] = { + { MP_QSTR_obj, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ }, + { MP_QSTR_default, MP_ARG_KW_ONLY | MP_ARG_OBJ, { .u_obj = mp_const_none } }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); -STATIC mp_obj_t mod_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj) { - common_hal_msgpack_pack(obj, stream_obj); + mp_obj_t handler = args[ARG_default].u_obj; + if (handler != mp_const_none && !MP_OBJ_IS_FUN(handler) && !MP_OBJ_IS_METH(handler)) { + mp_raise_ValueError(translate("default is not a function")); + } + + common_hal_msgpack_pack(args[ARG_obj].u_obj, args[ARG_buffer].u_obj, handler); return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mod_msgpack_pack_obj, mod_msgpack_pack); +MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); +//| def unpack(buffer: ReadableBuffer, *, ext_hook: Function=None, use_list: bool=True) -> object: +//| """Unpack and return one object from buffer. +//| :param ~_typing.ReadableBuffer buffer: buffer to read from +//| :param Optional[~_typing.Function] ext_hook: function called for objects in +//| msgpack ext format. +//| :param Optional[bool] use_list: return array as list or tuple (use_list=False). +//| :return object: object read from buffer. +//| """ -//| def unpack(buffer: ReadableBuffer) -> Any: -//| """Unpack and return one object (in msgpack format) from stream. -//| Call repeatedly to read multiple objects from the stream.""" -//| ... -//| +STATIC mp_obj_t mod_msgpack_unpack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { + enum { ARG_buffer, ARG_ext_hook, ARG_use_list }; + STATIC const mp_arg_t allowed_args[] = { + { MP_QSTR_buffer, MP_ARG_REQUIRED | MP_ARG_OBJ, }, + { MP_QSTR_ext_hook, MP_ARG_KW_ONLY | MP_ARG_OBJ, { .u_obj = mp_const_none } }, + { MP_QSTR_use_list, MP_ARG_KW_ONLY | MP_ARG_BOOL, { .u_bool = true } }, + }; + mp_arg_val_t args[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args); + + mp_obj_t hook = args[ARG_ext_hook].u_obj; + if (hook != mp_const_none && !MP_OBJ_IS_FUN(hook) && !MP_OBJ_IS_METH(hook)) { + mp_raise_ValueError(translate("ext_hook is not a function")); + } -STATIC mp_obj_t mod_msgpack_unpack(mp_obj_t stream_obj) { - return common_hal_msgpack_unpack(stream_obj); + return common_hal_msgpack_unpack(args[ARG_buffer].u_obj, hook, args[ARG_use_list].u_bool); } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_msgpack_unpack_obj, mod_msgpack_unpack); +MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_unpack_obj, 1, mod_msgpack_unpack); STATIC const mp_rom_map_elem_t msgpack_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_msgpack) }, + { MP_ROM_QSTR(MP_QSTR_ExtType), MP_ROM_PTR(&mod_msgpack_exttype_type) }, { MP_ROM_QSTR(MP_QSTR_pack), MP_ROM_PTR(&mod_msgpack_pack_obj) }, { MP_ROM_QSTR(MP_QSTR_unpack), MP_ROM_PTR(&mod_msgpack_unpack_obj) }, }; diff --git a/shared-bindings/msgpack/__init__.h b/shared-bindings/msgpack/__init__.h index 4836cc62e..a02ead0bd 100644 --- a/shared-bindings/msgpack/__init__.h +++ b/shared-bindings/msgpack/__init__.h @@ -29,6 +29,6 @@ #include "py/obj.h" -// Nothing now. +// nothing for now #endif // MICROPY_INCLUDED_SHARED_BINDINGS_MSGPACK___INIT___H diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 5bc7d1f61..204312109 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -27,6 +27,7 @@ #include #include +#include "py/obj.h" #include "py/binary.h" #include "py/objarray.h" #include "py/objlist.h" @@ -36,6 +37,7 @@ #include "py/stream.h" #include "supervisor/shared/translate.h" +#include "shared-bindings/msgpack/ExtType.h" //////////////////////////////////////////////////////////////// // stream management @@ -56,7 +58,7 @@ STATIC msgpack_stream_t get_stream(mp_obj_t stream_obj, int flags) { //////////////////////////////////////////////////////////////// // readers -STATIC void read_bytes(msgpack_stream_t *s, void *buf, mp_uint_t size) { +STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { if (size == 0) return; mp_uint_t ret = s->read(s->stream_obj, buf, size, &s->errcode); if (s->errcode != 0) { @@ -69,13 +71,13 @@ STATIC void read_bytes(msgpack_stream_t *s, void *buf, mp_uint_t size) { STATIC uint8_t read1(msgpack_stream_t *s) { uint8_t res = 0; - read_bytes(s, &res, 1); + read(s, &res, 1); return res; } STATIC uint16_t read2(msgpack_stream_t *s) { uint16_t res = 0; - read_bytes(s, &res, 2); + read(s, &res, 2); int n = 1; if (*(char *)&n == 1) res = __builtin_bswap16(res); return res; @@ -83,19 +85,18 @@ STATIC uint16_t read2(msgpack_stream_t *s) { STATIC uint32_t read4(msgpack_stream_t *s) { uint32_t res = 0; - read_bytes(s, &res, 4); + read(s, &res, 4); int n = 1; if (*(char *)&n == 1) res = __builtin_bswap32(res); return res; } STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { - size_t res = 0; + size_t res; switch (len_index) { case 0: res = (size_t)read1(s); break; case 1: res = (size_t)read2(s); break; case 2: res = (size_t)read4(s); break; - default: mp_raise_ValueError(translate("too big")); } return res; } @@ -103,7 +104,7 @@ STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { //////////////////////////////////////////////////////////////// // writers -STATIC void write_bytes(msgpack_stream_t *s, const void *buf, mp_uint_t size) { +STATIC void write(msgpack_stream_t *s, const void *buf, mp_uint_t size) { mp_uint_t ret = s->write(s->stream_obj, buf, size, &s->errcode); if (s->errcode != 0) { mp_raise_OSError(s->errcode); @@ -114,19 +115,19 @@ STATIC void write_bytes(msgpack_stream_t *s, const void *buf, mp_uint_t size) { } STATIC void write1(msgpack_stream_t *s, uint8_t obj) { - write_bytes(s, &obj, 1); + write(s, &obj, 1); } STATIC void write2(msgpack_stream_t *s, uint16_t obj) { int n = 1; if (*(char *)&n == 1) obj = __builtin_bswap16(obj); - write_bytes(s, &obj, 2); + write(s, &obj, 2); } STATIC void write4(msgpack_stream_t *s, uint32_t obj) { int n = 1; if (*(char *)&n == 1) obj = __builtin_bswap32(obj); - write_bytes(s, &obj, 4); + write(s, &obj, 4); } // compute and write msgpack size code (array structures) @@ -178,15 +179,34 @@ STATIC void pack_int(msgpack_stream_t *s, int32_t x) { } } -void pack_bin(msgpack_stream_t *s, const uint8_t* data, size_t len) { +STATIC void pack_bin(msgpack_stream_t *s, const uint8_t* data, size_t len) { write_size(s, 0xc4, len); for (size_t i=0; idata, &bufinfo, MP_BUFFER_READ); + pack_ext(s, ext->code, bufinfo.buf, bufinfo.len); } else if (MP_OBJ_IS_TYPE(obj, &mp_type_bytes)) { // bytes mp_buffer_info_t bufinfo; @@ -243,14 +268,14 @@ void pack(mp_obj_t obj, msgpack_stream_t *s) { mp_obj_tuple_t *self = MP_OBJ_TO_PTR(obj); pack_array(s, self->len); for (size_t i=0; ilen; i++) { - pack(self->items[i], s); + pack(self->items[i], s, default_handler); } } else if (MP_OBJ_IS_TYPE(obj, &mp_type_list)) { // list (layout differs from tuple) mp_obj_list_t *self = MP_OBJ_TO_PTR(obj); pack_array(s, self->len); for (size_t i=0; ilen; i++) { - pack(self->items[i], s); + pack(self->items[i], s, default_handler); } } else if (MP_OBJ_IS_TYPE(obj, &mp_type_dict)) { // dict @@ -259,8 +284,8 @@ void pack(mp_obj_t obj, msgpack_stream_t *s) { size_t cur = 0; mp_map_elem_t *next = NULL; while ((next = dict_iter_next(self, &cur)) != NULL) { - pack(next->key, s); - pack(next->value, s); + pack(next->key, s, default_handler); + pack(next->value, s, default_handler); } } else if (mp_obj_is_float(obj)) { union Float { mp_float_t f; uint32_t u; }; @@ -275,14 +300,60 @@ void pack(mp_obj_t obj, msgpack_stream_t *s) { } else if (obj == mp_const_true) { write1(s, 0xc3); } else { - mp_raise_ValueError(translate("no packer")); + if (default_handler != mp_const_none) { + // set default_handler to mp_const_none to avoid infinite recursion + // this also precludes some valid outputs + pack(mp_call_function_1(default_handler, obj), s, mp_const_none); + } else { + mp_raise_ValueError(translate("no default packer")); + } } } //////////////////////////////////////////////////////////////// // unpacker -mp_obj_t unpack(msgpack_stream_t *s) { +STATIC mp_obj_t unpack(msgpack_stream_t *s, mp_obj_t ext_hook, bool use_list); + +STATIC mp_obj_t unpack_array_elements(msgpack_stream_t *s, size_t size, mp_obj_t ext_hook, bool use_list) { + if (use_list) { + mp_obj_list_t *t = MP_OBJ_TO_PTR(mp_obj_new_list(size, NULL)); + for (size_t i=0; iitems[i] = unpack(s, ext_hook, use_list); + } + return MP_OBJ_FROM_PTR(t); + } else { + mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(size, NULL)); + for (size_t i=0; iitems[i] = unpack(s, ext_hook, use_list); + } + return MP_OBJ_FROM_PTR(t); + } +} + +STATIC mp_obj_t unpack_bytes(msgpack_stream_t *s, size_t size) { + vstr_t vstr; + vstr_init_len(&vstr, size); + byte *p = (byte*)vstr.buf; + read(s, p, size); + return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr); +} + +STATIC mp_obj_t unpack_ext(msgpack_stream_t *s, size_t size, mp_obj_t ext_hook) { + int8_t code = read1(s); + mp_obj_t data = unpack_bytes(s, size); + if (ext_hook != mp_const_none) { + return mp_call_function_2(ext_hook, MP_OBJ_NEW_SMALL_INT(code), data); + } else { + mod_msgpack_extype_obj_t *o = m_new_obj(mod_msgpack_extype_obj_t); + o->base.type = &mod_msgpack_exttype_type; + o->code = code; + o->data = data; + return MP_OBJ_FROM_PTR(o); + } +} + +STATIC mp_obj_t unpack(msgpack_stream_t *s, mp_obj_t ext_hook, bool use_list) { uint8_t code = read1(s); if (((code & 0b10000000) == 0) || ((code & 0b11100000) == 0b11100000)) { // int @@ -293,24 +364,19 @@ mp_obj_t unpack(msgpack_stream_t *s) { size_t len = code & 0b11111; // allocate on stack; len < 32 char str[len]; - read_bytes(s, &str, len); + read(s, &str, len); return mp_obj_new_str(str, len); } if ((code & 0b11110000) == 0b10010000) { - // array (tuple) - size_t len = code & 0b1111; - mp_obj_tuple_t *t = MP_OBJ_TO_PTR(mp_obj_new_tuple(len, NULL)); - for (size_t i=0; iitems[i] = unpack(s); - } - return MP_OBJ_FROM_PTR(t); + // array (list / tuple) + return unpack_array_elements(s, code & 0b1111, ext_hook, use_list); } if ((code & 0b11110000) == 0b10000000) { // map (dict) size_t len = code & 0b1111; mp_obj_dict_t *d = MP_OBJ_TO_PTR(mp_obj_new_dict(len)); for (size_t i=0; iitems[i] = unpack(s); - } - return MP_OBJ_FROM_PTR(t); + size_t size = read_size(s, code - 0xdc + 1); + return unpack_array_elements(s, size, ext_hook, use_list); } - case 0xc1: // never used - case 0xc7: // ext 8 - case 0xc8: // ext 16 - case 0xc9: // ext 32 - case 0xcb: // float 64 - case 0xcf: // uint 64 - case 0xd3: // int 64 case 0xd4: // fixenxt 1 + return unpack_ext(s, 1, ext_hook); case 0xd5: // fixenxt 2 + return unpack_ext(s, 2, ext_hook); case 0xd6: // fixenxt 4 + return unpack_ext(s, 4, ext_hook); case 0xd7: // fixenxt 8 + return unpack_ext(s, 8, ext_hook); case 0xd8: // fixenxt 16 + return unpack_ext(s, 16, ext_hook); + case 0xc7: // ext 8 + case 0xc8: // ext 16 + case 0xc9: + // ext 8, 16, 32 + return unpack_ext(s, read_size(s, code-0xc7), ext_hook); + case 0xc1: // never used + case 0xcb: // float 64 + case 0xcf: // uint 64 + case 0xd3: // int 64 default: - mp_raise_ValueError(translate("no unpacker found")); + mp_raise_NotImplementedError(translate("64 bit types")); } } -void common_hal_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj) { +void common_hal_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj, mp_obj_t default_handler) { msgpack_stream_t stream = get_stream(stream_obj, MP_STREAM_OP_WRITE); - pack(obj, &stream); + pack(obj, &stream, default_handler); } -mp_obj_t common_hal_msgpack_unpack(mp_obj_t stream_obj) { +mp_obj_t common_hal_msgpack_unpack(mp_obj_t stream_obj, mp_obj_t ext_hook, bool use_list) { msgpack_stream_t stream = get_stream(stream_obj, MP_STREAM_OP_WRITE); - return unpack(&stream); + return unpack(&stream, ext_hook, use_list); } diff --git a/shared-module/msgpack/__init__.h b/shared-module/msgpack/__init__.h index 0a5e7852a..88b4809f9 100644 --- a/shared-module/msgpack/__init__.h +++ b/shared-module/msgpack/__init__.h @@ -28,7 +28,7 @@ #include "py/stream.h" -void common_hal_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj); -mp_obj_t common_hal_msgpack_unpack(mp_obj_t stream_obj); +void common_hal_msgpack_pack(mp_obj_t obj, mp_obj_t stream_obj, mp_obj_t default_handler); +mp_obj_t common_hal_msgpack_unpack(mp_obj_t stream_obj, mp_obj_t ext_hook, bool use_list); #endif diff --git a/tests/extmod/umsgpack_pack.py b/tests/extmod/umsgpack_pack.py new file mode 100644 index 000000000..d9f0005e1 --- /dev/null +++ b/tests/extmod/umsgpack_pack.py @@ -0,0 +1,30 @@ +try: + from uio import BytesIO + import umsgpack as msgpack +except: + try: + from io import BytesIO + import msgpack + except ImportError: + print("SKIP") + raise SystemExit + +b = BytesIO() +msgpack.pack(False, s) +print(b.getvalue()) + +b = BytesIO() +msgpack.pack({"a": (-1, 0, 2, [3, None], 128)}, b) +print(b.getvalue()) + +# pack to a small-int not allowed +try: + msgpack.pack(123, 1) +except (AttributeError, OSError): # CPython and uPy have different errors + print('Exception') + +# pack to an object not allowed +try: + msgpack.pack(123, {}) +except (AttributeError, OSError): # CPython and uPy have different errors + print('Exception') diff --git a/tests/extmod/umsgpack_pack.py.ext b/tests/extmod/umsgpack_pack.py.ext new file mode 100644 index 000000000..2f966be06 --- /dev/null +++ b/tests/extmod/umsgpack_pack.py.ext @@ -0,0 +1,5 @@ +b'\xc2' +b'\x82\xa1a\x96\xff\x00\x02\x92\x03\xc0\xd1\x00\x80\xc4\x07abcdefg\xa1b\xd4\x05x' +Exception ExtType +Exception to int +Exception to object -- cgit v1.2.3 From 534b48fcfe688d88455bd8421fa02255ecc8508b Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 7 Dec 2020 16:08:16 -0800 Subject: remove a ~ from doc that causes an error; add ExtType.c to circuitpy_defns.mk --- locale/circuitpython.pot | 2 +- py/circuitpy_defns.mk | 1 + shared-bindings/msgpack/ExtType.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 979f62466..7acfbe1de 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-07 15:35-0800\n" +"POT-Creation-Date: 2020-12-07 16:05-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index f13f69bcf..39ff2e380 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -407,6 +407,7 @@ $(filter $(SRC_PATTERNS), \ microcontroller/ResetReason.c \ microcontroller/RunMode.c \ msgpack/__init__.c \ + msgpack/ExtType.c \ supervisor/RunReason.c \ ) diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index 3a4eee388..dfccbd3ef 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -34,7 +34,7 @@ //| def __init__(self, code: int, data: bytes) -> None: //| """Constructor""" //| -//| :param int code: type code in range 0~127. +//| :param int code: type code in range 0 .. 127. //| :param bytes data: representation. STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { -- cgit v1.2.3 From 9412c3f58e9340d9300cd048f566feda7c48c53c Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 7 Dec 2020 16:22:09 -0800 Subject: moved misplaced triple-quote --- shared-bindings/msgpack/ExtType.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index dfccbd3ef..daac55dc4 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -32,10 +32,9 @@ //| class ExtType: //| """ExtType represents ext type in msgpack.""" //| def __init__(self, code: int, data: bytes) -> None: -//| """Constructor""" -//| -//| :param int code: type code in range 0 .. 127. -//| :param bytes data: representation. +//| """Constructor +//| :param int code: type code in range 0~127. +//| :param bytes data: representation.""" STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { mod_msgpack_extype_obj_t *self = m_new_obj(mod_msgpack_extype_obj_t); -- cgit v1.2.3 From 5875a27fa8f09dc27c3d25c13f4aa28c22c0279b Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 7 Dec 2020 16:32:38 -0800 Subject: removed extra triple quote --- shared-bindings/msgpack/__init__.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index fcb86ac6c..5f1fac137 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -48,7 +48,7 @@ //| b = BytesIO() //| msgpack.pack({'list': [True, False, None, 1, 'abc'], 'str': 'blah'}, b) //| b.seek(0) -//| print(msgpack.unpack(b))""" +//| print(msgpack.unpack(b)) //| //| Example 2: handling objects //| -- cgit v1.2.3 From 9903c9e855f07b6660f6a89546030d47cd9c70e6 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 7 Dec 2020 16:50:52 -0800 Subject: fixed (?) typespec for callback functions --- shared-bindings/msgpack/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 5f1fac137..08d535c58 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -85,7 +85,7 @@ //| """Ouput object to buffer in msgpack format. //| :param object obj: Object to convert to msgpack format. //| :param ~_typing.WriteableBuffer buffer: buffer to write into -//| :param Optional[~_typing.Function] default: +//| :param Optional[~_typing.Callable[[object], None]] default: //| function called for python objects that do not have //| a representation in msgpack format. //| """ @@ -113,7 +113,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); //| def unpack(buffer: ReadableBuffer, *, ext_hook: Function=None, use_list: bool=True) -> object: //| """Unpack and return one object from buffer. //| :param ~_typing.ReadableBuffer buffer: buffer to read from -//| :param Optional[~_typing.Function] ext_hook: function called for objects in +//| :param Optional[~_typing.Callable[[int, bytes], object]] ext_hook: function called for objects in //| msgpack ext format. //| :param Optional[bool] use_list: return array as list or tuple (use_list=False). //| :return object: object read from buffer. -- cgit v1.2.3 From 413885a529db041413a1e1b259389afce3602d7e Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Mon, 7 Dec 2020 17:45:21 -0800 Subject: fix typspec in function declarations --- shared-bindings/msgpack/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 08d535c58..0660ee78b 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -81,7 +81,7 @@ //| """ -//| def pack(obj: object, buffer: WriteableBuffer, *, default: Function=None) -> None: +//| def pack(obj: object, buffer: WriteableBuffer, *, default: Callable[[object], None]]=None) -> None: //| """Ouput object to buffer in msgpack format. //| :param object obj: Object to convert to msgpack format. //| :param ~_typing.WriteableBuffer buffer: buffer to write into @@ -110,7 +110,7 @@ STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map } MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); -//| def unpack(buffer: ReadableBuffer, *, ext_hook: Function=None, use_list: bool=True) -> object: +//| def unpack(buffer: ReadableBuffer, *, ext_hook: Callable[[int, bytes], object]]=None, use_list: bool=True) -> object: //| """Unpack and return one object from buffer. //| :param ~_typing.ReadableBuffer buffer: buffer to read from //| :param Optional[~_typing.Callable[[int, bytes], object]] ext_hook: function called for objects in -- cgit v1.2.3 From 1f14d393645d2f3939b8e378148b440ed237e2ce Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Tue, 8 Dec 2020 11:50:45 -0800 Subject: remove two extra closing angular brackets --- shared-bindings/msgpack/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 0660ee78b..ade88b10d 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -81,7 +81,7 @@ //| """ -//| def pack(obj: object, buffer: WriteableBuffer, *, default: Callable[[object], None]]=None) -> None: +//| def pack(obj: object, buffer: WriteableBuffer, *, default: Callable[[object], None]=None) -> None: //| """Ouput object to buffer in msgpack format. //| :param object obj: Object to convert to msgpack format. //| :param ~_typing.WriteableBuffer buffer: buffer to write into @@ -110,7 +110,7 @@ STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map } MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); -//| def unpack(buffer: ReadableBuffer, *, ext_hook: Callable[[int, bytes], object]]=None, use_list: bool=True) -> object: +//| def unpack(buffer: ReadableBuffer, *, ext_hook: Callable[[int, bytes], object]=None, use_list: bool=True) -> object: //| """Unpack and return one object from buffer. //| :param ~_typing.ReadableBuffer buffer: buffer to read from //| :param Optional[~_typing.Callable[[int, bytes], object]] ext_hook: function called for objects in -- cgit v1.2.3 From 9e7a7b9dc422e3031c914a90f9ceda9b21ed27f8 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Tue, 8 Dec 2020 14:38:20 -0800 Subject: uglify typing hints --- shared-bindings/msgpack/__init__.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index ade88b10d..59ff694bb 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -81,7 +81,7 @@ //| """ -//| def pack(obj: object, buffer: WriteableBuffer, *, default: Callable[[object], None]=None) -> None: +//| def pack(obj: object, buffer: WriteableBuffer, *, default: Union[Callable[[object], None],None]=None) -> None: //| """Ouput object to buffer in msgpack format. //| :param object obj: Object to convert to msgpack format. //| :param ~_typing.WriteableBuffer buffer: buffer to write into @@ -110,7 +110,7 @@ STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map } MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); -//| def unpack(buffer: ReadableBuffer, *, ext_hook: Callable[[int, bytes], object]=None, use_list: bool=True) -> object: +//| def unpack(buffer: ReadableBuffer, *, ext_hook: Union[Callable[[int, bytes], object],None],None]=None, use_list: bool=True) -> object: //| """Unpack and return one object from buffer. //| :param ~_typing.ReadableBuffer buffer: buffer to read from //| :param Optional[~_typing.Callable[[int, bytes], object]] ext_hook: function called for objects in -- cgit v1.2.3 From a5c3dc286c38c3c007513db58c09a88308c2a863 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Tue, 8 Dec 2020 15:48:56 -0800 Subject: typing ... --- shared-bindings/msgpack/__init__.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 59ff694bb..ea1e43087 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -80,8 +80,7 @@ //| print(f"{data} -> {buffer.getvalue()} -> {decoded}") //| """ - -//| def pack(obj: object, buffer: WriteableBuffer, *, default: Union[Callable[[object], None],None]=None) -> None: +//| def pack(obj: object, buffer: WriteableBuffer, *, default: Union[Callable[[object], None], None] = None) -> None: //| """Ouput object to buffer in msgpack format. //| :param object obj: Object to convert to msgpack format. //| :param ~_typing.WriteableBuffer buffer: buffer to write into @@ -110,7 +109,8 @@ STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map } MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); -//| def unpack(buffer: ReadableBuffer, *, ext_hook: Union[Callable[[int, bytes], object],None],None]=None, use_list: bool=True) -> object: + +//| def unpack(buffer: ReadableBuffer, *, ext_hook: Union[Callable[[int, bytes], object], None] = None, use_list: bool=True) -> object: //| """Unpack and return one object from buffer. //| :param ~_typing.ReadableBuffer buffer: buffer to read from //| :param Optional[~_typing.Callable[[int, bytes], object]] ext_hook: function called for objects in -- cgit v1.2.3 From 3c724321d863c79dce0ec4d11e12fd6c9fa27c4c Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Wed, 9 Dec 2020 12:01:09 -0800 Subject: cosmetics --- shared-bindings/msgpack/ExtType.c | 2 -- shared-bindings/msgpack/__init__.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index daac55dc4..272c1cceb 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -61,7 +61,6 @@ STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n //| code: int //| """The type code, in range 0~127.""" -//| STATIC mp_obj_t mod_msgpack_exttype_get_code(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -89,7 +88,6 @@ const mp_obj_property_t mod_msgpack_exttype_code_obj = { //| data: bytes //| """Data.""" -//| STATIC mp_obj_t mod_msgpack_exttype_get_data(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index ea1e43087..06c3900b5 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -46,7 +46,7 @@ //| from io import BytesIO //| //| b = BytesIO() -//| msgpack.pack({'list': [True, False, None, 1, 'abc'], 'str': 'blah'}, b) +//| msgpack.pack({'list': [True, False, None, 1, 3.14], 'str': 'blah'}, b) //| b.seek(0) //| print(msgpack.unpack(b)) //| -- cgit v1.2.3 From 6d2329fb09ce47eaa5cdf0dbf9c5e1e1ef37632a Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Thu, 10 Dec 2020 10:59:26 -0800 Subject: add blank lines after all comment sections --- shared-bindings/msgpack/ExtType.c | 9 ++++++--- shared-bindings/msgpack/__init__.c | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index 272c1cceb..6f0a16b99 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -35,7 +35,8 @@ //| """Constructor //| :param int code: type code in range 0~127. //| :param bytes data: representation.""" - +//| ... +//| STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { mod_msgpack_extype_obj_t *self = m_new_obj(mod_msgpack_extype_obj_t); self->base.type = &mod_msgpack_exttype_type; @@ -61,7 +62,8 @@ STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n //| code: int //| """The type code, in range 0~127.""" - +//| ... +//| STATIC mp_obj_t mod_msgpack_exttype_get_code(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); return MP_OBJ_NEW_SMALL_INT(self->code); @@ -88,7 +90,8 @@ const mp_obj_property_t mod_msgpack_exttype_code_obj = { //| data: bytes //| """Data.""" - +//| ... +//| STATIC mp_obj_t mod_msgpack_exttype_get_data(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); return self->data; diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 06c3900b5..b41b32d45 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -79,6 +79,8 @@ //| decoded = unpack(buffer, ext_hook=decoder) //| print(f"{data} -> {buffer.getvalue()} -> {decoded}") //| """ +//| ... +//| //| def pack(obj: object, buffer: WriteableBuffer, *, default: Union[Callable[[object], None], None] = None) -> None: //| """Ouput object to buffer in msgpack format. @@ -88,7 +90,8 @@ //| function called for python objects that do not have //| a representation in msgpack format. //| """ - +//| ... +//| STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_obj, ARG_buffer, ARG_default }; STATIC const mp_arg_t allowed_args[] = { @@ -118,7 +121,8 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); //| :param Optional[bool] use_list: return array as list or tuple (use_list=False). //| :return object: object read from buffer. //| """ - +//| ... +//| STATIC mp_obj_t mod_msgpack_unpack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_ext_hook, ARG_use_list }; STATIC const mp_arg_t allowed_args[] = { -- cgit v1.2.3 From d29184b5a0fb5c54663d48a8e8906564c3d518ad Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Thu, 10 Dec 2020 12:15:43 -0800 Subject: try without ... in docs --- shared-bindings/msgpack/ExtType.c | 3 --- shared-bindings/msgpack/__init__.c | 3 --- 2 files changed, 6 deletions(-) diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index 6f0a16b99..5dc3d4992 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -35,7 +35,6 @@ //| """Constructor //| :param int code: type code in range 0~127. //| :param bytes data: representation.""" -//| ... //| STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { mod_msgpack_extype_obj_t *self = m_new_obj(mod_msgpack_extype_obj_t); @@ -62,7 +61,6 @@ STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n //| code: int //| """The type code, in range 0~127.""" -//| ... //| STATIC mp_obj_t mod_msgpack_exttype_get_code(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -90,7 +88,6 @@ const mp_obj_property_t mod_msgpack_exttype_code_obj = { //| data: bytes //| """Data.""" -//| ... //| STATIC mp_obj_t mod_msgpack_exttype_get_data(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index b41b32d45..5dc45dde2 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -79,7 +79,6 @@ //| decoded = unpack(buffer, ext_hook=decoder) //| print(f"{data} -> {buffer.getvalue()} -> {decoded}") //| """ -//| ... //| //| def pack(obj: object, buffer: WriteableBuffer, *, default: Union[Callable[[object], None], None] = None) -> None: @@ -90,7 +89,6 @@ //| function called for python objects that do not have //| a representation in msgpack format. //| """ -//| ... //| STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_obj, ARG_buffer, ARG_default }; @@ -121,7 +119,6 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); //| :param Optional[bool] use_list: return array as list or tuple (use_list=False). //| :return object: object read from buffer. //| """ -//| ... //| STATIC mp_obj_t mod_msgpack_unpack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_ext_hook, ARG_use_list }; -- cgit v1.2.3 From c875d7c22d447b9a29bcef62af7b46c902684d72 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Sat, 19 Dec 2020 19:06:43 -0800 Subject: speedup pack_bin, ext, str; catch short reads --- shared-module/msgpack/__init__.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/shared-module/msgpack/__init__.c b/shared-module/msgpack/__init__.c index 204312109..39178d46e 100644 --- a/shared-module/msgpack/__init__.c +++ b/shared-module/msgpack/__init__.c @@ -67,6 +67,9 @@ STATIC void read(msgpack_stream_t *s, void *buf, mp_uint_t size) { if (ret == 0) { mp_raise_msg(&mp_type_EOFError, NULL); } + if (ret < size) { + mp_raise_ValueError(translate("short read")); + } } STATIC uint8_t read1(msgpack_stream_t *s) { @@ -92,7 +95,7 @@ STATIC uint32_t read4(msgpack_stream_t *s) { } STATIC size_t read_size(msgpack_stream_t *s, uint8_t len_index) { - size_t res; + size_t res = 0; switch (len_index) { case 0: res = (size_t)read1(s); break; case 1: res = (size_t)read2(s); break; @@ -181,9 +184,7 @@ STATIC void pack_int(msgpack_stream_t *s, int32_t x) { STATIC void pack_bin(msgpack_stream_t *s, const uint8_t* data, size_t len) { write_size(s, 0xc4, len); - for (size_t i=0; i 0) write(s, data, len); } STATIC void pack_ext(msgpack_stream_t *s, int8_t code, const uint8_t* data, size_t len) { @@ -201,9 +202,7 @@ STATIC void pack_ext(msgpack_stream_t *s, int8_t code, const uint8_t* data, siz write_size(s, 0xc7, len); } write1(s, code); // type byte - for (size_t i=0; i 0) write(s, data, len); } STATIC void pack_str(msgpack_stream_t *s, const char* str, size_t len) { @@ -212,9 +211,7 @@ STATIC void pack_str(msgpack_stream_t *s, const char* str, size_t len) { } else { write_size(s, 0xd9, len); } - for (size_t l=0; l 0) write(s, str, len); } STATIC void pack_array(msgpack_stream_t *s, size_t len) { -- cgit v1.2.3 From d024df6b065c125f07c929371c94a48b058eff22 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 12 Nov 2020 14:04:50 -0600 Subject: esp32s2: Use better optimizer flags in debug builds (note that the before and after files both lack trailing newlines; this is how the esp-idf do) OPTIMIZATION_DEFAULT is -Og, which enables optimizations that do not interfere with the debugger: ``` elseif(CONFIG_COMPILER_OPTIMIZATION_DEFAULT) list(APPEND compile_options "-Og") ``` --- ports/esp32s2/esp-idf-config/sdkconfig-debug.defaults | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/esp-idf-config/sdkconfig-debug.defaults b/ports/esp32s2/esp-idf-config/sdkconfig-debug.defaults index f45f6ae9f..b108532aa 100644 --- a/ports/esp32s2/esp-idf-config/sdkconfig-debug.defaults +++ b/ports/esp32s2/esp-idf-config/sdkconfig-debug.defaults @@ -10,4 +10,7 @@ CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT=y # CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT is not set # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set \ No newline at end of file +# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set +CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG=y +CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y \ No newline at end of file -- cgit v1.2.3 From 05ba1431c387db97dbd66c07d3494a4dae7fc570 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 20 Nov 2020 14:53:13 -0600 Subject: esp32s2: espidf: Add IDFError this is an exception class for "generic" IDF errors that don't have their own exception type. --- ports/esp32s2/bindings/espidf/__init__.c | 27 +++++++++++++++++++++++---- ports/esp32s2/bindings/espidf/__init__.h | 1 + 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ports/esp32s2/bindings/espidf/__init__.c b/ports/esp32s2/bindings/espidf/__init__.c index 554bfaa39..5d3950f04 100644 --- a/ports/esp32s2/bindings/espidf/__init__.c +++ b/ports/esp32s2/bindings/espidf/__init__.c @@ -65,12 +65,12 @@ STATIC mp_obj_t espidf_heap_caps_get_largest_free_block(void) { } MP_DEFINE_CONST_FUN_OBJ_0(espidf_heap_caps_get_largest_free_block_obj, espidf_heap_caps_get_largest_free_block); -//| class MemoryError(MemoryError): -//| """Raised when an ESP IDF memory allocation fails.""" +//| class IDFError(OSError): +//| """Raised for certain generic ESP IDF errors.""" //| ... //| -NORETURN void mp_raise_espidf_MemoryError(void) { - nlr_raise(mp_obj_new_exception(&mp_type_espidf_MemoryError)); +NORETURN void mp_raise_espidf_IDFError(void) { + nlr_raise(mp_obj_new_exception(&mp_type_espidf_IDFError)); } void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kind_t kind) { @@ -83,6 +83,24 @@ void espidf_exception_print(const mp_print_t *print, mp_obj_t o_in, mp_print_kin mp_obj_exception_print(print, o_in, kind); } +const mp_obj_type_t mp_type_espidf_IDFError = { + { &mp_type_type }, + .name = MP_QSTR_IDFError, + .print = espidf_exception_print, + .make_new = mp_obj_exception_make_new, + .attr = mp_obj_exception_attr, + .parent = &mp_type_OSError, +}; + + +//| class MemoryError(MemoryError): +//| """Raised when an ESP IDF memory allocation fails.""" +//| ... +//| +NORETURN void mp_raise_espidf_MemoryError(void) { + nlr_raise(mp_obj_new_exception(&mp_type_espidf_MemoryError)); +} + const mp_obj_type_t mp_type_espidf_MemoryError = { { &mp_type_type }, .name = MP_QSTR_MemoryError, @@ -99,6 +117,7 @@ STATIC const mp_rom_map_elem_t espidf_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR_heap_caps_get_free_size), MP_ROM_PTR(&espidf_heap_caps_get_free_size_obj)}, { MP_ROM_QSTR(MP_QSTR_heap_caps_get_largest_free_block), MP_ROM_PTR(&espidf_heap_caps_get_largest_free_block_obj)}, + { MP_ROM_QSTR(MP_QSTR_IDFError), MP_ROM_PTR(&mp_type_espidf_IDFError) }, { MP_ROM_QSTR(MP_QSTR_MemoryError), MP_ROM_PTR(&mp_type_espidf_MemoryError) }, }; diff --git a/ports/esp32s2/bindings/espidf/__init__.h b/ports/esp32s2/bindings/espidf/__init__.h index 356c1c814..e35ec24b8 100644 --- a/ports/esp32s2/bindings/espidf/__init__.h +++ b/ports/esp32s2/bindings/espidf/__init__.h @@ -27,6 +27,7 @@ #ifndef MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H #define MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H +extern const mp_obj_type_t mp_type_espidf_IDFError; extern const mp_obj_type_t mp_type_espidf_MemoryError; NORETURN void mp_raise_espidf_MemoryError(void); -- cgit v1.2.3 From b40a579d180103d9f8a67390495d02e47554e7d7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 30 Oct 2020 10:05:16 -0500 Subject: esp32s2: espidf: Consistent error checking of esp-idf calls By surrounding most ESP-IDF API calls with this new macro, their failure will result in a CircuitPython exception. --- ports/esp32s2/bindings/espidf/__init__.c | 61 +++++++++++++++++++++ ports/esp32s2/bindings/espidf/__init__.h | 7 +++ ports/esp32s2/esp_error.c | 91 ++++++++++++++++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 ports/esp32s2/esp_error.c diff --git a/ports/esp32s2/bindings/espidf/__init__.c b/ports/esp32s2/bindings/espidf/__init__.c index 5d3950f04..708c30c39 100644 --- a/ports/esp32s2/bindings/espidf/__init__.c +++ b/ports/esp32s2/bindings/espidf/__init__.c @@ -127,3 +127,64 @@ const mp_obj_module_t espidf_module = { .base = { &mp_type_module }, .globals = (mp_obj_dict_t*)&espidf_module_globals, }; + +void raise_esp_error(esp_err_t err) { + const compressed_string_t *msg = NULL; + const mp_obj_type_t * exception_type = &mp_type_espidf_IDFError; + switch(err) { + case ESP_FAIL: + msg = translate("Generic Failure"); + break; + case ESP_ERR_NO_MEM: + exception_type = &mp_type_espidf_MemoryError; + msg = translate("Out of memory"); + break; + case ESP_ERR_INVALID_ARG: + msg = translate("Invalid argument"); + break; + case ESP_ERR_INVALID_STATE: + msg = translate("Invalid state"); + break; + case ESP_ERR_INVALID_SIZE: + msg = translate("Invalid size"); + break; + case ESP_ERR_NOT_FOUND: + msg = translate("Requested resource not found"); + break; + case ESP_ERR_NOT_SUPPORTED: + msg = translate("Operation or feature not supported"); + break; + case ESP_ERR_TIMEOUT: + msg = translate("Operation timed out"); + break; + case ESP_ERR_INVALID_RESPONSE: + msg = translate("Received response was invalid"); + break; + case ESP_ERR_INVALID_CRC: + msg = translate("CRC or checksum was invalid"); + break; + case ESP_ERR_INVALID_VERSION: + msg = translate("Version was invalid"); + break; + case ESP_ERR_INVALID_MAC: + msg = translate("MAC address was invalid"); + break; + } + if (msg) { + mp_raise_msg(exception_type, msg); + } + + const char *group = "ESP-IDF"; + + // tests must be in descending order + MP_STATIC_ASSERT( ESP_ERR_FLASH_BASE > ESP_ERR_MESH_BASE ); + MP_STATIC_ASSERT( ESP_ERR_MESH_BASE > ESP_ERR_WIFI_BASE ); + if(err >= ESP_ERR_FLASH_BASE) { + group = "Flash"; + } else if (err >= ESP_ERR_MESH_BASE) { + group = "Mesh"; + } else if (err >= ESP_ERR_WIFI_BASE) { + group = "WiFi"; + } + mp_raise_msg_varg(exception_type, translate("%s error 0x%x"), group, err); +} diff --git a/ports/esp32s2/bindings/espidf/__init__.h b/ports/esp32s2/bindings/espidf/__init__.h index e35ec24b8..5ff49970d 100644 --- a/ports/esp32s2/bindings/espidf/__init__.h +++ b/ports/esp32s2/bindings/espidf/__init__.h @@ -27,9 +27,16 @@ #ifndef MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H #define MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H +#include "esp_err.h" +#include "py/mpconfig.h" +#include "py/obj.h" + extern const mp_obj_type_t mp_type_espidf_IDFError; extern const mp_obj_type_t mp_type_espidf_MemoryError; NORETURN void mp_raise_espidf_MemoryError(void); +void raise_esp_error(esp_err_t err) NORETURN; +#define ESP_CALL_RAISE(x) do { int res = (x); if(res != ESP_OK) raise_esp_error(res); } while(0) + #endif // MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H diff --git a/ports/esp32s2/esp_error.c b/ports/esp32s2/esp_error.c new file mode 100644 index 000000000..57bc51528 --- /dev/null +++ b/ports/esp32s2/esp_error.c @@ -0,0 +1,91 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "esp_error.h" +#include "py/runtime.h" + +#include "bindings/espidf/__init__.h" + +void raise_esp_error(esp_err_t err) { + const compressed_string_t *msg = NULL; + const mp_obj_type_t * exception_type = &mp_type_espidf_IDFError; + switch(err) { + case ESP_FAIL: + msg = translate("Generic Failure"); + break; + case ESP_ERR_NO_MEM: + exception_type = &mp_type_espidf_MemoryError; + msg = translate("Out of memory"); + break; + case ESP_ERR_INVALID_ARG: + msg = translate("Invalid argument"); + break; + case ESP_ERR_INVALID_STATE: + msg = translate("Invalid state"); + break; + case ESP_ERR_INVALID_SIZE: + msg = translate("Invalid size"); + break; + case ESP_ERR_NOT_FOUND: + msg = translate("Requested resource not found"); + break; + case ESP_ERR_NOT_SUPPORTED: + msg = translate("Operation or feature not supported"); + break; + case ESP_ERR_TIMEOUT: + msg = translate("Operation timed out"); + break; + case ESP_ERR_INVALID_RESPONSE: + msg = translate("Received response was invalid"); + break; + case ESP_ERR_INVALID_CRC: + msg = translate("CRC or checksum was invalid"); + break; + case ESP_ERR_INVALID_VERSION: + msg = translate("Version was invalid"); + break; + case ESP_ERR_INVALID_MAC: + msg = translate("MAC address was invalid"); + break; + } + if (msg) { + mp_raise_msg(exception_type, msg); + } + + const char *group = "ESP-IDF"; + + // tests must be in descending order + MP_STATIC_ASSERT( ESP_ERR_FLASH_BASE > ESP_ERR_MESH_BASE ); + MP_STATIC_ASSERT( ESP_ERR_MESH_BASE > ESP_ERR_WIFI_BASE ); + if(err >= ESP_ERR_FLASH_BASE) { + group = "Flash"; + } else if (err >= ESP_ERR_MESH_BASE) { + group = "Mesh"; + } else if (err >= ESP_ERR_WIFI_BASE) { + group = "WiFi"; + } + mp_raise_msg_varg(exception_type, translate("%s error 0x%x"), group, err); +} -- cgit v1.2.3 From 537a4daabd79407a8c2c5cd4adead6019406d992 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 28 Oct 2020 10:20:36 -0500 Subject: mark script as executable --- tools/analyze_mpy.py | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 tools/analyze_mpy.py diff --git a/tools/analyze_mpy.py b/tools/analyze_mpy.py old mode 100644 new mode 100755 index a2f541d0f..99c06f62a --- a/tools/analyze_mpy.py +++ b/tools/analyze_mpy.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # SPDX-FileCopyrightText: 2014 MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors) # # SPDX-License-Identifier: MIT -- cgit v1.2.3 From 2cd377f1a7a91a46d154f4da9dbf50a747da9b41 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 28 Oct 2020 13:27:48 -0500 Subject: audiobusio: Make PDMIn optional --- py/circuitpy_mpconfig.mk | 4 ++++ shared-bindings/audiobusio/PDMIn.c | 8 ++++++++ shared-bindings/audiobusio/PDMIn.h | 2 ++ 3 files changed, 14 insertions(+) diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index e588c41e0..9a07f62a3 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -55,6 +55,10 @@ CFLAGS += -DCIRCUITPY_AUDIOBUSIO=$(CIRCUITPY_AUDIOBUSIO) CIRCUITPY_AUDIOBUSIO_I2SOUT ?= $(CIRCUITPY_AUDIOBUSIO) CFLAGS += -DCIRCUITPY_AUDIOBUSIO_I2SOUT=$(CIRCUITPY_AUDIOBUSIO_I2SOUT) +# Likewise, some boards have I2SOut but do not implement PDMIn. +CIRCUITPY_AUDIOBUSIO_PDMIN ?= $(CIRCUITPY_AUDIOBUSIO) +CFLAGS += -DCIRCUITPY_AUDIOBUSIO_PDMIN=$(CIRCUITPY_AUDIOBUSIO_PDMIN) + CIRCUITPY_AUDIOIO ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DCIRCUITPY_AUDIOIO=$(CIRCUITPY_AUDIOIO) diff --git a/shared-bindings/audiobusio/PDMIn.c b/shared-bindings/audiobusio/PDMIn.c index 6c5fa7939..a3cc8b07e 100644 --- a/shared-bindings/audiobusio/PDMIn.c +++ b/shared-bindings/audiobusio/PDMIn.c @@ -84,6 +84,9 @@ //| ... //| STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { +#if !CIRCUITPY_AUDIOBUSIO_PDMIN + mp_raise_NotImplementedError(translate("PDMIn not available")); +#else enum { ARG_clock_pin, ARG_data_pin, ARG_sample_rate, ARG_bit_depth, ARG_mono, ARG_oversample, ARG_startup_delay }; static const mp_arg_t allowed_args[] = { { MP_QSTR_clock_pin, MP_ARG_REQUIRED | MP_ARG_OBJ }, @@ -132,8 +135,10 @@ STATIC mp_obj_t audiobusio_pdmin_make_new(const mp_obj_type_t *type, size_t n_ar mp_hal_delay_ms(startup_delay * 1000); return MP_OBJ_FROM_PTR(self); +#endif } +#if CIRCUITPY_AUDIOBUSIO_PDMIN //| def deinit(self) -> None: //| """Deinitialises the PDMIn and releases any hardware resources for reuse.""" //| ... @@ -237,10 +242,13 @@ STATIC const mp_rom_map_elem_t audiobusio_pdmin_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_sample_rate), MP_ROM_PTR(&audiobusio_pdmin_sample_rate_obj) } }; STATIC MP_DEFINE_CONST_DICT(audiobusio_pdmin_locals_dict, audiobusio_pdmin_locals_dict_table); +#endif const mp_obj_type_t audiobusio_pdmin_type = { { &mp_type_type }, .name = MP_QSTR_PDMIn, .make_new = audiobusio_pdmin_make_new, +#if CIRCUITPY_AUDIOBUSIO_PDMIN .locals_dict = (mp_obj_dict_t*)&audiobusio_pdmin_locals_dict, +#endif }; diff --git a/shared-bindings/audiobusio/PDMIn.h b/shared-bindings/audiobusio/PDMIn.h index c2a8bab2f..e89fc7e23 100644 --- a/shared-bindings/audiobusio/PDMIn.h +++ b/shared-bindings/audiobusio/PDMIn.h @@ -33,6 +33,7 @@ extern const mp_obj_type_t audiobusio_pdmin_type; +#if CIRCUITPY_AUDIOBUSIO_PDMIN void common_hal_audiobusio_pdmin_construct(audiobusio_pdmin_obj_t* self, const mcu_pin_obj_t* clock_pin, const mcu_pin_obj_t* data_pin, uint32_t sample_rate, uint8_t bit_depth, bool mono, uint8_t oversample); @@ -43,5 +44,6 @@ uint32_t common_hal_audiobusio_pdmin_record_to_buffer(audiobusio_pdmin_obj_t* se uint8_t common_hal_audiobusio_pdmin_get_bit_depth(audiobusio_pdmin_obj_t* self); uint32_t common_hal_audiobusio_pdmin_get_sample_rate(audiobusio_pdmin_obj_t* self); // TODO(tannewt): Add record to file +#endif #endif // MICROPY_INCLUDED_SHARED_BINDINGS_AUDIOBUSIO_AUDIOOUT_H -- cgit v1.2.3 From a7542598a0ce1fbd7722312dd863b1d40b0c2837 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 30 Oct 2020 10:05:16 -0500 Subject: esp32s2: add I2SOut --- ports/esp32s2/Makefile | 1 + ports/esp32s2/common-hal/audiobusio/I2SOut.c | 126 ++++++++++++++ ports/esp32s2/common-hal/audiobusio/I2SOut.h | 45 +++++ ports/esp32s2/common-hal/audiobusio/PDMIn.c | 0 ports/esp32s2/common-hal/audiobusio/PDMIn.h | 0 ports/esp32s2/common-hal/audiobusio/__init__.c | 0 ports/esp32s2/common-hal/audiobusio/__init__.h | 0 ports/esp32s2/i2s_common.c | 231 +++++++++++++++++++++++++ ports/esp32s2/i2s_common.h | 61 +++++++ ports/esp32s2/mpconfigport.mk | 6 +- ports/esp32s2/supervisor/port.c | 8 + shared-module/audiocore/__init__.c | 60 +++++++ shared-module/audiocore/__init__.h | 8 + 13 files changed, 545 insertions(+), 1 deletion(-) create mode 100644 ports/esp32s2/common-hal/audiobusio/I2SOut.c create mode 100644 ports/esp32s2/common-hal/audiobusio/I2SOut.h create mode 100644 ports/esp32s2/common-hal/audiobusio/PDMIn.c create mode 100644 ports/esp32s2/common-hal/audiobusio/PDMIn.h create mode 100644 ports/esp32s2/common-hal/audiobusio/__init__.c create mode 100644 ports/esp32s2/common-hal/audiobusio/__init__.h create mode 100644 ports/esp32s2/i2s_common.c create mode 100644 ports/esp32s2/i2s_common.h diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index e08b8a792..c1e20d17a 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -175,6 +175,7 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_ESP32S2 -DCFG_TUSB_OS=OPT_OS_FREERTOS -DCFG_TUD SRC_C += \ background.c \ fatfs_port.c \ + i2s_common.c \ mphalport.c \ bindings/espidf/__init__.c \ boards/$(BOARD)/board.c \ diff --git a/ports/esp32s2/common-hal/audiobusio/I2SOut.c b/ports/esp32s2/common-hal/audiobusio/I2SOut.c new file mode 100644 index 000000000..be5b04fa9 --- /dev/null +++ b/ports/esp32s2/common-hal/audiobusio/I2SOut.c @@ -0,0 +1,126 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include +#include + +#include "mpconfigport.h" + +#include "bindings/espidf/__init__.h" + +// Some boards don't implement I2SOut, so suppress any routines from here. +#if CIRCUITPY_AUDIOBUSIO_I2SOUT + +#include "extmod/vfs_fat.h" +#include "py/gc.h" +#include "py/mperrno.h" +#include "py/runtime.h" +#include "common-hal/audiobusio/I2SOut.h" +#include "shared-bindings/audiobusio/I2SOut.h" +#include "shared-bindings/audiocore/RawSample.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "supervisor/shared/translate.h" + +#include "driver/i2s.h" + +// Caller validates that pins are free. +void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self, + const mcu_pin_obj_t* bit_clock, const mcu_pin_obj_t* word_select, + const mcu_pin_obj_t* data, bool left_justified) { + + port_i2s_allocate_init(&self->peripheral, left_justified); + + i2s_pin_config_t i2s_pin_config = { + .bck_io_num = bit_clock->number, + .ws_io_num = word_select->number, + .data_out_num = data->number, + .data_in_num = I2S_PIN_NO_CHANGE, + }; + ESP_CALL_RAISE(i2s_set_pin(self->peripheral.instance, &i2s_pin_config)); + self->bit_clock = bit_clock; + self->word_select = word_select; + self->data = data; +} + +bool common_hal_audiobusio_i2sout_deinited(audiobusio_i2sout_obj_t* self) { + return self->peripheral.instance == -1; +} + +void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t* self) { + if (common_hal_audiobusio_i2sout_deinited(self)) { + return; + } + + if (self->bit_clock) { + reset_pin_number(self->bit_clock->number); + } + self->bit_clock = NULL; + + if (self->word_select) { + reset_pin_number(self->word_select->number); + } + self->word_select = NULL; + + if (self->data) { + reset_pin_number(self->data->number); + } + self->data = NULL; + + if (self->peripheral.instance >= 0) { + port_i2s_reset_instance(self->peripheral.instance); + } + self->peripheral.instance = -1; +} + +void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self, + mp_obj_t sample, bool loop) { + if (common_hal_audiobusio_i2sout_get_playing(self)) { + common_hal_audiobusio_i2sout_stop(self); + } + port_i2s_play(&self->peripheral, sample, loop); +} + +void common_hal_audiobusio_i2sout_pause(audiobusio_i2sout_obj_t* self) { + port_i2s_pause(&self->peripheral); +} + +void common_hal_audiobusio_i2sout_resume(audiobusio_i2sout_obj_t* self) { + port_i2s_resume(&self->peripheral); +} + +bool common_hal_audiobusio_i2sout_get_paused(audiobusio_i2sout_obj_t* self) { + return port_i2s_paused(&self->peripheral); +} + +void common_hal_audiobusio_i2sout_stop(audiobusio_i2sout_obj_t* self) { + port_i2s_stop(&self->peripheral); +} + +bool common_hal_audiobusio_i2sout_get_playing(audiobusio_i2sout_obj_t* self) { + return port_i2s_playing(&self->peripheral); +} + +#endif // CIRCUITPY_AUDIOBUSIO_I2SOUT diff --git a/ports/esp32s2/common-hal/audiobusio/I2SOut.h b/ports/esp32s2/common-hal/audiobusio/I2SOut.h new file mode 100644 index 000000000..90266342c --- /dev/null +++ b/ports/esp32s2/common-hal/audiobusio/I2SOut.h @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "supervisor/background_callback.h" +#include "common-hal/microcontroller/Pin.h" + +#include "i2s_common.h" + +// Some boards don't implement I2SOut, so suppress any routines from here. +#if CIRCUITPY_AUDIOBUSIO_I2SOUT + +typedef struct { + mp_obj_base_t base; + i2s_t peripheral; + const mcu_pin_obj_t *bit_clock; + const mcu_pin_obj_t *word_select; + const mcu_pin_obj_t *data; +} audiobusio_i2sout_obj_t; + +#endif diff --git a/ports/esp32s2/common-hal/audiobusio/PDMIn.c b/ports/esp32s2/common-hal/audiobusio/PDMIn.c new file mode 100644 index 000000000..e69de29bb diff --git a/ports/esp32s2/common-hal/audiobusio/PDMIn.h b/ports/esp32s2/common-hal/audiobusio/PDMIn.h new file mode 100644 index 000000000..e69de29bb diff --git a/ports/esp32s2/common-hal/audiobusio/__init__.c b/ports/esp32s2/common-hal/audiobusio/__init__.c new file mode 100644 index 000000000..e69de29bb diff --git a/ports/esp32s2/common-hal/audiobusio/__init__.h b/ports/esp32s2/common-hal/audiobusio/__init__.h new file mode 100644 index 000000000..e69de29bb diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c new file mode 100644 index 000000000..1933665a3 --- /dev/null +++ b/ports/esp32s2/i2s_common.c @@ -0,0 +1,231 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "py/runtime.h" + +#include "i2s_common.h" +#include "bindings/espidf/__init__.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "shared-module/audiocore/__init__.h" + +#define I2S_QUEUE_SIZE (3) + +static i2s_t *i2s_instance[I2S_NUM_MAX]; +static QueueHandle_t i2s_queues[I2S_NUM_MAX]; +static TaskHandle_t i2s_tasks[I2S_NUM_MAX]; + +static int8_t port_i2s_allocate(void) { +#if defined(I2S_NUM_1) + if(!i2s_instance[1]) return 1; +#endif + if(!i2s_instance[0]) return 0; + + mp_raise_RuntimeError(translate("Peripheral in use")); +} + +void port_i2s_reset_instance(int i) { + assert(i >= 0 && i < I2S_NUM_MAX); + if (i2s_tasks[i]) { + vTaskDelete(i2s_tasks[i]); + } + i2s_tasks[i] = NULL; + + (void)i2s_driver_uninstall(i); + i2s_instance[i] = NULL; +} + +void i2s_reset(void) { + for (int i=0; i < I2S_NUM_MAX; i++) { + port_i2s_reset_instance(i); + } +} + +static void i2s_fill_buffer(i2s_t *self) { + if (self->instance < 0 || self->instance >= I2S_NUM_MAX) { + return; + } + if (self->paused || !self->sample) { + i2s_zero_dma_buffer(self->instance); + return; + } + while (!self->stopping) { + if (self->sample_data == self->sample_end) { + uint32_t sample_buffer_length; + audioio_get_buffer_result_t get_buffer_result = + audiosample_get_buffer(self->sample, false, 0, + &self->sample_data, &sample_buffer_length); + self->sample_end = self->sample_data + sample_buffer_length; + if (get_buffer_result == GET_BUFFER_DONE) { + if (self->loop) { + audiosample_reset_buffer(self->sample, false, 0); + } else { + self->stopping = true; + break; + } + } + if (get_buffer_result == GET_BUFFER_ERROR || sample_buffer_length == 0) { + self->stopping = true; + break; + } + } + size_t bytes_written = 0; + size_t bytecount = self->sample_end - self->sample_data; + if (self->samples_signed && self->channel_count == 2) { + if (self->bytes_per_sample == 2) { + ESP_CALL_RAISE(i2s_write(self->instance, self->sample_data, bytecount, &bytes_written, 0)); + } else { + ESP_CALL_RAISE(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, 0)); + } + } else { +#define STACK_BUFFER_SIZE (64) + size_t bytes_per_frame = self->channel_count * self->bytes_per_sample; + size_t framecount = MIN(STACK_BUFFER_SIZE / bytes_per_frame, bytecount); + int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; + if (self->samples_signed) { + assert(self->channel_count == 1); + if (self->bytes_per_sample == 1) { + audiosample_convert_s8m_s16s(signed_samples, (int8_t*)(void*)self->sample_data, framecount); + } else { + audiosample_convert_s16m_s16s(signed_samples, (int16_t*)(void*)self->sample_data, framecount); + } + } else { + if (self->channel_count == 1) { + if (self->bytes_per_sample == 1) { + audiosample_convert_u8m_s16s(signed_samples, (uint8_t*)(void*)self->sample_data, framecount); + } else { + audiosample_convert_u16m_s16s(signed_samples, (uint16_t*)(void*)self->sample_data, framecount); + } + } else { + if (self->bytes_per_sample == 1) { + audiosample_convert_u8s_s16s(signed_samples, (uint8_t*)(void*)self->sample_data, framecount); + } else { + audiosample_convert_u16s_s16s(signed_samples, (uint16_t*)(void*)self->sample_data, framecount); + } + } + } + size_t expanded_bytes_written = 0; + ESP_CALL_RAISE(i2s_write(self->instance, signed_samples, 4*framecount, &expanded_bytes_written, 0)); + assert(expanded_bytes_written % 4 == 0); + bytes_written = expanded_bytes_written / 4 * bytes_per_frame; + } + self->sample_data += bytes_written; + // We have filled the DMA buffer + if (!bytes_written) { + break; + } + } +} + +static void i2s_callback_fun(void *self_in) { + i2s_t *self = self_in; + i2s_fill_buffer(self); +} + +static void i2s_event_task(void *self_in) { + i2s_t *self = self_in; + while(true) { + i2s_event_type_t event; + BaseType_t result = xQueueReceive(i2s_queues[self->instance], &event, portMAX_DELAY); + if (result && event == I2S_EVENT_TX_DONE) { + background_callback_add(&self->callback, i2s_callback_fun, self_in); + } + } +} + +void port_i2s_allocate_init(i2s_t *self, bool left_justified) { + self->instance = port_i2s_allocate(); + + i2s_config_t i2s_config = { + .mode = I2S_MODE_MASTER | I2S_MODE_TX, + .sample_rate = 44100, + .bits_per_sample = 16, + .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, + .communication_format = left_justified ? I2S_COMM_FORMAT_STAND_I2S : I2S_COMM_FORMAT_STAND_I2S, + .dma_buf_count = 2, + .dma_buf_len = 128, // in _frames_, so 128 is 512 bytes per dma buf + .use_apll = false, + }; + ESP_CALL_RAISE(i2s_driver_install(self->instance, &i2s_config, I2S_QUEUE_SIZE, &i2s_queues[self->instance])); + + if (!xTaskCreate(i2s_event_task, "I2S_task", 3 * configMINIMAL_STACK_SIZE, self, CONFIG_PTHREAD_TASK_PRIO_DEFAULT, &i2s_tasks[self->instance])) { + mp_raise_OSError_msg(translate("xTaskCreate failed")); + } + i2s_instance[self->instance] = self; + +} + + +void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { + self->sample = sample; + self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8; + self->channel_count = audiosample_channel_count(sample); + bool single_buffer; + bool samples_signed; + uint32_t max_buffer_length; + uint8_t spacing; + audiosample_get_buffer_structure(sample, false, &single_buffer, &samples_signed, + &max_buffer_length, &spacing); + self->samples_signed = samples_signed; + self->loop = loop; + self->playing = true; + self->paused = false; + self->stopping = false; + // We always output stereo so output twice as many bits. + // uint16_t bits_per_sample_output = bits_per_sample * 2; + ESP_CALL_RAISE(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); + i2s_fill_buffer(self); +} + +bool port_i2s_playing(i2s_t *self) { + return self->playing && !self->stopping; +} + +bool port_i2s_paused(i2s_t *self) { + return self->paused; +} + +void port_i2s_stop(i2s_t *self) { + self->sample = NULL; + self->paused = false; + self->playing = false; + self->stopping = false; +} + +void port_i2s_pause(i2s_t *self) { + if (!self->paused) { + self->paused = true; + ESP_CALL_RAISE(i2s_stop(self->instance)); + } +} + +void port_i2s_resume(i2s_t *self) { + if (self->paused) { + self->paused = false; + ESP_CALL_RAISE(i2s_start(self->instance)); + } +} diff --git a/ports/esp32s2/i2s_common.h b/ports/esp32s2/i2s_common.h new file mode 100644 index 000000000..7709735da --- /dev/null +++ b/ports/esp32s2/i2s_common.h @@ -0,0 +1,61 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "py/obj.h" + +#include "supervisor/background_callback.h" + +#include "driver/i2s.h" + +typedef struct { + mp_obj_t *sample; + bool left_justified; + bool loop; + bool paused; + bool playing; + bool stopping; + bool samples_signed; + int8_t bytes_per_sample; + int8_t channel_count; + int8_t instance; + uint16_t buffer_length; + uint8_t *sample_data, *sample_end; + i2s_config_t i2s_config; + background_callback_t callback; +} i2s_t; + + +void port_i2s_allocate_init(i2s_t *self, bool left_justified); +void port_i2s_reset_instance(int i); +void i2s_reset(void); +void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop); +void port_i2s_stop(i2s_t *self); +bool port_i2s_playing(i2s_t *self); +bool port_i2s_paused(i2s_t *self); +void port_i2s_pause(i2s_t *self); +void port_i2s_resume(i2s_t *self); diff --git a/ports/esp32s2/mpconfigport.mk b/ports/esp32s2/mpconfigport.mk index 2ad8afb51..562c60998 100644 --- a/ports/esp32s2/mpconfigport.mk +++ b/ports/esp32s2/mpconfigport.mk @@ -15,7 +15,11 @@ LONGINT_IMPL = MPZ # These modules are implemented in ports//common-hal: CIRCUITPY_FULL_BUILD = 1 CIRCUITPY_ALARM = 1 -CIRCUITPY_AUDIOBUSIO = 0 +CIRCUITPY_AUDIOCORE = 1 +CIRCUITPY_AUDIOMP3 = 0 +CIRCUITPY_AUDIOBUSIO = 1 +CIRCUITPY_AUDIOBUSIO_PDMIN = 0 +CIRCUITPY_AUDIOBUSIO_I2SOUT = 1 CIRCUITPY_AUDIOIO = 0 CIRCUITPY_CANIO = 1 CIRCUITPY_COUNTIO = 1 diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index ff35845f7..75492492e 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -61,6 +61,10 @@ #include "components/soc/soc/esp32s2/include/soc/cache_memory.h" #include "components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h" +#if CIRCUITPY_AUDIOBUSIO +#include "i2s_common.h" +#endif + #define HEAP_SIZE (48 * 1024) uint32_t* heap; @@ -153,6 +157,10 @@ void reset_port(void) { ps2_reset(); #endif +#if CIRCUITPY_AUDIOBUSIO + i2s_reset(); +#endif + #if CIRCUITPY_PULSEIO esp32s2_peripherals_rmt_reset(); pulsein_reset(); diff --git a/shared-module/audiocore/__init__.c b/shared-module/audiocore/__init__.c index ac9d41b60..7bdfe460c 100644 --- a/shared-module/audiocore/__init__.c +++ b/shared-module/audiocore/__init__.c @@ -70,3 +70,63 @@ void audiosample_get_buffer_structure(mp_obj_t sample_obj, bool single_channel, proto->get_buffer_structure(MP_OBJ_TO_PTR(sample_obj), single_channel, single_buffer, samples_signed, max_buffer_length, spacing); } + +void audiosample_convert_u8m_s16s(int16_t *buffer_out, const uint8_t *buffer_in, size_t nframes) { + for(;nframes--;) { + int16_t sample = (*buffer_in++ - 0x80) << 8; + *buffer_out++ = sample; + *buffer_out++ = sample; + } +} + + +void audiosample_convert_u8s_s16s(int16_t *buffer_out, const uint8_t *buffer_in, size_t nframes) { + size_t nsamples = 2*nframes; + for(;nsamples--;) { + int16_t sample = (*buffer_in++ - 0x80) << 8; + *buffer_out++ = sample; + } +} + +void audiosample_convert_s8m_s16s(int16_t *buffer_out, const int8_t *buffer_in, size_t nframes) { + for(;nframes--;) { + int16_t sample = (*buffer_in++) << 8; + *buffer_out++ = sample; + *buffer_out++ = sample; + } +} + + +void audiosample_convert_s8s_s16s(int16_t *buffer_out, const int8_t *buffer_in, size_t nframes) { + size_t nsamples = 2*nframes; + for(;nsamples--;) { + int16_t sample = (*buffer_in++) << 8; + *buffer_out++ = sample; + } +} + + +void audiosample_convert_u16m_s16s(int16_t *buffer_out, const uint16_t *buffer_in, size_t nframes) { + for(;nframes--;) { + int16_t sample = *buffer_in++ - 0x8000; + *buffer_out++ = sample; + *buffer_out++ = sample; + } +} + + +void audiosample_convert_u16s_s16s(int16_t *buffer_out, const uint16_t *buffer_in, size_t nframes) { + size_t nsamples = 2*nframes; + for(;nsamples--;) { + int16_t sample = *buffer_in++ - 0x8000; + *buffer_out++ = sample; + } +} + +void audiosample_convert_s16m_s16s(int16_t *buffer_out, const int16_t *buffer_in, size_t nframes) { + for(;nframes--;) { + int16_t sample = *buffer_in++; + *buffer_out++ = sample; + *buffer_out++ = sample; + } +} diff --git a/shared-module/audiocore/__init__.h b/shared-module/audiocore/__init__.h index 7a56454b8..ec2cf1cfa 100644 --- a/shared-module/audiocore/__init__.h +++ b/shared-module/audiocore/__init__.h @@ -74,4 +74,12 @@ void audiosample_get_buffer_structure(mp_obj_t sample_obj, bool single_channel, bool* single_buffer, bool* samples_signed, uint32_t* max_buffer_length, uint8_t* spacing); +void audiosample_convert_u8m_s16s(int16_t *buffer_out, const uint8_t *buffer_in, size_t nframes); +void audiosample_convert_u8s_s16s(int16_t *buffer_out, const uint8_t *buffer_in, size_t nframes); +void audiosample_convert_s8m_s16s(int16_t *buffer_out, const int8_t *buffer_in, size_t nframes); +void audiosample_convert_s8s_s16s(int16_t *buffer_out, const int8_t *buffer_in, size_t nframes); +void audiosample_convert_u16m_s16s(int16_t *buffer_out, const uint16_t *buffer_in, size_t nframes); +void audiosample_convert_u16s_s16s(int16_t *buffer_out, const uint16_t *buffer_in, size_t nframes); +void audiosample_convert_s16m_s16s(int16_t *buffer_out, const int16_t *buffer_in, size_t nframes); + #endif // MICROPY_INCLUDED_SHARED_MODULE_AUDIOCORE__INIT__H -- cgit v1.2.3 From 42cad23dea7c4b6fdfb7a8a294cfeb8048f74cac Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 29 Dec 2020 16:31:29 -0600 Subject: make translate --- locale/circuitpython.pot | 64 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 3edadd57c..9016a38c9 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-23 23:04-0500\n" +"POT-Creation-Date: 2020-12-29 16:31-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -114,6 +114,11 @@ msgstr "" msgid "%q() takes %d positional arguments but %d were given" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "" @@ -536,6 +541,10 @@ msgstr "" msgid "CBC blocks must be multiples of 16 bytes" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -984,6 +993,10 @@ msgstr "" msgid "Function requires lock" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1110,6 +1123,7 @@ msgstr "" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" @@ -1218,6 +1232,14 @@ msgstr "" msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1258,6 +1280,10 @@ msgstr "" msgid "Length must be non-negative" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "" @@ -1496,6 +1522,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1504,6 +1542,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "" +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1520,6 +1562,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "" +#: ports/esp32s2/i2s_common.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "" @@ -1637,6 +1683,10 @@ msgstr "" msgid "Read-only object" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -1649,6 +1699,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "" @@ -2019,6 +2073,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3833,6 +3891,10 @@ msgstr "" msgid "x value out of bounds" msgstr "" +#: ports/esp32s2/i2s_common.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "" -- cgit v1.2.3 From ec02102409b3935d0efa6c6f132b7f38c414ff03 Mon Sep 17 00:00:00 2001 From: jerryneedell Date: Mon, 4 Jan 2021 07:41:25 -0500 Subject: implment use of DotStar for staus led --- .../unexpectedmaker_feathers2/mpconfigboard.h | 4 +- ports/esp32s2/common-hal/microcontroller/Pin.c | 43 ++++++++++++++++++++-- ports/esp32s2/common-hal/microcontroller/Pin.h | 4 +- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h index e100ac118..6b1a0c4aa 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -34,8 +34,8 @@ #define AUTORESET_DELAY_MS 500 -// #define MICROPY_HW_APA102_MOSI (&pin_GPIO40) -// #define MICROPY_HW_APA102_SCK (&pin_GPIO45) +#define MICROPY_HW_APA102_MOSI (&pin_GPIO40) +#define MICROPY_HW_APA102_SCK (&pin_GPIO45) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index fca89ce8e..fd01d68e1 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -37,13 +37,14 @@ #ifdef MICROPY_HW_NEOPIXEL bool neopixel_in_use; #endif +#ifdef MICROPY_HW_APA102_MOSI +bool apa102_sck_in_use; +bool apa102_mosi_in_use; +#endif STATIC uint32_t never_reset_pins[2]; STATIC uint32_t in_use[2]; -bool apa102_mosi_in_use; -bool apa102_sck_in_use; - STATIC void floating_gpio_reset(gpio_num_t pin_number) { // This is the same as gpio_reset_pin(), but without the pullup. // Note that gpio_config resets the iomatrix to GPIO_FUNC as well. @@ -86,6 +87,20 @@ void reset_pin_number(gpio_num_t pin_number) { return; } #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin_number == MICROPY_HW_APA102_MOSI->number || + pin_number == MICROPY_HW_APA102_SCK->number) { + apa102_mosi_in_use = apa102_mosi_in_use && pin_number != MICROPY_HW_APA102_MOSI->number; + apa102_sck_in_use = apa102_sck_in_use && pin_number != MICROPY_HW_APA102_SCK->number; + if (!apa102_sck_in_use && !apa102_mosi_in_use) { + rgb_led_status_init(); + } + return; + } + #endif + + + } void common_hal_reset_pin(const mcu_pin_obj_t* pin) { @@ -110,6 +125,11 @@ void reset_all_pins(void) { #ifdef MICROPY_HW_NEOPIXEL neopixel_in_use = false; #endif + #ifdef MICROPY_HW_APA102_MOSI + apa102_sck_in_use = false; + apa102_mosi_in_use = false; + #endif + } void claim_pin(const mcu_pin_obj_t* pin) { @@ -119,6 +139,15 @@ void claim_pin(const mcu_pin_obj_t* pin) { neopixel_in_use = true; } #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin == MICROPY_HW_APA102_MOSI) { + apa102_mosi_in_use = true; + } + if (pin == MICROPY_HW_APA102_SCK) { + apa102_sck_in_use = true; + } + #endif + } void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { @@ -131,6 +160,14 @@ bool pin_number_is_free(gpio_num_t pin_number) { return !neopixel_in_use; } #endif + #ifdef MICROPY_HW_APA102_MOSI + if (pin_number == MICROPY_HW_APA102_MOSI->number) { + return !apa102_mosi_in_use; + } + if (pin_number == MICROPY_HW_APA102_SCK->number) { + return !apa102_sck_in_use; + } + #endif uint8_t offset = pin_number / 32; uint32_t mask = 1 << (pin_number % 32); diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.h b/ports/esp32s2/common-hal/microcontroller/Pin.h index f6c008703..65f57a82d 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.h +++ b/ports/esp32s2/common-hal/microcontroller/Pin.h @@ -31,8 +31,10 @@ #include "peripherals/pins.h" -extern bool apa102_mosi_in_use; +#ifdef MICROPY_HW_APA102_MOSI extern bool apa102_sck_in_use; +extern bool apa102_mosi_in_use; +#endif #ifdef MICROPY_HW_NEOPIXEL extern bool neopixel_in_use; -- cgit v1.2.3 From 90a299bb1e6c80971b576dc51dd50bca6220b6f7 Mon Sep 17 00:00:00 2001 From: Bernhard Boser Date: Tue, 5 Jan 2021 11:17:09 -0800 Subject: added //| to (hopefully) get CI to pass --- locale/circuitpython.pot | 6 +++++- shared-bindings/msgpack/ExtType.c | 2 ++ shared-bindings/msgpack/__init__.c | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index cea26c6ba..578257e2d 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-08 09:56-0800\n" +"POT-Creation-Date: 2021-01-05 11:08-0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3438,6 +3438,10 @@ msgstr "" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" diff --git a/shared-bindings/msgpack/ExtType.c b/shared-bindings/msgpack/ExtType.c index 5dc3d4992..e9ddd32bc 100644 --- a/shared-bindings/msgpack/ExtType.c +++ b/shared-bindings/msgpack/ExtType.c @@ -61,6 +61,7 @@ STATIC mp_obj_t mod_msgpack_exttype_make_new(const mp_obj_type_t *type, size_t n //| code: int //| """The type code, in range 0~127.""" +//| ... //| STATIC mp_obj_t mod_msgpack_exttype_get_code(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); @@ -88,6 +89,7 @@ const mp_obj_property_t mod_msgpack_exttype_code_obj = { //| data: bytes //| """Data.""" +//| ... //| STATIC mp_obj_t mod_msgpack_exttype_get_data(mp_obj_t self_in) { mod_msgpack_extype_obj_t *self = MP_OBJ_TO_PTR(self_in); diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index 5dc45dde2..e1b6b8fce 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -89,6 +89,7 @@ //| function called for python objects that do not have //| a representation in msgpack format. //| """ +//| ... //| STATIC mp_obj_t mod_msgpack_pack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_obj, ARG_buffer, ARG_default }; @@ -119,6 +120,7 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); //| :param Optional[bool] use_list: return array as list or tuple (use_list=False). //| :return object: object read from buffer. //| """ +//| ... //| STATIC mp_obj_t mod_msgpack_unpack(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) { enum { ARG_buffer, ARG_ext_hook, ARG_use_list }; -- cgit v1.2.3 From cdad59fbc2d681d06a21aefedb00a6b6946cce1c Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Wed, 6 Jan 2021 09:03:58 -0800 Subject: Fix doc build with extra blank lines --- shared-bindings/msgpack/__init__.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/shared-bindings/msgpack/__init__.c b/shared-bindings/msgpack/__init__.c index e1b6b8fce..f5c47bb21 100644 --- a/shared-bindings/msgpack/__init__.c +++ b/shared-bindings/msgpack/__init__.c @@ -41,7 +41,8 @@ //| //| Not implemented: 64-bit int, uint, float. //| -//| Example 1: +//| Example 1:: +//| //| import msgpack //| from io import BytesIO //| @@ -50,7 +51,7 @@ //| b.seek(0) //| print(msgpack.unpack(b)) //| -//| Example 2: handling objects +//| Example 2: handling objects:: //| //| from msgpack import pack, unpack, ExtType //| from io import BytesIO @@ -78,11 +79,13 @@ //| buffer.seek(0) //| decoded = unpack(buffer, ext_hook=decoder) //| print(f"{data} -> {buffer.getvalue()} -> {decoded}") +//| //| """ //| //| def pack(obj: object, buffer: WriteableBuffer, *, default: Union[Callable[[object], None], None] = None) -> None: //| """Ouput object to buffer in msgpack format. +//| //| :param object obj: Object to convert to msgpack format. //| :param ~_typing.WriteableBuffer buffer: buffer to write into //| :param Optional[~_typing.Callable[[object], None]] default: @@ -114,10 +117,12 @@ MP_DEFINE_CONST_FUN_OBJ_KW(mod_msgpack_pack_obj, 1, mod_msgpack_pack); //| def unpack(buffer: ReadableBuffer, *, ext_hook: Union[Callable[[int, bytes], object], None] = None, use_list: bool=True) -> object: //| """Unpack and return one object from buffer. +//| //| :param ~_typing.ReadableBuffer buffer: buffer to read from //| :param Optional[~_typing.Callable[[int, bytes], object]] ext_hook: function called for objects in //| msgpack ext format. //| :param Optional[bool] use_list: return array as list or tuple (use_list=False). +//| //| :return object: object read from buffer. //| """ //| ... -- cgit v1.2.3 From 66d87782be3793fd179b12fa864e71509f1dbf6f Mon Sep 17 00:00:00 2001 From: BennyE Date: Wed, 6 Jan 2021 23:52:30 +0100 Subject: Adding authmode keyword --- ports/esp32s2/common-hal/wifi/Network.c | 35 +++++++++++++++++++++++++++++++++ shared-bindings/wifi/Network.c | 16 +++++++++++++++ shared-bindings/wifi/Network.h | 1 + shared-bindings/wifi/Radio.c | 2 +- 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index 2674df065..0289ad4eb 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -54,3 +54,38 @@ mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { // 2 instead of strlen(cstr) as this gives us only the country-code return mp_obj_new_str(cstr, 2); } + +mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { + char authmode[16]; + switch (self->record.authmode) { + case WIFI_AUTH_OPEN: + strcpy(authmode, "OPEN"); + break; + case WIFI_AUTH_WEP: + strcpy(authmode, "WEP"); + break; + case WIFI_AUTH_WPA_PSK: + strcpy(authmode, "WPA_PSK"); + break; + case WIFI_AUTH_WPA2_PSK: + strcpy(authmode, "WPA2_PSK"); + break; + case WIFI_AUTH_WPA_WPA2_PSK: + strcpy(authmode, "WPA_WPA2_PSK"); + break; + case WIFI_AUTH_WPA2_ENTERPRISE: + strcpy(authmode, "WPA2_ENTERPRISE"); + break; + case WIFI_AUTH_WPA3_PSK: + strcpy(authmode, "WPA3_PSK"); + break; + case WIFI_AUTH_WPA2_WPA3_PSK: + strcpy(authmode, "WPA2_WPA3_PSK"); + break; + default: + strcpy(authmode, "UNKNOWN"); + break; + } + const char* cstr = (const char*) authmode; + return mp_obj_new_str(cstr, strlen(cstr)); +} diff --git a/shared-bindings/wifi/Network.c b/shared-bindings/wifi/Network.c index 009712ad1..0f3006f2e 100644 --- a/shared-bindings/wifi/Network.c +++ b/shared-bindings/wifi/Network.c @@ -124,6 +124,21 @@ const mp_obj_property_t wifi_network_country_obj = { (mp_obj_t)&mp_const_none_obj }, }; +//| authmode: str +//| """String id of the authmode""" +//| +STATIC mp_obj_t wifi_network_get_authmode(mp_obj_t self) { + return common_hal_wifi_network_get_authmode(self); + +} +MP_DEFINE_CONST_FUN_OBJ_1(wifi_network_get_authmode_obj, wifi_network_get_authmode); + +const mp_obj_property_t wifi_network_authmode_obj = { + .base.type = &mp_type_property, + .proxy = { (mp_obj_t)&wifi_network_get_authmode_obj, + (mp_obj_t)&mp_const_none_obj, + (mp_obj_t)&mp_const_none_obj }, +}; STATIC const mp_rom_map_elem_t wifi_network_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_ssid), MP_ROM_PTR(&wifi_network_ssid_obj) }, @@ -131,6 +146,7 @@ STATIC const mp_rom_map_elem_t wifi_network_locals_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_rssi), MP_ROM_PTR(&wifi_network_rssi_obj) }, { MP_ROM_QSTR(MP_QSTR_channel), MP_ROM_PTR(&wifi_network_channel_obj) }, { MP_ROM_QSTR(MP_QSTR_country), MP_ROM_PTR(&wifi_network_country_obj) }, + { MP_ROM_QSTR(MP_QSTR_authmode), MP_ROM_PTR(&wifi_network_authmode_obj) }, }; STATIC MP_DEFINE_CONST_DICT(wifi_network_locals_dict, wifi_network_locals_dict_table); diff --git a/shared-bindings/wifi/Network.h b/shared-bindings/wifi/Network.h index e672e3108..0f07e7b55 100644 --- a/shared-bindings/wifi/Network.h +++ b/shared-bindings/wifi/Network.h @@ -40,5 +40,6 @@ extern mp_obj_t common_hal_wifi_network_get_bssid(wifi_network_obj_t *self); extern mp_obj_t common_hal_wifi_network_get_rssi(wifi_network_obj_t *self); extern mp_obj_t common_hal_wifi_network_get_channel(wifi_network_obj_t *self); extern mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self); +extern mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self); #endif // MICROPY_INCLUDED_SHARED_BINDINGS_WIFI_NETWORK_H diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 723572a32..63f507067 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -295,7 +295,7 @@ const mp_obj_property_t wifi_radio_ipv4_dns_obj = { }; //| ap_info: Optional[Network] -//| """Network object containing BSSID, SSID, channel, country and RSSI when connected to an access point. None otherwise.""" +//| """Network object containing BSSID, SSID, authmode, channel, country and RSSI when connected to an access point. None otherwise.""" //| STATIC mp_obj_t wifi_radio_get_ap_info(mp_obj_t self) { return common_hal_wifi_radio_get_ap_info(self); -- cgit v1.2.3 From 30ed8d136cea63eda2b518c3bbdfde2d79d9bf2c Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Wed, 6 Jan 2021 00:59:12 +0000 Subject: Translated using Weblate (French) Currently translated at 100.0% (892 of 892 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 187ee6f92..e898631ea 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-01 04:29+0000\n" +"PO-Revision-Date: 2021-01-07 01:29+0000\n" "Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -2595,7 +2595,7 @@ msgstr "les données doivent être de longueur égale" #: extmod/ulab/code/ndarray.c msgid "data type not understood" -msgstr "" +msgstr "le type de donnée n'est pas reconnu" #: py/parsenum.c msgid "decimal numbers not supported" @@ -2913,7 +2913,7 @@ msgstr "les formes d'entrée et de sortie ne sont pas compatibles" #: extmod/ulab/code/ulab_create.c msgid "input argument must be an integer, a tuple, or a list" -msgstr "" +msgstr "Paramètre entrant doit être un chiffre entier, un tuple, ou une liste" #: extmod/ulab/code/fft/fft.c msgid "input array length must be power of 2" @@ -3161,7 +3161,7 @@ msgstr "maxiter devrait être > 0" #: extmod/ulab/code/numerical/numerical.c msgid "median argument must be an ndarray" -msgstr "" +msgstr "Paramètre pour median doit être un ndarray" #: py/runtime.c #, c-format @@ -3745,7 +3745,7 @@ msgstr "trop d'arguments fournis avec ce format" #: extmod/ulab/code/ulab_create.c msgid "too many dimensions" -msgstr "" +msgstr "Trop de dimensions" #: extmod/ulab/code/ndarray.c msgid "too many indices" @@ -3758,7 +3758,7 @@ msgstr "trop de valeur à dégrouper (%d attendues)" #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays" -msgstr "" +msgstr "trapz est défini pour tableaux à une dimension" #: extmod/ulab/code/approx/approx.c msgid "trapz is defined for 1D arrays of equal length" -- cgit v1.2.3 From a03f35e093e8c54da0a5781988596694c2f81e6c Mon Sep 17 00:00:00 2001 From: Dennis Schweer Date: Thu, 7 Jan 2021 15:49:14 +0000 Subject: Translated using Weblate (German) Currently translated at 84.4% (753 of 892 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/de/ --- locale/de_DE.po | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/locale/de_DE.po b/locale/de_DE.po index 0dd711999..a1d072643 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -6,20 +6,22 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2020-11-26 03:11+0000\n" -"Last-Translator: Daniel Bravo Darriba \n" +"PO-Revision-Date: 2021-01-07 18:01+0000\n" +"Last-Translator: Dennis Schweer \n" "Language: de_DE\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.4-dev\n" +"X-Generator: Weblate 4.4.1-dev\n" #: main.c msgid "" "\n" "Code done running.\n" msgstr "" +"\n" +"Programm wird ausgeführt.\n" #: main.c msgid "" @@ -129,7 +131,7 @@ msgstr "'%q' Objekt unterstützt '%q' nicht" #: py/obj.c msgid "'%q' object does not support item assignment" -msgstr "" +msgstr "'%q' Objekt unterschützt keine Elementzuweisung" #: py/obj.c msgid "'%q' object does not support item deletion" @@ -141,7 +143,7 @@ msgstr "'%q' Objekt hat kein Attribut '%q'" #: py/runtime.c msgid "'%q' object is not an iterator" -msgstr "" +msgstr "'%q' Objekt ist kein Iterator" #: py/objtype.c py/runtime.c msgid "'%q' object is not callable" @@ -235,7 +237,7 @@ msgstr "'continue' außerhalb einer Schleife" #: py/objgenerator.c msgid "'coroutine' object is not an iterator" -msgstr "" +msgstr "'coroutine' Objekt ist kein Iterator" #: py/compile.c msgid "'data' requires at least 2 arguments" @@ -307,7 +309,7 @@ msgstr "Alle I2C-Peripheriegeräte sind in Benutzung" #: ports/esp32s2/common-hal/frequencyio/FrequencyIn.c #: ports/esp32s2/common-hal/rotaryio/IncrementalEncoder.c msgid "All PCNT units in use" -msgstr "" +msgstr "Alle PCNT Einheiten sind in Benutzung" #: ports/atmel-samd/common-hal/canio/Listener.c #: ports/esp32s2/common-hal/canio/Listener.c @@ -710,7 +712,7 @@ msgstr "Konnte Kamera nicht initialisieren" #: ports/cxd56/common-hal/gnss/GNSS.c msgid "Could not initialize GNSS" -msgstr "" +msgstr "GNSS konnte nicht initialisiert werden" #: ports/cxd56/common-hal/sdioio/SDCard.c msgid "Could not initialize SDCard" @@ -837,7 +839,7 @@ msgstr "Die EZB arbeitet jeweils nur mit 16 Bytes" #: ports/esp32s2/common-hal/busio/SPI.c ports/esp32s2/common-hal/canio/CAN.c msgid "ESP-IDF memory allocation failed" -msgstr "" +msgstr "ESP-IDF Speicherallozierung fehlgeschlagen" #: ports/atmel-samd/common-hal/frequencyio/FrequencyIn.c #: ports/atmel-samd/common-hal/ps2io/Ps2.c @@ -903,7 +905,7 @@ msgstr "FFT ist nur für ndarrays definiert" #: extmod/ulab/code/fft/fft.c msgid "FFT is implemented for linear arrays only" -msgstr "" +msgstr "FFT ist nur für lineare Arrays implementiert" #: ports/esp32s2/common-hal/socketpool/Socket.c msgid "Failed SSL handshake" @@ -934,7 +936,7 @@ msgstr "Konnte keine RX Buffer mit %d allozieren" #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Failed to allocate Wifi memory" -msgstr "" +msgstr "Zuweisung des Wifi Speichers ist fehlgeschlagen" #: ports/esp32s2/common-hal/wifi/ScannedNetworks.c msgid "Failed to allocate wifi scan memory" @@ -950,7 +952,7 @@ msgstr "Verbindung nicht erfolgreich: timeout" #: ports/esp32s2/common-hal/wifi/__init__.c msgid "Failed to init wifi" -msgstr "" +msgstr "Wifi Initialisierung ist fehlgeschlagen" #: shared-module/audiomp3/MP3Decoder.c msgid "Failed to parse MP3 file" @@ -1037,7 +1039,7 @@ msgstr "I2SOut nicht verfügbar" #: ports/esp32s2/common-hal/alarm/pin/__init__.c msgid "IOs 0, 2 & 4 do not support internal pullup in sleep" -msgstr "" +msgstr "IOs 0, 2 & 4 unterstützen keinen internen Pull up im sleep-Modus" #: shared-bindings/aesio/aes.c #, c-format @@ -1058,7 +1060,7 @@ msgstr "Inkorrekte Puffergröße" #: ports/esp32s2/common-hal/watchdog/WatchDogTimer.c msgid "Initialization failed due to lack of memory" -msgstr "" +msgstr "Initialisierung aufgrund von Speichermangel fehlgeschlagen" #: ports/atmel-samd/common-hal/pulseio/PulseIn.c msgid "Input taking too long" @@ -3858,7 +3860,7 @@ msgstr "nicht unterstütztes Formatzeichen '%c' (0x%x) bei Index %d" #: py/runtime.c msgid "unsupported type for %q: '%q'" -msgstr "" +msgstr "nicht unterstützer Typ für %q: '%q'" #: py/runtime.c msgid "unsupported type for operator" @@ -3866,7 +3868,7 @@ msgstr "nicht unterstützter Typ für Operator" #: py/runtime.c msgid "unsupported types for %q: '%q', '%q'" -msgstr "" +msgstr "nicht unterstützte Typen für %q: '%q', '%q'" #: py/objint.c #, c-format @@ -3911,7 +3913,7 @@ msgstr "" #: extmod/ulab/code/vector/vectorise.c msgid "wrong input type" -msgstr "" +msgstr "falscher Eingabetyp" #: extmod/ulab/code/ulab_create.c py/objstr.c msgid "wrong number of arguments" @@ -3927,7 +3929,7 @@ msgstr "falscher Operandentyp" #: extmod/ulab/code/vector/vectorise.c msgid "wrong output type" -msgstr "" +msgstr "Falscher Ausgabetyp" #: shared-module/displayio/Shape.c msgid "x value out of bounds" -- cgit v1.2.3 From e4129ecf00071a8b7b9f2b97f0522ba6bbeb0253 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 14:40:11 -0600 Subject: Makefile: Remove POT-Creation-Date from circuitpython.pot This line is only a magnet for conflicts; the date that circuitpython.pot was modified can be extracted from git metadata. Additionally, when we add "make translate" checking to pre-commit, this will avoid spurious changes since the most straightforward implementation would otherwise update this line every time pre-commit executed. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a1807c308..adb206d7b 100644 --- a/Makefile +++ b/Makefile @@ -222,7 +222,7 @@ pseudoxml: all-source: locale/circuitpython.pot: all-source - find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o circuitpython.pot -p locale + find $(TRANSLATE_SOURCES) -type d \( $(TRANSLATE_SOURCES_EXC) \) -prune -o -type f \( -iname "*.c" -o -iname "*.h" \) -print | (LC_ALL=C sort) | xgettext -f- -L C -s --add-location=file --keyword=translate -o - | sed -e '/"POT-Creation-Date: /d' > $@ # Historically, `make translate` updated the .pot file and ran msgmerge. # However, this was a frequent source of merge conflicts. Weblate can perform -- cgit v1.2.3 From e79ee785ac45abc1ee53d9cdbfd30f2290ee7bd9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 14:40:51 -0600 Subject: circuitpython.pot: regenerate without timestamp --- locale/circuitpython.pot | 1 - 1 file changed, 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index f319b82f8..63dc92d18 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,6 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-01-04 12:55-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" -- cgit v1.2.3 From 1dda33dc418cae1a0047df0241762ebdb3d87e8a Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 14:41:11 -0600 Subject: pre-commit: Add checking of 'make translate' status .. when this check completes with an error, circuitpython.pot has been updated and the changes can be staged. --- .pre-commit-config.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 322f37da4..82d89eaa3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,3 +11,10 @@ repos: exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/esp32s2/esp-idf-config/.*|ports/esp32s2/boards/.*/sdkconfig)' - id: trailing-whitespace exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)' +- repo: local + hooks: + - id: translations + name: Check Translations + entry: sh -c "make translate" + language: system + always_run: true -- cgit v1.2.3 From 7bb196b9d2133477bf967d6b1d5dafe0971f765f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 15:01:33 -0600 Subject: esp32s2: 'make flash': Allow customizing the esptool flags This can be useful so that e.g., on a Kaluga when programming via the FTDI chip, you can override the variable to specify "--after=hard_reset" to automatically return to running CircuitPython, choose a different baud rate (921600 is about 2s faster than 460800), etc: make BOARD=espressif_kaluga_1 ESPTOOL_FLAGS="-b 921600 --before=default_reset --after=hard_reset" --- ports/esp32s2/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 4a334a2eb..88bc8ce63 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -300,6 +300,8 @@ ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld $(BUILD)/esp-id FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE) +ESPTOOL_FLAGS ?= -b 460800 --before=default_reset --after=no_reset write_flash + all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 .PHONY: esp-idf-stamp @@ -338,10 +340,10 @@ $(BUILD)/firmware.uf2: $(BUILD)/circuitpython-firmware.bin $(Q)$(PYTHON3) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xbfdd4eee -b 0x0000 -c -o $@ $^ flash: $(BUILD)/firmware.bin - esptool.py --chip esp32s2 -p $(PORT) -b 460800 --before=default_reset --after=no_reset write_flash $(FLASH_FLAGS) 0x0000 $^ + esptool.py --chip esp32s2 -p $(PORT) $(ESPTOOL_FLAGS) write_flash $(FLASH_FLAGS) 0x0000 $^ flash-circuitpython-only: $(BUILD)/circuitpython-firmware.bin - esptool.py --chip esp32s2 -p $(PORT) -b 460800 --before=default_reset --after=no_reset write_flash $(FLASH_FLAGS) 0x10000 $^ + esptool.py --chip esp32s2 -p $(PORT) $(ESPTOOL_FLAGS) write_flash $(FLASH_FLAGS) 0x10000 $^ include $(TOP)/py/mkrules.mk -- cgit v1.2.3 From 115f3e08677520806b95dfc92e4462d119854023 Mon Sep 17 00:00:00 2001 From: BennyE Date: Thu, 7 Jan 2021 23:05:16 +0100 Subject: Updated code as per helpful suggestion --- ports/esp32s2/common-hal/wifi/Network.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index 0289ad4eb..83c675a19 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -56,34 +56,34 @@ mp_obj_t common_hal_wifi_network_get_country(wifi_network_obj_t *self) { } mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { - char authmode[16]; + const char* authmode = ""; switch (self->record.authmode) { case WIFI_AUTH_OPEN: - strcpy(authmode, "OPEN"); + authmode = "OPEN"; break; case WIFI_AUTH_WEP: - strcpy(authmode, "WEP"); + authmode = "WEP"; break; case WIFI_AUTH_WPA_PSK: - strcpy(authmode, "WPA_PSK"); + authmode = "WPA_PSK"; break; case WIFI_AUTH_WPA2_PSK: - strcpy(authmode, "WPA2_PSK"); + authmode = "WPA2_PSK"; break; case WIFI_AUTH_WPA_WPA2_PSK: - strcpy(authmode, "WPA_WPA2_PSK"); + authmode = "WPA_WPA2_PSK"; break; case WIFI_AUTH_WPA2_ENTERPRISE: - strcpy(authmode, "WPA2_ENTERPRISE"); + authmode = "WPA2_ENTERPRISE"; break; case WIFI_AUTH_WPA3_PSK: - strcpy(authmode, "WPA3_PSK"); + authmode = "WPA3_PSK"; break; case WIFI_AUTH_WPA2_WPA3_PSK: - strcpy(authmode, "WPA2_WPA3_PSK"); + authmode = "WPA2_WPA3_PSK"; break; default: - strcpy(authmode, "UNKNOWN"); + authmode = "UNKNOWN"; break; } const char* cstr = (const char*) authmode; -- cgit v1.2.3 From 010a4e7b0fefbee12f8139f7c5c13436545bb1eb Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 16:23:21 -0600 Subject: esp32s2: port: Ensure JTAG pins are available for debugging --- ports/esp32s2/supervisor/port.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index ead12003d..a6b6a82aa 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -111,6 +111,14 @@ safe_mode_t port_init(void) { heap = NULL; never_reset_module_internal_pins(); + #if defined(DEBUG) || defined(ENABLE_JTAG) + // JTAG + common_hal_never_reset_pin(&pin_GPIO39); + common_hal_never_reset_pin(&pin_GPIO40); + common_hal_never_reset_pin(&pin_GPIO41); + common_hal_never_reset_pin(&pin_GPIO42); + #endif + #ifdef CONFIG_SPIRAM heap = (uint32_t*) (DRAM0_CACHE_ADDRESS_HIGH - CONFIG_SPIRAM_SIZE); heap_size = CONFIG_SPIRAM_SIZE / sizeof(uint32_t); -- cgit v1.2.3 From 352226402c6b897ec9dc776a61cff3330b8a40df Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 16:28:33 -0600 Subject: esp32s2: i2s: fix accounting for "stretched" frames --- ports/esp32s2/i2s_common.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index 1933665a3..24ded295f 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -103,9 +103,9 @@ static void i2s_fill_buffer(i2s_t *self) { } } else { #define STACK_BUFFER_SIZE (64) - size_t bytes_per_frame = self->channel_count * self->bytes_per_sample; - size_t framecount = MIN(STACK_BUFFER_SIZE / bytes_per_frame, bytecount); - int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; + const size_t bytes_per_output_frame = 4; + size_t bytes_per_input_frame = self->channel_count * self->bytes_per_sample; + size_t framecount = MIN(STACK_BUFFER_SIZE / bytes_per_output_frame, bytecount / bytes_per_input_frame); if (self->samples_signed) { assert(self->channel_count == 1); if (self->bytes_per_sample == 1) { @@ -129,9 +129,9 @@ static void i2s_fill_buffer(i2s_t *self) { } } size_t expanded_bytes_written = 0; - ESP_CALL_RAISE(i2s_write(self->instance, signed_samples, 4*framecount, &expanded_bytes_written, 0)); + ESP_CALL_RAISE(i2s_write(self->instance, signed_samples, bytes_per_output_frame*framecount, &expanded_bytes_written, 0)); assert(expanded_bytes_written % 4 == 0); - bytes_written = expanded_bytes_written / 4 * bytes_per_frame; + bytes_written = expanded_bytes_written / bytes_per_output_frame * bytes_per_input_frame; } self->sample_data += bytes_written; // We have filled the DMA buffer @@ -181,6 +181,10 @@ void port_i2s_allocate_init(i2s_t *self, bool left_justified) { void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { + if (common_hal_audiobusio_i2sout_get_playing(self)) { + common_hal_audiobusio_i2sout_stop(self); + } + self->sample = sample; self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8; self->channel_count = audiosample_channel_count(sample); -- cgit v1.2.3 From d3afda61d8172ad6ec8706782c397d9cd52c3edc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 16:29:08 -0600 Subject: esp32s2: i2s: must reset buffer, otherwise wave samples don't start .. and other housekeeping when starting to play a sample --- ports/esp32s2/i2s_common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index 24ded295f..d5c0facaa 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -186,6 +186,7 @@ void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { } self->sample = sample; + self->loop = loop; self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8; self->channel_count = audiosample_channel_count(sample); bool single_buffer; @@ -195,12 +196,15 @@ void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { audiosample_get_buffer_structure(sample, false, &single_buffer, &samples_signed, &max_buffer_length, &spacing); self->samples_signed = samples_signed; - self->loop = loop; self->playing = true; self->paused = false; self->stopping = false; + self->sample_data = self->sample_end = NULL; // We always output stereo so output twice as many bits. // uint16_t bits_per_sample_output = bits_per_sample * 2; + + audiosample_reset_buffer(self->sample, false, 0); + ESP_CALL_RAISE(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); i2s_fill_buffer(self); } -- cgit v1.2.3 From cfd8288dfa0a27bd727e3877659d9bbb990dd1ce Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 7 Jan 2021 16:29:52 -0600 Subject: esp2s2: enlarge stack-buffer, use it instead of i2s_zero_dma_buffer .. it's not clear that there was a problem with i2s_zero_dma_buffer, but just in case. --- ports/esp32s2/i2s_common.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index d5c0facaa..ca2a3b93e 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -24,6 +24,8 @@ * THE SOFTWARE. */ +#include + #include "py/runtime.h" #include "i2s_common.h" @@ -69,8 +71,17 @@ static void i2s_fill_buffer(i2s_t *self) { if (self->instance < 0 || self->instance >= I2S_NUM_MAX) { return; } - if (self->paused || !self->sample) { - i2s_zero_dma_buffer(self->instance); +#define STACK_BUFFER_SIZE (512) + int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; +mp_printf(&mp_plat_print, "playing=%d paused=%d stopping=%d sample@%p sample_data=%p..%p\n", self->playing, self->paused, self->stopping, self->sample, self->sample_data, self->sample_end); + + if (!self->playing || self->paused || !self->sample) { + memset(signed_samples, 0, sizeof(signed_samples)); + + size_t bytes_written = 0; + do { + ESP_CALL_RAISE(i2s_write(self->instance, signed_samples, sizeof(signed_samples), &bytes_written, 0)); + } while (bytes_written != 0); return; } while (!self->stopping) { @@ -102,7 +113,6 @@ static void i2s_fill_buffer(i2s_t *self) { ESP_CALL_RAISE(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, 0)); } } else { -#define STACK_BUFFER_SIZE (64) const size_t bytes_per_output_frame = 4; size_t bytes_per_input_frame = self->channel_count * self->bytes_per_sample; size_t framecount = MIN(STACK_BUFFER_SIZE / bytes_per_output_frame, bytecount / bytes_per_input_frame); -- cgit v1.2.3 From 873a300d02316ca8b6d227574613385acc3df6b9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 08:46:41 -0600 Subject: i2s_fill_buffer: Need to fill with zeros when stopping --- ports/esp32s2/i2s_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index ca2a3b93e..5316c8088 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -75,7 +75,7 @@ static void i2s_fill_buffer(i2s_t *self) { int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; mp_printf(&mp_plat_print, "playing=%d paused=%d stopping=%d sample@%p sample_data=%p..%p\n", self->playing, self->paused, self->stopping, self->sample, self->sample_data, self->sample_end); - if (!self->playing || self->paused || !self->sample) { + if (!self->playing || self->paused || !self->sample || self->stopping) { memset(signed_samples, 0, sizeof(signed_samples)); size_t bytes_written = 0; -- cgit v1.2.3 From 0b7a4c4b2b7e6e56e40100ab1e85d79b8a93ef33 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 08:46:56 -0600 Subject: i2s_fill_buffer: remove debug print --- ports/esp32s2/i2s_common.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index 5316c8088..a58bdc23b 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -73,7 +73,6 @@ static void i2s_fill_buffer(i2s_t *self) { } #define STACK_BUFFER_SIZE (512) int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; -mp_printf(&mp_plat_print, "playing=%d paused=%d stopping=%d sample@%p sample_data=%p..%p\n", self->playing, self->paused, self->stopping, self->sample, self->sample_data, self->sample_end); if (!self->playing || self->paused || !self->sample || self->stopping) { memset(signed_samples, 0, sizeof(signed_samples)); -- cgit v1.2.3 From 12264cca34179c2e3bafad49145c9af3f827fa0f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 08:47:13 -0600 Subject: port_i2s_play: remove build error --- ports/esp32s2/i2s_common.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index a58bdc23b..a948ee0f5 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -190,10 +190,6 @@ void port_i2s_allocate_init(i2s_t *self, bool left_justified) { void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { - if (common_hal_audiobusio_i2sout_get_playing(self)) { - common_hal_audiobusio_i2sout_stop(self); - } - self->sample = sample; self->loop = loop; self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8; -- cgit v1.2.3 From 430bcdb59d47fc89c7788aeb300027bcf4e00bf2 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 08:49:25 -0600 Subject: port_i2s_play: fill the initial buffer via background callback There were _possibly_ problems where this routine was being entered by direct call AND by background callback. Schedule the work here, and it will be done almost immediately, without worry about interference. I don't know if this is strictly necessary, but it doesn't hurt. Since the I2S clock is being run all the time, we have to enter the background task to fill the FIFO with zeros constantly anyway. --- ports/esp32s2/i2s_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index a948ee0f5..552fe7424 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -211,7 +211,8 @@ void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { audiosample_reset_buffer(self->sample, false, 0); ESP_CALL_RAISE(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); - i2s_fill_buffer(self); + + background_callback_add(&self->callback, i2s_callback_fun, self); } bool port_i2s_playing(i2s_t *self) { -- cgit v1.2.3 From 5f0e41ad601664b37c109a5d84b2a6031a4a740f Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 09:01:34 -0600 Subject: I2SOut: Enable ticks during audio playback .. otherwise, the background callback to load the I2S fifos does not get run. (I'm not sure this is _correct_ behavior of sleep + background tasks, but it is the current behavior) --- ports/esp32s2/common-hal/audiobusio/I2SOut.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/esp32s2/common-hal/audiobusio/I2SOut.c b/ports/esp32s2/common-hal/audiobusio/I2SOut.c index be5b04fa9..694cab49d 100644 --- a/ports/esp32s2/common-hal/audiobusio/I2SOut.c +++ b/ports/esp32s2/common-hal/audiobusio/I2SOut.c @@ -63,6 +63,8 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self, self->bit_clock = bit_clock; self->word_select = word_select; self->data = data; + + supervisor_enable_tick(); } bool common_hal_audiobusio_i2sout_deinited(audiobusio_i2sout_obj_t* self) { @@ -93,6 +95,8 @@ void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t* self) { port_i2s_reset_instance(self->peripheral.instance); } self->peripheral.instance = -1; + + supervisor_disable_tick(); } void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self, -- cgit v1.2.3 From 39c166ba6a72d6e95aaf2865ff3e7cade39d04a2 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 8 Jan 2021 13:30:11 -0500 Subject: update tinyusb; _ticks_enabled only for SAMD21 --- lib/tinyusb | 2 +- ports/atmel-samd/supervisor/port.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/tinyusb b/lib/tinyusb index 218b80e63..cfcffe94c 160000 --- a/lib/tinyusb +++ b/lib/tinyusb @@ -1 +1 @@ -Subproject commit 218b80e63ab6ff87c1851e403f08b3d716d68f5e +Subproject commit cfcffe94ce62f5ef1fb5aef4641924d64dc4b1c0 diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index b9977fdc4..02b9e3874 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -429,7 +429,9 @@ uint32_t port_get_saved_word(void) { // TODO: Move this to an RTC backup register so we can preserve it when only the BACKUP power domain // is enabled. static volatile uint64_t overflowed_ticks = 0; +#ifdef SAMD21 static volatile bool _ticks_enabled = false; +#endif static uint32_t _get_count(uint64_t* overflow_count) { #ifdef SAM_D5X_E5X @@ -537,9 +539,11 @@ void port_disable_tick(void) { // they'll wake us up earlier. If we don't, we'll mess up ticks by overwriting // the next RTC wake up time. void port_interrupt_after_ticks(uint32_t ticks) { + #ifdef SAMD21 if (_ticks_enabled) { return; } + #endif _port_interrupt_after_ticks(ticks); } -- cgit v1.2.3 From 7556f38f04d641445a484133696664fc781a5c58 Mon Sep 17 00:00:00 2001 From: jerryneedell Date: Fri, 8 Jan 2021 14:40:06 -0500 Subject: initialize LDO2 in board_init() --- ports/esp32s2/boards/unexpectedmaker_feathers2/board.c | 8 ++++++++ ports/esp32s2/common-hal/microcontroller/Pin.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c index d8fd3a0a2..ac08190a5 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c @@ -27,6 +27,8 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" +#include "components/driver/include/driver/gpio.h" +#include "components/soc/include/hal/gpio_hal.h" void board_init(void) { // USB @@ -47,6 +49,12 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO30); common_hal_never_reset_pin(&pin_GPIO31); common_hal_never_reset_pin(&pin_GPIO32); + + + // Add LDO2 to never reset list, set to output and enable + common_hal_never_reset_pin(&pin_GPIO21); + gpio_set_direction(pin_GPIO21.number, GPIO_MODE_DEF_OUTPUT); + gpio_set_level(pin_GPIO21.number, true); } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index fd01d68e1..66677d1ea 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -171,7 +171,8 @@ bool pin_number_is_free(gpio_num_t pin_number) { uint8_t offset = pin_number / 32; uint32_t mask = 1 << (pin_number % 32); - return (never_reset_pins[offset] & mask) == 0 && (in_use[offset] & mask) == 0; + //return (never_reset_pins[offset] & mask) == 0 && (in_use[offset] & mask) == 0; + return (in_use[offset] & mask) == 0; } bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { -- cgit v1.2.3 From de5b138dcffce7c8f7cf8d30321713ee82ce995c Mon Sep 17 00:00:00 2001 From: jerryneedell Date: Fri, 8 Jan 2021 14:46:37 -0500 Subject: remove commented line --- ports/esp32s2/common-hal/microcontroller/Pin.c | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 66677d1ea..6889720e8 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -171,7 +171,6 @@ bool pin_number_is_free(gpio_num_t pin_number) { uint8_t offset = pin_number / 32; uint32_t mask = 1 << (pin_number % 32); - //return (never_reset_pins[offset] & mask) == 0 && (in_use[offset] & mask) == 0; return (in_use[offset] & mask) == 0; } -- cgit v1.2.3 From 06ab848a0d78594d17b49022174bf0e023b68c60 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Fri, 8 Jan 2021 16:48:25 -0600 Subject: added platform --- ports/esp32s2/mpconfigport.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ports/esp32s2/mpconfigport.h b/ports/esp32s2/mpconfigport.h index db7393d8e..9c0fd9da3 100644 --- a/ports/esp32s2/mpconfigport.h +++ b/ports/esp32s2/mpconfigport.h @@ -32,6 +32,7 @@ #define MICROPY_PY_UJSON (1) #define MICROPY_USE_INTERNAL_PRINTF (0) +#define MICROPY_PY_SYS_PLATFORM "Espressif ESP32-S2" #include "py/circuitpy_mpconfig.h" -- cgit v1.2.3 From 7b4558b750df85026e1801bb661343101da9df5a Mon Sep 17 00:00:00 2001 From: Caio Henrique de Queiroz Katayama Date: Fri, 8 Jan 2021 19:17:17 -0500 Subject: Fix socket.recvfrom_into() --- ports/esp32s2/common-hal/socketpool/Socket.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ports/esp32s2/common-hal/socketpool/Socket.c b/ports/esp32s2/common-hal/socketpool/Socket.c index 32c5fc72f..5e943f8fd 100644 --- a/ports/esp32s2/common-hal/socketpool/Socket.c +++ b/ports/esp32s2/common-hal/socketpool/Socket.c @@ -178,7 +178,7 @@ mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* se struct sockaddr_in source_addr; socklen_t socklen = sizeof(source_addr); - int bytes_received = lwip_recvfrom(self->num, buf, len - 1, 0, (struct sockaddr *)&source_addr, &socklen); + int bytes_received = lwip_recvfrom(self->num, buf, len, 0, (struct sockaddr *)&source_addr, &socklen); memcpy((void *)ip, (void*)&source_addr.sin_addr.s_addr, sizeof source_addr.sin_addr.s_addr); *port = source_addr.sin_port; @@ -186,10 +186,9 @@ mp_uint_t common_hal_socketpool_socket_recvfrom_into(socketpool_socket_obj_t* se if (bytes_received < 0) { mp_raise_BrokenPipeError(); return 0; - } else { - buf[bytes_received] = 0; // Null-terminate whatever we received - return bytes_received; } + + return bytes_received; } void common_hal_socketpool_socket_close(socketpool_socket_obj_t* self) { -- cgit v1.2.3 From 96dd3d3fef30ce632312ba592b84e2b9f5d84399 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 18:21:27 -0600 Subject: ensure gettext program is available to pre-commit --- .github/workflows/pre-commit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 8caf56d26..20c76c124 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -15,6 +15,8 @@ jobs: steps: - uses: actions/checkout@v1 - uses: actions/setup-python@v1 + - name: Install deps + run: sudo apt-get update && sudo apt-get install -y gettext - name: set PY run: echo >>$GITHUB_ENV PY="$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" - uses: actions/cache@v1 -- cgit v1.2.3 From 288c54c70a8b6a6682ae9ac8c0a5483c3968d433 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 8 Jan 2021 18:54:02 -0600 Subject: need to find strings in ulab --- .github/workflows/pre-commit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 20c76c124..af62072c8 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -17,6 +17,8 @@ jobs: - uses: actions/setup-python@v1 - name: Install deps run: sudo apt-get update && sudo apt-get install -y gettext + - name: Populate selected submodules + run: git submodule update --init extmod/ulab - name: set PY run: echo >>$GITHUB_ENV PY="$(python -c 'import hashlib, sys;print(hashlib.sha256(sys.version.encode()+sys.executable.encode()).hexdigest())')" - uses: actions/cache@v1 -- cgit v1.2.3 From dd10c534c526b8c8709127e7f13fbdad71a47c39 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 8 Jan 2021 22:32:23 -0500 Subject: restore len(alarm.sleep_memory) and bool(alarm.sleep_memory) --- shared-bindings/alarm/SleepMemory.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/shared-bindings/alarm/SleepMemory.c b/shared-bindings/alarm/SleepMemory.c index bec0b7665..aed24827a 100644 --- a/shared-bindings/alarm/SleepMemory.c +++ b/shared-bindings/alarm/SleepMemory.c @@ -53,6 +53,25 @@ //| """Not used. Access the sole instance through `alarm.sleep_memory`.""" //| ... //| +//| def __bool__(self) -> bool: +//| """``sleep_memory`` is ``True`` if its length is greater than zero. +//| This is an easy way to check for its existence. +//| """ +//| ... +//| +//| def __len__(self) -> int: +//| """Return the length. This is used by (`len`)""" +//| ... +//| +STATIC mp_obj_t alarm_sleep_memory_unary_op(mp_unary_op_t op, mp_obj_t self_in) { + alarm_sleep_memory_obj_t *self = MP_OBJ_TO_PTR(self_in); + uint16_t len = common_hal_alarm_sleep_memory_get_length(self); + switch (op) { + case MP_UNARY_OP_BOOL: return mp_obj_new_bool(len != 0); + case MP_UNARY_OP_LEN: return MP_OBJ_NEW_SMALL_INT(len); + default: return MP_OBJ_NULL; // op not supported + } +} STATIC const mp_rom_map_elem_t alarm_sleep_memory_locals_dict_table[] = { }; @@ -154,6 +173,7 @@ const mp_obj_type_t alarm_sleep_memory_type = { { &mp_type_type }, .name = MP_QSTR_SleepMemory, .subscr = alarm_sleep_memory_subscr, + .unary_op = alarm_sleep_memory_unary_op, .print = NULL, .locals_dict = (mp_obj_t)&alarm_sleep_memory_locals_dict, }; -- cgit v1.2.3 From 255ffa979cd62063bcbabbc64e3c4fb8d1c0f216 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Fri, 8 Jan 2021 22:16:58 -0500 Subject: avoid inline compile errors --- py/circuitpy_defns.mk | 8 ++++++++ supervisor/shared/translate.c | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/py/circuitpy_defns.mk b/py/circuitpy_defns.mk index d6d192a95..8e8751036 100644 --- a/py/circuitpy_defns.mk +++ b/py/circuitpy_defns.mk @@ -58,6 +58,14 @@ BASE_CFLAGS = \ # -H +# Set a global CIRCUITPY_DEBUG flag. +# Don't just call it "DEBUG": too many libraries use plain DEBUG. +ifneq ($(DEBUG),) +CFLAGS += -DCIRCUITPY_DEBUG=$(DEBUG) +else +CFLAGS += -DCIRCUITPY_DEBUG=0 +endif + ### # Handle frozen modules. diff --git a/supervisor/shared/translate.c b/supervisor/shared/translate.c index 44544c98d..8bd3c5acd 100644 --- a/supervisor/shared/translate.c +++ b/supervisor/shared/translate.c @@ -122,7 +122,12 @@ char* decompress(const compressed_string_t* compressed, char* decompressed) { return decompressed; } -inline __attribute__((always_inline)) const compressed_string_t* translate(const char* original) { +inline +// gcc10 -flto has issues with this being always_inline for debug builds. +#if CIRCUITPY_DEBUG < 1 + __attribute__((always_inline)) +#endif +const compressed_string_t* translate(const char* original) { #ifndef NO_QSTR #define QDEF(id, str) #define TRANSLATION(id, firstbyte, ...) if (strcmp(original, id) == 0) { static const compressed_string_t v = { .data = firstbyte, .tail = { __VA_ARGS__ } }; return &v; } else -- cgit v1.2.3 From 13efbf24e58b2be940cad44e4f0816d6daa67202 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sat, 9 Jan 2021 10:33:56 -0600 Subject: disable msgpack on boards without room --- ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.mk | 1 + ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk | 1 + ports/nrf/boards/pca10100/mpconfigboard.mk | 1 + 3 files changed, 3 insertions(+) diff --git a/ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.mk b/ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.mk index a63f14274..8773c5771 100644 --- a/ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.mk +++ b/ports/atmel-samd/boards/qtpy_m0_haxpress/mpconfigboard.mk @@ -17,6 +17,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 SUPEROPT_GC = 0 diff --git a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk index 704d26514..734be2d14 100644 --- a/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk +++ b/ports/atmel-samd/boards/stackrduino_m0_pro/mpconfigboard.mk @@ -16,6 +16,7 @@ CIRCUITPY_BITBANGIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_COUNTIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_VECTORIO = 0 CIRCUITPY_BUSDEVICE = 0 diff --git a/ports/nrf/boards/pca10100/mpconfigboard.mk b/ports/nrf/boards/pca10100/mpconfigboard.mk index 86ba65454..76d15e608 100644 --- a/ports/nrf/boards/pca10100/mpconfigboard.mk +++ b/ports/nrf/boards/pca10100/mpconfigboard.mk @@ -15,6 +15,7 @@ CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_FREQUENCYIO = 0 CIRCUITPY_I2CPERIPHERAL = 0 +CIRCUITPY_MSGPACK = 0 CIRCUITPY_NEOPIXEL_WRITE = 0 CIRCUITPY_NVM = 0 CIRCUITPY_PIXELBUF = 0 -- cgit v1.2.3 From 999ee68e12877e6b2188a821fd43efc1567279fe Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 12:22:53 -0500 Subject: try adding new feather def --- .github/workflows/build.yml | 1 + .../adafruit_feather_esp32s2_nopsram/board.c | 47 ++++++++++++++++ .../mpconfigboard.h | 46 ++++++++++++++++ .../mpconfigboard.mk | 17 ++++++ .../boards/adafruit_feather_esp32s2_nopsram/pins.c | 63 ++++++++++++++++++++++ .../adafruit_feather_esp32s2_nopsram/sdkconfig | 0 6 files changed, 174 insertions(+) create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/sdkconfig diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b6c80558e..8c44edc89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -422,6 +422,7 @@ jobs: matrix: board: - "adafruit_esp32s2_eink_portal" + - "adafruit_feather_esp32s2_nopsram" - "adafruit_metro_esp32s2" - "electroniccats_bastwifi" - "espressif_kaluga_1" diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c new file mode 100644 index 000000000..9f708874b --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c @@ -0,0 +1,47 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "boards/board.h" +#include "mpconfigboard.h" +#include "shared-bindings/microcontroller/Pin.h" + +void board_init(void) { + // USB + common_hal_never_reset_pin(&pin_GPIO19); + common_hal_never_reset_pin(&pin_GPIO20); + + // Debug UART + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h new file mode 100644 index 000000000..b63524abe --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h @@ -0,0 +1,46 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +//Micropython setup + +#define MICROPY_HW_BOARD_NAME "Feather ESP32S2 without PSRAM" +#define MICROPY_HW_MCU_NAME "ESP32S2" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO33) + +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") + +#define AUTORESET_DELAY_MS 500 + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) + diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk new file mode 100644 index 000000000..2d22b726a --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk @@ -0,0 +1,17 @@ +USB_VID = 0x239A +USB_PID = 0x80EC +USB_PRODUCT = "Feather ESP32S2 no PSRAM" +USB_MANUFACTURER = "Adafruit" + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=40m +CIRCUITPY_ESP_FLASH_SIZE=4MB + +CIRCUITPY_MODULE=wroom diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c new file mode 100644 index 000000000..bf14d81ae --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c @@ -0,0 +1,63 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + + + { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/sdkconfig b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/sdkconfig new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3 From 813fa671f34484caf592b41fcf4b4b9e20e07e26 Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 12:29:08 -0500 Subject: nowhitespace --- ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h | 1 - 1 file changed, 1 deletion(-) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h index b63524abe..9d95e8e43 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h @@ -43,4 +43,3 @@ #define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) #define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) #define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) - -- cgit v1.2.3 From 7de1da45dacfa446b034b0cf65c98dadf0ab7272 Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 13:23:17 -0500 Subject: woops out of sync header, plus... i dunno add some frozen modules cause we have almost no RAM :( --- ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c | 2 +- .../esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c index 9f708874b..b8fbf34d6 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c @@ -24,7 +24,7 @@ * THE SOFTWARE. */ -#include "boards/board.h" +#include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk index 2d22b726a..bf44d1687 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk @@ -15,3 +15,8 @@ CIRCUITPY_ESP_FLASH_FREQ=40m CIRCUITPY_ESP_FLASH_SIZE=4MB CIRCUITPY_MODULE=wroom + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register \ No newline at end of file -- cgit v1.2.3 From 301facf102b6e65b427492976116c6fb114c30db Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 13:36:21 -0500 Subject: newline --- ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk index bf44d1687..3290f8cae 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.mk @@ -19,4 +19,4 @@ CIRCUITPY_MODULE=wroom FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register \ No newline at end of file +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register -- cgit v1.2.3 From a600fd3478c0f3851e384507817b853608439de3 Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 14:01:58 -0500 Subject: forgot deinit --- ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c index b8fbf34d6..aaef97c7d 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/board.c @@ -34,8 +34,10 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO20); // Debug UART +#ifdef DEBUG common_hal_never_reset_pin(&pin_GPIO43); common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ } bool board_requests_safe_mode(void) { @@ -45,3 +47,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} -- cgit v1.2.3 From 10861b403881c96cc7da6d1b8c6e80b40332fee7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 9 Jan 2021 13:41:44 -0600 Subject: esp32s2: Rename ESP_CALL_RAISE to CHECK_ESP_RESULT Suggested by @tannewt, thanks! --- ports/esp32s2/bindings/espidf/__init__.h | 2 +- ports/esp32s2/common-hal/audiobusio/I2SOut.c | 2 +- ports/esp32s2/i2s_common.c | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ports/esp32s2/bindings/espidf/__init__.h b/ports/esp32s2/bindings/espidf/__init__.h index 5ff49970d..9248b01ac 100644 --- a/ports/esp32s2/bindings/espidf/__init__.h +++ b/ports/esp32s2/bindings/espidf/__init__.h @@ -37,6 +37,6 @@ extern const mp_obj_type_t mp_type_espidf_MemoryError; NORETURN void mp_raise_espidf_MemoryError(void); void raise_esp_error(esp_err_t err) NORETURN; -#define ESP_CALL_RAISE(x) do { int res = (x); if(res != ESP_OK) raise_esp_error(res); } while(0) +#define CHECK_ESP_RESULT(x) do { int res = (x); if(res != ESP_OK) raise_esp_error(res); } while(0) #endif // MICROPY_INCLUDED_ESP32S2_BINDINGS_ESPIDF___INIT___H diff --git a/ports/esp32s2/common-hal/audiobusio/I2SOut.c b/ports/esp32s2/common-hal/audiobusio/I2SOut.c index 694cab49d..ee16c6ca8 100644 --- a/ports/esp32s2/common-hal/audiobusio/I2SOut.c +++ b/ports/esp32s2/common-hal/audiobusio/I2SOut.c @@ -59,7 +59,7 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self, .data_out_num = data->number, .data_in_num = I2S_PIN_NO_CHANGE, }; - ESP_CALL_RAISE(i2s_set_pin(self->peripheral.instance, &i2s_pin_config)); + CHECK_ESP_RESULT(i2s_set_pin(self->peripheral.instance, &i2s_pin_config)); self->bit_clock = bit_clock; self->word_select = word_select; self->data = data; diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c index 552fe7424..f967e9a09 100644 --- a/ports/esp32s2/i2s_common.c +++ b/ports/esp32s2/i2s_common.c @@ -79,7 +79,7 @@ static void i2s_fill_buffer(i2s_t *self) { size_t bytes_written = 0; do { - ESP_CALL_RAISE(i2s_write(self->instance, signed_samples, sizeof(signed_samples), &bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, sizeof(signed_samples), &bytes_written, 0)); } while (bytes_written != 0); return; } @@ -107,9 +107,9 @@ static void i2s_fill_buffer(i2s_t *self) { size_t bytecount = self->sample_end - self->sample_data; if (self->samples_signed && self->channel_count == 2) { if (self->bytes_per_sample == 2) { - ESP_CALL_RAISE(i2s_write(self->instance, self->sample_data, bytecount, &bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write(self->instance, self->sample_data, bytecount, &bytes_written, 0)); } else { - ESP_CALL_RAISE(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, 0)); } } else { const size_t bytes_per_output_frame = 4; @@ -138,7 +138,7 @@ static void i2s_fill_buffer(i2s_t *self) { } } size_t expanded_bytes_written = 0; - ESP_CALL_RAISE(i2s_write(self->instance, signed_samples, bytes_per_output_frame*framecount, &expanded_bytes_written, 0)); + CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, bytes_per_output_frame*framecount, &expanded_bytes_written, 0)); assert(expanded_bytes_written % 4 == 0); bytes_written = expanded_bytes_written / bytes_per_output_frame * bytes_per_input_frame; } @@ -179,7 +179,7 @@ void port_i2s_allocate_init(i2s_t *self, bool left_justified) { .dma_buf_len = 128, // in _frames_, so 128 is 512 bytes per dma buf .use_apll = false, }; - ESP_CALL_RAISE(i2s_driver_install(self->instance, &i2s_config, I2S_QUEUE_SIZE, &i2s_queues[self->instance])); + CHECK_ESP_RESULT(i2s_driver_install(self->instance, &i2s_config, I2S_QUEUE_SIZE, &i2s_queues[self->instance])); if (!xTaskCreate(i2s_event_task, "I2S_task", 3 * configMINIMAL_STACK_SIZE, self, CONFIG_PTHREAD_TASK_PRIO_DEFAULT, &i2s_tasks[self->instance])) { mp_raise_OSError_msg(translate("xTaskCreate failed")); @@ -210,7 +210,7 @@ void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { audiosample_reset_buffer(self->sample, false, 0); - ESP_CALL_RAISE(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); + CHECK_ESP_RESULT(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); background_callback_add(&self->callback, i2s_callback_fun, self); } @@ -233,13 +233,13 @@ void port_i2s_stop(i2s_t *self) { void port_i2s_pause(i2s_t *self) { if (!self->paused) { self->paused = true; - ESP_CALL_RAISE(i2s_stop(self->instance)); + CHECK_ESP_RESULT(i2s_stop(self->instance)); } } void port_i2s_resume(i2s_t *self) { if (self->paused) { self->paused = false; - ESP_CALL_RAISE(i2s_start(self->instance)); + CHECK_ESP_RESULT(i2s_start(self->instance)); } } -- cgit v1.2.3 From 4735cf4747764f0694e1285085e99f06a7a11a81 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 9 Jan 2021 13:48:36 -0600 Subject: esp32s2: audiobusio: move i2s_common inside Originally, I believed the implementation might be shared with AudioOut, as on the ESP32 (non-S2) the I2S peripheral was also used to drive the DAC. However, this is not the case on ESP32-S2 and appears it will not be the case with the ESP32-S3 or -C3, to the extent that there's skeletal support for either of them in esp-idf master branch. However, it could still be shared by I2SIn or PDMIn (the latter being hypothetically implemented as I2SIn + digital postprocessing like we did in the atmel-sam port, to my understanding), so I moved it to the common-hal folder. --- ports/esp32s2/Makefile | 1 - ports/esp32s2/common-hal/audiobusio/I2SOut.h | 2 +- ports/esp32s2/common-hal/audiobusio/__init__.c | 245 +++++++++++++++++++++++++ ports/esp32s2/common-hal/audiobusio/__init__.h | 61 ++++++ ports/esp32s2/i2s_common.c | 245 ------------------------- ports/esp32s2/i2s_common.h | 61 ------ ports/esp32s2/supervisor/port.c | 2 +- 7 files changed, 308 insertions(+), 309 deletions(-) delete mode 100644 ports/esp32s2/i2s_common.c delete mode 100644 ports/esp32s2/i2s_common.h diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 88bc8ce63..9827b555c 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -175,7 +175,6 @@ CFLAGS += -DCFG_TUSB_MCU=OPT_MCU_ESP32S2 -DCFG_TUSB_OS=OPT_OS_FREERTOS -DCFG_TUD SRC_C += \ background.c \ fatfs_port.c \ - i2s_common.c \ mphalport.c \ bindings/espidf/__init__.c \ boards/$(BOARD)/board.c \ diff --git a/ports/esp32s2/common-hal/audiobusio/I2SOut.h b/ports/esp32s2/common-hal/audiobusio/I2SOut.h index 90266342c..891e9af67 100644 --- a/ports/esp32s2/common-hal/audiobusio/I2SOut.h +++ b/ports/esp32s2/common-hal/audiobusio/I2SOut.h @@ -29,7 +29,7 @@ #include "supervisor/background_callback.h" #include "common-hal/microcontroller/Pin.h" -#include "i2s_common.h" +#include "common-hal/audiobusio/__init__.h" // Some boards don't implement I2SOut, so suppress any routines from here. #if CIRCUITPY_AUDIOBUSIO_I2SOUT diff --git a/ports/esp32s2/common-hal/audiobusio/__init__.c b/ports/esp32s2/common-hal/audiobusio/__init__.c index e69de29bb..01c77c531 100644 --- a/ports/esp32s2/common-hal/audiobusio/__init__.c +++ b/ports/esp32s2/common-hal/audiobusio/__init__.c @@ -0,0 +1,245 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include + +#include "py/runtime.h" + +#include "common-hal/audiobusio/__init__.h" +#include "bindings/espidf/__init__.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "shared-module/audiocore/__init__.h" + +#define I2S_QUEUE_SIZE (3) + +static i2s_t *i2s_instance[I2S_NUM_MAX]; +static QueueHandle_t i2s_queues[I2S_NUM_MAX]; +static TaskHandle_t i2s_tasks[I2S_NUM_MAX]; + +static int8_t port_i2s_allocate(void) { +#if defined(I2S_NUM_1) + if(!i2s_instance[1]) return 1; +#endif + if(!i2s_instance[0]) return 0; + + mp_raise_RuntimeError(translate("Peripheral in use")); +} + +void port_i2s_reset_instance(int i) { + assert(i >= 0 && i < I2S_NUM_MAX); + if (i2s_tasks[i]) { + vTaskDelete(i2s_tasks[i]); + } + i2s_tasks[i] = NULL; + + (void)i2s_driver_uninstall(i); + i2s_instance[i] = NULL; +} + +void i2s_reset(void) { + for (int i=0; i < I2S_NUM_MAX; i++) { + port_i2s_reset_instance(i); + } +} + +static void i2s_fill_buffer(i2s_t *self) { + if (self->instance < 0 || self->instance >= I2S_NUM_MAX) { + return; + } +#define STACK_BUFFER_SIZE (512) + int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; + + if (!self->playing || self->paused || !self->sample || self->stopping) { + memset(signed_samples, 0, sizeof(signed_samples)); + + size_t bytes_written = 0; + do { + CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, sizeof(signed_samples), &bytes_written, 0)); + } while (bytes_written != 0); + return; + } + while (!self->stopping) { + if (self->sample_data == self->sample_end) { + uint32_t sample_buffer_length; + audioio_get_buffer_result_t get_buffer_result = + audiosample_get_buffer(self->sample, false, 0, + &self->sample_data, &sample_buffer_length); + self->sample_end = self->sample_data + sample_buffer_length; + if (get_buffer_result == GET_BUFFER_DONE) { + if (self->loop) { + audiosample_reset_buffer(self->sample, false, 0); + } else { + self->stopping = true; + break; + } + } + if (get_buffer_result == GET_BUFFER_ERROR || sample_buffer_length == 0) { + self->stopping = true; + break; + } + } + size_t bytes_written = 0; + size_t bytecount = self->sample_end - self->sample_data; + if (self->samples_signed && self->channel_count == 2) { + if (self->bytes_per_sample == 2) { + CHECK_ESP_RESULT(i2s_write(self->instance, self->sample_data, bytecount, &bytes_written, 0)); + } else { + CHECK_ESP_RESULT(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, 0)); + } + } else { + const size_t bytes_per_output_frame = 4; + size_t bytes_per_input_frame = self->channel_count * self->bytes_per_sample; + size_t framecount = MIN(STACK_BUFFER_SIZE / bytes_per_output_frame, bytecount / bytes_per_input_frame); + if (self->samples_signed) { + assert(self->channel_count == 1); + if (self->bytes_per_sample == 1) { + audiosample_convert_s8m_s16s(signed_samples, (int8_t*)(void*)self->sample_data, framecount); + } else { + audiosample_convert_s16m_s16s(signed_samples, (int16_t*)(void*)self->sample_data, framecount); + } + } else { + if (self->channel_count == 1) { + if (self->bytes_per_sample == 1) { + audiosample_convert_u8m_s16s(signed_samples, (uint8_t*)(void*)self->sample_data, framecount); + } else { + audiosample_convert_u16m_s16s(signed_samples, (uint16_t*)(void*)self->sample_data, framecount); + } + } else { + if (self->bytes_per_sample == 1) { + audiosample_convert_u8s_s16s(signed_samples, (uint8_t*)(void*)self->sample_data, framecount); + } else { + audiosample_convert_u16s_s16s(signed_samples, (uint16_t*)(void*)self->sample_data, framecount); + } + } + } + size_t expanded_bytes_written = 0; + CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, bytes_per_output_frame*framecount, &expanded_bytes_written, 0)); + assert(expanded_bytes_written % 4 == 0); + bytes_written = expanded_bytes_written / bytes_per_output_frame * bytes_per_input_frame; + } + self->sample_data += bytes_written; + // We have filled the DMA buffer + if (!bytes_written) { + break; + } + } +} + +static void i2s_callback_fun(void *self_in) { + i2s_t *self = self_in; + i2s_fill_buffer(self); +} + +static void i2s_event_task(void *self_in) { + i2s_t *self = self_in; + while(true) { + i2s_event_type_t event; + BaseType_t result = xQueueReceive(i2s_queues[self->instance], &event, portMAX_DELAY); + if (result && event == I2S_EVENT_TX_DONE) { + background_callback_add(&self->callback, i2s_callback_fun, self_in); + } + } +} + +void port_i2s_allocate_init(i2s_t *self, bool left_justified) { + self->instance = port_i2s_allocate(); + + i2s_config_t i2s_config = { + .mode = I2S_MODE_MASTER | I2S_MODE_TX, + .sample_rate = 44100, + .bits_per_sample = 16, + .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, + .communication_format = left_justified ? I2S_COMM_FORMAT_STAND_I2S : I2S_COMM_FORMAT_STAND_I2S, + .dma_buf_count = 2, + .dma_buf_len = 128, // in _frames_, so 128 is 512 bytes per dma buf + .use_apll = false, + }; + CHECK_ESP_RESULT(i2s_driver_install(self->instance, &i2s_config, I2S_QUEUE_SIZE, &i2s_queues[self->instance])); + + if (!xTaskCreate(i2s_event_task, "I2S_task", 3 * configMINIMAL_STACK_SIZE, self, CONFIG_PTHREAD_TASK_PRIO_DEFAULT, &i2s_tasks[self->instance])) { + mp_raise_OSError_msg(translate("xTaskCreate failed")); + } + i2s_instance[self->instance] = self; + +} + + +void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { + self->sample = sample; + self->loop = loop; + self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8; + self->channel_count = audiosample_channel_count(sample); + bool single_buffer; + bool samples_signed; + uint32_t max_buffer_length; + uint8_t spacing; + audiosample_get_buffer_structure(sample, false, &single_buffer, &samples_signed, + &max_buffer_length, &spacing); + self->samples_signed = samples_signed; + self->playing = true; + self->paused = false; + self->stopping = false; + self->sample_data = self->sample_end = NULL; + // We always output stereo so output twice as many bits. + // uint16_t bits_per_sample_output = bits_per_sample * 2; + + audiosample_reset_buffer(self->sample, false, 0); + + CHECK_ESP_RESULT(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); + + background_callback_add(&self->callback, i2s_callback_fun, self); +} + +bool port_i2s_playing(i2s_t *self) { + return self->playing && !self->stopping; +} + +bool port_i2s_paused(i2s_t *self) { + return self->paused; +} + +void port_i2s_stop(i2s_t *self) { + self->sample = NULL; + self->paused = false; + self->playing = false; + self->stopping = false; +} + +void port_i2s_pause(i2s_t *self) { + if (!self->paused) { + self->paused = true; + CHECK_ESP_RESULT(i2s_stop(self->instance)); + } +} + +void port_i2s_resume(i2s_t *self) { + if (self->paused) { + self->paused = false; + CHECK_ESP_RESULT(i2s_start(self->instance)); + } +} diff --git a/ports/esp32s2/common-hal/audiobusio/__init__.h b/ports/esp32s2/common-hal/audiobusio/__init__.h index e69de29bb..7709735da 100644 --- a/ports/esp32s2/common-hal/audiobusio/__init__.h +++ b/ports/esp32s2/common-hal/audiobusio/__init__.h @@ -0,0 +1,61 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Jeff Epler for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#pragma once + +#include "py/obj.h" + +#include "supervisor/background_callback.h" + +#include "driver/i2s.h" + +typedef struct { + mp_obj_t *sample; + bool left_justified; + bool loop; + bool paused; + bool playing; + bool stopping; + bool samples_signed; + int8_t bytes_per_sample; + int8_t channel_count; + int8_t instance; + uint16_t buffer_length; + uint8_t *sample_data, *sample_end; + i2s_config_t i2s_config; + background_callback_t callback; +} i2s_t; + + +void port_i2s_allocate_init(i2s_t *self, bool left_justified); +void port_i2s_reset_instance(int i); +void i2s_reset(void); +void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop); +void port_i2s_stop(i2s_t *self); +bool port_i2s_playing(i2s_t *self); +bool port_i2s_paused(i2s_t *self); +void port_i2s_pause(i2s_t *self); +void port_i2s_resume(i2s_t *self); diff --git a/ports/esp32s2/i2s_common.c b/ports/esp32s2/i2s_common.c deleted file mode 100644 index f967e9a09..000000000 --- a/ports/esp32s2/i2s_common.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2020 Jeff Epler for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include - -#include "py/runtime.h" - -#include "i2s_common.h" -#include "bindings/espidf/__init__.h" -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" - -#include "shared-module/audiocore/__init__.h" - -#define I2S_QUEUE_SIZE (3) - -static i2s_t *i2s_instance[I2S_NUM_MAX]; -static QueueHandle_t i2s_queues[I2S_NUM_MAX]; -static TaskHandle_t i2s_tasks[I2S_NUM_MAX]; - -static int8_t port_i2s_allocate(void) { -#if defined(I2S_NUM_1) - if(!i2s_instance[1]) return 1; -#endif - if(!i2s_instance[0]) return 0; - - mp_raise_RuntimeError(translate("Peripheral in use")); -} - -void port_i2s_reset_instance(int i) { - assert(i >= 0 && i < I2S_NUM_MAX); - if (i2s_tasks[i]) { - vTaskDelete(i2s_tasks[i]); - } - i2s_tasks[i] = NULL; - - (void)i2s_driver_uninstall(i); - i2s_instance[i] = NULL; -} - -void i2s_reset(void) { - for (int i=0; i < I2S_NUM_MAX; i++) { - port_i2s_reset_instance(i); - } -} - -static void i2s_fill_buffer(i2s_t *self) { - if (self->instance < 0 || self->instance >= I2S_NUM_MAX) { - return; - } -#define STACK_BUFFER_SIZE (512) - int16_t signed_samples[STACK_BUFFER_SIZE / sizeof(int16_t)]; - - if (!self->playing || self->paused || !self->sample || self->stopping) { - memset(signed_samples, 0, sizeof(signed_samples)); - - size_t bytes_written = 0; - do { - CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, sizeof(signed_samples), &bytes_written, 0)); - } while (bytes_written != 0); - return; - } - while (!self->stopping) { - if (self->sample_data == self->sample_end) { - uint32_t sample_buffer_length; - audioio_get_buffer_result_t get_buffer_result = - audiosample_get_buffer(self->sample, false, 0, - &self->sample_data, &sample_buffer_length); - self->sample_end = self->sample_data + sample_buffer_length; - if (get_buffer_result == GET_BUFFER_DONE) { - if (self->loop) { - audiosample_reset_buffer(self->sample, false, 0); - } else { - self->stopping = true; - break; - } - } - if (get_buffer_result == GET_BUFFER_ERROR || sample_buffer_length == 0) { - self->stopping = true; - break; - } - } - size_t bytes_written = 0; - size_t bytecount = self->sample_end - self->sample_data; - if (self->samples_signed && self->channel_count == 2) { - if (self->bytes_per_sample == 2) { - CHECK_ESP_RESULT(i2s_write(self->instance, self->sample_data, bytecount, &bytes_written, 0)); - } else { - CHECK_ESP_RESULT(i2s_write_expand(self->instance, self->sample_data, bytecount, 8, 16, &bytes_written, 0)); - } - } else { - const size_t bytes_per_output_frame = 4; - size_t bytes_per_input_frame = self->channel_count * self->bytes_per_sample; - size_t framecount = MIN(STACK_BUFFER_SIZE / bytes_per_output_frame, bytecount / bytes_per_input_frame); - if (self->samples_signed) { - assert(self->channel_count == 1); - if (self->bytes_per_sample == 1) { - audiosample_convert_s8m_s16s(signed_samples, (int8_t*)(void*)self->sample_data, framecount); - } else { - audiosample_convert_s16m_s16s(signed_samples, (int16_t*)(void*)self->sample_data, framecount); - } - } else { - if (self->channel_count == 1) { - if (self->bytes_per_sample == 1) { - audiosample_convert_u8m_s16s(signed_samples, (uint8_t*)(void*)self->sample_data, framecount); - } else { - audiosample_convert_u16m_s16s(signed_samples, (uint16_t*)(void*)self->sample_data, framecount); - } - } else { - if (self->bytes_per_sample == 1) { - audiosample_convert_u8s_s16s(signed_samples, (uint8_t*)(void*)self->sample_data, framecount); - } else { - audiosample_convert_u16s_s16s(signed_samples, (uint16_t*)(void*)self->sample_data, framecount); - } - } - } - size_t expanded_bytes_written = 0; - CHECK_ESP_RESULT(i2s_write(self->instance, signed_samples, bytes_per_output_frame*framecount, &expanded_bytes_written, 0)); - assert(expanded_bytes_written % 4 == 0); - bytes_written = expanded_bytes_written / bytes_per_output_frame * bytes_per_input_frame; - } - self->sample_data += bytes_written; - // We have filled the DMA buffer - if (!bytes_written) { - break; - } - } -} - -static void i2s_callback_fun(void *self_in) { - i2s_t *self = self_in; - i2s_fill_buffer(self); -} - -static void i2s_event_task(void *self_in) { - i2s_t *self = self_in; - while(true) { - i2s_event_type_t event; - BaseType_t result = xQueueReceive(i2s_queues[self->instance], &event, portMAX_DELAY); - if (result && event == I2S_EVENT_TX_DONE) { - background_callback_add(&self->callback, i2s_callback_fun, self_in); - } - } -} - -void port_i2s_allocate_init(i2s_t *self, bool left_justified) { - self->instance = port_i2s_allocate(); - - i2s_config_t i2s_config = { - .mode = I2S_MODE_MASTER | I2S_MODE_TX, - .sample_rate = 44100, - .bits_per_sample = 16, - .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, - .communication_format = left_justified ? I2S_COMM_FORMAT_STAND_I2S : I2S_COMM_FORMAT_STAND_I2S, - .dma_buf_count = 2, - .dma_buf_len = 128, // in _frames_, so 128 is 512 bytes per dma buf - .use_apll = false, - }; - CHECK_ESP_RESULT(i2s_driver_install(self->instance, &i2s_config, I2S_QUEUE_SIZE, &i2s_queues[self->instance])); - - if (!xTaskCreate(i2s_event_task, "I2S_task", 3 * configMINIMAL_STACK_SIZE, self, CONFIG_PTHREAD_TASK_PRIO_DEFAULT, &i2s_tasks[self->instance])) { - mp_raise_OSError_msg(translate("xTaskCreate failed")); - } - i2s_instance[self->instance] = self; - -} - - -void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop) { - self->sample = sample; - self->loop = loop; - self->bytes_per_sample = audiosample_bits_per_sample(sample) / 8; - self->channel_count = audiosample_channel_count(sample); - bool single_buffer; - bool samples_signed; - uint32_t max_buffer_length; - uint8_t spacing; - audiosample_get_buffer_structure(sample, false, &single_buffer, &samples_signed, - &max_buffer_length, &spacing); - self->samples_signed = samples_signed; - self->playing = true; - self->paused = false; - self->stopping = false; - self->sample_data = self->sample_end = NULL; - // We always output stereo so output twice as many bits. - // uint16_t bits_per_sample_output = bits_per_sample * 2; - - audiosample_reset_buffer(self->sample, false, 0); - - CHECK_ESP_RESULT(i2s_set_sample_rates(self->instance, audiosample_sample_rate(sample))); - - background_callback_add(&self->callback, i2s_callback_fun, self); -} - -bool port_i2s_playing(i2s_t *self) { - return self->playing && !self->stopping; -} - -bool port_i2s_paused(i2s_t *self) { - return self->paused; -} - -void port_i2s_stop(i2s_t *self) { - self->sample = NULL; - self->paused = false; - self->playing = false; - self->stopping = false; -} - -void port_i2s_pause(i2s_t *self) { - if (!self->paused) { - self->paused = true; - CHECK_ESP_RESULT(i2s_stop(self->instance)); - } -} - -void port_i2s_resume(i2s_t *self) { - if (self->paused) { - self->paused = false; - CHECK_ESP_RESULT(i2s_start(self->instance)); - } -} diff --git a/ports/esp32s2/i2s_common.h b/ports/esp32s2/i2s_common.h deleted file mode 100644 index 7709735da..000000000 --- a/ports/esp32s2/i2s_common.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2020 Jeff Epler for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#pragma once - -#include "py/obj.h" - -#include "supervisor/background_callback.h" - -#include "driver/i2s.h" - -typedef struct { - mp_obj_t *sample; - bool left_justified; - bool loop; - bool paused; - bool playing; - bool stopping; - bool samples_signed; - int8_t bytes_per_sample; - int8_t channel_count; - int8_t instance; - uint16_t buffer_length; - uint8_t *sample_data, *sample_end; - i2s_config_t i2s_config; - background_callback_t callback; -} i2s_t; - - -void port_i2s_allocate_init(i2s_t *self, bool left_justified); -void port_i2s_reset_instance(int i); -void i2s_reset(void); -void port_i2s_play(i2s_t *self, mp_obj_t sample, bool loop); -void port_i2s_stop(i2s_t *self); -bool port_i2s_playing(i2s_t *self); -bool port_i2s_paused(i2s_t *self); -void port_i2s_pause(i2s_t *self); -void port_i2s_resume(i2s_t *self); diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index a6b6a82aa..a5215fdef 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -62,7 +62,7 @@ #include "components/soc/soc/esp32s2/include/soc/rtc_cntl_reg.h" #if CIRCUITPY_AUDIOBUSIO -#include "i2s_common.h" +#include "common-hal/audiobusio/__init__.h" #endif #define HEAP_SIZE (48 * 1024) -- cgit v1.2.3 From e20c65d8f044cb9522cd1a7f4a3030efefa77cbb Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Sat, 9 Jan 2021 13:59:54 -0600 Subject: background tasks: Add, use port_wake_main_task Some ports need an extra operation to ensure that the main task is awoken so that a queued background task will execute during an ongoing light sleep. This removes the need to enable supervisor ticks while I2SOut is operating. Closes: #3952 --- ports/esp32s2/common-hal/audiobusio/I2SOut.c | 4 ---- ports/esp32s2/supervisor/port.c | 12 +++++++++++- supervisor/port.h | 4 ++++ supervisor/shared/background_callback.c | 4 ++++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ports/esp32s2/common-hal/audiobusio/I2SOut.c b/ports/esp32s2/common-hal/audiobusio/I2SOut.c index ee16c6ca8..86322be86 100644 --- a/ports/esp32s2/common-hal/audiobusio/I2SOut.c +++ b/ports/esp32s2/common-hal/audiobusio/I2SOut.c @@ -63,8 +63,6 @@ void common_hal_audiobusio_i2sout_construct(audiobusio_i2sout_obj_t* self, self->bit_clock = bit_clock; self->word_select = word_select; self->data = data; - - supervisor_enable_tick(); } bool common_hal_audiobusio_i2sout_deinited(audiobusio_i2sout_obj_t* self) { @@ -95,8 +93,6 @@ void common_hal_audiobusio_i2sout_deinit(audiobusio_i2sout_obj_t* self) { port_i2s_reset_instance(self->peripheral.instance); } self->peripheral.instance = -1; - - supervisor_disable_tick(); } void common_hal_audiobusio_i2sout_play(audiobusio_i2sout_obj_t* self, diff --git a/ports/esp32s2/supervisor/port.c b/ports/esp32s2/supervisor/port.c index a5215fdef..6491e7430 100644 --- a/ports/esp32s2/supervisor/port.c +++ b/ports/esp32s2/supervisor/port.c @@ -111,6 +111,12 @@ safe_mode_t port_init(void) { heap = NULL; never_reset_module_internal_pins(); + #if defined(DEBUG) + // debug UART + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); + #endif + #if defined(DEBUG) || defined(ENABLE_JTAG) // JTAG common_hal_never_reset_pin(&pin_GPIO39); @@ -291,10 +297,14 @@ void port_disable_tick(void) { esp_timer_stop(_tick_timer); } -void sleep_timer_cb(void* arg) { +void port_wake_main_task() { xTaskNotifyGive(circuitpython_task); } +void sleep_timer_cb(void* arg) { + port_wake_main_task(); +} + void port_interrupt_after_ticks(uint32_t ticks) { uint64_t timeout_us = ticks * 1000000ull / 1024; if (esp_timer_start_once(_sleep_timer, timeout_us) != ESP_OK) { diff --git a/supervisor/port.h b/supervisor/port.h index 862400986..812cf715b 100644 --- a/supervisor/port.h +++ b/supervisor/port.h @@ -99,4 +99,8 @@ void port_background_task(void); void port_start_background_task(void); void port_finish_background_task(void); +// Some ports need special handling to wake the main task from an interrupt +// context or other task. The port must implement the necessary code in this +// function. A default weak implementation is provided that does nothing. +void port_wake_main_task(void); #endif // MICROPY_INCLUDED_SUPERVISOR_PORT_H diff --git a/supervisor/shared/background_callback.c b/supervisor/shared/background_callback.c index ef686cbab..288c9a4df 100644 --- a/supervisor/shared/background_callback.c +++ b/supervisor/shared/background_callback.c @@ -38,6 +38,8 @@ STATIC volatile background_callback_t *callback_head, *callback_tail; #define CALLBACK_CRITICAL_BEGIN (common_hal_mcu_disable_interrupts()) #define CALLBACK_CRITICAL_END (common_hal_mcu_enable_interrupts()) +MP_WEAK void port_wake_main_task(void) {} + void background_callback_add_core(background_callback_t *cb) { CALLBACK_CRITICAL_BEGIN; if (cb->prev || callback_head == cb) { @@ -55,6 +57,8 @@ void background_callback_add_core(background_callback_t *cb) { } callback_tail = cb; CALLBACK_CRITICAL_END; + + port_wake_main_task(); } void background_callback_add(background_callback_t *cb, background_callback_fun fun, void *data) { -- cgit v1.2.3 From 908e02439d79b7dd9d29f7465833aead504c257c Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sat, 9 Jan 2021 15:04:23 -0500 Subject: Look up TCC resolution as necessary --- ports/atmel-samd/common-hal/pwmio/PWMOut.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ports/atmel-samd/common-hal/pwmio/PWMOut.c b/ports/atmel-samd/common-hal/pwmio/PWMOut.c index 2e538ccdc..b5142c21e 100644 --- a/ports/atmel-samd/common-hal/pwmio/PWMOut.c +++ b/ports/atmel-samd/common-hal/pwmio/PWMOut.c @@ -44,6 +44,7 @@ # define _TCC_SIZE(unused, n) TCC ## n ## _SIZE, # define TCC_SIZES { REPEAT_MACRO(_TCC_SIZE, 0, TCC_INST_NUM) } +static const uint8_t tcc_sizes[TCC_INST_NUM] = TCC_SIZES; static uint32_t tcc_periods[TCC_INST_NUM]; static uint32_t tc_periods[TC_INST_NUM]; @@ -233,8 +234,7 @@ pwmout_result_t common_hal_pwmio_pwmout_construct(pwmio_pwmout_obj_t* self, resolution = 16; } else { // TCC resolution varies so look it up. - const uint8_t _tcc_sizes[TCC_INST_NUM] = TCC_SIZES; - resolution = _tcc_sizes[timer->index]; + resolution = tcc_sizes[timer->index]; } // First determine the divisor that gets us the highest resolution. uint32_t system_clock = common_hal_mcu_processor_get_frequency(); @@ -421,7 +421,8 @@ void common_hal_pwmio_pwmout_set_frequency(pwmio_pwmout_obj_t* self, if (t->is_tc) { resolution = 16; } else { - resolution = 24; + // TCC resolution varies so look it up. + resolution = tcc_sizes[t->index]; } uint32_t system_clock = common_hal_mcu_processor_get_frequency(); uint32_t new_top; -- cgit v1.2.3 From 68a5e6dcbab095a7267fa885f8e5ef4703935c71 Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 15:52:58 -0500 Subject: copypaste typo --- ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c index bf14d81ae..d4704c224 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/pins.c @@ -29,14 +29,14 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO16) }, - { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO17) }, - { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO15) }, - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO18) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) }, -- cgit v1.2.3 From b5b0d45b73f38c5b428830e432088bbebe8523ae Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 22:36:54 -0500 Subject: add tft --- .github/workflows/build.yml | 1 + .../board.c | 118 +++++++++++++++++++++ .../mpconfigboard.h | 45 ++++++++ .../mpconfigboard.mk | 22 ++++ .../pins.c | 72 +++++++++++++ .../sdkconfig | 0 6 files changed, 258 insertions(+) create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c create mode 100644 ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4fccb1596..b918ba64a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -432,6 +432,7 @@ jobs: matrix: board: - "adafruit_feather_esp32s2_nopsram" + - "adafruit_feather_esp32s2_tftback_nopsram" - "adafruit_magtag_2.9_grayscale" - "adafruit_metro_esp32s2" - "electroniccats_bastwifi" diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c new file mode 100644 index 000000000..304a64e45 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c @@ -0,0 +1,118 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2020 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "mpconfigboard.h" +#include "hal/include/hal_gpio.h" +#include "shared-bindings/microcontroller/Pin.h" +#include "shared-bindings/busio/SPI.h" +#include "shared-bindings/displayio/FourWire.h" +#include "shared-module/displayio/__init__.h" +#include "shared-module/displayio/mipi_constants.h" + +displayio_fourwire_obj_t board_display_obj; + +#define DELAY 0x80 + +uint8_t display_init_sequence[] = { + 0x01, 0 | DELAY, 150, // SWRESET + 0x11, 0 | DELAY, 255, // SLPOUT + 0x36, 1, 0x00, // _MADCTL bottom to top refresh in vsync aligned order. + 0x3a, 1, 0x55, // COLMOD - 16bit color + 0x21, 0 | DELAY, 10, // _INVON + 0x13, 0 | DELAY, 10, // _NORON + 0x29, 0 | DELAY, 255, // _DISPON +}; + +void board_init(void) { + // USB + common_hal_never_reset_pin(&pin_GPIO19); + common_hal_never_reset_pin(&pin_GPIO20); + + // Debug UART +#ifdef DEBUG + common_hal_never_reset_pin(&pin_GPIO43); + common_hal_never_reset_pin(&pin_GPIO44); +#endif /* DEBUG */ + + busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; + common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL); + common_hal_busio_spi_never_reset(spi); + + displayio_fourwire_obj_t* bus = &displays[0].fourwire_bus; + bus->base.type = &displayio_fourwire_type; + common_hal_displayio_fourwire_construct(bus, + spi, + &pin_GPIO40, // TFT_DC Command or data + &pin_GPIO42, // TFT_CS Chip select + &pin_GPIO41, // TFT_RST Reset + 20000000, // Baudrate + 0, // Polarity + 0); // Phase + + displayio_display_obj_t* display = &displays[0].display; + display->base.type = &displayio_display_type; + common_hal_displayio_display_construct(display, + bus, + 240, // Width (after rotation) + 135, // Height (after rotation) + 0, // column start + 0, // row start + 0, // rotation + 16, // Color depth + false, // Grayscale + false, // Pixels in a byte share a row. Only used for depth < 8 + 1, // bytes per cell. Only valid for depths < 8 + false, // reverse_pixels_in_byte. Only valid for depths < 8 + true, // reverse_pixels_in_word + MIPI_COMMAND_SET_COLUMN_ADDRESS, // Set column command + MIPI_COMMAND_SET_PAGE_ADDRESS, // Set row command + MIPI_COMMAND_WRITE_MEMORY_START, // Write memory command + 0x37, // set vertical scroll command + display_init_sequence, + sizeof(display_init_sequence), + &pin_GPIO7, // backlight pin + NO_BRIGHTNESS_COMMAND, + 1.0f, // brightness (ignored) + true, // auto_brightness + false, // single_byte_bounds + false, // data_as_commands + true, // auto_refresh + 60, // native_frames_per_second + true, // backlight_on_high + false); // not SH1107 +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} + +void board_deinit(void) { +} diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h new file mode 100644 index 000000000..9d95e8e43 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h @@ -0,0 +1,45 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2019 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +//Micropython setup + +#define MICROPY_HW_BOARD_NAME "Feather ESP32S2 without PSRAM" +#define MICROPY_HW_MCU_NAME "ESP32S2" + +#define MICROPY_HW_NEOPIXEL (&pin_GPIO33) + +#define CIRCUITPY_BOOT_BUTTON (&pin_GPIO0) + +#define BOARD_USER_SAFE_MODE_ACTION translate("pressing boot button at start up.\n") + +#define AUTORESET_DELAY_MS 500 + +#define DEFAULT_I2C_BUS_SCL (&pin_GPIO4) +#define DEFAULT_I2C_BUS_SDA (&pin_GPIO3) + +#define DEFAULT_SPI_BUS_SCK (&pin_GPIO36) +#define DEFAULT_SPI_BUS_MOSI (&pin_GPIO35) +#define DEFAULT_SPI_BUS_MISO (&pin_GPIO37) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk new file mode 100644 index 000000000..989f092cf --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk @@ -0,0 +1,22 @@ +USB_VID = 0x239A +USB_PID = 0x80EC +USB_PRODUCT = "Feather ESP32S2 TFT no PSRAM" +USB_MANUFACTURER = "Adafruit" + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = MPZ + +# The default queue depth of 16 overflows on release builds, +# so increase it to 32. +CFLAGS += -DCFG_TUD_TASK_QUEUE_SZ=32 + +CIRCUITPY_ESP_FLASH_MODE=dio +CIRCUITPY_ESP_FLASH_FREQ=40m +CIRCUITPY_ESP_FLASH_SIZE=4MB + +CIRCUITPY_MODULE=wroom + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Requests +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c new file mode 100644 index 000000000..7e2054f41 --- /dev/null +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c @@ -0,0 +1,72 @@ +#include "shared-bindings/board/__init__.h" + +#include "shared-module/displayio/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_D0), MP_ROM_PTR(&pin_GPIO0) }, + + { MP_ROM_QSTR(MP_QSTR_D3), MP_ROM_PTR(&pin_GPIO3) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_GPIO3) }, + + { MP_ROM_QSTR(MP_QSTR_D4), MP_ROM_PTR(&pin_GPIO4) }, + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_GPIO4) }, + + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_GPIO5) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_GPIO6) }, + + { MP_ROM_QSTR(MP_QSTR_TFT_BACKLIGHT), MP_ROM_PTR(&pin_GPIO7) }, + + { MP_ROM_QSTR(MP_QSTR_D8), MP_ROM_PTR(&pin_GPIO8) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_GPIO8) }, + + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_GPIO9) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_GPIO11) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_GPIO12) }, + + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, + { MP_ROM_QSTR(MP_QSTR_L), MP_ROM_PTR(&pin_GPIO13) }, + + { MP_ROM_QSTR(MP_QSTR_D14), MP_ROM_PTR(&pin_GPIO14) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_GPIO14) }, + + { MP_ROM_QSTR(MP_QSTR_D15), MP_ROM_PTR(&pin_GPIO15) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_GPIO15) }, + + { MP_ROM_QSTR(MP_QSTR_D16), MP_ROM_PTR(&pin_GPIO16) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_GPIO16) }, + + { MP_ROM_QSTR(MP_QSTR_D17), MP_ROM_PTR(&pin_GPIO17) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO17) }, + + { MP_ROM_QSTR(MP_QSTR_D18), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_GPIO18) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL_POWER), MP_ROM_PTR(&pin_GPIO21) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_GPIO33) }, + + { MP_ROM_QSTR(MP_QSTR_D35), MP_ROM_PTR(&pin_GPIO35) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_GPIO35) }, + + { MP_ROM_QSTR(MP_QSTR_D36), MP_ROM_PTR(&pin_GPIO36) }, + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_GPIO36) }, + + { MP_ROM_QSTR(MP_QSTR_D37), MP_ROM_PTR(&pin_GPIO37) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_GPIO37) }, + + { MP_ROM_QSTR(MP_QSTR_D38), MP_ROM_PTR(&pin_GPIO38) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_GPIO38) }, + + { MP_ROM_QSTR(MP_QSTR_D39), MP_ROM_PTR(&pin_GPIO39) }, + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_GPIO39) }, + + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_GPIO40) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_GPIO41) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_GPIO42) }, + + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + + { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/sdkconfig new file mode 100644 index 000000000..e69de29bb -- cgit v1.2.3 From 5b9ce9e7cfbfccd1d9f30d25bb4d3004175363ab Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 22:42:43 -0500 Subject: fix dup usb --- .../boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk index 989f092cf..3ba6f6228 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x239A -USB_PID = 0x80EC +USB_PID = 0x80EE USB_PRODUCT = "Feather ESP32S2 TFT no PSRAM" USB_MANUFACTURER = "Adafruit" -- cgit v1.2.3 From d036620c707dc2cadd6f955c4d6b9161b01e62a7 Mon Sep 17 00:00:00 2001 From: lady ada Date: Sat, 9 Jan 2021 23:19:04 -0500 Subject: compilier --- ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c index 304a64e45..8d2b26017 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c @@ -26,10 +26,9 @@ #include "supervisor/board.h" #include "mpconfigboard.h" -#include "hal/include/hal_gpio.h" -#include "shared-bindings/microcontroller/Pin.h" #include "shared-bindings/busio/SPI.h" #include "shared-bindings/displayio/FourWire.h" +#include "shared-bindings/microcontroller/Pin.h" #include "shared-module/displayio/__init__.h" #include "shared-module/displayio/mipi_constants.h" -- cgit v1.2.3 From 8652d696142159f147efb74f0947a9e0bd7a357e Mon Sep 17 00:00:00 2001 From: Jonah Yolles-Murphy Date: Sun, 10 Jan 2021 04:04:50 -0500 Subject: update TG-Watch pins, name, and frozen libraries --- .github/workflows/build.yml | 2 +- .gitmodules | 12 +++++ frozen/Adafruit_CircuitPython_Display_Shapes | 1 + frozen/Adafruit_CircuitPython_Display_Text | 1 + frozen/Adafruit_CircuitPython_ProgressBar | 1 + frozen/Adafruit_CircuitPython_ST7789 | 1 + ports/nrf/boards/TG-Watch02/board.c | 38 ++++++++++++++ ports/nrf/boards/TG-Watch02/mpconfigboard.h | 64 +++++++++++++++++++++++ ports/nrf/boards/TG-Watch02/mpconfigboard.mk | 23 +++++++++ ports/nrf/boards/TG-Watch02/pins.c | 73 +++++++++++++++++++++++++++ ports/nrf/boards/TG-Watch02A/board.c | 38 -------------- ports/nrf/boards/TG-Watch02A/mpconfigboard.h | 61 ---------------------- ports/nrf/boards/TG-Watch02A/mpconfigboard.mk | 19 ------- ports/nrf/boards/TG-Watch02A/pins.c | 51 ------------------- 14 files changed, 215 insertions(+), 170 deletions(-) create mode 160000 frozen/Adafruit_CircuitPython_Display_Shapes create mode 160000 frozen/Adafruit_CircuitPython_Display_Text create mode 160000 frozen/Adafruit_CircuitPython_ProgressBar create mode 160000 frozen/Adafruit_CircuitPython_ST7789 create mode 100644 ports/nrf/boards/TG-Watch02/board.c create mode 100644 ports/nrf/boards/TG-Watch02/mpconfigboard.h create mode 100644 ports/nrf/boards/TG-Watch02/mpconfigboard.mk create mode 100644 ports/nrf/boards/TG-Watch02/pins.c delete mode 100644 ports/nrf/boards/TG-Watch02A/board.c delete mode 100644 ports/nrf/boards/TG-Watch02A/mpconfigboard.h delete mode 100644 ports/nrf/boards/TG-Watch02A/mpconfigboard.mk delete mode 100644 ports/nrf/boards/TG-Watch02A/pins.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a21c13c4..d53dc5121 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -176,7 +176,7 @@ jobs: board: - "8086_commander" - "ADM_B_NRF52840_1" - - "TG-Watch02A" + - "TG-Watch02" - "aloriumtech_evo_m51" - "aramcon_badge_2019" - "arduino_mkr1300" diff --git a/.gitmodules b/.gitmodules index b74cd0b30..0fb64d4b5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -156,3 +156,15 @@ [submodule "ports/esp32s2/certificates/nina-fw"] path = ports/esp32s2/certificates/nina-fw url = https://github.com/adafruit/nina-fw.git +[submodule "frozen/Adafruit_CircuitPython_ST7789"] + path = frozen/Adafruit_CircuitPython_ST7789 + url = https://github.com/adafruit/Adafruit_CircuitPython_ST7789 +[submodule "frozen/Adafruit_CircuitPython_Display_Shapes"] + path = frozen/Adafruit_CircuitPython_Display_Shapes + url = https://github.com/adafruit/Adafruit_CircuitPython_Display_Shapes +[submodule "frozen/Adafruit_CircuitPython_Display_Text"] + path = frozen/Adafruit_CircuitPython_Display_Text + url = https://github.com/adafruit/Adafruit_CircuitPython_Display_Text +[submodule "frozen/Adafruit_CircuitPython_ProgressBar"] + path = frozen/Adafruit_CircuitPython_ProgressBar + url = https://github.com/adafruit/Adafruit_CircuitPython_ProgressBar diff --git a/frozen/Adafruit_CircuitPython_Display_Shapes b/frozen/Adafruit_CircuitPython_Display_Shapes new file mode 160000 index 000000000..07435f53e --- /dev/null +++ b/frozen/Adafruit_CircuitPython_Display_Shapes @@ -0,0 +1 @@ +Subproject commit 07435f53ee60e373042d6a3c8261218edd7c4e88 diff --git a/frozen/Adafruit_CircuitPython_Display_Text b/frozen/Adafruit_CircuitPython_Display_Text new file mode 160000 index 000000000..92733f510 --- /dev/null +++ b/frozen/Adafruit_CircuitPython_Display_Text @@ -0,0 +1 @@ +Subproject commit 92733f5103eb81e1c1f0b0e2cdd9009f3bae344a diff --git a/frozen/Adafruit_CircuitPython_ProgressBar b/frozen/Adafruit_CircuitPython_ProgressBar new file mode 160000 index 000000000..f8206d40e --- /dev/null +++ b/frozen/Adafruit_CircuitPython_ProgressBar @@ -0,0 +1 @@ +Subproject commit f8206d40e9375bfa5ffc8ace2948751c742c8f8f diff --git a/frozen/Adafruit_CircuitPython_ST7789 b/frozen/Adafruit_CircuitPython_ST7789 new file mode 160000 index 000000000..e0225d3f7 --- /dev/null +++ b/frozen/Adafruit_CircuitPython_ST7789 @@ -0,0 +1 @@ +Subproject commit e0225d3f7c4e137846cb2ceed4915559d4ba9daf diff --git a/ports/nrf/boards/TG-Watch02/board.c b/ports/nrf/boards/TG-Watch02/board.c new file mode 100644 index 000000000..781793328 --- /dev/null +++ b/ports/nrf/boards/TG-Watch02/board.c @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} diff --git a/ports/nrf/boards/TG-Watch02/mpconfigboard.h b/ports/nrf/boards/TG-Watch02/mpconfigboard.h new file mode 100644 index 000000000..3ed4288a1 --- /dev/null +++ b/ports/nrf/boards/TG-Watch02/mpconfigboard.h @@ -0,0 +1,64 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Glenn Ruben Bakke + * Copyright (c) 2018 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "nrfx/hal/nrf_gpio.h" + +#define MICROPY_HW_BOARD_NAME "TG-Watch02" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define MICROPY_HW_NEOPIXEL (&pin_P0_16) +#define MICROPY_HW_LED_STATUS (&pin_P1_15) + +// TG-Gui requires a deeper call stack than normal CircuitPython +#define CIRCUITPY_PYSTACK_SIZE 8192 // 1536 is the normal size, (32 bytes/frame * 48 frames) +#define BOARD_HAS_CRYSTAL 0 + +#if QSPI_FLASH_FILESYSTEM +#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17) +#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22) +#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23) +#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21) +#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19) +#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20) +#endif + +#if SPI_FLASH_FILESYSTEM +#define SPI_FLASH_MOSI_PIN &pin_P0_17 +#define SPI_FLASH_MISO_PIN &pin_P0_22 +#define SPI_FLASH_SCK_PIN &pin_P0_19 +#define SPI_FLASH_CS_PIN &pin_P0_20 +#endif + +#define DEFAULT_I2C_BUS_SCL (&pin_P0_11) +#define DEFAULT_I2C_BUS_SDA (&pin_P0_12) + +#define DEFAULT_SPI_BUS_SCK (&pin_P0_14) +#define DEFAULT_SPI_BUS_MOSI (&pin_P0_13) +#define DEFAULT_SPI_BUS_MISO (&pin_P0_15) + +#define DEFAULT_UART_BUS_RX (&pin_P0_24) +#define DEFAULT_UART_BUS_TX (&pin_P0_25) diff --git a/ports/nrf/boards/TG-Watch02/mpconfigboard.mk b/ports/nrf/boards/TG-Watch02/mpconfigboard.mk new file mode 100644 index 000000000..d6eff4fed --- /dev/null +++ b/ports/nrf/boards/TG-Watch02/mpconfigboard.mk @@ -0,0 +1,23 @@ +USB_VID = 0x239A +USB_PID = 0x802A +USB_PRODUCT = "TG_Watch02" +USB_MANUFACTURER = "TG-Techie" + +MCU_CHIP = nrf52840 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 2 +EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q128JV_SQ" + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ST7789 +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Shapes +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Text +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ProgressBar +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LSM6DS +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_FocalTouch +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DS3231 +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DRV2605 +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BLE +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center diff --git a/ports/nrf/boards/TG-Watch02/pins.c b/ports/nrf/boards/TG-Watch02/pins.c new file mode 100644 index 000000000..71eb1c0a9 --- /dev/null +++ b/ports/nrf/boards/TG-Watch02/pins.c @@ -0,0 +1,73 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + + /* default ports */ + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + + /* TG-Watch02 specific pins */ + { MP_ROM_QSTR(MP_QSTR_VBUS_PRESENT), MP_ROM_PTR(&pin_P1_04) }, + { MP_ROM_QSTR(MP_QSTR_HAPTIC_ENABLE), MP_ROM_PTR(&pin_P1_06) }, + { MP_ROM_QSTR(MP_QSTR_HAPTIC_INT), MP_ROM_PTR(&pin_P1_07) }, + { MP_ROM_QSTR(MP_QSTR_CTP_INT), MP_ROM_PTR(&pin_P1_05) }, + { MP_ROM_QSTR(MP_QSTR_CTP_RST), MP_ROM_PTR(&pin_P1_03) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RST), MP_ROM_PTR(&pin_P1_01) }, + + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_P1_12) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_P1_13) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_P1_14) }, + + { MP_ROM_QSTR(MP_QSTR_ACCEL_INT1), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_ACCEL_INT2), MP_ROM_PTR(&pin_P1_10) }, + + { MP_ROM_QSTR(MP_QSTR_BATTERY_DIV), MP_ROM_PTR(&pin_P0_29) }, + + { MP_ROM_QSTR(MP_QSTR_RTC_INT), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR_RTC_RST), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_CHRG_STAT), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_SMC_RST), MP_ROM_PTR(&pin_P0_08) }, + + /* nrf52840 compatible pins */ + { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_03) }, + + { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_31) }, + + { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_P0_29) }, + + { MP_ROM_QSTR(MP_QSTR_SWITCH), MP_ROM_PTR(&pin_P1_02) }, + + { MP_ROM_QSTR(MP_QSTR_NFC1), MP_ROM_PTR(&pin_P0_09) }, + { MP_ROM_QSTR(MP_QSTR_NFC2), MP_ROM_PTR(&pin_P0_10) }, + + { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_08) }, + { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P1_09) }, + + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P0_16) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_25) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_24) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) }, +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/nrf/boards/TG-Watch02A/board.c b/ports/nrf/boards/TG-Watch02A/board.c deleted file mode 100644 index 781793328..000000000 --- a/ports/nrf/boards/TG-Watch02A/board.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "supervisor/board.h" - -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.h b/ports/nrf/boards/TG-Watch02A/mpconfigboard.h deleted file mode 100644 index 9b8a31858..000000000 --- a/ports/nrf/boards/TG-Watch02A/mpconfigboard.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Glenn Ruben Bakke - * Copyright (c) 2018 Dan Halbert for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "nrfx/hal/nrf_gpio.h" - -#define MICROPY_HW_BOARD_NAME "TG-Techie's TG-Watch02A" -#define MICROPY_HW_MCU_NAME "nRF52840" - -#define MICROPY_HW_LED_STATUS (&pin_P0_07) - -#if QSPI_FLASH_FILESYSTEM -#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17) -#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22) -#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23) -#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21) -#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19) -#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20) -#endif - -#if SPI_FLASH_FILESYSTEM -#define SPI_FLASH_MOSI_PIN &pin_P0_17 -#define SPI_FLASH_MISO_PIN &pin_P0_22 -#define SPI_FLASH_SCK_PIN &pin_P0_19 -#define SPI_FLASH_CS_PIN &pin_P0_20 -#endif - -#define BOARD_HAS_CRYSTAL 0 - -#define DEFAULT_I2C_BUS_SCL (&pin_P0_11) -#define DEFAULT_I2C_BUS_SDA (&pin_P0_12) - -#define DEFAULT_SPI_BUS_SCK (&pin_P0_14) -#define DEFAULT_SPI_BUS_MOSI (&pin_P0_13) -#define DEFAULT_SPI_BUS_MISO (&pin_P0_15) - -#define DEFAULT_UART_BUS_RX (&pin_P0_24) -#define DEFAULT_UART_BUS_TX (&pin_P0_25) diff --git a/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk b/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk deleted file mode 100644 index 4f5899fa7..000000000 --- a/ports/nrf/boards/TG-Watch02A/mpconfigboard.mk +++ /dev/null @@ -1,19 +0,0 @@ -USB_VID = 0x239A -USB_PID = 0x80DB -USB_PRODUCT = "TG-Watch02A" -USB_MANUFACTURER = "TG-Tech" - -MCU_CHIP = nrf52840 - -QSPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICE_COUNT = 2 -EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q128JV_SQ" - -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LSM6DS -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_FocalTouch -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DS3231 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DRV2605 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BLE -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center diff --git a/ports/nrf/boards/TG-Watch02A/pins.c b/ports/nrf/boards/TG-Watch02A/pins.c deleted file mode 100644 index 582d954ec..000000000 --- a/ports/nrf/boards/TG-Watch02A/pins.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -STATIC const mp_rom_map_elem_t board_module_globals_table[] = { - - /*Port and bus pins*/ - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) }, - - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) }, - - { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, - { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, - { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - - /*TG-Watch02A specific pins*/ - - //tft / display pins - { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_P0_07) }, - { MP_ROM_QSTR(MP_QSTR_DISP_PWR), MP_ROM_PTR(&pin_P0_05) }, - { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_P1_14) }, - { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_P1_12) }, - { MP_ROM_QSTR(MP_QSTR_TFT_RESET), MP_ROM_PTR(&pin_P1_01) }, - - //cap touch screen - { MP_ROM_QSTR(MP_QSTR_CTP_RESET), MP_ROM_PTR(&pin_P1_03) }, - { MP_ROM_QSTR(MP_QSTR_CTP_INT), MP_ROM_PTR(&pin_P1_05) }, - - //power / battery - { MP_ROM_QSTR(MP_QSTR_CHRG_STAT), MP_ROM_PTR(&pin_P0_06) }, - { MP_ROM_QSTR(MP_QSTR_BAT_VDIV), MP_ROM_PTR(&pin_P0_29) }, - { MP_ROM_QSTR(MP_QSTR_VBUS_PRESENT), MP_ROM_PTR(&pin_P1_04) }, - - //sensors / outputs - { MP_ROM_QSTR(MP_QSTR_RTC_RESET), MP_ROM_PTR(&pin_P0_26) }, - { MP_ROM_QSTR(MP_QSTR_RTC_INT), MP_ROM_PTR(&pin_P0_27) }, - - { MP_ROM_QSTR(MP_QSTR_ACCEL_INT1), MP_ROM_PTR(&pin_P1_11) }, - { MP_ROM_QSTR(MP_QSTR_ACCEL_INT2), MP_ROM_PTR(&pin_P1_10) }, - - { MP_ROM_QSTR(MP_QSTR_HAPTIC_INT), MP_ROM_PTR(&pin_P1_07) }, - { MP_ROM_QSTR(MP_QSTR_HAPTIC_ENABLE), MP_ROM_PTR(&pin_P1_06) }, - - //smc pins - { MP_ROM_QSTR(MP_QSTR_SMC_RESET), MP_ROM_PTR(&pin_P0_08) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON0), MP_ROM_PTR(&pin_P1_08) }, - { MP_ROM_QSTR(MP_QSTR_BUTTON1), MP_ROM_PTR(&pin_P1_09) }, -}; - -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); -- cgit v1.2.3 From 53e4d78a3cf42b4a8766d8d2d8315464b80b9632 Mon Sep 17 00:00:00 2001 From: BennyE Date: Sun, 10 Jan 2021 17:18:43 +0100 Subject: Update ports/esp32s2/common-hal/wifi/Network.c Avoid to use yet another variable. Co-authored-by: Scott Shawcroft --- ports/esp32s2/common-hal/wifi/Network.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Network.c b/ports/esp32s2/common-hal/wifi/Network.c index 83c675a19..b6eb6bb43 100644 --- a/ports/esp32s2/common-hal/wifi/Network.c +++ b/ports/esp32s2/common-hal/wifi/Network.c @@ -86,6 +86,5 @@ mp_obj_t common_hal_wifi_network_get_authmode(wifi_network_obj_t *self) { authmode = "UNKNOWN"; break; } - const char* cstr = (const char*) authmode; - return mp_obj_new_str(cstr, strlen(cstr)); + return mp_obj_new_str(authmode, strlen(authmode)); } -- cgit v1.2.3 From c87e1a6527edd6cfe218bf1b5241468ef9161646 Mon Sep 17 00:00:00 2001 From: lady ada Date: Sun, 10 Jan 2021 11:58:39 -0500 Subject: ok lets try without auto-display --- .../boards/adafruit_feather_esp32s2_tftback_nopsram/board.c | 7 ++++++- .../esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c index 8d2b26017..c8be18747 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/board.c @@ -32,6 +32,7 @@ #include "shared-module/displayio/__init__.h" #include "shared-module/displayio/mipi_constants.h" +/* displayio_fourwire_obj_t board_display_obj; #define DELAY 0x80 @@ -46,6 +47,8 @@ uint8_t display_init_sequence[] = { 0x29, 0 | DELAY, 255, // _DISPON }; +*/ + void board_init(void) { // USB common_hal_never_reset_pin(&pin_GPIO19); @@ -57,6 +60,7 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO44); #endif /* DEBUG */ + /* busio_spi_obj_t* spi = &displays[0].fourwire_bus.inline_bus; common_hal_busio_spi_construct(spi, &pin_GPIO36, &pin_GPIO35, NULL); common_hal_busio_spi_never_reset(spi); @@ -68,7 +72,7 @@ void board_init(void) { &pin_GPIO40, // TFT_DC Command or data &pin_GPIO42, // TFT_CS Chip select &pin_GPIO41, // TFT_RST Reset - 20000000, // Baudrate + 4000000, // Baudrate 0, // Polarity 0); // Phase @@ -103,6 +107,7 @@ void board_init(void) { 60, // native_frames_per_second true, // backlight_on_high false); // not SH1107 + */ } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c index 7e2054f41..7e1a72374 100644 --- a/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c +++ b/ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/pins.c @@ -67,6 +67,6 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, - { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} + // { MP_ROM_QSTR(MP_QSTR_DISPLAY), MP_ROM_PTR(&displays[0].display)} }; MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); -- cgit v1.2.3 From a397af9bdfc23d7d0b3c7c05aab799d674b7c953 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 10 Jan 2021 13:16:19 -0500 Subject: Round BLE timing values; fix timeout check --- ports/nrf/common-hal/_bleio/Adapter.c | 12 ++++++------ shared-bindings/_bleio/Adapter.c | 14 +++++++------- shared-bindings/_pixelbuf/__init__.c | 2 +- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ports/nrf/common-hal/_bleio/Adapter.c b/ports/nrf/common-hal/_bleio/Adapter.c index 53a40f9a6..10794c16a 100644 --- a/ports/nrf/common-hal/_bleio/Adapter.c +++ b/ports/nrf/common-hal/_bleio/Adapter.c @@ -469,7 +469,7 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t* ble_drv_add_event_handler(scan_on_ble_evt, self->scan_results); - uint32_t nrf_timeout = SEC_TO_UNITS(timeout, UNIT_10_MS); + uint32_t nrf_timeout = SEC_TO_UNITS(timeout, UNIT_10_MS) + 0.5f; if (nrf_timeout > UINT16_MAX) { // 0xffff / 100 mp_raise_ValueError(translate("timeout must be < 655.35 secs")); @@ -479,15 +479,15 @@ mp_obj_t common_hal_bleio_adapter_start_scan(bleio_adapter_obj_t *self, uint8_t* mp_raise_ValueError(translate("non-zero timeout must be > 0.01")); } - if (nrf_timeout) { + if (nrf_timeout == 0) { nrf_timeout = BLE_GAP_SCAN_TIMEOUT_UNLIMITED; } ble_gap_scan_params_t scan_params = { .extended = extended, - .interval = SEC_TO_UNITS(interval, UNIT_0_625_MS), + .interval = SEC_TO_UNITS(interval, UNIT_0_625_MS) + 0.5f, .timeout = nrf_timeout, - .window = SEC_TO_UNITS(window, UNIT_0_625_MS), + .window = SEC_TO_UNITS(window, UNIT_0_625_MS) + 0.5f, .scan_phys = BLE_GAP_PHY_1MBPS, .active = active }; @@ -553,7 +553,7 @@ mp_obj_t common_hal_bleio_adapter_connect(bleio_adapter_obj_t *self, bleio_addre .window = MSEC_TO_UNITS(100, UNIT_0_625_MS), .scan_phys = BLE_GAP_PHY_1MBPS, // timeout of 0 means no timeout - .timeout = SEC_TO_UNITS(timeout, UNIT_10_MS), + .timeout = SEC_TO_UNITS(timeout, UNIT_10_MS) + 0.5f, }; ble_gap_conn_params_t conn_params = { @@ -696,7 +696,7 @@ uint32_t _common_hal_bleio_adapter_start_advertising(bleio_adapter_obj_t *self, } ble_gap_adv_params_t adv_params = { - .interval = SEC_TO_UNITS(interval, UNIT_0_625_MS), + .interval = SEC_TO_UNITS(interval, UNIT_0_625_MS) + 0.5f, .properties.type = adv_type, .duration = SEC_TO_UNITS(timeout, UNIT_10_MS), .filter_policy = BLE_GAP_ADV_FP_ANY, diff --git a/shared-bindings/_bleio/Adapter.c b/shared-bindings/_bleio/Adapter.c index 7d7076aab..81277fd70 100644 --- a/shared-bindings/_bleio/Adapter.c +++ b/shared-bindings/_bleio/Adapter.c @@ -33,8 +33,8 @@ #include "shared-bindings/_bleio/Address.h" #include "shared-bindings/_bleio/Adapter.h" -#define ADV_INTERVAL_MIN (0.02001f) -#define ADV_INTERVAL_MIN_STRING "0.02001" +#define ADV_INTERVAL_MIN (0.02f) +#define ADV_INTERVAL_MIN_STRING "0.02" #define ADV_INTERVAL_MAX (10.24f) #define ADV_INTERVAL_MAX_STRING "10.24" // 20ms is recommended by Apple @@ -204,7 +204,7 @@ const mp_obj_property_t bleio_adapter_name_obj = { //| :param ~_typing.ReadableBuffer scan_response: scan response data packet bytes. ``None`` if no scan response is needed. //| :param bool connectable: If `True` then other devices are allowed to connect to this peripheral. //| :param bool anonymous: If `True` then this device's MAC address is randomized before advertising. -//| :param int timeout: If set, we will only advertise for this many seconds. +//| :param int timeout: If set, we will only advertise for this many seconds. Zero means no timeout. //| :param float interval: advertising interval, in seconds""" //| ... //| @@ -237,7 +237,7 @@ STATIC mp_obj_t bleio_adapter_start_advertising(mp_uint_t n_args, const mp_obj_t args[ARG_interval].u_obj = mp_obj_new_float(ADV_INTERVAL_DEFAULT); } - const mp_float_t interval = mp_obj_float_get(args[ARG_interval].u_obj); + const mp_float_t interval = mp_obj_get_float(args[ARG_interval].u_obj); if (interval < ADV_INTERVAL_MIN || interval > ADV_INTERVAL_MAX) { mp_raise_ValueError_varg(translate("interval must be in range %s-%s"), ADV_INTERVAL_MIN_STRING, ADV_INTERVAL_MAX_STRING); @@ -279,7 +279,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(bleio_adapter_stop_advertising_obj, bleio_adapt //| ignored. Format is one byte for length (n) and n bytes of prefix and can be repeated. //| :param int buffer_size: the maximum number of advertising bytes to buffer. //| :param bool extended: When True, support extended advertising packets. Increasing buffer_size is recommended when this is set. -//| :param float timeout: the scan timeout in seconds. If None, will scan until `stop_scan` is called. +//| :param float timeout: the scan timeout in seconds. If None or zero, will scan until `stop_scan` is called. //| :param float interval: the interval (in seconds) between the start of two consecutive scan windows //| Must be in the range 0.0025 - 40.959375 seconds. //| :param float window: the duration (in seconds) to scan a single BLE channel. @@ -320,7 +320,7 @@ STATIC mp_obj_t bleio_adapter_start_scan(size_t n_args, const mp_obj_t *pos_args args[ARG_window].u_obj = mp_obj_new_float(WINDOW_DEFAULT); } - const mp_float_t interval = mp_obj_float_get(args[ARG_interval].u_obj); + const mp_float_t interval = mp_obj_get_float(args[ARG_interval].u_obj); if (interval < INTERVAL_MIN || interval > INTERVAL_MAX) { mp_raise_ValueError_varg(translate("interval must be in range %s-%s"), INTERVAL_MIN_STRING, INTERVAL_MAX_STRING); } @@ -332,7 +332,7 @@ STATIC mp_obj_t bleio_adapter_start_scan(size_t n_args, const mp_obj_t *pos_args } #pragma GCC diagnostic pop - const mp_float_t window = mp_obj_float_get(args[ARG_window].u_obj); + const mp_float_t window = mp_obj_get_float(args[ARG_window].u_obj); if (window > interval) { mp_raise_ValueError(translate("window must be <= interval")); } diff --git a/shared-bindings/_pixelbuf/__init__.c b/shared-bindings/_pixelbuf/__init__.c index c61acc939..fdd02509c 100644 --- a/shared-bindings/_pixelbuf/__init__.c +++ b/shared-bindings/_pixelbuf/__init__.c @@ -51,7 +51,7 @@ //| STATIC mp_obj_t pixelbuf_colorwheel(mp_obj_t n) { - return MP_OBJ_NEW_SMALL_INT(colorwheel(MP_OBJ_IS_SMALL_INT(n) ? MP_OBJ_SMALL_INT_VALUE(n) : mp_obj_float_get(n))); + return MP_OBJ_NEW_SMALL_INT(colorwheel(MP_OBJ_IS_SMALL_INT(n) ? MP_OBJ_SMALL_INT_VALUE(n) : mp_obj_get_float(n))); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(pixelbuf_colorwheel_obj, pixelbuf_colorwheel); -- cgit v1.2.3 From 6928de0364fa6682bd39b48b1bac9a566773f3fd Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 10 Jan 2021 13:54:08 -0500 Subject: merge from upstream and update to 6.0.x --- docs/robots.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/robots.txt b/docs/robots.txt index 39a4eaeed..ad3189d42 100644 --- a/docs/robots.txt +++ b/docs/robots.txt @@ -1,6 +1,6 @@ User-agent: * Allow: /*/latest/ Allow: /en/latest/ # Fallback for bots that don't understand wildcards -Allow: /*/5.3.x/ -Allow: /en/5.3.x/ # Fallback for bots that don't understand wildcards +Allow: /*/6.0.x/ +Allow: /en/6.0.x/ # Fallback for bots that don't understand wildcards Disallow: / -- cgit v1.2.3 From 316bd0c72d852ce5983decd17b4b0bfd4828f294 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Sun, 10 Jan 2021 19:19:48 -0500 Subject: fix atmel-samd DAC channel selection logic --- ports/atmel-samd/common-hal/analogio/AnalogOut.c | 31 ++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/ports/atmel-samd/common-hal/analogio/AnalogOut.c b/ports/atmel-samd/common-hal/analogio/AnalogOut.c index 1565b0a8f..2ddbb6e3a 100644 --- a/ports/atmel-samd/common-hal/analogio/AnalogOut.c +++ b/ports/atmel-samd/common-hal/analogio/AnalogOut.c @@ -55,21 +55,22 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self, mp_raise_NotImplementedError(translate("No DAC on chip")); #else - int channel = -1; - - #if defined(PIN_PA02) && !defined(IGNORE_PIN_PA02) - if (pin->number != PIN_PA02) { - channel = 0; - } - #endif - #if defined(PIN_PA05) && defined(PIN_PA05) && !defined(IGNORE_PIN_PA05) - if (pin->number != PIN_PA05) { - channel = 1; - } - #endif - - if(channel == -1) { - mp_raise_ValueError(translate("AnalogOut not supported on given pin")); + uint8_t channel; + switch (pin->number) { + #if defined(PIN_PA02) && !defined(IGNORE_PIN_PA02) + case PIN_PA02: + channel = 0; + break; + #endif + + #if defined(SAM_D5X_E5X) && defined(PIN_PA05) && defined(PIN_PA05) && !defined(IGNORE_PIN_PA05) + case PIN_PA05: + channel = 1; + break; + #endif + + default: + mp_raise_ValueError(translate("AnalogOut not supported on given pin")); return; } -- cgit v1.2.3 From 5f448139e0c5972def8a8f138cd29afd1e9222f8 Mon Sep 17 00:00:00 2001 From: microDev <70126934+microDev1@users.noreply.github.com> Date: Mon, 11 Jan 2021 15:30:45 +0530 Subject: fixes and enhancement for touch alarm - prevent touch alarm initialization if not set - fix wake_alarm is set to touch alarm on autoreload - add ability to have multiple touch alarms in light sleep --- locale/circuitpython.pot | 10 ++-- ports/esp32s2/common-hal/alarm/__init__.c | 4 +- ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c | 66 ++++++++++++++++------- 3 files changed, 53 insertions(+), 27 deletions(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index f319b82f8..dc5396b8e 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-01-04 12:55-0600\n" +"POT-Creation-Date: 2021-01-11 14:24+0530\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1485,12 +1485,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/ports/esp32s2/common-hal/alarm/__init__.c b/ports/esp32s2/common-hal/alarm/__init__.c index 47764a03a..1cec5d4ae 100644 --- a/ports/esp32s2/common-hal/alarm/__init__.c +++ b/ports/esp32s2/common-hal/alarm/__init__.c @@ -92,9 +92,9 @@ STATIC mp_obj_t _get_wake_alarm(size_t n_alarms, const mp_obj_t *alarms) { return alarm_pin_pinalarm_get_wakeup_alarm(n_alarms, alarms); } - case ESP_SLEEP_WAKEUP_TOUCHPAD: + case ESP_SLEEP_WAKEUP_TOUCHPAD: { return alarm_touch_touchalarm_get_wakeup_alarm(n_alarms, alarms); - break; + } case ESP_SLEEP_WAKEUP_UNDEFINED: default: diff --git a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c index 20553877c..3095bc9e8 100644 --- a/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +++ b/ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c @@ -31,8 +31,8 @@ #include "peripherals/touch.h" #include "supervisor/esp_port.h" +static uint16_t touch_channel_mask; static volatile bool woke_up = false; -static touch_pad_t touch_channel = TOUCH_PAD_MAX; void common_hal_alarm_touch_touchalarm_construct(alarm_touch_touchalarm_obj_t *self, const mcu_pin_obj_t *pin) { if (pin->touch_channel == TOUCH_PAD_MAX) { @@ -50,14 +50,20 @@ mp_obj_t alarm_touch_touchalarm_get_wakeup_alarm(const size_t n_alarms, const mp } } + // Create TouchAlarm object. alarm_touch_touchalarm_obj_t *alarm = m_new_obj(alarm_touch_touchalarm_obj_t); alarm->base.type = &alarm_touch_touchalarm_type; alarm->pin = NULL; + touch_pad_t wake_channel = touch_pad_get_current_meas_channel(); + if (wake_channel == TOUCH_PAD_MAX) { + return alarm; + } + // Map the pin number back to a pin object. for (size_t i = 0; i < mcu_pin_globals.map.used; i++) { const mcu_pin_obj_t* pin_obj = MP_OBJ_TO_PTR(mcu_pin_globals.map.table[i].value); - if (pin_obj->touch_channel == touch_channel) { + if (pin_obj->touch_channel == wake_channel) { alarm->pin = mcu_pin_globals.map.table[i].value; break; } @@ -83,46 +89,66 @@ void alarm_touch_touchalarm_set_alarm(const bool deep_sleep, const size_t n_alar for (size_t i = 0; i < n_alarms; i++) { if (MP_OBJ_IS_TYPE(alarms[i], &alarm_touch_touchalarm_type)) { - if (!touch_alarm_set) { - touch_alarm = MP_OBJ_TO_PTR(alarms[i]); - touch_alarm_set = true; - } else { - mp_raise_ValueError(translate("Only one alarm.touch alarm can be set.")); + if (deep_sleep && touch_alarm_set) { + mp_raise_ValueError(translate("Only one TouchAlarm can be set in deep sleep.")); } + touch_alarm = MP_OBJ_TO_PTR(alarms[i]); + touch_channel_mask |= 1 << touch_alarm->pin->number; + touch_alarm_set = true; } } + if (!touch_alarm_set) { return; } - touch_channel = touch_alarm->pin->touch_channel; - // configure interrupt for pretend to deep sleep // this will be disabled if we actually deep sleep - // intialize touchpad + // reset touch peripheral peripherals_touch_reset(); peripherals_touch_never_reset(true); - peripherals_touch_init(touch_channel); - // wait for touch data to reset - mp_hal_delay_ms(10); + for (uint8_t i = 1; i <= 14; i++) { + if ((touch_channel_mask & 1 << i) != 0) { + touch_pad_t touch_channel = (touch_pad_t)i; + // intialize touchpad + peripherals_touch_init(touch_channel); - // configure trigger threshold - uint32_t touch_value; - touch_pad_read_benchmark(touch_channel, &touch_value); - touch_pad_set_thresh(touch_channel, touch_value * 0.1); //10% + // wait for touch data to reset + mp_hal_delay_ms(10); + + // configure trigger threshold + uint32_t touch_value; + touch_pad_read_benchmark(touch_channel, &touch_value); + touch_pad_set_thresh(touch_channel, touch_value * 0.1); //10% + } + } // configure touch interrupt touch_pad_timeout_set(true, SOC_TOUCH_PAD_THRESHOLD_MAX); touch_pad_isr_register(touch_interrupt, NULL, TOUCH_PAD_INTR_MASK_ALL); - touch_pad_intr_enable(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE | TOUCH_PAD_INTR_MASK_TIMEOUT); + touch_pad_intr_enable(TOUCH_PAD_INTR_MASK_ACTIVE | TOUCH_PAD_INTR_MASK_INACTIVE); } void alarm_touch_touchalarm_prepare_for_deep_sleep(void) { - // intialize touchpad + if (!touch_channel_mask) { + return; + } + + touch_pad_t touch_channel = TOUCH_PAD_MAX; + for (uint8_t i = 1; i <= 14; i++) { + if ((touch_channel_mask & 1 << i) != 0) { + touch_channel = (touch_pad_t)i; + break; + } + } + + // reset touch peripheral peripherals_touch_never_reset(false); peripherals_touch_reset(); + + // intialize touchpad peripherals_touch_init(touch_channel); // configure touchpad for sleep @@ -148,6 +174,6 @@ bool alarm_touch_touchalarm_woke_us_up(void) { void alarm_touch_touchalarm_reset(void) { woke_up = false; - touch_channel = TOUCH_PAD_MAX; + touch_channel_mask = 0; peripherals_touch_never_reset(false); } -- cgit v1.2.3 From 0593e464bfa52eda31ff53772f6e7f8150f6b01c Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 11 Jan 2021 13:52:46 -0600 Subject: ulab: bump to version 1.6.1 --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index c4b06e419..d62d07ea0 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit c4b06e419f3d515478b05bb8ce03ebdb29cddec4 +Subproject commit d62d07ea0b9597535428ebe6012da6b0d6608bf9 -- cgit v1.2.3 From 9e9291777f5fe3bb6f1545c62cb7285268f61cda Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Mon, 11 Jan 2021 16:09:05 -0500 Subject: Update created code.py file formatting. --- supervisor/shared/filesystem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/filesystem.c b/supervisor/shared/filesystem.c index 88603be0c..184c67b5f 100644 --- a/supervisor/shared/filesystem.c +++ b/supervisor/shared/filesystem.c @@ -74,7 +74,7 @@ static void make_sample_code_file(FATFS *fatfs) { #if CIRCUITPY_FULL_BUILD FIL fs; UINT char_written = 0; - const byte buffer[] = "print('Hello World!')\n"; + const byte buffer[] = "print("Hello World!")\n"; //Create or modify existing code.py file f_open(fatfs, &fs, "/code.py", FA_WRITE | FA_CREATE_ALWAYS); f_write(&fs, buffer, sizeof(buffer) - 1, &char_written); -- cgit v1.2.3 From 09596ddca208b2bd337c5e6650e61d1ff972dad4 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Mon, 11 Jan 2021 16:26:27 -0500 Subject: Adding escape characters. --- supervisor/shared/filesystem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor/shared/filesystem.c b/supervisor/shared/filesystem.c index 184c67b5f..618dc796b 100644 --- a/supervisor/shared/filesystem.c +++ b/supervisor/shared/filesystem.c @@ -74,7 +74,7 @@ static void make_sample_code_file(FATFS *fatfs) { #if CIRCUITPY_FULL_BUILD FIL fs; UINT char_written = 0; - const byte buffer[] = "print("Hello World!")\n"; + const byte buffer[] = "print(\"Hello World!\")\n"; //Create or modify existing code.py file f_open(fatfs, &fs, "/code.py", FA_WRITE | FA_CREATE_ALWAYS); f_write(&fs, buffer, sizeof(buffer) - 1, &char_written); -- cgit v1.2.3 From 0bc5461dc77203ded954a7446f421a520ea50789 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 12 Jan 2021 00:22:49 +0100 Subject: Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 24 ++++++++++++++++++++++++ locale/cs.po | 24 ++++++++++++++++++++++++ locale/de_DE.po | 24 ++++++++++++++++++++++++ locale/el.po | 24 ++++++++++++++++++++++++ locale/es.po | 24 ++++++++++++++++++++++++ locale/fil.po | 24 ++++++++++++++++++++++++ locale/fr.po | 24 ++++++++++++++++++++++++ locale/hi.po | 24 ++++++++++++++++++++++++ locale/it_IT.po | 24 ++++++++++++++++++++++++ locale/ja.po | 24 ++++++++++++++++++++++++ locale/ko.po | 24 ++++++++++++++++++++++++ locale/nl.po | 24 ++++++++++++++++++++++++ locale/pl.po | 24 ++++++++++++++++++++++++ locale/pt_BR.po | 24 ++++++++++++++++++++++++ locale/sv.po | 24 ++++++++++++++++++++++++ locale/zh_Latn_pinyin.po | 24 ++++++++++++++++++++++++ 16 files changed, 384 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index 9fc91305e..2c0408f22 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -280,6 +280,10 @@ msgstr "0.0 ke kompleks berpangkat" msgid "3-arg pow() not supported" msgstr "pow() 3-arg tidak didukung" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2474,6 +2478,10 @@ msgstr "" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2558,6 +2566,10 @@ msgstr "" msgid "default 'except' must be last" msgstr "'except' standar harus terakhir" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2657,6 +2669,10 @@ msgstr "hanya mengharapkan sebuah nilai (value) untuk set" msgid "expecting key:value for dict" msgstr "key:value diharapkan untuk dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "argumen keyword ekstra telah diberikan" @@ -3189,6 +3205,10 @@ msgstr "" msgid "no binding for nonlocal found" msgstr "tidak ada ikatan/bind pada temuan nonlocal" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "tidak ada modul yang bernama '%q'" @@ -3523,6 +3543,10 @@ msgstr "kompilasi script tidak didukung" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index c72a781be..3d8c8d953 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -278,6 +278,10 @@ msgstr "" msgid "3-arg pow() not supported" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2428,6 +2432,10 @@ msgstr "" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2512,6 +2520,10 @@ msgstr "" msgid "default 'except' must be last" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2611,6 +2623,10 @@ msgstr "" msgid "expecting key:value for dict" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "" @@ -3143,6 +3159,10 @@ msgstr "" msgid "no binding for nonlocal found" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "" @@ -3476,6 +3496,10 @@ msgstr "" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index a1d072643..647f29435 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -279,6 +279,10 @@ msgstr "0.0 zu einer komplexen Potenz" msgid "3-arg pow() not supported" msgstr "3-arg pow() wird nicht unterstützt" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2493,6 +2497,10 @@ msgstr "chr() arg ist nicht in range(256)" msgid "circle can only be registered in one parent" msgstr "Kreis kann nur in einem Elternteil registriert werden" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "Farbpuffer muss 3 Bytes (RGB) oder 4 Bytes (RGB + pad byte) sein" @@ -2579,6 +2587,10 @@ msgstr "Dezimalzahlen nicht unterstützt" msgid "default 'except' must be last" msgstr "Die Standart-Ausnahmebehandlung muss als letztes sein" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2680,6 +2692,10 @@ msgstr "Erwarte nur einen Wert für set" msgid "expecting key:value for dict" msgstr "Erwarte key:value für dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "Es wurden zusätzliche Keyword-Argumente angegeben" @@ -3219,6 +3235,10 @@ msgstr "kein verfügbares Netzwerkadapter (NIC)" msgid "no binding for nonlocal found" msgstr "Kein Binding für nonlocal gefunden" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "Kein Modul mit dem Namen '%q'" @@ -3558,6 +3578,10 @@ msgstr "kompilieren von Skripten nicht unterstützt" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "Vorzeichen nicht erlaubt in einem String formatierungs specifier" diff --git a/locale/el.po b/locale/el.po index acf4241d1..bfa6779ab 100644 --- a/locale/el.po +++ b/locale/el.po @@ -275,6 +275,10 @@ msgstr "" msgid "3-arg pow() not supported" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2425,6 +2429,10 @@ msgstr "" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2509,6 +2517,10 @@ msgstr "" msgid "default 'except' must be last" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2608,6 +2620,10 @@ msgstr "" msgid "expecting key:value for dict" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "" @@ -3140,6 +3156,10 @@ msgstr "" msgid "no binding for nonlocal found" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "" @@ -3473,6 +3493,10 @@ msgstr "" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" diff --git a/locale/es.po b/locale/es.po index 90fbc5631..e4391fef6 100644 --- a/locale/es.po +++ b/locale/es.po @@ -281,6 +281,10 @@ msgstr "0.0 a una potencia compleja" msgid "3-arg pow() not supported" msgstr "pow() con 3 argumentos no soportado" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2491,6 +2495,10 @@ msgstr "El argumento de chr() no esta en el rango(256)" msgid "circle can only be registered in one parent" msgstr "circulo solo puede ser registrado con un pariente" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "color buffer debe ser 3 bytes (RGB) ó 4 bytes (RGB + pad byte)" @@ -2575,6 +2583,10 @@ msgstr "números decimales no soportados" msgid "default 'except' must be last" msgstr "'except' por defecto deberia estar de último" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2676,6 +2688,10 @@ msgstr "esperando solo un valor para set" msgid "expecting key:value for dict" msgstr "esperando la clave:valor para dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "argumento(s) por palabra clave adicionales fueron dados" @@ -3211,6 +3227,10 @@ msgstr "NIC no disponible" msgid "no binding for nonlocal found" msgstr "no se ha encontrado ningún enlace para nonlocal" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "ningún módulo se llama '%q'" @@ -3549,6 +3569,10 @@ msgstr "script de compilación no soportado" msgid "shape must be a tuple" msgstr "forma tiene que ser una tupla" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "signo no permitido en el espeficador de string format" diff --git a/locale/fil.po b/locale/fil.po index d82731e31..82a59922b 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -277,6 +277,10 @@ msgstr "0.0 para sa complex power" msgid "3-arg pow() not supported" msgstr "3-arg pow() hindi suportado" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2462,6 +2466,10 @@ msgstr "chr() arg wala sa sakop ng range(256)" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "color buffer ay dapat na 3 bytes (RGB) o 4 bytes (RGB + pad byte)" @@ -2546,6 +2554,10 @@ msgstr "decimal numbers hindi sinusuportahan" msgid "default 'except' must be last" msgstr "default 'except' ay dapat sa huli" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2650,6 +2662,10 @@ msgstr "umaasa sa value para sa set" msgid "expecting key:value for dict" msgstr "umaasang key: halaga para sa dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "dagdag na keyword argument na ibinigay" @@ -3187,6 +3203,10 @@ msgstr "walang magagamit na NIC" msgid "no binding for nonlocal found" msgstr "no binding para sa nonlocal, nahanap" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "walang module na '%q'" @@ -3524,6 +3544,10 @@ msgstr "script kompilasyon hindi supportado" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "sign hindi maaring string format specifier" diff --git a/locale/fr.po b/locale/fr.po index e898631ea..3fb38788f 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -286,6 +286,10 @@ msgstr "0.0 à une puissance complexe" msgid "3-arg pow() not supported" msgstr "pow() non supporté avec 3 paramètres" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2519,6 +2523,10 @@ msgstr "paramètre de chr() hors les bornes de range(256)" msgid "circle can only be registered in one parent" msgstr "le cercle ne peut être enregistré que dans un seul parent" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "le tampon de couleur doit faire 3 octets (RVB) ou 4 (RVB + pad byte)" @@ -2605,6 +2613,10 @@ msgstr "nombres décimaux non supportés" msgid "default 'except' must be last" msgstr "l''except' par défaut doit être en dernier" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2706,6 +2718,10 @@ msgstr "une simple valeur est attendue pour l'ensemble 'set'" msgid "expecting key:value for dict" msgstr "couple clef:valeur attendu pour un dictionnaire 'dict'" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "argument(s) nommé(s) supplémentaire(s) donné(s)" @@ -3245,6 +3261,10 @@ msgstr "adapteur réseau non disponible" msgid "no binding for nonlocal found" msgstr "pas de lien trouvé pour nonlocal" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "pas de module '%q'" @@ -3585,6 +3605,10 @@ msgstr "compilation de script non supportée" msgid "shape must be a tuple" msgstr "forme doit être un tuple" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "signe non autorisé dans les spéc. de formats de chaînes de caractères" diff --git a/locale/hi.po b/locale/hi.po index ba82ca895..916f22a13 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -275,6 +275,10 @@ msgstr "" msgid "3-arg pow() not supported" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2425,6 +2429,10 @@ msgstr "" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2509,6 +2517,10 @@ msgstr "" msgid "default 'except' must be last" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2608,6 +2620,10 @@ msgstr "" msgid "expecting key:value for dict" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "" @@ -3140,6 +3156,10 @@ msgstr "" msgid "no binding for nonlocal found" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "" @@ -3473,6 +3493,10 @@ msgstr "" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index c0b2aa931..91d11bdcb 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -276,6 +276,10 @@ msgstr "0.0 elevato alla potenza di un numero complesso" msgid "3-arg pow() not supported" msgstr "pow() con tre argmomenti non supportata" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2463,6 +2467,10 @@ msgstr "argomento di chr() non è in range(256)" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2549,6 +2557,10 @@ msgstr "numeri decimali non supportati" msgid "default 'except' must be last" msgstr "'except' predefinito deve essere ultimo" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2652,6 +2664,10 @@ msgstr "un solo valore atteso per set" msgid "expecting key:value for dict" msgstr "chiave:valore atteso per dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "argomento nominato aggiuntivo fornito" @@ -3191,6 +3207,10 @@ msgstr "busio.UART non ancora implementato" msgid "no binding for nonlocal found" msgstr "nessun binding per nonlocal trovato" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "nessun modulo chiamato '%q'" @@ -3532,6 +3552,10 @@ msgstr "compilazione dello scrip non suportata" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "segno non permesso nello spcificatore di formato della stringa" diff --git a/locale/ja.po b/locale/ja.po index 770752e99..7c4e080eb 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -280,6 +280,10 @@ msgstr "0.0を複素数でべき乗" msgid "3-arg pow() not supported" msgstr "引数3つのpow()は非対応" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2448,6 +2452,10 @@ msgstr "" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2534,6 +2542,10 @@ msgstr "" msgid "default 'except' must be last" msgstr "デフォルトのexceptは最後に置く必要があります" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2635,6 +2647,10 @@ msgstr "setには値のみが必要" msgid "expecting key:value for dict" msgstr "dictには key:value が必要" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "余分なキーワード引数があります" @@ -3168,6 +3184,10 @@ msgstr "利用可能なNICがありません" msgid "no binding for nonlocal found" msgstr "nonlocalの対象が見つかりません" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "'%q' という名前のモジュールはありません" @@ -3504,6 +3524,10 @@ msgstr "スクリプトのコンパイルは非対応" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "文字列フォーマット指定子で符号は使えません" diff --git a/locale/ko.po b/locale/ko.po index 97ede047a..7bf8c4ca6 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -276,6 +276,10 @@ msgstr "" msgid "3-arg pow() not supported" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2429,6 +2433,10 @@ msgstr "" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2513,6 +2521,10 @@ msgstr "" msgid "default 'except' must be last" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2612,6 +2624,10 @@ msgstr "" msgid "expecting key:value for dict" msgstr "" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "" @@ -3144,6 +3160,10 @@ msgstr "" msgid "no binding for nonlocal found" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "" @@ -3477,6 +3497,10 @@ msgstr "" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index 3fce13212..224898f42 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -278,6 +278,10 @@ msgstr "0.0 tot een complexe macht" msgid "3-arg pow() not supported" msgstr "3-arg pow() niet ondersteund" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2480,6 +2484,10 @@ msgid "circle can only be registered in one parent" msgstr "" "cirkel kan slechts bij één object van een hoger niveau worden geregistreerd" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "kleurbuffer moet 3 bytes (RGB) of 4 bytes (RGB + pad byte) zijn" @@ -2564,6 +2572,10 @@ msgstr "decimale getallen zijn niet ondersteund" msgid "default 'except' must be last" msgstr "standaard 'expect' moet laatste zijn" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2665,6 +2677,10 @@ msgstr "verwacht alleen een waarde voor set" msgid "expecting key:value for dict" msgstr "verwacht key:waarde for dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "extra keyword argumenten gegeven" @@ -3201,6 +3217,10 @@ msgstr "geen netwerkadapter (NIC) beschikbaar" msgid "no binding for nonlocal found" msgstr "geen binding voor nonlocal gevonden" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "geen module met naam '%q'" @@ -3537,6 +3557,10 @@ msgstr "scriptcompilatie wordt niet ondersteund" msgid "shape must be a tuple" msgstr "vorm moet een tupel zijn" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "teken niet toegestaan in string formaatspecificatie" diff --git a/locale/pl.po b/locale/pl.po index 80d5cf90b..df26ae451 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -280,6 +280,10 @@ msgstr "0.0 do potęgi zespolonej" msgid "3-arg pow() not supported" msgstr "3-argumentowy pow() jest niewspierany" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2445,6 +2449,10 @@ msgstr "argument chr() poza zakresem range(256)" msgid "circle can only be registered in one parent" msgstr "" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "bufor kolorów musi nieć 3 bajty (RGB) lub 4 bajty (RGB + wypełnienie)" @@ -2529,6 +2537,10 @@ msgstr "liczby dziesiętne nieobsługiwane" msgid "default 'except' must be last" msgstr "domyślny 'except' musi być ostatni" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2629,6 +2641,10 @@ msgstr "oczekiwano tylko wartości dla zbioru" msgid "expecting key:value for dict" msgstr "oczekiwano klucz:wartość dla słownika" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "nadmiarowe argumenty nazwane" @@ -3161,6 +3177,10 @@ msgstr "brak wolnego NIC" msgid "no binding for nonlocal found" msgstr "brak wiązania dla zmiennej nielokalnej" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "brak modułu o nazwie '%q'" @@ -3496,6 +3516,10 @@ msgstr "kompilowanie skryptów nieobsługiwane" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "znak jest niedopuszczalny w specyfikacji formatu łańcucha" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index f399ade16..f6dea7565 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -286,6 +286,10 @@ msgstr "0,0 para uma potência complexa" msgid "3-arg pow() not supported" msgstr "3-arg pow() não compatível" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2506,6 +2510,10 @@ msgstr "o arg chr() está fora do intervalo(256)" msgid "circle can only be registered in one parent" msgstr "o círculo só pode ser registrado em um pai" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "o buffer das cores deve ter 3 bytes (RGB) ou 4 bytes (RGB + pad byte)" @@ -2592,6 +2600,10 @@ msgstr "os números decimais não são compatíveis" msgid "default 'except' must be last" msgstr "a predefinição 'exceto' deve ser o último" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2694,6 +2706,10 @@ msgstr "esperando apenas um valor para o conjunto" msgid "expecting key:value for dict" msgstr "chave esperada: valor para dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "argumentos extras de palavras-chave passados" @@ -3232,6 +3248,10 @@ msgstr "não há uma Placa de Rede disponível" msgid "no binding for nonlocal found" msgstr "nenhuma ligação para nonlocal foi encontrada" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "nenhum módulo chamado '%q'" @@ -3572,6 +3592,10 @@ msgstr "compilação de script não suportada" msgid "shape must be a tuple" msgstr "a forma deve ser uma tupla" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "sinal não permitido no especificador do formato da sequência" diff --git a/locale/sv.po b/locale/sv.po index 6a19dc5ad..80950a400 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -282,6 +282,10 @@ msgstr "0,0 till ett komplext nummer" msgid "3-arg pow() not supported" msgstr "3-arguments pow() stöds inte" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2480,6 +2484,10 @@ msgstr "chr() arg är inte i intervallet(256)" msgid "circle can only be registered in one parent" msgstr "circle kan endast registreras i en förälder" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "färgbuffert måste vara 3 byte (RGB) eller 4 byte (RGB + pad byte)" @@ -2564,6 +2572,10 @@ msgstr "decimaltal stöds inte" msgid "default 'except' must be last" msgstr "standard \"except\" måste ligga sist" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2666,6 +2678,10 @@ msgstr "förväntar bara ett värde för set" msgid "expecting key:value for dict" msgstr "förväntar nyckel:värde för dict" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "extra keyword-argument angivna" @@ -3201,6 +3217,10 @@ msgstr "ingen tillgänglig NIC" msgid "no binding for nonlocal found" msgstr "ingen bindning för ickelokal hittad" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "ingen modul med namnet '%q'" @@ -3537,6 +3557,10 @@ msgstr "skriptkompilering stöds inte" msgid "shape must be a tuple" msgstr "shape måste vara en tuple" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "tecknet tillåts inte i strängformatspecificerare" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 596855cf6..63472bedc 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -280,6 +280,10 @@ msgstr "0.0 dào fùzá diànyuán" msgid "3-arg pow() not supported" msgstr "bù zhīchí 3-arg pow ()" +#: shared-module/msgpack/__init__.c +msgid "64 bit types" +msgstr "" + #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c msgid "A hardware interrupt channel is already in use" @@ -2464,6 +2468,10 @@ msgstr "chr() cān shǔ bùzài fànwéi (256)" msgid "circle can only be registered in one parent" msgstr "quānzi zhǐ néng zài yī wèi jiāzhǎng zhōng zhùcè" +#: shared-bindings/msgpack/ExtType.c +msgid "code outside range 0~127" +msgstr "" + #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" msgstr "" @@ -2551,6 +2559,10 @@ msgstr "bù zhīchí xiǎoshù shù" msgid "default 'except' must be last" msgstr "mòrèn 'except' bìxū shì zuìhòu yīgè" +#: shared-bindings/msgpack/__init__.c +msgid "default is not a function" +msgstr "" + #: shared-bindings/audiobusio/PDMIn.c msgid "" "destination buffer must be a bytearray or array of type 'B' for bit_depth = 8" @@ -2652,6 +2664,10 @@ msgstr "jǐn qídài shèzhì de zhí" msgid "expecting key:value for dict" msgstr "qídài guānjiàn: Zìdiǎn de jiàzhí" +#: shared-bindings/msgpack/__init__.c +msgid "ext_hook is not a function" +msgstr "" + #: py/argcheck.c msgid "extra keyword arguments given" msgstr "éwài de guānjiàn cí cānshù" @@ -3185,6 +3201,10 @@ msgstr "méiyǒu kěyòng de NIC" msgid "no binding for nonlocal found" msgstr "zhǎo bù dào fēi běndì de bǎng dìng" +#: shared-module/msgpack/__init__.c +msgid "no default packer" +msgstr "" + #: py/builtinimport.c msgid "no module named '%q'" msgstr "méiyǒu mókuài '%q'" @@ -3520,6 +3540,10 @@ msgstr "bù zhīchí jiǎoběn biānyì" msgid "shape must be a tuple" msgstr "" +#: shared-module/msgpack/__init__.c +msgid "short read" +msgstr "" + #: py/objstr.c msgid "sign not allowed in string format specifier" msgstr "zìfú chuàn géshì shuōmíng fú zhōng bù yǔnxǔ shǐyòng fúhào" -- cgit v1.2.3 From 452d66dd0ec117e9015ff9ce8162326c4bfc6b1a Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Mon, 11 Jan 2021 19:12:52 -0500 Subject: Update ports/atmel-samd/common-hal/analogio/AnalogOut.c whoops, yes! Co-authored-by: Scott Shawcroft --- ports/atmel-samd/common-hal/analogio/AnalogOut.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/atmel-samd/common-hal/analogio/AnalogOut.c b/ports/atmel-samd/common-hal/analogio/AnalogOut.c index 2ddbb6e3a..3ddd9cac6 100644 --- a/ports/atmel-samd/common-hal/analogio/AnalogOut.c +++ b/ports/atmel-samd/common-hal/analogio/AnalogOut.c @@ -63,7 +63,7 @@ void common_hal_analogio_analogout_construct(analogio_analogout_obj_t* self, break; #endif - #if defined(SAM_D5X_E5X) && defined(PIN_PA05) && defined(PIN_PA05) && !defined(IGNORE_PIN_PA05) + #if defined(SAM_D5X_E5X) && defined(PIN_PA05) && !defined(IGNORE_PIN_PA05) case PIN_PA05: channel = 1; break; -- cgit v1.2.3 From 1f53d5a4b9277d36f0c24f08cc4608c413b7eafa Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Tue, 12 Jan 2021 14:23:49 +0000 Subject: Translated using Weblate (French) Currently translated at 100.0% (898 of 898 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 3fb38788f..60f9bb9ae 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-07 01:29+0000\n" +"PO-Revision-Date: 2021-01-12 15:40+0000\n" "Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -288,7 +288,7 @@ msgstr "pow() non supporté avec 3 paramètres" #: shared-module/msgpack/__init__.c msgid "64 bit types" -msgstr "" +msgstr "types à 64 bit" #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c @@ -2525,7 +2525,7 @@ msgstr "le cercle ne peut être enregistré que dans un seul parent" #: shared-bindings/msgpack/ExtType.c msgid "code outside range 0~127" -msgstr "" +msgstr "code hors bornes 0~127" #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" @@ -2615,7 +2615,7 @@ msgstr "l''except' par défaut doit être en dernier" #: shared-bindings/msgpack/__init__.c msgid "default is not a function" -msgstr "" +msgstr "default n'est pas une fonction" #: shared-bindings/audiobusio/PDMIn.c msgid "" @@ -2720,7 +2720,7 @@ msgstr "couple clef:valeur attendu pour un dictionnaire 'dict'" #: shared-bindings/msgpack/__init__.c msgid "ext_hook is not a function" -msgstr "" +msgstr "ext_hook n'est pas une fonction" #: py/argcheck.c msgid "extra keyword arguments given" @@ -3263,7 +3263,7 @@ msgstr "pas de lien trouvé pour nonlocal" #: shared-module/msgpack/__init__.c msgid "no default packer" -msgstr "" +msgstr "aucun emballeur par défault" #: py/builtinimport.c msgid "no module named '%q'" @@ -3607,7 +3607,7 @@ msgstr "forme doit être un tuple" #: shared-module/msgpack/__init__.c msgid "short read" -msgstr "" +msgstr "donnée trop petite" #: py/objstr.c msgid "sign not allowed in string format specifier" -- cgit v1.2.3 From af4732a71675ee847ae827691b4a040bf2f4bd9a Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 12 Jan 2021 16:40:07 +0100 Subject: Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 8 ++++---- locale/cs.po | 8 ++++---- locale/de_DE.po | 8 ++++---- locale/el.po | 8 ++++---- locale/es.po | 8 ++++---- locale/fil.po | 8 ++++---- locale/fr.po | 11 +++++++---- locale/hi.po | 8 ++++---- locale/it_IT.po | 8 ++++---- locale/ja.po | 8 ++++---- locale/ko.po | 8 ++++---- locale/nl.po | 8 ++++---- locale/pl.po | 8 ++++---- locale/pt_BR.po | 11 +++++++---- locale/sv.po | 11 +++++++---- locale/zh_Latn_pinyin.po | 8 ++++---- 16 files changed, 73 insertions(+), 64 deletions(-) diff --git a/locale/ID.po b/locale/ID.po index 2c0408f22..f2dc049d9 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -1515,12 +1515,12 @@ msgstr "" "Hanya monokrom, 4bpp atau 8bpp yang diindeks, dan 16bpp atau lebih yang " "didukung: %d bpp diberikan" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/cs.po b/locale/cs.po index 3d8c8d953..f02a5863d 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -1491,12 +1491,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/de_DE.po b/locale/de_DE.po index 647f29435..b7f11335a 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -1516,12 +1516,12 @@ msgstr "" "Nur monochrome, indizierte 4bpp oder 8bpp, und 16bpp oder größere BMPs " "unterstützt: %d bpp wurden gegeben" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/el.po b/locale/el.po index bfa6779ab..77c0f664d 100644 --- a/locale/el.po +++ b/locale/el.po @@ -1488,12 +1488,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/es.po b/locale/es.po index e4391fef6..227c0c5a1 100644 --- a/locale/es.po +++ b/locale/es.po @@ -1515,12 +1515,12 @@ msgstr "" "Solo se admiten BMP monocromáticos, indexados de 4 bpp u 8 bpp y 16 bpp o " "más: %d bpp proporcionados" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/fil.po b/locale/fil.po index 82a59922b..ba3cb2892 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -1506,12 +1506,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/fr.po b/locale/fr.po index 60f9bb9ae..a2e704f5b 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -1531,14 +1531,14 @@ msgstr "" "Seulement les BMP monochromes, 4 bpp ou 8 bpp, ou 16 bpp et plus sont " "supportés: %d bpp fournis" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." +msgstr "" + #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Seulement une alarme alarm.time peut être réglée." -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." -msgstr "Seulement une alarme alarm.touch peut être réglée." - #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Une seule couleur peut être transparente à la fois" @@ -4006,6 +4006,9 @@ msgstr "zi doit être de type float" msgid "zi must be of shape (n_section, 2)" msgstr "zi doit être de forme (n_section, 2)" +#~ msgid "Only one alarm.touch alarm can be set." +#~ msgstr "Seulement une alarme alarm.touch peut être réglée." + #~ msgid "TouchAlarm not available in light sleep" #~ msgstr "TouchAlarm n'est pas disponible en mode someil léger" diff --git a/locale/hi.po b/locale/hi.po index 916f22a13..5c9dfcb77 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -1488,12 +1488,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/it_IT.po b/locale/it_IT.po index 91d11bdcb..6ee6c7109 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -1511,12 +1511,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/ja.po b/locale/ja.po index 7c4e080eb..6c391bb41 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -1503,12 +1503,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/ko.po b/locale/ko.po index 7bf8c4ca6..deb7c617e 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -1491,12 +1491,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/nl.po b/locale/nl.po index 224898f42..a9e7d6bf6 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -1508,14 +1508,14 @@ msgstr "" "Alleen monochrome en 4bpp of 8bpp, en 16bpp of grotere geïndiceerde BMP's " "zijn ondersteund: %d bpp is gegeven" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." +msgstr "" + #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Slechts één alarm.time alarm kan worden ingesteld." -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." -msgstr "" - #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Er kan maar één kleur per keer transparant zijn" diff --git a/locale/pl.po b/locale/pl.po index df26ae451..4356b0491 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -1502,12 +1502,12 @@ msgid "" "%d bpp given" msgstr "" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c diff --git a/locale/pt_BR.po b/locale/pt_BR.po index f6dea7565..d93307486 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -1523,14 +1523,14 @@ msgstr "" "São compatíveis apenas os BMPs monocromáticos, indexados em 4bpp ou 8bpp e " "16bpp ou superior: determinado %d bpp" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." +msgstr "" + #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Apenas um alarme alarm.time pode ser definido." -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." -msgstr "Apenas um alarme alarm.touch pode ser definido." - #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Apenas uma cor pode ser transparente de cada vez" @@ -3992,6 +3992,9 @@ msgstr "zi deve ser de um tipo float" msgid "zi must be of shape (n_section, 2)" msgstr "zi deve estar na forma (n_section, 2)" +#~ msgid "Only one alarm.touch alarm can be set." +#~ msgstr "Apenas um alarme alarm.touch pode ser definido." + #~ msgid "TouchAlarm not available in light sleep" #~ msgstr "O TouchAlarm não está disponívle no modo light sleep" diff --git a/locale/sv.po b/locale/sv.po index 80950a400..8cae54588 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -1512,14 +1512,14 @@ msgstr "" "Endast monokrom, indexerad 4 bpp eller 8 bpp och 16 bpp eller högre BMP: er " "stöds: %d bpp angiven" +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." +msgstr "" + #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." msgstr "Endast ett alarm.time kan ställas in." -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." -msgstr "Endast ett larm av typ alarm.touch kan ställas in." - #: shared-module/displayio/ColorConverter.c msgid "Only one color can be transparent at a time" msgstr "Bara en färg kan vara genomskinlig i taget" @@ -3957,6 +3957,9 @@ msgstr "zi måste vara av typ float" msgid "zi must be of shape (n_section, 2)" msgstr "zi måste vara i formen (n_section, 2)" +#~ msgid "Only one alarm.touch alarm can be set." +#~ msgstr "Endast ett larm av typ alarm.touch kan ställas in." + #~ msgid "input argument must be an integer or a 2-tuple" #~ msgstr "indataargumentet måste vara ett heltal eller en 2-tupel" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 63472bedc..735c90743 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -1504,12 +1504,12 @@ msgstr "" "Jǐn zhīchí dān sè, suǒyǐn wéi 4bpp huò 8bpp yǐjí 16bpp huò gèng gāo de BMP: " "Gěi chū %d bpp" -#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c -msgid "Only one alarm.time alarm can be set." +#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c +msgid "Only one TouchAlarm can be set in deep sleep." msgstr "" -#: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c -msgid "Only one alarm.touch alarm can be set." +#: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c +msgid "Only one alarm.time alarm can be set." msgstr "" #: shared-module/displayio/ColorConverter.c -- cgit v1.2.3 From f7f97ae1b780458265db2091c9bb1337c3108aed Mon Sep 17 00:00:00 2001 From: lady ada Date: Tue, 12 Jan 2021 12:50:08 -0500 Subject: samd21 board with only 4 neopixels + two touchpads --- .../atmel-samd/boards/neopixel_trinkey_m0/board.c | 40 +++++++++++++++ .../boards/neopixel_trinkey_m0/mpconfigboard.h | 57 ++++++++++++++++++++++ .../boards/neopixel_trinkey_m0/mpconfigboard.mk | 44 +++++++++++++++++ ports/atmel-samd/boards/neopixel_trinkey_m0/pins.c | 9 ++++ ports/atmel-samd/supervisor/port.c | 3 +- 5 files changed, 152 insertions(+), 1 deletion(-) create mode 100644 ports/atmel-samd/boards/neopixel_trinkey_m0/board.c create mode 100644 ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.h create mode 100644 ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk create mode 100644 ports/atmel-samd/boards/neopixel_trinkey_m0/pins.c diff --git a/ports/atmel-samd/boards/neopixel_trinkey_m0/board.c b/ports/atmel-samd/boards/neopixel_trinkey_m0/board.c new file mode 100644 index 000000000..cde441b3d --- /dev/null +++ b/ports/atmel-samd/boards/neopixel_trinkey_m0/board.c @@ -0,0 +1,40 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" +#include "common-hal/microcontroller/Pin.h" +#include "supervisor/shared/board.h" +#include "hal/include/hal_gpio.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { +} diff --git a/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.h b/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.h new file mode 100644 index 000000000..ebf8b1e34 --- /dev/null +++ b/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.h @@ -0,0 +1,57 @@ +#define MICROPY_HW_BOARD_NAME "Adafruit NeoPixel Trinkey M0" +#define MICROPY_HW_MCU_NAME "samd21e18" + +#define MICROPY_HW_NEOPIXEL (&pin_PA05) + +#define MICROPY_PORT_A (0) +#define MICROPY_PORT_B (0) +#define MICROPY_PORT_C (0) + +#define IGNORE_PIN_PA00 1 +#define IGNORE_PIN_PA01 1 +#define IGNORE_PIN_PA02 1 +#define IGNORE_PIN_PA04 1 +#define IGNORE_PIN_PA06 1 +#define IGNORE_PIN_PA08 1 +#define IGNORE_PIN_PA09 1 +#define IGNORE_PIN_PA10 1 +#define IGNORE_PIN_PA11 1 +#define IGNORE_PIN_PA12 1 +#define IGNORE_PIN_PA13 1 +#define IGNORE_PIN_PA14 1 +#define IGNORE_PIN_PA15 1 +#define IGNORE_PIN_PA16 1 +#define IGNORE_PIN_PA17 1 +#define IGNORE_PIN_PA18 1 +#define IGNORE_PIN_PA19 1 +#define IGNORE_PIN_PA20 1 +#define IGNORE_PIN_PA21 1 +// USB is always used internally so skip the pin objects for it. +#define IGNORE_PIN_PA24 1 +#define IGNORE_PIN_PA25 1 +#define IGNORE_PIN_PA27 1 +#define IGNORE_PIN_PA28 1 +#define IGNORE_PIN_PA30 1 +#define IGNORE_PIN_PA31 1 +#define IGNORE_PIN_PB00 1 +#define IGNORE_PIN_PB01 1 +#define IGNORE_PIN_PB02 1 +#define IGNORE_PIN_PB03 1 +#define IGNORE_PIN_PB04 1 +#define IGNORE_PIN_PB05 1 +#define IGNORE_PIN_PB06 1 +#define IGNORE_PIN_PB07 1 +#define IGNORE_PIN_PB08 1 +#define IGNORE_PIN_PB09 1 +#define IGNORE_PIN_PB10 1 +#define IGNORE_PIN_PB11 1 +#define IGNORE_PIN_PB12 1 +#define IGNORE_PIN_PB13 1 +#define IGNORE_PIN_PB14 1 +#define IGNORE_PIN_PB15 1 +#define IGNORE_PIN_PB16 1 +#define IGNORE_PIN_PB17 1 +#define IGNORE_PIN_PB22 1 +#define IGNORE_PIN_PB23 1 +#define IGNORE_PIN_PB30 1 +#define IGNORE_PIN_PB31 1 diff --git a/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk b/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk new file mode 100644 index 000000000..4b7dbc8f0 --- /dev/null +++ b/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk @@ -0,0 +1,44 @@ +USB_VID = 0x239A +USB_PID = 0x80F0 +USB_PRODUCT = "NeoPixel Trinkey M0" +USB_MANUFACTURER = "Adafruit Industries LLC" + +CHIP_VARIANT = SAMD21E18A +CHIP_FAMILY = samd21 + +INTERNAL_FLASH_FILESYSTEM = 1 +LONGINT_IMPL = NONE + +SUPEROPT_GC = 0 + +CIRCUITPY_ANALOGIO = 0 +CIRCUITPY_ROTARYIO = 0 +CIRCUITPY_RTC = 0 +CIRCUITPY_SAMD = 0 +CIRCUITPY_PS2IO = 0 +CIRCUITPY_PULSEIO = 0 +CIRCUITPY_PWMIO = 0 +CIRCUITPY_AUDIOCORE = 0 +CIRCUITPY_BUSIO = 0 +CIRCUITPY_STORAGE = 0 + +CIRCUITPY_MATH = 1 +CIRCUITPY_PIXELBUF = 1 +CIRCUITPY_USB_MIDI = 1 +CIRCUITPY_TOUCHIO = 1 +CIRCUITPY_FULL_BUILD = 0 + +CFLAGS_BOARD = --param max-inline-insns-auto=15 +ifeq ($(TRANSLATION), zh_Latn_pinyin) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +endif +ifeq ($(TRANSLATION), de_DE) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif + +# Include these Python libraries in firmware. +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID \ No newline at end of file diff --git a/ports/atmel-samd/boards/neopixel_trinkey_m0/pins.c b/ports/atmel-samd/boards/neopixel_trinkey_m0/pins.c new file mode 100644 index 000000000..3673fcbec --- /dev/null +++ b/ports/atmel-samd/boards/neopixel_trinkey_m0/pins.c @@ -0,0 +1,9 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_global_dict_table[] = { + { MP_ROM_QSTR(MP_QSTR_TOUCH1), MP_ROM_PTR(&pin_PA03) }, + { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA05) }, + { MP_ROM_QSTR(MP_QSTR_TOUCH2), MP_ROM_PTR(&pin_PA07) }, + +}; +MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table); diff --git a/ports/atmel-samd/supervisor/port.c b/ports/atmel-samd/supervisor/port.c index 02b9e3874..c2e27e1e7 100644 --- a/ports/atmel-samd/supervisor/port.c +++ b/ports/atmel-samd/supervisor/port.c @@ -319,8 +319,9 @@ safe_mode_t port_init(void) { } void reset_port(void) { +#if CIRCUITPY_BUSIO reset_sercoms(); - +#endif #if CIRCUITPY_AUDIOIO audio_dma_reset(); audioout_reset(); -- cgit v1.2.3 From 748d44892def232c0e585c4b1d8a4569d3367315 Mon Sep 17 00:00:00 2001 From: lady ada Date: Tue, 12 Jan 2021 12:55:02 -0500 Subject: fix some precommit complaints --- .github/workflows/build.yml | 1 + locale/circuitpython.pot | 2 ++ ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b918ba64a..9899972eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -261,6 +261,7 @@ jobs: - "monster_m4sk" - "ndgarage_ndbit6" - "ndgarage_ndbit6_v2" + - "neopixel_trinkey_m0" - "nfc_copy_cat" - "nice_nano" - "nucleo_f746zg" diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 5a8c60763..205c8465a 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -3397,6 +3397,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk b/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk index 4b7dbc8f0..ab8065a9c 100644 --- a/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk +++ b/ports/atmel-samd/boards/neopixel_trinkey_m0/mpconfigboard.mk @@ -41,4 +41,4 @@ endif # Include these Python libraries in firmware. FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID \ No newline at end of file +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_HID -- cgit v1.2.3 From a07b59552d83d0cff03ac98630b7422f19840c48 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 12 Jan 2021 19:25:50 +0100 Subject: Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/cs.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/de_DE.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/el.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/es.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/fil.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/fr.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/hi.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/it_IT.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/ja.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/ko.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/nl.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/pl.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/pt_BR.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/sv.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ locale/zh_Latn_pinyin.po | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 16 files changed, 992 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index f2dc049d9..f4bb1512e 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -118,6 +118,11 @@ msgstr "%q harus berupa int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() mengambil posisi argumen %d tapi %d yang diberikan" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' argumen dibutuhkan" @@ -546,6 +551,10 @@ msgstr "Bytes harus di antara 0 dan 255." msgid "CBC blocks must be multiples of 16 bytes" msgstr "Blok CBC harus merupakan kelipatan 16 byte" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Panggil super().__init__() sebelum mengakses objek asli." @@ -1006,6 +1015,10 @@ msgstr "Frekuensi harus cocok dengan PWMOut yang ada menggunakan timer ini" msgid "Function requires lock" msgstr "Fungsinya membutuhkan kunci" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1134,6 +1147,7 @@ msgstr "Frekuensi PWM tidak valid" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argumen tidak valid" @@ -1243,6 +1257,14 @@ msgstr "Mode operasi tidak valid." msgid "Invalid security_mode" msgstr "security_mode tidak valid" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Suara tidak valid" @@ -1283,6 +1305,10 @@ msgstr "Panjang harus berupa int" msgid "Length must be non-negative" msgstr "Panjangnya harus non-negatif" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "Pin MISO gagal inisialisasi." @@ -1531,6 +1557,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1539,6 +1577,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "Sampel berlebihan harus kelipatan 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1557,6 +1599,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "ParallelBus belum didukung" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Izin ditolak" @@ -1678,6 +1724,10 @@ msgstr "sistem file (filesystem) bersifat Read-only" msgid "Read-only object" msgstr "sistem file (filesystem) bersifat Read-only" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Segarkan terlalu cepat" @@ -1690,6 +1740,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "Mode AES yang diminta tidak didukung" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Channel Kanan tidak didukung" @@ -2069,6 +2123,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3920,6 +3978,10 @@ msgstr "" msgid "x value out of bounds" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "" diff --git a/locale/cs.po b/locale/cs.po index f02a5863d..2394834a1 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -116,6 +116,11 @@ msgstr "%q by měl být int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() vyžaduje %d pozičních argumentů, ale %d jich bylo zadáno" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "Je vyžadován argument '%q'" @@ -542,6 +547,10 @@ msgstr "" msgid "CBC blocks must be multiples of 16 bytes" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -990,6 +999,10 @@ msgstr "" msgid "Function requires lock" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1116,6 +1129,7 @@ msgstr "" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" @@ -1225,6 +1239,14 @@ msgstr "" msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1265,6 +1287,10 @@ msgstr "" msgid "Length must be non-negative" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "" @@ -1507,6 +1533,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1515,6 +1553,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "" +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1531,6 +1573,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "" @@ -1648,6 +1694,10 @@ msgstr "" msgid "Read-only object" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -1660,6 +1710,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "" @@ -2030,6 +2084,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3872,6 +3930,10 @@ msgstr "" msgid "x value out of bounds" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "" diff --git a/locale/de_DE.po b/locale/de_DE.po index b7f11335a..f83fafe3a 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -117,6 +117,11 @@ msgstr "%q sollte ein integer sein" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() nimmt %d Argumente ohne Keyword an, aber es wurden %d angegeben" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' Argument erforderlich" @@ -547,6 +552,10 @@ msgstr "Ein Bytes kann nur Werte zwischen 0 und 255 annehmen." msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBC-Blöcke müssen ein Vielfaches von 16 Bytes sein" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Rufe super().__init__() vor dem Zugriff auf ein natives Objekt auf." @@ -1005,6 +1014,10 @@ msgstr "" msgid "Function requires lock" msgstr "Die Funktion erwartet, dass der 'lock'-Befehl zuvor ausgeführt wurde" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1133,6 +1146,7 @@ msgstr "Ungültige PWM Frequenz" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Ungültiges Argument" @@ -1242,6 +1256,14 @@ msgstr "Ungültiger Ausführungsmodus." msgid "Invalid security_mode" msgstr "Ungültiger security_mode" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Ungültige Stimme" @@ -1282,6 +1304,10 @@ msgstr "Länge muss ein int sein" msgid "Length must be non-negative" msgstr "Länge darf nicht negativ sein" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "MISO pin Initialisierung fehlgeschlagen." @@ -1532,6 +1558,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1540,6 +1578,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "Oversample muss ein Vielfaches von 8 sein." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1556,6 +1598,10 @@ msgstr "Die PWM-Frequenz ist nicht schreibbar wenn variable_Frequenz = False." msgid "ParallelBus not yet supported" msgstr "ParallelBus wird noch nicht unterstützt" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Zugang verweigert" @@ -1676,6 +1722,10 @@ msgstr "Schreibgeschützte Dateisystem" msgid "Read-only object" msgstr "Schreibgeschützte Objekt" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Zu früh neu geladen" @@ -1688,6 +1738,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "Der angeforderte AES-Modus wird nicht unterstützt" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Rechter Kanal wird nicht unterstützt" @@ -2076,6 +2130,10 @@ msgstr "Wert Länge != Erforderliche feste Länge" msgid "Value length > max_length" msgstr "Länge des Wertes > max_length" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "Viper-Funktionen unterstützen derzeit nicht mehr als 4 Argumente" @@ -3959,6 +4017,10 @@ msgstr "Falscher Ausgabetyp" msgid "x value out of bounds" msgstr "x Wert außerhalb der Grenzen" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y sollte ein int sein" diff --git a/locale/el.po b/locale/el.po index 77c0f664d..267bc4987 100644 --- a/locale/el.po +++ b/locale/el.po @@ -113,6 +113,11 @@ msgstr "" msgid "%q() takes %d positional arguments but %d were given" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "" @@ -539,6 +544,10 @@ msgstr "" msgid "CBC blocks must be multiples of 16 bytes" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -987,6 +996,10 @@ msgstr "" msgid "Function requires lock" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1113,6 +1126,7 @@ msgstr "" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" @@ -1222,6 +1236,14 @@ msgstr "" msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1262,6 +1284,10 @@ msgstr "" msgid "Length must be non-negative" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "" @@ -1504,6 +1530,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1512,6 +1550,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "" +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1528,6 +1570,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "" @@ -1645,6 +1691,10 @@ msgstr "" msgid "Read-only object" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -1657,6 +1707,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "" @@ -2027,6 +2081,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3869,6 +3927,10 @@ msgstr "" msgid "x value out of bounds" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "" diff --git a/locale/es.po b/locale/es.po index 227c0c5a1..e456d7829 100644 --- a/locale/es.po +++ b/locale/es.po @@ -119,6 +119,11 @@ msgstr "%q debe ser un int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() toma %d argumentos posicionales pero %d fueron dados" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "argumento '%q' requerido" @@ -551,6 +556,10 @@ msgstr "Bytes debe estar entre 0 y 255." msgid "CBC blocks must be multiples of 16 bytes" msgstr "Los bloques CBC deben ser múltiplos de 16 bytes" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Llame a super().__ init __() antes de acceder al objeto nativo." @@ -1006,6 +1015,10 @@ msgstr "" msgid "Function requires lock" msgstr "La función requiere lock" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1134,6 +1147,7 @@ msgstr "Frecuencia PWM inválida" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argumento inválido" @@ -1243,6 +1257,14 @@ msgstr "Modo de ejecución inválido." msgid "Invalid security_mode" msgstr "'security_mode' no válido" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Voz inválida" @@ -1283,6 +1305,10 @@ msgstr "Length debe ser un int" msgid "Length must be non-negative" msgstr "Length no deberia ser negativa" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "MISO pin init fallido." @@ -1531,6 +1557,18 @@ msgstr "Solo un color puede ser transparente a la vez" msgid "Only raw int supported for ip" msgstr "Solo se aceptan enteros crudos para ip" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "Se acabaron los enchufes" @@ -1539,6 +1577,10 @@ msgstr "Se acabaron los enchufes" msgid "Oversample must be multiple of 8." msgstr "El sobremuestreo debe ser un múltiplo de 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1557,6 +1599,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "ParallelBus todavía no soportado" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Permiso denegado" @@ -1681,6 +1727,10 @@ msgstr "Sistema de archivos de solo-Lectura" msgid "Read-only object" msgstr "Objeto de solo-lectura" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Refresco demasiado pronto" @@ -1693,6 +1743,10 @@ msgstr "RemoteTransmissionRequests limitado a 8 bytes" msgid "Requested AES mode is unsupported" msgstr "El modo AES solicitado no es compatible" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Canal derecho no soportado" @@ -2079,6 +2133,10 @@ msgstr "Tamaño del valor != del tamaño fijo requerido" msgid "Value length > max_length" msgstr "Tamaño de valor > max_length" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "funciones Viper no soportan por el momento, más de 4 argumentos" @@ -3946,6 +4004,10 @@ msgstr "tipo de salida incorrecta" msgid "x value out of bounds" msgstr "valor x fuera de límites" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y deberia ser un int" diff --git a/locale/fil.po b/locale/fil.po index ba3cb2892..753ecef58 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -115,6 +115,11 @@ msgid "%q() takes %d positional arguments but %d were given" msgstr "" "Ang %q() ay kumukuha ng %d positional arguments pero %d lang ang binigay" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' argument kailangan" @@ -545,6 +550,10 @@ msgstr "Sa gitna ng 0 o 255 dapat ang bytes." msgid "CBC blocks must be multiples of 16 bytes" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -1000,6 +1009,10 @@ msgstr "" msgid "Function requires lock" msgstr "Function nangangailangan ng lock" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1128,6 +1141,7 @@ msgstr "Mali ang PWM frequency" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Maling argumento" @@ -1237,6 +1251,14 @@ msgstr "Mali ang run mode." msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1277,6 +1299,10 @@ msgstr "Haba ay dapat int" msgid "Length must be non-negative" msgstr "Haba ay dapat hindi negatibo" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "Hindi ma-initialize ang MISO pin." @@ -1522,6 +1548,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1530,6 +1568,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "Oversample ay dapat multiple ng 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1547,6 +1589,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Walang pahintulot" @@ -1665,6 +1711,10 @@ msgstr "Basahin-lamang mode" msgid "Read-only object" msgstr "Basahin-lamang" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -1677,6 +1727,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Hindi supportado ang kanang channel" @@ -2049,6 +2103,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3923,6 +3981,10 @@ msgstr "" msgid "x value out of bounds" msgstr "wala sa sakop ang address" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y ay dapat int" diff --git a/locale/fr.po b/locale/fr.po index a2e704f5b..50166c71e 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -124,6 +124,11 @@ msgstr "%q doit être un chiffre entier (int)" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() prend %d paramètres positionnels mais %d ont été donnés" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "paramètre '%q' requis" @@ -556,6 +561,10 @@ msgstr "Les octets 'bytes' doivent être entre 0 et 255." msgid "CBC blocks must be multiples of 16 bytes" msgstr "Les blocs CBC doivent être des multiples de 16 octets" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Appelez super () .__ init __ () avant d'accéder à l'objet natif." @@ -1022,6 +1031,10 @@ msgstr "" msgid "Function requires lock" msgstr "La fonction nécessite un verrou ('lock')" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1150,6 +1163,7 @@ msgstr "Fréquence de PWM invalide" msgid "Invalid Pin" msgstr "Broche invalide" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Paramètre invalide" @@ -1259,6 +1273,14 @@ msgstr "Mode de lancement invalide." msgid "Invalid security_mode" msgstr "'security_mode' invalide" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Voix invalide" @@ -1299,6 +1321,10 @@ msgstr "Length doit être un chiffre entier (int)" msgid "Length must be non-negative" msgstr "Length ne doit pas être négatif" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "Échec de l'initialization de la broche MISO." @@ -1547,6 +1573,18 @@ msgstr "Une seule couleur peut être transparente à la fois" msgid "Only raw int supported for ip" msgstr "IP n'accepte que les chiffres entiers bruts" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "Plus de sockets" @@ -1555,6 +1593,10 @@ msgstr "Plus de sockets" msgid "Oversample must be multiple of 8." msgstr "Le sur-échantillonage doit être un multiple de 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1575,6 +1617,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "ParallelBus pas encore supporté" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Permission refusée" @@ -1702,6 +1748,10 @@ msgstr "Système de fichier en lecture seule" msgid "Read-only object" msgstr "Objet en lecture seule" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Rafraîchissement trop tôt" @@ -1714,6 +1764,10 @@ msgstr "RemoteTransmissionRequests limité à 8 octets" msgid "Requested AES mode is unsupported" msgstr "Le mode AES demandé n'est pas supporté" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Canal droit non supporté" @@ -2102,6 +2156,10 @@ msgstr "Longueur de valeur != Longueur fixe requise" msgid "Value length > max_length" msgstr "Longueur de la valeur > max_length" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3982,6 +4040,10 @@ msgstr "type de sortie incorrect" msgid "x value out of bounds" msgstr "valeur x hors limites" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "'y' doit être un entier 'int'" diff --git a/locale/hi.po b/locale/hi.po index 5c9dfcb77..fc106f8d1 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -113,6 +113,11 @@ msgstr "" msgid "%q() takes %d positional arguments but %d were given" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "" @@ -539,6 +544,10 @@ msgstr "" msgid "CBC blocks must be multiples of 16 bytes" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -987,6 +996,10 @@ msgstr "" msgid "Function requires lock" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1113,6 +1126,7 @@ msgstr "" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" @@ -1222,6 +1236,14 @@ msgstr "" msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1262,6 +1284,10 @@ msgstr "" msgid "Length must be non-negative" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "" @@ -1504,6 +1530,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1512,6 +1550,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "" +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1528,6 +1570,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "" @@ -1645,6 +1691,10 @@ msgstr "" msgid "Read-only object" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -1657,6 +1707,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "" @@ -2027,6 +2081,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3869,6 +3927,10 @@ msgstr "" msgid "x value out of bounds" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "" diff --git a/locale/it_IT.po b/locale/it_IT.po index 6ee6c7109..efdb07116 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -114,6 +114,11 @@ msgstr "y dovrebbe essere un int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() prende %d argomenti posizionali ma ne sono stati forniti %d" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' argomento richiesto" @@ -545,6 +550,10 @@ msgstr "I byte devono essere compresi tra 0 e 255" msgid "CBC blocks must be multiples of 16 bytes" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -1000,6 +1009,10 @@ msgstr "" msgid "Function requires lock" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1128,6 +1141,7 @@ msgstr "Frequenza PWM non valida" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argomento non valido" @@ -1239,6 +1253,14 @@ msgstr "Modalità di esecuzione non valida." msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1280,6 +1302,10 @@ msgstr "Length deve essere un intero" msgid "Length must be non-negative" msgstr "Length deve essere non negativo" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "inizializzazione del pin MISO fallita." @@ -1527,6 +1553,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1535,6 +1573,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "L'oversampling deve essere multiplo di 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1556,6 +1598,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Permesso negato" @@ -1675,6 +1721,10 @@ msgstr "Filesystem in sola lettura" msgid "Read-only object" msgstr "Sola lettura" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -1687,6 +1737,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Canale destro non supportato" @@ -2061,6 +2115,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "Le funzioni Viper non supportano più di 4 argomenti al momento" @@ -3931,6 +3989,10 @@ msgstr "" msgid "x value out of bounds" msgstr "indirizzo fuori limite" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y dovrebbe essere un int" diff --git a/locale/ja.po b/locale/ja.po index 6c391bb41..29e3086aa 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -118,6 +118,11 @@ msgstr "%qはint型でなければなりません" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() は %d 個の位置引数を取りますが、%d 個与えられました" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' 引数が必要" @@ -546,6 +551,10 @@ msgstr "バイト値は0から255の間でなければなりません" msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBCブロックは16バイトの整数倍でなければなりません" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -998,6 +1007,10 @@ msgstr "このタイマーを使う既存のPWMOutと周波数を一致させる msgid "Function requires lock" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1126,6 +1139,7 @@ msgstr "無効なPWM周波数" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "不正な引数" @@ -1235,6 +1249,14 @@ msgstr "不正なrun mode" msgid "Invalid security_mode" msgstr "不正なsecurity_mode" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "不正なボイス" @@ -1275,6 +1297,10 @@ msgstr "長さには整数が必要" msgid "Length must be non-negative" msgstr "Lengthは非負数でなければなりません" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "MISOピン初期化に失敗" @@ -1519,6 +1545,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1527,6 +1565,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "オーバーサンプルは8の倍数でなければなりません" +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1544,6 +1586,10 @@ msgstr "PWM周波数は生成時のvariable_frequencyがFalseのとき書き換 msgid "ParallelBus not yet supported" msgstr "ParallelBusにはまだ対応していません" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "パーミッション拒否" @@ -1661,6 +1707,10 @@ msgstr "読み込み専用のファイルシステム" msgid "Read-only object" msgstr "読み込み専用のオブジェクト" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "リフレッシュが早すぎます" @@ -1673,6 +1723,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "要求のAESモードは非対応" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "右チャネルは非対応" @@ -2050,6 +2104,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3900,6 +3958,10 @@ msgstr "" msgid "x value out of bounds" msgstr "xが範囲外" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "yは整数でなければなりません" diff --git a/locale/ko.po b/locale/ko.po index deb7c617e..7088a00ba 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -114,6 +114,11 @@ msgstr "%q 는 정수(int) 여야합니다" msgid "%q() takes %d positional arguments but %d were given" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "" @@ -542,6 +547,10 @@ msgstr "바이트는 0에서 255 사이 여야합니다." msgid "CBC blocks must be multiples of 16 bytes" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -990,6 +999,10 @@ msgstr "" msgid "Function requires lock" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1116,6 +1129,7 @@ msgstr "" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "" @@ -1225,6 +1239,14 @@ msgstr "" msgid "Invalid security_mode" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1265,6 +1287,10 @@ msgstr "길이는 정수(int) 여야합니다" msgid "Length must be non-negative" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "" @@ -1507,6 +1533,18 @@ msgstr "" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1515,6 +1553,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "" +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1531,6 +1573,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "" @@ -1648,6 +1694,10 @@ msgstr "" msgid "Read-only object" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "" @@ -1660,6 +1710,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "" @@ -2031,6 +2085,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "" @@ -3873,6 +3931,10 @@ msgstr "" msgid "x value out of bounds" msgstr "" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "" diff --git a/locale/nl.po b/locale/nl.po index a9e7d6bf6..2ed0b2dc5 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -116,6 +116,11 @@ msgstr "%q moet een int zijn" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() verwacht %d positionele argumenten maar kreeg %d" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' argument vereist" @@ -544,6 +549,10 @@ msgstr "Bytes moeten tussen 0 en 255 liggen." msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBC blocks moeten meervouden van 16 bytes zijn" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Roep super().__init__() aan voor toegang native object." @@ -999,6 +1008,10 @@ msgstr "" msgid "Function requires lock" msgstr "Functie vereist lock" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1127,6 +1140,7 @@ msgstr "Ongeldige PWM frequentie" msgid "Invalid Pin" msgstr "Ongeldige Pin" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Ongeldig argument" @@ -1236,6 +1250,14 @@ msgstr "Ongeldige run modus." msgid "Invalid security_mode" msgstr "Ongeldige security_mode" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Ongeldige stem" @@ -1276,6 +1298,10 @@ msgstr "Lengte moet een int zijn" msgid "Length must be non-negative" msgstr "Lengte moet niet negatief zijn" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "MISO pin init mislukt." @@ -1524,6 +1550,18 @@ msgstr "Er kan maar één kleur per keer transparant zijn" msgid "Only raw int supported for ip" msgstr "Alleen raw int ondersteund voor IP" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "Geen sockets meer beschikbaar" @@ -1532,6 +1570,10 @@ msgstr "Geen sockets meer beschikbaar" msgid "Oversample must be multiple of 8." msgstr "Oversample moet een meervoud van 8 zijn." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1551,6 +1593,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "ParallelBus nog niet ondersteund" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Toegang geweigerd" @@ -1677,6 +1723,10 @@ msgstr "Alleen-lezen bestandssysteem" msgid "Read-only object" msgstr "Alleen-lezen object" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Verversing te snel" @@ -1689,6 +1739,10 @@ msgstr "RemoteTransmissionRequests is beperkt tot 8 bytes" msgid "Requested AES mode is unsupported" msgstr "Gevraagde AES modus is niet ondersteund" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Rechter kanaal niet ondersteund" @@ -2071,6 +2125,10 @@ msgstr "Waarde lengte != vereist vaste lengte" msgid "Value length > max_length" msgstr "Waarde length > max_length" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "Viper-functies ondersteunen momenteel niet meer dan 4 argumenten" @@ -3933,6 +3991,10 @@ msgstr "onjuist uitvoer type" msgid "x value out of bounds" msgstr "x-waarde buiten bereik" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y moet een int zijn" diff --git a/locale/pl.po b/locale/pl.po index 4356b0491..38f26355b 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -118,6 +118,11 @@ msgstr "%q powinno być typu int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() bierze %d argumentów pozycyjnych, lecz podano %d" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' wymaga argumentu" @@ -546,6 +551,10 @@ msgstr "Bytes musi być między 0 a 255." msgid "CBC blocks must be multiples of 16 bytes" msgstr "Bloki CBC muszą być wielokrotnościami 16 bajtów" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "" @@ -998,6 +1007,10 @@ msgstr "" msgid "Function requires lock" msgstr "Funkcja wymaga blokady" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1126,6 +1139,7 @@ msgstr "Zła częstotliwość PWM" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Zły argument" @@ -1235,6 +1249,14 @@ msgstr "Zły tryb uruchomienia." msgid "Invalid security_mode" msgstr "Nieprawidłowy security_mode" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "" @@ -1275,6 +1297,10 @@ msgstr "Długość musi być całkowita" msgid "Length must be non-negative" msgstr "Długość musi być nieujemna" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "Nie powiodło się ustawienie pinu MISO." @@ -1518,6 +1544,18 @@ msgstr "W danym momencie przezroczysty może być tylko jeden kolor" msgid "Only raw int supported for ip" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "" @@ -1526,6 +1564,10 @@ msgstr "" msgid "Oversample must be multiple of 8." msgstr "Nadpróbkowanie musi być wielokrotnością 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1542,6 +1584,10 @@ msgstr "Nie można zmienić częstotliwości PWM gdy variable_frequency=False." msgid "ParallelBus not yet supported" msgstr "ParallelBus nie jest jeszcze obsługiwany" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Odmowa dostępu" @@ -1659,6 +1705,10 @@ msgstr "System plików tylko do odczytu" msgid "Read-only object" msgstr "Obiekt tylko do odczytu" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Zbyt wczesne odświeżenie" @@ -1671,6 +1721,10 @@ msgstr "" msgid "Requested AES mode is unsupported" msgstr "Żądany tryb AES nie jest obsługiwany" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Prawy kanał jest niewspierany" @@ -2041,6 +2095,10 @@ msgstr "" msgid "Value length > max_length" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "Funkcje Viper nie obsługują obecnie więcej niż 4 argumentów" @@ -3892,6 +3950,10 @@ msgstr "" msgid "x value out of bounds" msgstr "x poza zakresem" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y powinno być całkowite" diff --git a/locale/pt_BR.po b/locale/pt_BR.po index d93307486..7a3a3c0fb 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -120,6 +120,11 @@ msgstr "%q deve ser um int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() recebe %d argumentos posicionais, porém %d foram informados" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' argumento(s) requerido(s)" @@ -556,6 +561,10 @@ msgstr "Os bytes devem estar entre 0 e 255." msgid "CBC blocks must be multiples of 16 bytes" msgstr "Os blocos CBC devem ter múltiplos de 16 bytes" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Chame super().__init__() antes de acessar o objeto nativo." @@ -1015,6 +1024,10 @@ msgstr "" msgid "Function requires lock" msgstr "A função requer bloqueio" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1143,6 +1156,7 @@ msgstr "Frequência PWM inválida" msgid "Invalid Pin" msgstr "Pino inválido" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Argumento inválido" @@ -1252,6 +1266,14 @@ msgstr "O modo de execução é inválido." msgid "Invalid security_mode" msgstr "O Security_mode é inválido" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "A voz é inválida" @@ -1292,6 +1314,10 @@ msgstr "Tamanho deve ser um int" msgid "Length must be non-negative" msgstr "O comprimento deve ser positivo" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "A inicialização do pino MISO falhou." @@ -1539,6 +1565,18 @@ msgstr "Apenas uma cor pode ser transparente de cada vez" msgid "Only raw int supported for ip" msgstr "Apenas o int bruto é compatível para o ip" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "Sem soquetes" @@ -1547,6 +1585,10 @@ msgstr "Sem soquetes" msgid "Oversample must be multiple of 8." msgstr "A superamostragem deve ser um múltiplo de 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1567,6 +1609,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "O ParallelBus ainda não é compatível" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Permissão negada" @@ -1696,6 +1742,10 @@ msgstr "Sistema de arquivos somente leitura" msgid "Read-only object" msgstr "Objeto de leitura apenas" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "A recarga foi cedo demais" @@ -1708,6 +1758,10 @@ msgstr "As requisições de transmissões remotas é limitada a 8 bytes" msgid "Requested AES mode is unsupported" msgstr "O modo AES solicitado não é compatível" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Canal direito não suportado" @@ -2094,6 +2148,10 @@ msgstr "Comprimento do valor != comprimento fixo necessário" msgid "Value length > max_length" msgstr "O comprimento do valor é > max_length" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "Atualmente, as funções do Viper não suportam mais de 4 argumentos" @@ -3968,6 +4026,10 @@ msgstr "tipo da saída incorreta" msgid "x value out of bounds" msgstr "o valor x está fora dos limites" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y deve ser um int" diff --git a/locale/sv.po b/locale/sv.po index 8cae54588..d618f3e28 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -120,6 +120,11 @@ msgstr "%q ska vara en int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() kräver %d positionsargument men %d gavs" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "'%q' argument krävs" @@ -548,6 +553,10 @@ msgstr "Bytes måste vara mellan 0 och 255." msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBC-block måste vara multiplar om 16 byte" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Anropa super().__init__() innan du använder det ursprungliga objektet." @@ -1003,6 +1012,10 @@ msgstr "Frekvensen måste matcha befintlig PWMOut med denna timer" msgid "Function requires lock" msgstr "Funktion kräver lås" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1131,6 +1144,7 @@ msgstr "Ogiltig PWM-frekvens" msgid "Invalid Pin" msgstr "Ogiltig pinne" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Ogiltigt argument" @@ -1240,6 +1254,14 @@ msgstr "Ogiltigt körläge." msgid "Invalid security_mode" msgstr "Ogiltigt säkerhetsläge" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Ogiltig kanal" @@ -1280,6 +1302,10 @@ msgstr "Length måste vara en int" msgid "Length must be non-negative" msgstr "Length måste vara positiv" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "init för MISO-pinne misslyckades." @@ -1528,6 +1554,18 @@ msgstr "Bara en färg kan vara genomskinlig i taget" msgid "Only raw int supported for ip" msgstr "Endast raw int stöds för ip" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "Slut på sockets" @@ -1536,6 +1574,10 @@ msgstr "Slut på sockets" msgid "Oversample must be multiple of 8." msgstr "Översampling måste vara multipel av 8." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1554,6 +1596,10 @@ msgstr "" msgid "ParallelBus not yet supported" msgstr "ParallelBus stöds ännu inte" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Åtkomst nekad" @@ -1680,6 +1726,10 @@ msgstr "Skrivskyddat filsystem" msgid "Read-only object" msgstr "Skrivskyddat objekt" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Uppdaterad för tidigt" @@ -1692,6 +1742,10 @@ msgstr "RemoteTransmissionRequests begränsad till 8 byte" msgid "Requested AES mode is unsupported" msgstr "Det begärda AES-läget stöds inte" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Höger kanal stöds inte" @@ -2074,6 +2128,10 @@ msgstr "Värdets längde ! = krävd fast längd" msgid "Value length > max_length" msgstr "Värdets längd > max_length" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "Viper-funktioner stöder för närvarande inte mer än fyra argument" @@ -3933,6 +3991,10 @@ msgstr "fel utdatatyp" msgid "x value out of bounds" msgstr "x-värde utanför intervall" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y ska vara en int" diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 735c90743..9b1bdf564 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -118,6 +118,11 @@ msgstr "%q yīnggāi shì yīgè int" msgid "%q() takes %d positional arguments but %d were given" msgstr "%q() cǎiyòng %d wèizhì cānshù, dàn gěi chū %d" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +#, c-format +msgid "%s error 0x%x" +msgstr "" + #: py/argcheck.c msgid "'%q' argument required" msgstr "xūyào '%q' cānshù" @@ -546,6 +551,10 @@ msgstr "Zì jié bìxū jiè yú 0 dào 255 zhī jiān." msgid "CBC blocks must be multiples of 16 bytes" msgstr "CBC kuài bì xū shì 16 zì jié de bèi shù" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "CRC or checksum was invalid" +msgstr "" + #: py/objtype.c msgid "Call super().__init__() before accessing native object." msgstr "Zài fǎngwèn běn jī wùjiàn zhīqián diàoyòng super().__init__()." @@ -996,6 +1005,10 @@ msgstr "Pínlǜ bìxū yǔ shǐyòng cǐ jìshí qì de xiàn yǒu PWMOut xiāng msgid "Function requires lock" msgstr "Hánshù xūyào suǒdìng" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Generic Failure" +msgstr "" + #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c #: shared-bindings/framebufferio/FramebufferDisplay.c @@ -1124,6 +1137,7 @@ msgstr "Wúxiào de PWM pínlǜ" msgid "Invalid Pin" msgstr "" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #: py/moduerrno.c shared-module/rgbmatrix/RGBMatrix.c msgid "Invalid argument" msgstr "Wúxiào de cānshù" @@ -1233,6 +1247,14 @@ msgstr "Wúxiào de yùnxíng móshì." msgid "Invalid security_mode" msgstr "Ānquán móshì wúxiào" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid size" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Invalid state" +msgstr "" + #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" msgstr "Yǔyīn wúxiào" @@ -1273,6 +1295,10 @@ msgstr "Chángdù bìxū shì yīgè zhěngshù" msgid "Length must be non-negative" msgstr "Chángdù bìxū shìfēi fùshù" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "MAC address was invalid" +msgstr "" + #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." msgstr "MISO yǐn jiǎo chūshǐhuà shībài." @@ -1520,6 +1546,18 @@ msgstr "Yīcì zhǐ néng yǒuyī zhǒng yánsè shì tòumíng de" msgid "Only raw int supported for ip" msgstr "Ip jǐn zhīchí raw int" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation or feature not supported" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Operation timed out" +msgstr "" + +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Out of memory" +msgstr "" + #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" msgstr "tào jiē zì wài" @@ -1528,6 +1566,10 @@ msgstr "tào jiē zì wài" msgid "Oversample must be multiple of 8." msgstr "Guò cǎiyàng bìxū shì 8 de bèishù." +#: shared-bindings/audiobusio/PDMIn.c +msgid "PDMIn not available" +msgstr "" + #: shared-bindings/pwmio/PWMOut.c msgid "" "PWM duty_cycle must be between 0 and 65535 inclusive (16 bit resolution)" @@ -1545,6 +1587,10 @@ msgstr "Dāng biànliàng_pínlǜ shì False zài jiànzhú shí PWM pínlǜ bù msgid "ParallelBus not yet supported" msgstr "Shàng bù zhīchí ParallelBus" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "Peripheral in use" +msgstr "" + #: py/moduerrno.c msgid "Permission denied" msgstr "Quánxiàn bèi jùjué" @@ -1666,6 +1712,10 @@ msgstr "Zhǐ dú wénjiàn xìtǒng" msgid "Read-only object" msgstr "Zhǐ dú duìxiàng" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Received response was invalid" +msgstr "" + #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" msgstr "Shuāxīn tài kuàile" @@ -1678,6 +1728,10 @@ msgstr "RemoteTransmissionRequests xiànzhì wèi 8 gè zì jié" msgid "Requested AES mode is unsupported" msgstr "Qǐngqiú de AES móshì bù shòu zhīchí" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Requested resource not found" +msgstr "" + #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" msgstr "Bù zhīchí yòu tōngdào" @@ -2059,6 +2113,10 @@ msgstr "Zhí chángdù != Suǒ xū de gùdìng chángdù" msgid "Value length > max_length" msgstr "Zhí chángdù > zuìdà chángdù" +#: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c +msgid "Version was invalid" +msgstr "" + #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" msgstr "Viper hánshù mùqián bù zhīchí chāoguò 4 gè cānshù" @@ -3916,6 +3974,10 @@ msgstr "cuòwù de shūchū lèixíng" msgid "x value out of bounds" msgstr "x zhí chāochū biānjiè" +#: ports/esp32s2/common-hal/audiobusio/__init__.c +msgid "xTaskCreate failed" +msgstr "" + #: shared-bindings/displayio/Shape.c msgid "y should be an int" msgstr "y yīnggāi shì yīgè zhěngshù" -- cgit v1.2.3 From ed0cb248e9a002ce0bdd08243f223e48c0288f96 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 12 Jan 2021 16:04:29 -0600 Subject: esp32s2: Fix 'make flash' As reported by @jerryneedell, this change was incorrect; the given ESPTOOL_FLAGS caused `write_flash` to be repeated twice, which doesn't work. Closes #3981. --- ports/esp32s2/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/esp32s2/Makefile b/ports/esp32s2/Makefile index 9827b555c..aac934782 100644 --- a/ports/esp32s2/Makefile +++ b/ports/esp32s2/Makefile @@ -299,7 +299,7 @@ ESP_AUTOGEN_LD = $(BUILD)/esp-idf/esp-idf/esp32s2/esp32s2_out.ld $(BUILD)/esp-id FLASH_FLAGS = --flash_mode $(CIRCUITPY_ESP_FLASH_MODE) --flash_freq $(CIRCUITPY_ESP_FLASH_FREQ) --flash_size $(CIRCUITPY_ESP_FLASH_SIZE) -ESPTOOL_FLAGS ?= -b 460800 --before=default_reset --after=no_reset write_flash +ESPTOOL_FLAGS ?= -b 460800 --before=default_reset --after=no_reset all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2 -- cgit v1.2.3 From f95d10b2a66d69aeaea02ff778fde0d92400fffc Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 12 Jan 2021 16:30:20 -0600 Subject: make translate --- locale/circuitpython.pot | 2 ++ 1 file changed, 2 insertions(+) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index e8ac7512a..82058a611 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -3455,6 +3455,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h -- cgit v1.2.3 From 4b304128710987f7f97e327a486fefe5e9305005 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 12 Jan 2021 18:23:37 -0500 Subject: shrink some de_DE builds --- ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk | 2 ++ ports/atmel-samd/boards/pewpew10/mpconfigboard.mk | 5 +++++ ports/atmel-samd/boards/shirtty/mpconfigboard.mk | 2 ++ 3 files changed, 9 insertions(+) diff --git a/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk b/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk index fd24edafa..07b1b9800 100644 --- a/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk +++ b/ports/atmel-samd/boards/arduino_nano_33_iot/mpconfigboard.mk @@ -11,3 +11,5 @@ LONGINT_IMPL = NONE CIRCUITPY_FULL_BUILD = 0 SUPEROPT_GC = 0 + +CFLAGS_BOARD = --param max-inline-insns-auto=15 diff --git a/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk b/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk index 1cc91a8df..fadcc2144 100644 --- a/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pewpew10/mpconfigboard.mk @@ -24,3 +24,8 @@ SUPEROPT_GC = 0 FROZEN_MPY_DIRS += $(TOP)/frozen/pew-pewpew-standalone-10.x CFLAGS_BOARD = --param max-inline-insns-auto=15 +ifeq ($(TRANSLATION), de_DE) +RELEASE_NEEDS_CLEAN_BUILD = 1 +CFLAGS_INLINE_LIMIT = 35 +SUPEROPT_VM = 0 +endif diff --git a/ports/atmel-samd/boards/shirtty/mpconfigboard.mk b/ports/atmel-samd/boards/shirtty/mpconfigboard.mk index a04e09769..0b56e9ae0 100644 --- a/ports/atmel-samd/boards/shirtty/mpconfigboard.mk +++ b/ports/atmel-samd/boards/shirtty/mpconfigboard.mk @@ -13,3 +13,5 @@ CIRCUITPY_I2CPERIPHERAL = 1 CIRCUITPY_TOUCHIO = 0 SUPEROPT_GC = 0 + +CFLAGS_BOARD = --param max-inline-insns-auto=15 -- cgit v1.2.3 From 5e52ca053037b8f03a40d56c07958fbe0289a2ed Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Tue, 12 Jan 2021 18:41:50 -0500 Subject: make translate --- locale/circuitpython.pot | 2 ++ 1 file changed, 2 insertions(+) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index e8ac7512a..82058a611 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -3455,6 +3455,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h -- cgit v1.2.3 From 88ce6911b7e75dfb783b8d1acf5d6f478e7ca59b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 12 Jan 2021 18:52:39 -0600 Subject: Revert "pre-commit: Add checking of 'make translate' status" This reverts commit 1dda33dc418cae1a0047df0241762ebdb3d87e8a. --- .pre-commit-config.yaml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 82d89eaa3..322f37da4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,10 +11,3 @@ repos: exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*|ports/esp32s2/esp-idf-config/.*|ports/esp32s2/boards/.*/sdkconfig)' - id: trailing-whitespace exclude: '^(tests/.*\.exp|tests/cmdline/.*|tests/.*/data/.*)' -- repo: local - hooks: - - id: translations - name: Check Translations - entry: sh -c "make translate" - language: system - always_run: true -- cgit v1.2.3 From 0a13eff940933b3756f70c673b958476c4b0241c Mon Sep 17 00:00:00 2001 From: Wellington Terumi Uemura Date: Tue, 12 Jan 2021 21:31:50 +0000 Subject: Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (913 of 913 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/pt_BR/ --- locale/pt_BR.po | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/locale/pt_BR.po b/locale/pt_BR.po index 7a3a3c0fb..d21283a4e 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-05 21:03+0000\n" +"PO-Revision-Date: 2021-01-13 02:19+0000\n" "Last-Translator: Wellington Terumi Uemura \n" "Language-Team: \n" "Language: pt_BR\n" @@ -123,7 +123,7 @@ msgstr "%q() recebe %d argumentos posicionais, porém %d foram informados" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #, c-format msgid "%s error 0x%x" -msgstr "" +msgstr "%s erro 0x%x" #: py/argcheck.c msgid "'%q' argument required" @@ -293,7 +293,7 @@ msgstr "3-arg pow() não compatível" #: shared-module/msgpack/__init__.c msgid "64 bit types" -msgstr "" +msgstr "Tipos 64 bit" #: ports/atmel-samd/common-hal/countio/Counter.c #: ports/atmel-samd/common-hal/rotaryio/IncrementalEncoder.c @@ -563,7 +563,7 @@ msgstr "Os blocos CBC devem ter múltiplos de 16 bytes" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "CRC or checksum was invalid" -msgstr "" +msgstr "CRC ou checksum inválido" #: py/objtype.c msgid "Call super().__init__() before accessing native object." @@ -1026,7 +1026,7 @@ msgstr "A função requer bloqueio" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Generic Failure" -msgstr "" +msgstr "Falha Genérica" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c @@ -1268,11 +1268,11 @@ msgstr "O Security_mode é inválido" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid size" -msgstr "" +msgstr "Tamanho inválido" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" -msgstr "" +msgstr "Estado inválido" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1316,7 +1316,7 @@ msgstr "O comprimento deve ser positivo" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "MAC address was invalid" -msgstr "" +msgstr "Endereço MAC inválido" #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." @@ -1551,7 +1551,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c msgid "Only one TouchAlarm can be set in deep sleep." -msgstr "" +msgstr "Apenas um TouchAlarm pode ser colocado em deep sleep." #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." @@ -1567,15 +1567,15 @@ msgstr "Apenas o int bruto é compatível para o ip" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" -msgstr "" +msgstr "A operação ou o recurso não é suportado" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation timed out" -msgstr "" +msgstr "A operação expirou" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Out of memory" -msgstr "" +msgstr "Sem memória" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" @@ -1587,7 +1587,7 @@ msgstr "A superamostragem deve ser um múltiplo de 8." #: shared-bindings/audiobusio/PDMIn.c msgid "PDMIn not available" -msgstr "" +msgstr "O PDMIn não está disponível" #: shared-bindings/pwmio/PWMOut.c msgid "" @@ -1611,7 +1611,7 @@ msgstr "O ParallelBus ainda não é compatível" #: ports/esp32s2/common-hal/audiobusio/__init__.c msgid "Peripheral in use" -msgstr "" +msgstr "O periférico está em uso" #: py/moduerrno.c msgid "Permission denied" @@ -1744,7 +1744,7 @@ msgstr "Objeto de leitura apenas" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Received response was invalid" -msgstr "" +msgstr "A resposta recebida foi inválida" #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" @@ -1760,7 +1760,7 @@ msgstr "O modo AES solicitado não é compatível" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Requested resource not found" -msgstr "" +msgstr "O recurso solicitado não foi encontrado" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" @@ -2150,7 +2150,7 @@ msgstr "O comprimento do valor é > max_length" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Version was invalid" -msgstr "" +msgstr "A versão era inválida" #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" @@ -2570,7 +2570,7 @@ msgstr "o círculo só pode ser registrado em um pai" #: shared-bindings/msgpack/ExtType.c msgid "code outside range 0~127" -msgstr "" +msgstr "código fora do alcance 0~127" #: shared-bindings/displayio/Palette.c msgid "color buffer must be 3 bytes (RGB) or 4 bytes (RGB + pad byte)" @@ -2660,7 +2660,7 @@ msgstr "a predefinição 'exceto' deve ser o último" #: shared-bindings/msgpack/__init__.c msgid "default is not a function" -msgstr "" +msgstr "o padrão não é uma função" #: shared-bindings/audiobusio/PDMIn.c msgid "" @@ -2766,7 +2766,7 @@ msgstr "chave esperada: valor para dict" #: shared-bindings/msgpack/__init__.c msgid "ext_hook is not a function" -msgstr "" +msgstr "o ext_hook não é uma função" #: py/argcheck.c msgid "extra keyword arguments given" @@ -3308,7 +3308,7 @@ msgstr "nenhuma ligação para nonlocal foi encontrada" #: shared-module/msgpack/__init__.c msgid "no default packer" -msgstr "" +msgstr "nenhum empacotador padrão" #: py/builtinimport.c msgid "no module named '%q'" @@ -3652,7 +3652,7 @@ msgstr "a forma deve ser uma tupla" #: shared-module/msgpack/__init__.c msgid "short read" -msgstr "" +msgstr "leitura curta" #: py/objstr.c msgid "sign not allowed in string format specifier" @@ -4028,7 +4028,7 @@ msgstr "o valor x está fora dos limites" #: ports/esp32s2/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" -msgstr "" +msgstr "o xTaskCreate falhou" #: shared-bindings/displayio/Shape.c msgid "y should be an int" -- cgit v1.2.3 From 35a10952b2d21a3b8bf725a8a84d15dab67cc036 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 13 Jan 2021 03:19:08 +0100 Subject: Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/ --- locale/ID.po | 2 ++ locale/cs.po | 2 ++ locale/de_DE.po | 2 ++ locale/el.po | 2 ++ locale/es.po | 2 ++ locale/fil.po | 2 ++ locale/fr.po | 2 ++ locale/hi.po | 2 ++ locale/it_IT.po | 2 ++ locale/ja.po | 2 ++ locale/ko.po | 2 ++ locale/nl.po | 2 ++ locale/pl.po | 2 ++ locale/pt_BR.po | 2 ++ locale/sv.po | 2 ++ locale/zh_Latn_pinyin.po | 2 ++ 16 files changed, 32 insertions(+) diff --git a/locale/ID.po b/locale/ID.po index f4bb1512e..6aa4f0fba 100644 --- a/locale/ID.po +++ b/locale/ID.po @@ -3505,6 +3505,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/cs.po b/locale/cs.po index 2394834a1..a27a1459a 100644 --- a/locale/cs.po +++ b/locale/cs.po @@ -3458,6 +3458,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/de_DE.po b/locale/de_DE.po index f83fafe3a..350c7aac1 100644 --- a/locale/de_DE.po +++ b/locale/de_DE.po @@ -3538,6 +3538,8 @@ msgstr "pow() drittes Argument darf nicht 0 sein" msgid "pow() with 3 arguments requires integers" msgstr "pow () mit 3 Argumenten erfordert Integer" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/el.po b/locale/el.po index 267bc4987..7001c2aa2 100644 --- a/locale/el.po +++ b/locale/el.po @@ -3455,6 +3455,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/es.po b/locale/es.po index e456d7829..45695665c 100644 --- a/locale/es.po +++ b/locale/es.po @@ -3529,6 +3529,8 @@ msgstr "el 3er argumento de pow() no puede ser 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() con 3 argumentos requiere enteros" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/fil.po b/locale/fil.po index 753ecef58..ddd5f3dfe 100644 --- a/locale/fil.po +++ b/locale/fil.po @@ -3504,6 +3504,8 @@ msgstr "pow() 3rd argument ay hindi maaring 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() na may 3 argumento kailangan ng integers" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/fr.po b/locale/fr.po index 50166c71e..87e2024be 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -3565,6 +3565,8 @@ msgstr "le 3e argument de pow() ne peut être 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() avec 3 arguments nécessite des entiers" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/hi.po b/locale/hi.po index fc106f8d1..618490b37 100644 --- a/locale/hi.po +++ b/locale/hi.po @@ -3455,6 +3455,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/it_IT.po b/locale/it_IT.po index efdb07116..f9f77b20e 100644 --- a/locale/it_IT.po +++ b/locale/it_IT.po @@ -3512,6 +3512,8 @@ msgstr "il terzo argomento di pow() non può essere 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() con 3 argomenti richiede interi" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/ja.po b/locale/ja.po index 29e3086aa..37d23f959 100644 --- a/locale/ja.po +++ b/locale/ja.po @@ -3485,6 +3485,8 @@ msgstr "pow()の3つ目の引数は0にできません" msgid "pow() with 3 arguments requires integers" msgstr "pow()の第3引数には整数が必要" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/ko.po b/locale/ko.po index 7088a00ba..b7fc29629 100644 --- a/locale/ko.po +++ b/locale/ko.po @@ -3459,6 +3459,8 @@ msgstr "" msgid "pow() with 3 arguments requires integers" msgstr "" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/nl.po b/locale/nl.po index 2ed0b2dc5..52984373c 100644 --- a/locale/nl.po +++ b/locale/nl.po @@ -3517,6 +3517,8 @@ msgstr "derde argument van pow() mag geen 0 zijn" msgid "pow() with 3 arguments requires integers" msgstr "pow() met 3 argumenten vereist integers" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/pl.po b/locale/pl.po index 38f26355b..41eee9e74 100644 --- a/locale/pl.po +++ b/locale/pl.po @@ -3477,6 +3477,8 @@ msgstr "trzeci argument pow() nie może być 0" msgid "pow() with 3 arguments requires integers" msgstr "trzyargumentowe pow() wymaga liczb całkowitych" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/pt_BR.po b/locale/pt_BR.po index d21283a4e..64723c193 100644 --- a/locale/pt_BR.po +++ b/locale/pt_BR.po @@ -3552,6 +3552,8 @@ msgstr "O terceiro argumento pow() não pode ser 0" msgid "pow() with 3 arguments requires integers" msgstr "o pow() com 3 argumentos requer números inteiros" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/sv.po b/locale/sv.po index d618f3e28..477664972 100644 --- a/locale/sv.po +++ b/locale/sv.po @@ -3517,6 +3517,8 @@ msgstr "pow() 3: e argument kan inte vara 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() med 3 argument kräver heltal" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h diff --git a/locale/zh_Latn_pinyin.po b/locale/zh_Latn_pinyin.po index 9b1bdf564..d9a750b34 100644 --- a/locale/zh_Latn_pinyin.po +++ b/locale/zh_Latn_pinyin.po @@ -3500,6 +3500,8 @@ msgstr "pow() 3 cān shǔ bùnéng wéi 0" msgid "pow() with 3 arguments requires integers" msgstr "pow() yǒu 3 cānshù xūyào zhěngshù" +#: ports/esp32s2/boards/adafruit_feather_esp32s2_nopsram/mpconfigboard.h +#: ports/esp32s2/boards/adafruit_feather_esp32s2_tftback_nopsram/mpconfigboard.h #: ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/mpconfigboard.h #: ports/esp32s2/boards/adafruit_metro_esp32s2/mpconfigboard.h #: ports/esp32s2/boards/electroniccats_bastwifi/mpconfigboard.h -- cgit v1.2.3 From b4eb46b9ef198a59a83df7e6f8c5847c1ac6383b Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Wed, 13 Jan 2021 02:39:31 +0000 Subject: Translated using Weblate (French) Currently translated at 100.0% (913 of 913 strings) Translation: CircuitPython/main Translate-URL: https://hosted.weblate.org/projects/circuitpython/main/fr/ --- locale/fr.po | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/locale/fr.po b/locale/fr.po index 87e2024be..ad0ed6e7a 100644 --- a/locale/fr.po +++ b/locale/fr.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-04 12:55-0600\n" -"PO-Revision-Date: 2021-01-12 15:40+0000\n" +"PO-Revision-Date: 2021-01-13 16:07+0000\n" "Last-Translator: Hugo Dahl \n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -127,7 +127,7 @@ msgstr "%q() prend %d paramètres positionnels mais %d ont été donnés" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c #, c-format msgid "%s error 0x%x" -msgstr "" +msgstr "%s erreur 0x%x" #: py/argcheck.c msgid "'%q' argument required" @@ -563,7 +563,7 @@ msgstr "Les blocs CBC doivent être des multiples de 16 octets" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "CRC or checksum was invalid" -msgstr "" +msgstr "CRC ou somme de contrôle invalide" #: py/objtype.c msgid "Call super().__init__() before accessing native object." @@ -1033,7 +1033,7 @@ msgstr "La fonction nécessite un verrou ('lock')" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Generic Failure" -msgstr "" +msgstr "Échec génerique" #: shared-bindings/displayio/Display.c #: shared-bindings/displayio/EPaperDisplay.c @@ -1275,11 +1275,11 @@ msgstr "'security_mode' invalide" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid size" -msgstr "" +msgstr "Taille invalide" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Invalid state" -msgstr "" +msgstr "État invalide" #: shared-bindings/audiomixer/Mixer.c msgid "Invalid voice" @@ -1323,7 +1323,7 @@ msgstr "Length ne doit pas être négatif" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "MAC address was invalid" -msgstr "" +msgstr "Adresse physique (MAC) invalide" #: shared-module/bitbangio/SPI.c msgid "MISO pin init failed." @@ -1559,7 +1559,7 @@ msgstr "" #: ports/esp32s2/common-hal/alarm/touch/TouchAlarm.c msgid "Only one TouchAlarm can be set in deep sleep." -msgstr "" +msgstr "Seulement une TouchAlarm peu être réglée en someil profond." #: ports/esp32s2/common-hal/alarm/time/TimeAlarm.c msgid "Only one alarm.time alarm can be set." @@ -1575,15 +1575,15 @@ msgstr "IP n'accepte que les chiffres entiers bruts" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation or feature not supported" -msgstr "" +msgstr "Opération ou fonction non supportée" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Operation timed out" -msgstr "" +msgstr "Timeout de l'opération" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Out of memory" -msgstr "" +msgstr "Hors de mémoire" #: ports/esp32s2/common-hal/socketpool/SocketPool.c msgid "Out of sockets" @@ -1595,7 +1595,7 @@ msgstr "Le sur-échantillonage doit être un multiple de 8." #: shared-bindings/audiobusio/PDMIn.c msgid "PDMIn not available" -msgstr "" +msgstr "PDMIn non disponible" #: shared-bindings/pwmio/PWMOut.c msgid "" @@ -1619,7 +1619,7 @@ msgstr "ParallelBus pas encore supporté" #: ports/esp32s2/common-hal/audiobusio/__init__.c msgid "Peripheral in use" -msgstr "" +msgstr "Périphérique en utilisation" #: py/moduerrno.c msgid "Permission denied" @@ -1750,7 +1750,7 @@ msgstr "Objet en lecture seule" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Received response was invalid" -msgstr "" +msgstr "Réponse reçue invalide" #: shared-bindings/displayio/EPaperDisplay.c msgid "Refresh too soon" @@ -1766,7 +1766,7 @@ msgstr "Le mode AES demandé n'est pas supporté" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Requested resource not found" -msgstr "" +msgstr "Resource demandée non trouvée" #: ports/atmel-samd/common-hal/audioio/AudioOut.c msgid "Right channel unsupported" @@ -2158,7 +2158,7 @@ msgstr "Longueur de la valeur > max_length" #: ports/esp32s2/bindings/espidf/__init__.c ports/esp32s2/esp_error.c msgid "Version was invalid" -msgstr "" +msgstr "Version est invalide" #: py/emitnative.c msgid "Viper functions don't currently support more than 4 arguments" @@ -4044,7 +4044,7 @@ msgstr "valeur x hors limites" #: ports/esp32s2/common-hal/audiobusio/__init__.c msgid "xTaskCreate failed" -msgstr "" +msgstr "Échec de xTaskCreate" #: shared-bindings/displayio/Shape.c msgid "y should be an int" -- cgit v1.2.3 From ccace62ac955bfffa3d8fc6a48e8c3953343a7bc Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Wed, 13 Jan 2021 15:35:51 -0500 Subject: don't check length for remote characteristic or dedescriptor --- ports/nrf/common-hal/_bleio/Characteristic.c | 15 ++++++++------- ports/nrf/common-hal/_bleio/Connection.c | 2 +- ports/nrf/common-hal/_bleio/Descriptor.c | 15 ++++++++------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/ports/nrf/common-hal/_bleio/Characteristic.c b/ports/nrf/common-hal/_bleio/Characteristic.c index 57c481448..c0f0372c3 100644 --- a/ports/nrf/common-hal/_bleio/Characteristic.c +++ b/ports/nrf/common-hal/_bleio/Characteristic.c @@ -132,13 +132,6 @@ size_t common_hal_bleio_characteristic_get_value(bleio_characteristic_obj_t *sel } void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self, mp_buffer_info_t *bufinfo) { - if (self->fixed_length && bufinfo->len != self->max_length) { - mp_raise_ValueError(translate("Value length != required fixed length")); - } - if (bufinfo->len > self->max_length) { - mp_raise_ValueError(translate("Value length > max_length")); - } - // Do GATT operations only if this characteristic has been added to a registered service. if (self->handle != BLE_GATT_HANDLE_INVALID) { @@ -148,6 +141,14 @@ void common_hal_bleio_characteristic_set_value(bleio_characteristic_obj_t *self, common_hal_bleio_gattc_write(self->handle, conn_handle, bufinfo, (self->props & CHAR_PROP_WRITE_NO_RESPONSE)); } else { + // Validate data length for local characteristics only. + if (self->fixed_length && bufinfo->len != self->max_length) { + mp_raise_ValueError(translate("Value length != required fixed length")); + } + if (bufinfo->len > self->max_length) { + mp_raise_ValueError(translate("Value length > max_length")); + } + // Always write the value locally even if no connections are active. // conn_handle is ignored for non-system attributes, so we use BLE_CONN_HANDLE_INVALID. common_hal_bleio_gatts_write(self->handle, BLE_CONN_HANDLE_INVALID, bufinfo); diff --git a/ports/nrf/common-hal/_bleio/Connection.c b/ports/nrf/common-hal/_bleio/Connection.c index 4f747bf97..36fda0bb3 100644 --- a/ports/nrf/common-hal/_bleio/Connection.c +++ b/ports/nrf/common-hal/_bleio/Connection.c @@ -522,7 +522,7 @@ STATIC void on_char_discovery_rsp(ble_gattc_evt_char_disc_rsp_t *response, bleio common_hal_bleio_characteristic_construct( characteristic, m_char_discovery_service, gattc_char->handle_value, uuid, props, SECURITY_MODE_OPEN, SECURITY_MODE_OPEN, - GATT_MAX_DATA_LENGTH, false, // max_length, fixed_length: values may not matter for gattc + GATT_MAX_DATA_LENGTH, false, // max_length, fixed_length: values don't matter for gattc mp_const_empty_bytes); mp_obj_list_append(MP_OBJ_FROM_PTR(m_char_discovery_service->characteristic_list), diff --git a/ports/nrf/common-hal/_bleio/Descriptor.c b/ports/nrf/common-hal/_bleio/Descriptor.c index 9e9110723..d848659fc 100644 --- a/ports/nrf/common-hal/_bleio/Descriptor.c +++ b/ports/nrf/common-hal/_bleio/Descriptor.c @@ -73,13 +73,6 @@ size_t common_hal_bleio_descriptor_get_value(bleio_descriptor_obj_t *self, uint8 } void common_hal_bleio_descriptor_set_value(bleio_descriptor_obj_t *self, mp_buffer_info_t *bufinfo) { - if (self->fixed_length && bufinfo->len != self->max_length) { - mp_raise_ValueError(translate("Value length != required fixed length")); - } - if (bufinfo->len > self->max_length) { - mp_raise_ValueError(translate("Value length > max_length")); - } - // Do GATT operations only if this descriptor has been registered. if (self->handle != BLE_GATT_HANDLE_INVALID) { uint16_t conn_handle = bleio_connection_get_conn_handle(self->characteristic->service->connection); @@ -87,6 +80,14 @@ void common_hal_bleio_descriptor_set_value(bleio_descriptor_obj_t *self, mp_buff // false means WRITE_REQ, not write-no-response common_hal_bleio_gattc_write(self->handle, conn_handle, bufinfo, false); } else { + // Validate data length for local descriptors only. + if (self->fixed_length && bufinfo->len != self->max_length) { + mp_raise_ValueError(translate("Value length != required fixed length")); + } + if (bufinfo->len > self->max_length) { + mp_raise_ValueError(translate("Value length > max_length")); + } + common_hal_bleio_gatts_write(self->handle, conn_handle, bufinfo); } } -- cgit v1.2.3 From 8f8af900987833c338d02fe08cac667ee450b514 Mon Sep 17 00:00:00 2001 From: Jonah Yolles-Murphy Date: Wed, 13 Jan 2021 23:51:34 -0500 Subject: final name and extra board --- .github/workflows/build.yml | 2 +- .gitmodules | 3 ++ frozen/Adafruit_CircuitPython_LC709203F | 1 + ports/nrf/boards/TG-Watch/board.c | 38 ++++++++++++++ ports/nrf/boards/TG-Watch/mpconfigboard.h | 64 ++++++++++++++++++++++++ ports/nrf/boards/TG-Watch/mpconfigboard.mk | 24 +++++++++ ports/nrf/boards/TG-Watch/pins.c | 74 ++++++++++++++++++++++++++++ ports/nrf/boards/TG-Watch02/board.c | 38 -------------- ports/nrf/boards/TG-Watch02/mpconfigboard.h | 64 ------------------------ ports/nrf/boards/TG-Watch02/mpconfigboard.mk | 23 --------- ports/nrf/boards/TG-Watch02/pins.c | 73 --------------------------- 11 files changed, 205 insertions(+), 199 deletions(-) create mode 160000 frozen/Adafruit_CircuitPython_LC709203F create mode 100644 ports/nrf/boards/TG-Watch/board.c create mode 100644 ports/nrf/boards/TG-Watch/mpconfigboard.h create mode 100644 ports/nrf/boards/TG-Watch/mpconfigboard.mk create mode 100644 ports/nrf/boards/TG-Watch/pins.c delete mode 100644 ports/nrf/boards/TG-Watch02/board.c delete mode 100644 ports/nrf/boards/TG-Watch02/mpconfigboard.h delete mode 100644 ports/nrf/boards/TG-Watch02/mpconfigboard.mk delete mode 100644 ports/nrf/boards/TG-Watch02/pins.c diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d53dc5121..bf2771c02 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -176,7 +176,7 @@ jobs: board: - "8086_commander" - "ADM_B_NRF52840_1" - - "TG-Watch02" + - "TG-Watch" - "aloriumtech_evo_m51" - "aramcon_badge_2019" - "arduino_mkr1300" diff --git a/.gitmodules b/.gitmodules index 0fb64d4b5..f4080de1b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -168,3 +168,6 @@ [submodule "frozen/Adafruit_CircuitPython_ProgressBar"] path = frozen/Adafruit_CircuitPython_ProgressBar url = https://github.com/adafruit/Adafruit_CircuitPython_ProgressBar +[submodule "frozen/Adafruit_CircuitPython_LC709203F"] + path = frozen/Adafruit_CircuitPython_LC709203F + url = https://github.com/adafruit/Adafruit_CircuitPython_LC709203F diff --git a/frozen/Adafruit_CircuitPython_LC709203F b/frozen/Adafruit_CircuitPython_LC709203F new file mode 160000 index 000000000..9945e1da2 --- /dev/null +++ b/frozen/Adafruit_CircuitPython_LC709203F @@ -0,0 +1 @@ +Subproject commit 9945e1da2bca561995c6dea387d47877e89cf571 diff --git a/ports/nrf/boards/TG-Watch/board.c b/ports/nrf/boards/TG-Watch/board.c new file mode 100644 index 000000000..781793328 --- /dev/null +++ b/ports/nrf/boards/TG-Watch/board.c @@ -0,0 +1,38 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "supervisor/board.h" + +void board_init(void) { +} + +bool board_requests_safe_mode(void) { + return false; +} + +void reset_board(void) { + +} diff --git a/ports/nrf/boards/TG-Watch/mpconfigboard.h b/ports/nrf/boards/TG-Watch/mpconfigboard.h new file mode 100644 index 000000000..07a607b3d --- /dev/null +++ b/ports/nrf/boards/TG-Watch/mpconfigboard.h @@ -0,0 +1,64 @@ +/* + * This file is part of the MicroPython project, http://micropython.org/ + * + * The MIT License (MIT) + * + * Copyright (c) 2016 Glenn Ruben Bakke + * Copyright (c) 2018 Dan Halbert for Adafruit Industries + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "nrfx/hal/nrf_gpio.h" + +#define MICROPY_HW_BOARD_NAME "TG-Watch" +#define MICROPY_HW_MCU_NAME "nRF52840" + +#define MICROPY_HW_NEOPIXEL (&pin_P0_16) +#define MICROPY_HW_LED_STATUS (&pin_P1_15) + +// TG-Gui requires a deeper call stack than normal CircuitPython +#define CIRCUITPY_PYSTACK_SIZE 8192 // 1536 is the normal size, (32 bytes/frame * 48 frames) +#define BOARD_HAS_CRYSTAL 0 + +#if QSPI_FLASH_FILESYSTEM +#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17) +#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22) +#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23) +#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21) +#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19) +#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20) +#endif + +#if SPI_FLASH_FILESYSTEM +#define SPI_FLASH_MOSI_PIN &pin_P0_17 +#define SPI_FLASH_MISO_PIN &pin_P0_22 +#define SPI_FLASH_SCK_PIN &pin_P0_19 +#define SPI_FLASH_CS_PIN &pin_P0_20 +#endif + +#define DEFAULT_I2C_BUS_SCL (&pin_P0_11) +#define DEFAULT_I2C_BUS_SDA (&pin_P0_12) + +#define DEFAULT_SPI_BUS_SCK (&pin_P0_14) +#define DEFAULT_SPI_BUS_MOSI (&pin_P0_13) +#define DEFAULT_SPI_BUS_MISO (&pin_P0_15) + +#define DEFAULT_UART_BUS_RX (&pin_P0_24) +#define DEFAULT_UART_BUS_TX (&pin_P0_25) diff --git a/ports/nrf/boards/TG-Watch/mpconfigboard.mk b/ports/nrf/boards/TG-Watch/mpconfigboard.mk new file mode 100644 index 000000000..6a002d940 --- /dev/null +++ b/ports/nrf/boards/TG-Watch/mpconfigboard.mk @@ -0,0 +1,24 @@ +USB_VID = 0x239A +USB_PID = 0x802A +USB_PRODUCT = "TG_Watch02" +USB_MANUFACTURER = "TG-Techie" + +MCU_CHIP = nrf52840 + +QSPI_FLASH_FILESYSTEM = 1 +EXTERNAL_FLASH_DEVICE_COUNT = 2 +EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q128JV_SQ" + +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ST7789 +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Shapes +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Text +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ProgressBar +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LSM6DS +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_FocalTouch +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DS3231 +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LC709203F +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DRV2605 +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BLE +FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center diff --git a/ports/nrf/boards/TG-Watch/pins.c b/ports/nrf/boards/TG-Watch/pins.c new file mode 100644 index 000000000..275b89b22 --- /dev/null +++ b/ports/nrf/boards/TG-Watch/pins.c @@ -0,0 +1,74 @@ +#include "shared-bindings/board/__init__.h" + +STATIC const mp_rom_map_elem_t board_module_globals_table[] = { + + /* default ports */ + { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, + { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, + { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, + + { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) }, + { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) }, + { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) }, + + { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_25) }, + { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_24) }, + + { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) }, + { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) }, + + /* TG-Watch specific pins */ + { MP_ROM_QSTR(MP_QSTR_VBUS_PRESENT), MP_ROM_PTR(&pin_P1_04) }, + { MP_ROM_QSTR(MP_QSTR_HAPTIC_ENABLE), MP_ROM_PTR(&pin_P1_06) }, + { MP_ROM_QSTR(MP_QSTR_HAPTIC_INT), MP_ROM_PTR(&pin_P1_07) }, + { MP_ROM_QSTR(MP_QSTR_CTP_INT), MP_ROM_PTR(&pin_P1_05) }, + { MP_ROM_QSTR(MP_QSTR_CTP_RST), MP_ROM_PTR(&pin_P1_03) }, + { MP_ROM_QSTR(MP_QSTR_TFT_RST), MP_ROM_PTR(&pin_P1_01) }, + + { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_P1_12) }, + { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_P1_13) }, + { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_P1_14) }, + + { MP_ROM_QSTR(MP_QSTR_ACCEL_INT1), MP_ROM_PTR(&pin_P1_11) }, + { MP_ROM_QSTR(MP_QSTR_ACCEL_INT2), MP_ROM_PTR(&pin_P1_10) }, + + { MP_ROM_QSTR(MP_QSTR_BATTERY_DIV), MP_ROM_PTR(&pin_P0_29) }, + + { MP_ROM_QSTR(MP_QSTR_RTC_INT), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR_RTC_RST), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR_CHRG_STAT), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR_BAT_INT), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR_SMC_RST), MP_ROM_PTR(&pin_P0_04) }, + + /* nrf52840 compatible pins */ + { MP_ROM_QSTR(MP_QSTR__A0), MP_ROM_PTR(&pin_P0_04) }, + { MP_ROM_QSTR(MP_QSTR__A1), MP_ROM_PTR(&pin_P0_05) }, + { MP_ROM_QSTR(MP_QSTR__A2), MP_ROM_PTR(&pin_P0_30) }, + { MP_ROM_QSTR(MP_QSTR__A3), MP_ROM_PTR(&pin_P0_28) }, + { MP_ROM_QSTR(MP_QSTR__A4), MP_ROM_PTR(&pin_P0_02) }, + { MP_ROM_QSTR(MP_QSTR__A5), MP_ROM_PTR(&pin_P0_03) }, + + { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_31) }, + + { MP_ROM_QSTR(MP_QSTR__VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_29) }, + { MP_ROM_QSTR(MP_QSTR__BATTERY), MP_ROM_PTR(&pin_P0_29) }, + + { MP_ROM_QSTR(MP_QSTR__SWITCH), MP_ROM_PTR(&pin_P1_02) }, + + { MP_ROM_QSTR(MP_QSTR__NFC1), MP_ROM_PTR(&pin_P0_09) }, + { MP_ROM_QSTR(MP_QSTR__NFC2), MP_ROM_PTR(&pin_P0_10) }, + + { MP_ROM_QSTR(MP_QSTR__D2), MP_ROM_PTR(&pin_P0_10) }, + { MP_ROM_QSTR(MP_QSTR__D5), MP_ROM_PTR(&pin_P1_08) }, + { MP_ROM_QSTR(MP_QSTR__D6), MP_ROM_PTR(&pin_P0_07) }, + { MP_ROM_QSTR(MP_QSTR__D9), MP_ROM_PTR(&pin_P0_26) }, + { MP_ROM_QSTR(MP_QSTR__D10), MP_ROM_PTR(&pin_P0_27) }, + { MP_ROM_QSTR(MP_QSTR__D11), MP_ROM_PTR(&pin_P0_06) }, + { MP_ROM_QSTR(MP_QSTR__D12), MP_ROM_PTR(&pin_P0_08) }, + { MP_ROM_QSTR(MP_QSTR__D13), MP_ROM_PTR(&pin_P1_09) }, + + { MP_ROM_QSTR(MP_QSTR__NEOPIXEL), MP_ROM_PTR(&pin_P0_16) }, +}; + +MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); diff --git a/ports/nrf/boards/TG-Watch02/board.c b/ports/nrf/boards/TG-Watch02/board.c deleted file mode 100644 index 781793328..000000000 --- a/ports/nrf/boards/TG-Watch02/board.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2017 Scott Shawcroft for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "supervisor/board.h" - -void board_init(void) { -} - -bool board_requests_safe_mode(void) { - return false; -} - -void reset_board(void) { - -} diff --git a/ports/nrf/boards/TG-Watch02/mpconfigboard.h b/ports/nrf/boards/TG-Watch02/mpconfigboard.h deleted file mode 100644 index 3ed4288a1..000000000 --- a/ports/nrf/boards/TG-Watch02/mpconfigboard.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * This file is part of the MicroPython project, http://micropython.org/ - * - * The MIT License (MIT) - * - * Copyright (c) 2016 Glenn Ruben Bakke - * Copyright (c) 2018 Dan Halbert for Adafruit Industries - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "nrfx/hal/nrf_gpio.h" - -#define MICROPY_HW_BOARD_NAME "TG-Watch02" -#define MICROPY_HW_MCU_NAME "nRF52840" - -#define MICROPY_HW_NEOPIXEL (&pin_P0_16) -#define MICROPY_HW_LED_STATUS (&pin_P1_15) - -// TG-Gui requires a deeper call stack than normal CircuitPython -#define CIRCUITPY_PYSTACK_SIZE 8192 // 1536 is the normal size, (32 bytes/frame * 48 frames) -#define BOARD_HAS_CRYSTAL 0 - -#if QSPI_FLASH_FILESYSTEM -#define MICROPY_QSPI_DATA0 NRF_GPIO_PIN_MAP(0, 17) -#define MICROPY_QSPI_DATA1 NRF_GPIO_PIN_MAP(0, 22) -#define MICROPY_QSPI_DATA2 NRF_GPIO_PIN_MAP(0, 23) -#define MICROPY_QSPI_DATA3 NRF_GPIO_PIN_MAP(0, 21) -#define MICROPY_QSPI_SCK NRF_GPIO_PIN_MAP(0, 19) -#define MICROPY_QSPI_CS NRF_GPIO_PIN_MAP(0, 20) -#endif - -#if SPI_FLASH_FILESYSTEM -#define SPI_FLASH_MOSI_PIN &pin_P0_17 -#define SPI_FLASH_MISO_PIN &pin_P0_22 -#define SPI_FLASH_SCK_PIN &pin_P0_19 -#define SPI_FLASH_CS_PIN &pin_P0_20 -#endif - -#define DEFAULT_I2C_BUS_SCL (&pin_P0_11) -#define DEFAULT_I2C_BUS_SDA (&pin_P0_12) - -#define DEFAULT_SPI_BUS_SCK (&pin_P0_14) -#define DEFAULT_SPI_BUS_MOSI (&pin_P0_13) -#define DEFAULT_SPI_BUS_MISO (&pin_P0_15) - -#define DEFAULT_UART_BUS_RX (&pin_P0_24) -#define DEFAULT_UART_BUS_TX (&pin_P0_25) diff --git a/ports/nrf/boards/TG-Watch02/mpconfigboard.mk b/ports/nrf/boards/TG-Watch02/mpconfigboard.mk deleted file mode 100644 index d6eff4fed..000000000 --- a/ports/nrf/boards/TG-Watch02/mpconfigboard.mk +++ /dev/null @@ -1,23 +0,0 @@ -USB_VID = 0x239A -USB_PID = 0x802A -USB_PRODUCT = "TG_Watch02" -USB_MANUFACTURER = "TG-Techie" - -MCU_CHIP = nrf52840 - -QSPI_FLASH_FILESYSTEM = 1 -EXTERNAL_FLASH_DEVICE_COUNT = 2 -EXTERNAL_FLASH_DEVICES = "GD25Q16C, W25Q128JV_SQ" - -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BusDevice -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ST7789 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Shapes -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Display_Text -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_ProgressBar -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_LSM6DS -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_FocalTouch -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DS3231 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_DRV2605 -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BLE -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_BLE_Apple_Notification_Center diff --git a/ports/nrf/boards/TG-Watch02/pins.c b/ports/nrf/boards/TG-Watch02/pins.c deleted file mode 100644 index 71eb1c0a9..000000000 --- a/ports/nrf/boards/TG-Watch02/pins.c +++ /dev/null @@ -1,73 +0,0 @@ -#include "shared-bindings/board/__init__.h" - -STATIC const mp_rom_map_elem_t board_module_globals_table[] = { - - /* default ports */ - { MP_ROM_QSTR(MP_QSTR_UART), MP_ROM_PTR(&board_uart_obj) }, - { MP_ROM_QSTR(MP_QSTR_SPI), MP_ROM_PTR(&board_spi_obj) }, - { MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&board_i2c_obj) }, - - /* TG-Watch02 specific pins */ - { MP_ROM_QSTR(MP_QSTR_VBUS_PRESENT), MP_ROM_PTR(&pin_P1_04) }, - { MP_ROM_QSTR(MP_QSTR_HAPTIC_ENABLE), MP_ROM_PTR(&pin_P1_06) }, - { MP_ROM_QSTR(MP_QSTR_HAPTIC_INT), MP_ROM_PTR(&pin_P1_07) }, - { MP_ROM_QSTR(MP_QSTR_CTP_INT), MP_ROM_PTR(&pin_P1_05) }, - { MP_ROM_QSTR(MP_QSTR_CTP_RST), MP_ROM_PTR(&pin_P1_03) }, - { MP_ROM_QSTR(MP_QSTR_TFT_RST), MP_ROM_PTR(&pin_P1_01) }, - - { MP_ROM_QSTR(MP_QSTR_TFT_DC), MP_ROM_PTR(&pin_P1_12) }, - { MP_ROM_QSTR(MP_QSTR_D21), MP_ROM_PTR(&pin_P1_13) }, - { MP_ROM_QSTR(MP_QSTR_TFT_CS), MP_ROM_PTR(&pin_P1_14) }, - - { MP_ROM_QSTR(MP_QSTR_ACCEL_INT1), MP_ROM_PTR(&pin_P1_11) }, - { MP_ROM_QSTR(MP_QSTR_ACCEL_INT2), MP_ROM_PTR(&pin_P1_10) }, - - { MP_ROM_QSTR(MP_QSTR_BATTERY_DIV), MP_ROM_PTR(&pin_P0_29) }, - - { MP_ROM_QSTR(MP_QSTR_RTC_INT), MP_ROM_PTR(&pin_P0_27) }, - { MP_ROM_QSTR(MP_QSTR_RTC_RST), MP_ROM_PTR(&pin_P0_26) }, - { MP_ROM_QSTR(MP_QSTR_CHRG_STAT), MP_ROM_PTR(&pin_P0_06) }, - { MP_ROM_QSTR(MP_QSTR_BACKLIGHT), MP_ROM_PTR(&pin_P0_07) }, - { MP_ROM_QSTR(MP_QSTR_SMC_RST), MP_ROM_PTR(&pin_P0_08) }, - - /* nrf52840 compatible pins */ - { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_P0_04) }, - { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_P0_05) }, - { MP_ROM_QSTR(MP_QSTR_A2), MP_ROM_PTR(&pin_P0_30) }, - { MP_ROM_QSTR(MP_QSTR_A3), MP_ROM_PTR(&pin_P0_28) }, - { MP_ROM_QSTR(MP_QSTR_A4), MP_ROM_PTR(&pin_P0_02) }, - { MP_ROM_QSTR(MP_QSTR_A5), MP_ROM_PTR(&pin_P0_03) }, - - { MP_ROM_QSTR(MP_QSTR_AREF), MP_ROM_PTR(&pin_P0_31) }, - - { MP_ROM_QSTR(MP_QSTR_VOLTAGE_MONITOR), MP_ROM_PTR(&pin_P0_29) }, - { MP_ROM_QSTR(MP_QSTR_BATTERY), MP_ROM_PTR(&pin_P0_29) }, - - { MP_ROM_QSTR(MP_QSTR_SWITCH), MP_ROM_PTR(&pin_P1_02) }, - - { MP_ROM_QSTR(MP_QSTR_NFC1), MP_ROM_PTR(&pin_P0_09) }, - { MP_ROM_QSTR(MP_QSTR_NFC2), MP_ROM_PTR(&pin_P0_10) }, - - { MP_ROM_QSTR(MP_QSTR_D2), MP_ROM_PTR(&pin_P0_10) }, - { MP_ROM_QSTR(MP_QSTR_D5), MP_ROM_PTR(&pin_P1_08) }, - { MP_ROM_QSTR(MP_QSTR_D6), MP_ROM_PTR(&pin_P0_07) }, - { MP_ROM_QSTR(MP_QSTR_D9), MP_ROM_PTR(&pin_P0_26) }, - { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_P0_27) }, - { MP_ROM_QSTR(MP_QSTR_D11), MP_ROM_PTR(&pin_P0_06) }, - { MP_ROM_QSTR(MP_QSTR_D12), MP_ROM_PTR(&pin_P0_08) }, - { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_P1_09) }, - - { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_P0_16) }, - - { MP_ROM_QSTR(MP_QSTR_SCK), MP_ROM_PTR(&pin_P0_14) }, - { MP_ROM_QSTR(MP_QSTR_MOSI), MP_ROM_PTR(&pin_P0_13) }, - { MP_ROM_QSTR(MP_QSTR_MISO), MP_ROM_PTR(&pin_P0_15) }, - - { MP_ROM_QSTR(MP_QSTR_TX), MP_ROM_PTR(&pin_P0_25) }, - { MP_ROM_QSTR(MP_QSTR_RX), MP_ROM_PTR(&pin_P0_24) }, - - { MP_ROM_QSTR(MP_QSTR_SCL), MP_ROM_PTR(&pin_P0_11) }, - { MP_ROM_QSTR(MP_QSTR_SDA), MP_ROM_PTR(&pin_P0_12) }, -}; - -MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table); -- cgit v1.2.3 From 5f8ad0c5e612f0468732a3de7549892060f31ab7 Mon Sep 17 00:00:00 2001 From: Jonah Yolles-Murphy Date: Thu, 14 Jan 2021 00:02:56 -0500 Subject: correct USB_PRODUCT for TG-Watch --- ports/nrf/boards/TG-Watch/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/boards/TG-Watch/mpconfigboard.mk b/ports/nrf/boards/TG-Watch/mpconfigboard.mk index 6a002d940..191637e30 100644 --- a/ports/nrf/boards/TG-Watch/mpconfigboard.mk +++ b/ports/nrf/boards/TG-Watch/mpconfigboard.mk @@ -1,6 +1,6 @@ USB_VID = 0x239A USB_PID = 0x802A -USB_PRODUCT = "TG_Watch02" +USB_PRODUCT = "TG-Watch" USB_MANUFACTURER = "TG-Techie" MCU_CHIP = nrf52840 -- cgit v1.2.3 From c63d5a44a0a05d25ba80bbeb9ce1670dacde4e17 Mon Sep 17 00:00:00 2001 From: Jonah Yolles-Murphy Date: Thu, 14 Jan 2021 00:08:34 -0500 Subject: restore TG-Watch USB_PID from accidental overwrite --- ports/nrf/boards/TG-Watch/mpconfigboard.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/boards/TG-Watch/mpconfigboard.mk b/ports/nrf/boards/TG-Watch/mpconfigboard.mk index 191637e30..f1aac6d71 100644 --- a/ports/nrf/boards/TG-Watch/mpconfigboard.mk +++ b/ports/nrf/boards/TG-Watch/mpconfigboard.mk @@ -1,5 +1,5 @@ USB_VID = 0x239A -USB_PID = 0x802A +USB_PID = 0x80DB USB_PRODUCT = "TG-Watch" USB_MANUFACTURER = "TG-Techie" -- cgit v1.2.3 From e519dd3c5269745f4d6c66a012974e622bc08343 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 13 Jan 2021 23:45:59 -0600 Subject: Retry on all disconnect reasons other than: 2 exception reasons & 1 manual disconnect reason. --- ports/esp32s2/common-hal/wifi/__init__.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index 08d7a164f..b8e8f731b 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -65,11 +65,9 @@ static void event_handler(void* arg, esp_event_base_t event_base, uint8_t reason = d->reason; ESP_LOGW(TAG, "reason %d 0x%02x", reason, reason); if (radio->retries_left > 0 && - (reason == WIFI_REASON_AUTH_EXPIRE || - reason == WIFI_REASON_NOT_AUTHED || - reason == WIFI_REASON_ASSOC_EXPIRE || - reason == WIFI_REASON_CONNECTION_FAIL || - reason == WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT)) { + reason != WIFI_REASON_AUTH_FAIL && + reason != WIFI_REASON_NO_AP_FOUND && + reason != WIFI_REASON_ASSOC_LEAVE) { radio->retries_left--; ESP_LOGI(TAG, "Retrying connect. %d retries remaining", radio->retries_left); esp_wifi_connect(); -- cgit v1.2.3 From f75bb5c50f3fac1d12c058abfc3446345d97f013 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 13 Jan 2021 23:46:35 -0600 Subject: Rename to match WIFI_REASON. Also return specific reason code. --- ports/esp32s2/common-hal/wifi/Radio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index e9f374a06..930230088 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -168,11 +168,11 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t } while ((bits & (WIFI_CONNECTED_BIT | WIFI_DISCONNECTED_BIT)) == 0 && !mp_hal_is_interrupted()); if ((bits & WIFI_DISCONNECTED_BIT) != 0) { if (self->last_disconnect_reason == WIFI_REASON_AUTH_FAIL) { - return WIFI_RADIO_ERROR_AUTH; + return WIFI_RADIO_ERROR_AUTH_FAIL; } else if (self->last_disconnect_reason == WIFI_REASON_NO_AP_FOUND) { return WIFI_RADIO_ERROR_NO_AP_FOUND; } - return WIFI_RADIO_ERROR_UNKNOWN; + return self->last_disconnect_reason; } return WIFI_RADIO_ERROR_NONE; } -- cgit v1.2.3 From d1249fbe470bfdaf376e510c8deb2f35f14bb55c Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 13 Jan 2021 23:46:52 -0600 Subject: Include all reason codes. --- shared-bindings/wifi/Radio.h | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/shared-bindings/wifi/Radio.h b/shared-bindings/wifi/Radio.h index 1e8f362e3..64c1052f7 100644 --- a/shared-bindings/wifi/Radio.h +++ b/shared-bindings/wifi/Radio.h @@ -36,10 +36,39 @@ const mp_obj_type_t wifi_radio_type; typedef enum { - WIFI_RADIO_ERROR_NONE, - WIFI_RADIO_ERROR_UNKNOWN, - WIFI_RADIO_ERROR_AUTH, - WIFI_RADIO_ERROR_NO_AP_FOUND + // 0 is circuitpython-specific; 1-53 are IEEE; 200+ are Espressif + WIFI_RADIO_ERROR_NONE = 0, + WIFI_RADIO_ERROR_UNSPECIFIED = 1, + WIFI_RADIO_ERROR_AUTH_EXPIRE = 2, + WIFI_RADIO_ERROR_AUTH_LEAVE = 3, + WIFI_RADIO_ERROR_ASSOC_EXPIRE = 4, + WIFI_RADIO_ERROR_ASSOC_TOOMANY = 5, + WIFI_RADIO_ERROR_NOT_AUTHED = 6, + WIFI_RADIO_ERROR_NOT_ASSOCED = 7, + WIFI_RADIO_ERROR_ASSOC_LEAVE = 8, + WIFI_RADIO_ERROR_ASSOC_NOT_AUTHED = 9, + WIFI_RADIO_ERROR_DISASSOC_PWRCAP_BAD = 10, + WIFI_RADIO_ERROR_DISASSOC_SUPCHAN_BAD = 11, + WIFI_RADIO_ERROR_IE_INVALID = 13, + WIFI_RADIO_ERROR_MIC_FAILURE = 14, + WIFI_RADIO_ERROR_4WAY_HANDSHAKE_TIMEOUT = 15, + WIFI_RADIO_ERROR_GROUP_KEY_UPDATE_TIMEOUT = 16, + WIFI_RADIO_ERROR_IE_IN_4WAY_DIFFERS = 17, + WIFI_RADIO_ERROR_GROUP_CIPHER_INVALID = 18, + WIFI_RADIO_ERROR_PAIRWISE_CIPHER_INVALID = 19, + WIFI_RADIO_ERROR_AKMP_INVALID = 20, + WIFI_RADIO_ERROR_UNSUPP_RSN_IE_VERSION = 21, + WIFI_RADIO_ERROR_INVALID_RSN_IE_CAP = 22, + WIFI_RADIO_ERROR_802_1X_AUTH_FAILED = 23, + WIFI_RADIO_ERROR_CIPHER_SUITE_REJECTED = 24, + WIFI_RADIO_ERROR_INVALID_PMKID = 53, + WIFI_RADIO_ERROR_BEACON_TIMEOUT = 200, + WIFI_RADIO_ERROR_NO_AP_FOUND = 201, + WIFI_RADIO_ERROR_AUTH_FAIL = 202, + WIFI_RADIO_ERROR_ASSOC_FAIL = 203, + WIFI_RADIO_ERROR_HANDSHAKE_TIMEOUT = 204, + WIFI_RADIO_ERROR_CONNECTION_FAIL = 205, + WIFI_RADIO_ERROR_AP_TSF_RESET = 206, } wifi_radio_error_t; extern bool common_hal_wifi_radio_get_enabled(wifi_radio_obj_t *self); -- cgit v1.2.3 From 8febdee2640570932c1659817bcaadd429761e8b Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Wed, 13 Jan 2021 23:47:23 -0600 Subject: Rename to match WIFI_REASON. Also include specific error code in "Unknown failure" Exception. --- shared-bindings/wifi/Radio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c index 63f507067..8181fc4c9 100644 --- a/shared-bindings/wifi/Radio.c +++ b/shared-bindings/wifi/Radio.c @@ -218,12 +218,12 @@ STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_m } wifi_radio_error_t error = common_hal_wifi_radio_connect(self, ssid.buf, ssid.len, password.buf, password.len, args[ARG_channel].u_int, timeout, bssid.buf, bssid.len); - if (error == WIFI_RADIO_ERROR_AUTH) { + if (error == WIFI_RADIO_ERROR_AUTH_FAIL) { mp_raise_ConnectionError(translate("Authentication failure")); } else if (error == WIFI_RADIO_ERROR_NO_AP_FOUND) { mp_raise_ConnectionError(translate("No network with that ssid")); } else if (error != WIFI_RADIO_ERROR_NONE) { - mp_raise_ConnectionError(translate("Unknown failure")); + mp_raise_msg_varg(&mp_type_ConnectionError, translate("Unknown failure %d"), error); } return mp_const_none; -- cgit v1.2.3 From b05c6bac21dedafd60d0a81ea6c6b68c313a57b2 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 14 Jan 2021 11:04:36 -0500 Subject: change extensa github actions cache key to avoid bad cache --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9899972eb..9dde06f70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -464,7 +464,7 @@ jobs: id: idf-cache with: path: ${{ github.workspace }}/.idf_tools - key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20200801 + key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210114 - name: Clone IDF submodules run: | (cd $IDF_PATH && git submodule update --init) -- cgit v1.2.3 From 54cc9ab4b99f508d38bcb90bfdb924de4652a1b9 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 14 Jan 2021 11:04:36 -0500 Subject: change extensa github actions cache key to avoid bad cache --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9899972eb..9dde06f70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -464,7 +464,7 @@ jobs: id: idf-cache with: path: ${{ github.workspace }}/.idf_tools - key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20200801 + key: ${{ runner.os }}-idf-tools-${{ hashFiles('.git/modules/ports/esp32s2/esp-idf/HEAD') }}-20210114 - name: Clone IDF submodules run: | (cd $IDF_PATH && git submodule update --init) -- cgit v1.2.3 From aedc8efeda907d9492ae4f5c04018a4704276275 Mon Sep 17 00:00:00 2001 From: Dan Halbert Date: Thu, 14 Jan 2021 14:43:47 -0500 Subject: Add pin A1 as alias for AD1; A1 is preferred --- ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c index 645dc12a1..ff44d9edb 100644 --- a/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c +++ b/ports/esp32s2/boards/adafruit_magtag_2.9_grayscale/pins.c @@ -4,7 +4,11 @@ STATIC const mp_rom_map_elem_t board_global_dict_table[] = { { MP_ROM_QSTR(MP_QSTR_D10), MP_ROM_PTR(&pin_GPIO10) }, + + { MP_ROM_QSTR(MP_QSTR_A1), MP_ROM_PTR(&pin_GPIO18) }, + // Previous name from schematic. { MP_ROM_QSTR(MP_QSTR_AD1), MP_ROM_PTR(&pin_GPIO18) }, + { MP_ROM_QSTR(MP_QSTR_D13), MP_ROM_PTR(&pin_GPIO13) }, { MP_ROM_QSTR(MP_QSTR_SPEAKER), MP_ROM_PTR(&pin_GPIO17) }, -- cgit v1.2.3 From 8e51139da09d981bd2f975db907e1a9c35f4a73d Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 14 Jan 2021 13:42:28 -0600 Subject: update uzlib to v2.9.5 uzlib isn't actually used in any firmwares, but is built into the "unix" port used for testing. The main benefit of the update is to fix problems encountered on Windows, as the old ref of uzlib had filenames with embedded colons; this has been fixed upstream. uzlib seems to have been reabsed since the version that we took; this doesn't really matter to us. --- lib/uzlib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/uzlib b/lib/uzlib index f966da0fa..27e4f4c15 160000 --- a/lib/uzlib +++ b/lib/uzlib @@ -1 +1 @@ -Subproject commit f966da0fab121e910ea74f037f074538a2e6dbbb +Subproject commit 27e4f4c15ba30c2cfc89575159e8efb50f95037e -- cgit v1.2.3 From 059363f0e2079a172912360e8ed17e245e1f4d66 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 13 Jan 2021 15:38:47 -0600 Subject: ports/unix: Fix parallel build problem This is the same as I added to mpy-cross at e666e86035d5, see #3074 --- ports/unix/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/unix/Makefile b/ports/unix/Makefile index 4bfb13c6a..305c0549d 100644 --- a/ports/unix/Makefile +++ b/ports/unix/Makefile @@ -318,3 +318,5 @@ $(BUILD)/libaxtls.a: $(TOP)/lib/axtls/README | $(OBJ_DIRS) $(TOP)/lib/axtls/README: @echo "You cloned without --recursive, fetching submodules for you." (cd $(TOP); git submodule update --init --recursive) + +$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h -- cgit v1.2.3 From ad87f3768997d54ea5f98bc9a4668c17b4b3e1f9 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Thu, 14 Jan 2021 14:16:11 -0600 Subject: ulab: update to 1.7.0 --- extmod/ulab | 2 +- locale/circuitpython.pot | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index d62d07ea0..fe3e19ca4 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit d62d07ea0b9597535428ebe6012da6b0d6608bf9 +Subproject commit fe3e19ca416b3c5ed92789f151ec6cc4a29eb7f8 diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 82058a611..1c92d3765 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2278,10 +2278,18 @@ msgstr "" msgid "branch not in range" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer is smaller than requested size" +msgstr "" + #: shared-bindings/audiocore/RawSample.c msgid "buffer must be a bytes-like object" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "buffer size must be a multiple of element size" +msgstr "" + #: shared-module/struct/__init__.c msgid "buffer size must match format" msgstr "" @@ -3339,6 +3347,10 @@ msgstr "" msgid "offset must be >= 0" msgstr "" +#: extmod/ulab/code/ulab_create.c +msgid "offset must be non-negative and no greater than buffer length" +msgstr "" + #: py/objstr.c py/objstrunicode.c msgid "offset out of bounds" msgstr "" -- cgit v1.2.3 From 564dce858f2307c649155bb9c14810aad6b823c1 Mon Sep 17 00:00:00 2001 From: anecdata <16617689+anecdata@users.noreply.github.com> Date: Thu, 14 Jan 2021 17:53:37 -0600 Subject: Update translations --- locale/circuitpython.pot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/locale/circuitpython.pot b/locale/circuitpython.pot index 82058a611..09ce1718d 100644 --- a/locale/circuitpython.pot +++ b/locale/circuitpython.pot @@ -2013,7 +2013,8 @@ msgid "Unhandled ESP TLS error %d %d %x %d" msgstr "" #: shared-bindings/wifi/Radio.c -msgid "Unknown failure" +#, c-format +msgid "Unknown failure %d" msgstr "" #: ports/nrf/common-hal/_bleio/__init__.c -- cgit v1.2.3 From d85e0716166bc73e4d1bdde4a5ee2287fe811750 Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Thu, 14 Jan 2021 18:04:41 -0600 Subject: Hard code new copyright date --- conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.py b/conf.py index 590e5bc2c..fb3c0756d 100644 --- a/conf.py +++ b/conf.py @@ -103,7 +103,7 @@ redirects_file = 'docs/redirects.txt' # General information about the project. project = 'Adafruit CircuitPython' -copyright = '2014-2020, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)' +copyright = '2014-2021, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)' # These are overwritten on ReadTheDocs. # The version info for the project you're documenting, acts as replacement for -- cgit v1.2.3 From d88bb0b09b54dedd2508ec4ededb63ae562c0d1a Mon Sep 17 00:00:00 2001 From: Hugo Dahl Date: Thu, 14 Jan 2021 18:16:34 -0600 Subject: Set year from execution date Set the date (year) of the copyright notice to be the current year at the time the documentation is generated. --- conf.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/conf.py b/conf.py index fb3c0756d..c2d3d37ee 100644 --- a/conf.py +++ b/conf.py @@ -23,6 +23,7 @@ import re import subprocess import sys import urllib.parse +import time import recommonmark from sphinx.transforms import SphinxTransform @@ -101,9 +102,12 @@ redirects_file = 'docs/redirects.txt' # The master toctree document. #master_doc = 'index' +# Get current date (execution) for copyright year +current_date = time.localtime() + # General information about the project. project = 'Adafruit CircuitPython' -copyright = '2014-2021, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)' +copyright = f'2014-{current_date.tm_year}, MicroPython & CircuitPython contributors (https://github.com/adafruit/circuitpython/graphs/contributors)' # These are overwritten on ReadTheDocs. # The version info for the project you're documenting, acts as replacement for -- cgit v1.2.3 From a98df7209d5e0bd73353f435fb9c206f13da36ca Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 15 Jan 2021 09:50:58 -0600 Subject: Update to 1.7.1 --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index fe3e19ca4..3592e54c2 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit fe3e19ca416b3c5ed92789f151ec6cc4a29eb7f8 +Subproject commit 3592e54c223460d20a05537b5809abea524d21a9 -- cgit v1.2.3 From c843122d3dbc34212c64da40baddf1a7b59ac1e1 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 15 Jan 2021 12:00:29 -0600 Subject: fix doc build --- extmod/ulab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/ulab b/extmod/ulab index 3592e54c2..8b804f3bc 160000 --- a/extmod/ulab +++ b/extmod/ulab @@ -1 +1 @@ -Subproject commit 3592e54c223460d20a05537b5809abea524d21a9 +Subproject commit 8b804f3bcd8c5a3ac1b3e09e0ff7faf8270751de -- cgit v1.2.3 From a9389343a85fa701d2c9068de525d9a67a484a92 Mon Sep 17 00:00:00 2001 From: jerryneedell Date: Sun, 17 Jan 2021 05:15:19 -0500 Subject: Revert "UMFEATHERS2 - implement use of DotStar for status led" --- .../boards/unexpectedmaker_feathers2/board.c | 8 ---- .../unexpectedmaker_feathers2/mpconfigboard.h | 4 +- ports/esp32s2/common-hal/microcontroller/Pin.c | 45 ++-------------------- ports/esp32s2/common-hal/microcontroller/Pin.h | 4 +- 4 files changed, 7 insertions(+), 54 deletions(-) diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c index ac08190a5..d8fd3a0a2 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/board.c @@ -27,8 +27,6 @@ #include "supervisor/board.h" #include "mpconfigboard.h" #include "shared-bindings/microcontroller/Pin.h" -#include "components/driver/include/driver/gpio.h" -#include "components/soc/include/hal/gpio_hal.h" void board_init(void) { // USB @@ -49,12 +47,6 @@ void board_init(void) { common_hal_never_reset_pin(&pin_GPIO30); common_hal_never_reset_pin(&pin_GPIO31); common_hal_never_reset_pin(&pin_GPIO32); - - - // Add LDO2 to never reset list, set to output and enable - common_hal_never_reset_pin(&pin_GPIO21); - gpio_set_direction(pin_GPIO21.number, GPIO_MODE_DEF_OUTPUT); - gpio_set_level(pin_GPIO21.number, true); } bool board_requests_safe_mode(void) { diff --git a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h index 6b1a0c4aa..e100ac118 100644 --- a/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h +++ b/ports/esp32s2/boards/unexpectedmaker_feathers2/mpconfigboard.h @@ -34,8 +34,8 @@ #define AUTORESET_DELAY_MS 500 -#define MICROPY_HW_APA102_MOSI (&pin_GPIO40) -#define MICROPY_HW_APA102_SCK (&pin_GPIO45) +// #define MICROPY_HW_APA102_MOSI (&pin_GPIO40) +// #define MICROPY_HW_APA102_SCK (&pin_GPIO45) #define DEFAULT_I2C_BUS_SCL (&pin_GPIO9) #define DEFAULT_I2C_BUS_SDA (&pin_GPIO8) diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.c b/ports/esp32s2/common-hal/microcontroller/Pin.c index 6889720e8..fca89ce8e 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.c +++ b/ports/esp32s2/common-hal/microcontroller/Pin.c @@ -37,14 +37,13 @@ #ifdef MICROPY_HW_NEOPIXEL bool neopixel_in_use; #endif -#ifdef MICROPY_HW_APA102_MOSI -bool apa102_sck_in_use; -bool apa102_mosi_in_use; -#endif STATIC uint32_t never_reset_pins[2]; STATIC uint32_t in_use[2]; +bool apa102_mosi_in_use; +bool apa102_sck_in_use; + STATIC void floating_gpio_reset(gpio_num_t pin_number) { // This is the same as gpio_reset_pin(), but without the pullup. // Note that gpio_config resets the iomatrix to GPIO_FUNC as well. @@ -87,20 +86,6 @@ void reset_pin_number(gpio_num_t pin_number) { return; } #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin_number == MICROPY_HW_APA102_MOSI->number || - pin_number == MICROPY_HW_APA102_SCK->number) { - apa102_mosi_in_use = apa102_mosi_in_use && pin_number != MICROPY_HW_APA102_MOSI->number; - apa102_sck_in_use = apa102_sck_in_use && pin_number != MICROPY_HW_APA102_SCK->number; - if (!apa102_sck_in_use && !apa102_mosi_in_use) { - rgb_led_status_init(); - } - return; - } - #endif - - - } void common_hal_reset_pin(const mcu_pin_obj_t* pin) { @@ -125,11 +110,6 @@ void reset_all_pins(void) { #ifdef MICROPY_HW_NEOPIXEL neopixel_in_use = false; #endif - #ifdef MICROPY_HW_APA102_MOSI - apa102_sck_in_use = false; - apa102_mosi_in_use = false; - #endif - } void claim_pin(const mcu_pin_obj_t* pin) { @@ -139,15 +119,6 @@ void claim_pin(const mcu_pin_obj_t* pin) { neopixel_in_use = true; } #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin == MICROPY_HW_APA102_MOSI) { - apa102_mosi_in_use = true; - } - if (pin == MICROPY_HW_APA102_SCK) { - apa102_sck_in_use = true; - } - #endif - } void common_hal_mcu_pin_claim(const mcu_pin_obj_t* pin) { @@ -160,18 +131,10 @@ bool pin_number_is_free(gpio_num_t pin_number) { return !neopixel_in_use; } #endif - #ifdef MICROPY_HW_APA102_MOSI - if (pin_number == MICROPY_HW_APA102_MOSI->number) { - return !apa102_mosi_in_use; - } - if (pin_number == MICROPY_HW_APA102_SCK->number) { - return !apa102_sck_in_use; - } - #endif uint8_t offset = pin_number / 32; uint32_t mask = 1 << (pin_number % 32); - return (in_use[offset] & mask) == 0; + return (never_reset_pins[offset] & mask) == 0 && (in_use[offset] & mask) == 0; } bool common_hal_mcu_pin_is_free(const mcu_pin_obj_t *pin) { diff --git a/ports/esp32s2/common-hal/microcontroller/Pin.h b/ports/esp32s2/common-hal/microcontroller/Pin.h index 65f57a82d..f6c008703 100644 --- a/ports/esp32s2/common-hal/microcontroller/Pin.h +++ b/ports/esp32s2/common-hal/microcontroller/Pin.h @@ -31,10 +31,8 @@ #include "peripherals/pins.h" -#ifdef MICROPY_HW_APA102_MOSI -extern bool apa102_sck_in_use; extern bool apa102_mosi_in_use; -#endif +extern bool apa102_sck_in_use; #ifdef MICROPY_HW_NEOPIXEL extern bool neopixel_in_use; -- cgit v1.2.3